# HG changeset patch # User Mychaela Falconia # Date 1583640991 0 # Node ID f67e5ad30324c6d5449559e1f618cd0b07529893 # Parent 57cb825b505a4f628823468fced3ea6ffbcfc937 fc-loadtool: flash e-program-bin implemented diff -r 57cb825b505a -r f67e5ad30324 loadtools/flmain.c --- a/loadtools/flmain.c Sun Mar 08 04:09:08 2020 +0000 +++ b/loadtools/flmain.c Sun Mar 08 04:16:31 2020 +0000 @@ -113,6 +113,7 @@ {"dump2srec", flashcmd_dump2file}, {"erase", flashcmd_erase}, {"erase-program-boot", flashcmd_erase_program_boot}, + {"e-program-bin", flashcmd_progbin_wrap}, {"e-program-m0", flashcmd_program_m0}, {"e-program-srec", flashcmd_program_srec}, {"geom", flashcmd_geom}, diff -r 57cb825b505a -r f67e5ad30324 loadtools/flprogbin.c --- 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 #include #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;