]> git.gag.com Git - fw/stlink/commitdiff
use correct SNB values for high flash pages on 2mb devices.
authorWoodrow Douglass <wdouglass@carnegierobotics.com>
Fri, 31 Oct 2014 17:54:37 +0000 (13:54 -0400)
committerWoodrow Douglass <wdouglass@carnegierobotics.com>
Fri, 31 Oct 2014 17:54:37 +0000 (13:54 -0400)
src/stlink-common.c

index fca82284b72964bc5ef4d9801a92dec3d7edf14d..4d30287add9b39dfbddc8259bf67077566f69c9f 100644 (file)
@@ -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 */