Show summary after successful programming.

Also, treat failure to reset afterwards as a warning, rather than a
fatal error.
This commit is contained in:
Daniel Beer 2011-12-27 12:58:28 +13:00
parent 711ffbfd1a
commit f4de94bd46
3 changed files with 10 additions and 4 deletions

View File

@ -543,10 +543,11 @@ static int do_cmd_prog(char **arg, int prog_flags)
if (prog_flush(&prog) < 0)
return -1;
if (device_ctl(DEVICE_CTL_RESET) < 0) {
printc_err("prog: failed to reset after programming\n");
return -1;
}
printc("Done, %d bytes written\n", prog.total_written);
if (device_ctl(DEVICE_CTL_RESET) < 0)
printc_err("warning: prog: "
"failed to reset after programming\n");
unmark_modified(MODIFY_SYMS);
return 0;

View File

@ -49,6 +49,7 @@ int prog_flush(struct prog_data *prog)
if (device_writemem(prog->addr, prog->buf, prog->len) < 0)
return -1;
prog->total_written += prog->len;
prog->addr += prog->len;
prog->len = 0;
return 0;

View File

@ -25,11 +25,15 @@
struct prog_data {
char section[64];
uint8_t buf[PROG_BUFSIZE];
address_t addr;
int len;
int flags;
int have_erased;
address_t total_written;
};
#define PROG_WANT_ERASE 0x01