From: Sven Wegener Date: Tue, 21 Oct 2014 08:04:10 +0000 (+0200) Subject: SNB is wider than three bits on STM32F4 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=abe1a0f026807ad1aec26b3f1ac176fd053b661f;p=fw%2Fstlink SNB is wider than three bits on STM32F4 The SNB part of the FLASH_CR register is four bits wide on F4 devices and five bits wide on F4_HD devices. F4 devices have a reserved bit alongside the sector number, so just increase the bitmask to cover all five bits. Currently flashing breaks, if flahing sector eight and above before flashing lower sectors, because the highest bit is never unset. Signed-off-by: Sven Wegener --- diff --git a/src/stlink-common.c b/src/stlink-common.c index 22f3655..acc8416 100644 --- a/src/stlink-common.c +++ b/src/stlink-common.c @@ -89,7 +89,7 @@ #define FLASH_F4_CR_LOCK 31 #define FLASH_F4_CR_SER 1 #define FLASH_F4_CR_SNB 3 -#define FLASH_F4_CR_SNB_MASK 0x38 +#define FLASH_F4_CR_SNB_MASK 0xf8 #define FLASH_F4_SR_BSY 16 #define L1_WRITE_BLOCK_SIZE 0x80