From 3c84f7328f2485d65fb6ebb925bf9eae4fa81ae5 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 13 Jun 2023 18:19:31 +0100 Subject: [PATCH] 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. --- src/stk500v2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/stk500v2.c b/src/stk500v2.c index 73576c0e..a95af29c 100644 --- a/src/stk500v2.c +++ b/src/stk500v2.c @@ -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;