Correct flash paged write for avrftdi.c

This commit is contained in:
Stefan Rueger 2022-08-20 14:08:04 +01:00
parent 38aa1313f9
commit f8dd9bc97d
No known key found for this signature in database
GPG Key ID: B0B4F1FD86B1EC55
1 changed files with 2 additions and 3 deletions

View File

@ -1059,12 +1059,11 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
/* 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
*/ */
for(poll_index = addr+len-1; poll_index > addr-1; poll_index--) for(poll_index = addr+len-1; (int) poll_index >= (int) addr; poll_index--)
if(m->buf[poll_index] != 0xff) if(m->buf[poll_index] != 0xff)
break; break;
if((poll_index < addr + len) && m->buf[poll_index] != 0xff) if((int) poll_index >= (int) addr) {
{
buf_size = bufptr - buf; buf_size = bufptr - buf;
if(verbose > TRACE) if(verbose > TRACE)