From e80d5d2359b28fe65737d4d24d0d92410ba314be Mon Sep 17 00:00:00 2001 From: Woodrow Douglass Date: Fri, 31 Oct 2014 13:54:37 -0400 Subject: [PATCH] use correct SNB values for high flash pages on 2mb devices. --- src/stlink-common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stlink-common.c b/src/stlink-common.c index fca8228..4d30287 100644 --- a/src/stlink-common.c +++ b/src/stlink-common.c @@ -1050,6 +1050,10 @@ int stlink_erase_flash_page(stlink_t *sl, stm32_addr_t flashaddr) uint32_t sector=calculate_F4_sectornum(flashaddr); fprintf(stderr, "EraseFlash - Sector:0x%x Size:0x%x\n", sector, stlink_calculate_pagesize(sl, flashaddr)); + + //the SNB values for flash sectors in the second bank do not directly follow the values for the first bank on 2mb devices... + if (sector >= 12) sector += 4; + write_flash_cr_snb(sl, sector); /* start erase operation */ -- 2.47.2