FreeCalypso > hg > freecalypso-tools
diff loadtools/flprogbin.c @ 673:f67e5ad30324
fc-loadtool: flash e-program-bin implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 08 Mar 2020 04:16:31 +0000 |
parents | 57cb825b505a |
children | 185c9bf208d3 |
line wrap: on
line diff
--- a/loadtools/flprogbin.c Sun Mar 08 04:09:08 2020 +0000 +++ b/loadtools/flprogbin.c Sun Mar 08 04:16:31 2020 +0000 @@ -11,6 +11,7 @@ #include <time.h> #include <unistd.h> #include "flash.h" +#include "discontig.h" extern int target_fd; @@ -23,6 +24,7 @@ char *imgfile; { struct flash_bank_info *bi; + struct discontig_prog erase_region; u_long origlen, bytesdone; u_long crc_base_addr, crc_from_target; uint32_t crcaccum; @@ -92,6 +94,15 @@ } /* finally done with the arg parsing etc, can get to work now */ + if (with_erase) { + erase_region.start = flashoff; + erase_region.end = flashoff + len; + i = erase_sectors_for_prog(bi, &erase_region, 1); + if (i < 0) { + fclose(binf); + return(i); + } + } crc_base_addr = bi->base_addr + flashoff; sprintf(shortarg, "%lx", (u_long) bi->base_addr); targv[0] = bi->ops->loadagent_setbase_cmd;