In interactive mode, reset the address and length if we start dumping

a memory type different than the previous one.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@103 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Brian S. Dean
2001-11-21 18:54:11 +00:00
parent b50ce8fabd
commit e95114a18d
4 changed files with 75 additions and 49 deletions

10
term.c
View File

@@ -206,6 +206,7 @@ int hexdump_buf(FILE * f, int startaddr, unsigned char * buf, int len)
int cmd_dump(int fd, struct avrpart * p, int argc, char * argv[])
{
static char prevmem[128] = {0};
char * e;
unsigned char * buf;
int maxsize;
@@ -223,6 +224,13 @@ int cmd_dump(int fd, struct avrpart * p, int argc, char * argv[])
memtype = argv[1];
if (strncmp(prevmem, memtype, strlen(memtype)) != 0) {
addr = 0;
len = 64;
strncpy(prevmem, memtype, sizeof(prevmem)-1);
prevmem[sizeof(prevmem)-1] = 0;
}
mem = avr_locate_mem(p, memtype);
if (mem == NULL) {
fprintf(stderr, "\"%s\" memory type not defined for part \"%s\"\n",
@@ -298,7 +306,7 @@ int cmd_write(int fd, struct avrpart * p, int argc, char * argv[])
AVRMEM * mem;
if (argc < 4) {
fprintf(stderr, "Usage: write flash|eeprom|fuse <addr> <byte1> "
fprintf(stderr, "Usage: write <memtype> <addr> <byte1> "
"<byte2> ... byteN>\n");
return -1;
}