]> www.infradead.org Git - users/borneoa/openocd-next.git/commitdiff
flash/nor/rp2040: Fix incorrect erase bounds calculation
authorLuke Wren <luke@raspberrypi.com>
Tue, 6 Aug 2024 10:57:04 +0000 (11:57 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Fri, 25 Apr 2025 09:27:40 +0000 (09:27 +0000)
when erase region does not start at 0

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Luke Wren <luke@raspberrypi.com>
Change-Id: I2b9db61e8ac837b6c6431aacf3b73ed3a1772fbc
Reviewed-on: https://review.openocd.org/c/openocd/+/8445
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
src/flash/nor/rp2040.c

index 9151b687898912ce3b477307a5ef47d2e953d855..ed8341d1ff963b53af7e034c0223c360165f11ed 100644 (file)
@@ -821,7 +821,7 @@ static int rp2040_flash_erase(struct flash_bank *bank, unsigned int first, unsig
                goto cleanup_and_return;
 
        uint32_t offset_next = bank->sectors[first].offset;
-       uint32_t offset_last = bank->sectors[last].offset + bank->sectors[last].size - bank->sectors[first].offset;
+       uint32_t offset_last = bank->sectors[last].offset + bank->sectors[last].size;
 
        /* Break erase into multiple calls to avoid timeout on large erase. Choose 128k chunk which has
           fairly low ROM call overhead and empirically seems to avoid the default keep_alive() limit