Compare commits
No commits in common. "ebe79687f06b7648c2de87d9debd4ea93275eb49" and "2ce8578da5d07eaad059a747116c6c36748abe96" have entirely different histories.
ebe79687f0
...
2ce8578da5
@ -51,7 +51,6 @@ typedef struct bfly_privdata_s
|
|||||||
|
|
||||||
uint8_t twi_address;
|
uint8_t twi_address;
|
||||||
uint8_t chip_erase;
|
uint8_t chip_erase;
|
||||||
uint8_t stay_in_bootloader;
|
|
||||||
|
|
||||||
uint16_t buffersize;
|
uint16_t buffersize;
|
||||||
uint16_t flashsize;
|
uint16_t flashsize;
|
||||||
@ -65,7 +64,6 @@ static struct option bfly_optargs[] =
|
|||||||
{ "address", 1, 0, 'a' }, /* [ -a <address ] */
|
{ "address", 1, 0, 'a' }, /* [ -a <address ] */
|
||||||
{ "device", 1, 0, 'd' }, /* -d <device> */
|
{ "device", 1, 0, 'd' }, /* -d <device> */
|
||||||
{ "erase", 0, 0, 'e' }, /* [ -e ] */
|
{ "erase", 0, 0, 'e' }, /* [ -e ] */
|
||||||
{ "stay", 0, 0, 's' }, /* [ -s ] */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* *************************************************************************
|
/* *************************************************************************
|
||||||
@ -114,17 +112,12 @@ static int bfly_optarg_cb(int val, const char *arg, void *privdata)
|
|||||||
p_priv->chip_erase = 1;
|
p_priv->chip_erase = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's': /* stay in bootloader */
|
|
||||||
p_priv->stay_in_bootloader = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?': /* error */
|
case '?': /* error */
|
||||||
fprintf(stderr, "Usage: butterfly_prog [options]\n"
|
fprintf(stderr, "Usage: butterfly_prog [options]\n"
|
||||||
" -a <address> - optional: twi address for twiboot bridge mode\n"
|
" -a <address> - optional: twi address for twiboot bridge mode\n"
|
||||||
" -d <device> - selects butterfly serial device\n"
|
" -d <device> - selects butterfly serial device\n"
|
||||||
" -e - executes a chip erase\n"
|
" -e - executes a chip erase\n"
|
||||||
" -s - stay in bootloader afterwards\n"
|
|
||||||
" -r <flash|eeprom>:<file> - reads flash/eeprom to file (.bin | .hex | -)\n"
|
" -r <flash|eeprom>:<file> - reads flash/eeprom to file (.bin | .hex | -)\n"
|
||||||
" -w <flash|eeprom>:<file> - write flash/eeprom from file (.bin | .hex)\n"
|
" -w <flash|eeprom>:<file> - write flash/eeprom from file (.bin | .hex)\n"
|
||||||
" -n - disable verify after write\n"
|
" -n - disable verify after write\n"
|
||||||
@ -396,16 +389,7 @@ static int butterfly_enter_progmode(bfly_privdata_t * p_priv)
|
|||||||
* ************************************************************************* */
|
* ************************************************************************* */
|
||||||
static int butterfly_leave_progmode(bfly_privdata_t * p_priv)
|
static int butterfly_leave_progmode(bfly_privdata_t * p_priv)
|
||||||
{
|
{
|
||||||
if (p_priv->stay_in_bootloader)
|
(void)write(p_priv->fd, "L", 1);
|
||||||
{
|
|
||||||
/* Leave programming mode */
|
|
||||||
(void)write(p_priv->fd, "L", 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Exit Bootloader */
|
|
||||||
(void)write(p_priv->fd, "E", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return butterfly_expect_cr(p_priv);
|
return butterfly_expect_cr(p_priv);
|
||||||
} /* butterfly_leave_progmode */
|
} /* butterfly_leave_progmode */
|
||||||
|
@ -193,7 +193,7 @@ static int funk_optarg_cb(int val, const char *arg, void *privdata)
|
|||||||
" -n - disable verify after write\n"
|
" -n - disable verify after write\n"
|
||||||
" -p <0|1|2> - progress bar mode\n"
|
" -p <0|1|2> - progress bar mode\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Example: funkboot -d /dev/ttyUSB0 -a 0x22 -w flash:blmc.hex -w eeprom:blmc_eeprom.hex\n"
|
"Example: funkboot -d /dev/ttyUSB0 -a 0x22 -w flash:blmc.hex -w flash:blmc_eeprom.hex\n"
|
||||||
"\n");
|
"\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ static int mpm_optarg_cb(int val, const char *arg, void *privdata)
|
|||||||
" -n - disable verify after write\n"
|
" -n - disable verify after write\n"
|
||||||
" -p <0|1|2> - progress bar mode\n"
|
" -p <0|1|2> - progress bar mode\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Example: mpmboot -d /dev/ttyUSB0 -a 0x22 -w flash:blmc.hex -w eeprom:blmc_eeprom.hex\n"
|
"Example: mpmboot -d /dev/ttyUSB0 -a 0x22 -w flash:blmc.hex -w flash:blmc_eeprom.hex\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
15
twiboot.c
15
twiboot.c
@ -74,7 +74,6 @@ struct twi_privdata
|
|||||||
uint8_t address;
|
uint8_t address;
|
||||||
int fd;
|
int fd;
|
||||||
int connected;
|
int connected;
|
||||||
int stay_in_bootloader;
|
|
||||||
|
|
||||||
uint8_t pagesize;
|
uint8_t pagesize;
|
||||||
uint16_t flashsize;
|
uint16_t flashsize;
|
||||||
@ -83,9 +82,8 @@ struct twi_privdata
|
|||||||
|
|
||||||
static struct option twi_optargs[] =
|
static struct option twi_optargs[] =
|
||||||
{
|
{
|
||||||
{ "address", 1, 0, 'a' }, /* -a <addr> */
|
{ "address", 1, 0, 'a'}, /* -a <addr> */
|
||||||
{ "device", 1, 0, 'd' }, /* [ -d <device> ] */
|
{ "device", 1, 0, 'd'}, /* [ -d <device> ] */
|
||||||
{ "stay", 0, 0, 's' }, /* [ -s ] */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -301,7 +299,7 @@ static int twi_close(struct multiboot *mboot)
|
|||||||
{
|
{
|
||||||
struct twi_privdata *twi = (struct twi_privdata *)mboot->privdata;
|
struct twi_privdata *twi = (struct twi_privdata *)mboot->privdata;
|
||||||
|
|
||||||
if (twi->connected && !twi->stay_in_bootloader)
|
if (twi->connected)
|
||||||
{
|
{
|
||||||
twi_switch_application(twi, BOOTTYPE_APPLICATION);
|
twi_switch_application(twi, BOOTTYPE_APPLICATION);
|
||||||
}
|
}
|
||||||
@ -537,22 +535,17 @@ static int twi_optarg_cb(int val, const char *arg, void *privdata)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's': /* stay in bootloader */
|
|
||||||
twi->stay_in_bootloader = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?': /* error */
|
case '?': /* error */
|
||||||
fprintf(stderr, "Usage: twiboot [options]\n"
|
fprintf(stderr, "Usage: twiboot [options]\n"
|
||||||
" -a <address> - selects i2c address (0x01 - 0x7F)\n"
|
" -a <address> - selects i2c address (0x01 - 0x7F)\n"
|
||||||
" -d <device> - selects i2c device (default: /dev/i2c-0)\n"
|
" -d <device> - selects i2c device (default: /dev/i2c-0)\n"
|
||||||
" -s - stay in bootloader afterwards\n"
|
|
||||||
" -r <flash|eeprom>:<file> - reads flash/eeprom to file (.bin | .hex | -)\n"
|
" -r <flash|eeprom>:<file> - reads flash/eeprom to file (.bin | .hex | -)\n"
|
||||||
" -w <flash|eeprom>:<file> - write flash/eeprom from file (.bin | .hex)\n"
|
" -w <flash|eeprom>:<file> - write flash/eeprom from file (.bin | .hex)\n"
|
||||||
" -n - disable verify after write\n"
|
" -n - disable verify after write\n"
|
||||||
" -p <0|1|2> - progress bar mode\n"
|
" -p <0|1|2> - progress bar mode\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Example: twiboot -a 0x22 -w flash:blmc.hex -w eeprom:blmc_eeprom.hex\n"
|
"Example: twiboot -a 0x22 -w flash:blmc.hex -w flash:blmc_eeprom.hex\n"
|
||||||
"\n");
|
"\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user