F1 set_flash_cr_strt unconditionally set the PER bit and so mass erase didn't work
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Fri, 20 Jan 2012 16:25:01 +0000 (17:25 +0100)
committerUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Fri, 20 Jan 2012 16:25:01 +0000 (17:25 +0100)
src/stlink-common.c

index 39a714b179ee7df00c10541107cda2cd516bd299..b6e4a51a5409b77237aecb6e61887efd7f0ff170 100644 (file)
@@ -246,9 +246,9 @@ static void set_flash_cr_strt(stlink_t *sl) {
                stlink_write_debug32(sl, FLASH_F4_CR, x);
        }
        else {
-               /* assume come on the flash_cr_per path */
-           const uint32_t n = (1 << FLASH_CR_PER) | (1 << FLASH_CR_STRT);
-           stlink_write_debug32(sl, FLASH_CR, n);
+           stlink_write_debug32(
+                sl, FLASH_CR, 
+                stlink_read_debug32(sl,FLASH_CR) |(1 << FLASH_CR_STRT) );
        }
 }