Fix avr_read() for page reads with page sizes that are not a multiple of the memory size

This commit is contained in:
Marius Greuel 2021-12-26 16:57:23 +01:00
parent c60c5c4b83
commit 55251ea6f5
1 changed files with 3 additions and 2 deletions

View File

@ -331,7 +331,7 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
/* supports "paged load" thru post-increment */ /* supports "paged load" thru post-increment */
if ((p->flags & AVRPART_HAS_TPI) && mem->page_size > 1 && if ((p->flags & AVRPART_HAS_TPI) && mem->page_size > 1 &&
pgm->cmd_tpi != NULL) { mem->size % mem->page_size == 0 && pgm->cmd_tpi != NULL) {
while (avr_tpi_poll_nvmbsy(pgm)); while (avr_tpi_poll_nvmbsy(pgm));
@ -361,7 +361,8 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
return avr_mem_hiaddr(mem); return avr_mem_hiaddr(mem);
} }
if (pgm->paged_load != NULL && mem->page_size > 1) { if (pgm->paged_load != NULL && mem->page_size > 1 &&
mem->size % mem->page_size == 0) {
/* /*
* the programmer supports a paged mode read * the programmer supports a paged mode read
*/ */