diff --git a/src/fileio.c b/src/fileio.c index 96f5f9c2..35bea6a4 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -331,6 +331,9 @@ static int ihex_readrec(struct ihexsrec *ihex, char * rec) { unsigned fileio_mem_offset(const AVRPART *p, const AVRMEM *mem) { AVRMEM *base; + if(mem->type == 0 && mem->size == ANY_MEM_SIZE) + return 0; + unsigned location = mem_is_in_flash(mem) && (base = avr_locate_flash(p))? mem->offset - base->offset: mem_is_io(mem) || mem_is_sram(mem)? MAX_FLASH_SIZE + mem->offset: @@ -1546,7 +1549,6 @@ int fileio_fmt_autodetect(const char *fname) { } - int fileio_mem(int op, const char *filename, FILEFMT format, const AVRPART *p, const AVRMEM *mem, int size) { diff --git a/src/update.c b/src/update.c index 9fa4c1ff..a596d98d 100644 --- a/src/update.c +++ b/src/update.c @@ -396,8 +396,8 @@ static int update_avr_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRME if(memstats_mem(p, mem, size, &fs) < 0) return -1; - imsg_info("read %d byte%s in %d section%s within %s\n", - fs.nbytes, str_plural(fs.nbytes), + imsg_info("read %d byte%s for %s in %d section%s within %s\n", + fs.nbytes, str_plural(fs.nbytes), avr_mem_name(p, mem), fs.nsections, str_plural(fs.nsections), str_ccinterval(fs.firstaddr, fs.lastaddr)); if(mem->page_size > 1) { @@ -633,6 +633,37 @@ int do_op(const PROGRAMMER *pgm, const AVRPART *p, const UPDATE *upd, enum updat goto error; if(umemlist) { + int allsize = rc; + for(int i=0; isize; + if(allsize - off < size) + size = allsize - off; + memcpy(m->buf, mem->buf+off, size); + memcpy(m->tags, mem->tags+off, size); + + int ret = update_avr_write(pgm, p, m, upd, flags, size, caption); + if(ret < 0) { + pmsg_warning("unable to write %s (ret = %d), skipping...\n", m_name, ret); + continue; + } + } break; } else { update_avr_write(pgm, p, mem, upd, flags, rc, "Writing");