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,6 +1045,15 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
bufptr += 4; bufptr += 4;
} }
/* find a poll byte. we cannot poll a value of 0xff, so look
* for a value != 0xff
*/
for(poll_index = addr+len-1; poll_index > addr-1; poll_index--)
if(m->buf[poll_index] != 0xff)
break;
if((poll_index < addr + len) && m->buf[poll_index] != 0xff)
{
buf_size = bufptr - buf; buf_size = bufptr - buf;
if(verbose > TRACE) if(verbose > TRACE)
@ -1055,15 +1064,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
return -1; return -1;
bufptr = buf; bufptr = buf;
/* find a poll byte. we cannot poll a value of 0xff, so look
* for a value != 0xff
*/
for(poll_index = addr+len-1; poll_index > addr-1; poll_index--)
if(m->buf[poll_index] != 0xff)
break;
if((poll_index < addr + len) && m->buf[poll_index] != 0xff)
{
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));