From 2a92b8cce42c73e51681df1a786937f17a66b74e Mon Sep 17 00:00:00 2001 From: MCUdude Date: Thu, 17 Feb 2022 13:00:30 +0100 Subject: [PATCH] Add support for memory "fill" with arbitrary data too If you run the following command: $ write eeprom 0x00 0x10 A B C ... It will write the following data to EEPROM: |ABCCCCCCCCCCCCCC| starting from address 0x00 --- src/term.c | 62 +++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/src/term.c b/src/term.c index ce58c19c..fc2e5d3c 100644 --- a/src/term.c +++ b/src/term.c @@ -336,7 +336,7 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, unsigned char b; int rc; int werror; - int write_mode; + int write_mode, start_offset; AVRMEM * mem; if (argc < 4) { @@ -370,8 +370,8 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, return -1; } - // Figure out how many bytes to write to memory - if(strcmp(argv[5], "...") == 0) { + // Figure out how many bytes there is to write to memory + if(strcmp(argv[argc - 1], "...") == 0) { write_mode = WRITE_MODE_FILL; len = strtoul(argv[3], &e, 0); if (*e || (e == argv[3])) { @@ -397,38 +397,34 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p, return -1; } - if(write_mode == WRITE_MODE_STANDARD) { - for (i=3; ierr_led(pgm, OFF);