Submitted by Martin Thierer:

bug #60863: avrftdi programming error probably caused by multiple, consecutive empty pages
* avrftdi.c (avrftdi_flash_write): Skip empty pages



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1462 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2021-11-07 16:00:16 +00:00
parent 9cf4edf76f
commit eb461f706f
3 changed files with 19 additions and 13 deletions

View File

@ -1,3 +1,9 @@
2021-11-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Martin Thierer:
bug #60863: avrftdi programming error probably caused by multiple, consecutive empty pages
* avrftdi.c (avrftdi_flash_write): Skip empty pages
2021-11-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de> 2021-11-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Matwey V. Kornilov: Submitted by Matwey V. Kornilov:

1
NEWS
View File

@ -63,6 +63,7 @@ Current:
bug #55009: no efuses for m164a/pa bug #55009: no efuses for m164a/pa
bug #55734: USBtiny programming of ATmega328p broken by Patch #9278 bug #55734: USBtiny programming of ATmega328p broken by Patch #9278
bug #58495: Add atmega324pb support to avrdude.conf.in bug #58495: Add atmega324pb support to avrdude.conf.in
bug #60863: avrftdi programming error probably caused by multiple, consecutive empty pages
* Patches: * Patches:
patch #9482: Add support for UPDI and AVR8X patch #9482: Add support for UPDI and AVR8X

View File

@ -1045,16 +1045,6 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
bufptr += 4; bufptr += 4;
} }
buf_size = bufptr - buf;
if(verbose > TRACE)
buf_dump(buf, buf_size, "command buffer", 0, 16*2);
log_info("Transmitting buffer of size: %d\n", buf_size);
if (0 > avrftdi_transmit(pgm, MPSSE_DO_WRITE, buf, buf, buf_size))
return -1;
bufptr = buf;
/* find a poll byte. we cannot poll a value of 0xff, so look /* find a poll byte. we cannot poll a value of 0xff, so look
* for a value != 0xff * for a value != 0xff
*/ */
@ -1064,6 +1054,17 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
if((poll_index < addr + len) && m->buf[poll_index] != 0xff) if((poll_index < addr + len) && m->buf[poll_index] != 0xff)
{ {
buf_size = bufptr - buf;
if(verbose > TRACE)
buf_dump(buf, buf_size, "command buffer", 0, 16*2);
log_info("Transmitting buffer of size: %d\n", buf_size);
if (0 > avrftdi_transmit(pgm, MPSSE_DO_WRITE, buf, buf, buf_size))
return -1;
bufptr = buf;
log_info("Using m->buf[%d] = 0x%02x as polling value ", poll_index, log_info("Using m->buf[%d] = 0x%02x as polling value ", poll_index,
m->buf[poll_index]); m->buf[poll_index]);
/* poll page write ready */ /* poll page write ready */
@ -1077,9 +1078,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
} }
else else
{ {
log_warn("No suitable byte (!=0xff) for polling found.\n"); log_warn("Skipping empty page (containing only 0xff bytes)\n");
log_warn("Trying to sleep instead, but programming errors may occur.\n");
log_warn("Be sure to verify programmed memory (no -V option)\n");
/* TODO sync write */ /* TODO sync write */
/* sleep */ /* sleep */
usleep((m->max_write_delay)); usleep((m->max_write_delay));