Invalidate cache in stk500v2_paged_write()

Bytewise access uses a cache, but paged access doesn't so must invalidate
the cache when writing a page - otherwise mixing bytewise and paged access
is bound to fail.
This commit is contained in:
Stefan Rueger
2023-06-13 18:19:31 +01:00
parent 4722417fe0
commit 3c84f7328f

View File

@@ -2724,6 +2724,7 @@ static int stk500v2_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A
// determine which command is to be used
if (strcmp(m->desc, "flash") == 0) {
addrshift = 1;
PDATA(pgm)->flash_pageaddr = -1UL; // Invalidate cache
commandbuf[0] = CMD_PROGRAM_FLASH_ISP;
/*
* If bit 31 is set, this indicates that the following read/write
@@ -2735,6 +2736,7 @@ static int stk500v2_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A
use_ext_addr = (1U << 31);
}
} else if (strcmp(m->desc, "eeprom") == 0) {
PDATA(pgm)->eeprom_pageaddr = -1UL; // Invalidate cache
commandbuf[0] = CMD_PROGRAM_EEPROM_ISP;
}
commandbuf[4] = m->delay;