Skip to content

Commit ec945ba

Browse files
committed
STM32H7 CM4: correct FLASH_SIZE
FLASH_SIZE_DATA_REGISTER is not accessible by M4, acces makes a hard fault
1 parent cecc47b commit ec945ba

File tree

1 file changed

+4
-0
lines changed
  • targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS

1 file changed

+4
-0
lines changed

targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h747xx.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13916,9 +13916,13 @@ typedef struct
1391613916
*/
1391713917
#define FLASH_SIZE_DATA_REGISTER 0x1FF1E880U
1391813918
#define FLASH_SECTOR_TOTAL 8U /* 8 sectors */
13919+
#ifdef CORE_CM4
13920+
#define FLASH_SIZE 0x200000UL /* 2 MB */
13921+
#else
1391913922
#define FLASH_SIZE ((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0xFFFFU)) ? 0x200000U : \
1392013923
((((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x0000U)) ? 0x200000U : \
1392113924
(((uint32_t)(*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) & (0x0FFFU)) << 10U))) /* 2 MB */
13925+
#endif
1392213926
#define FLASH_BANK_SIZE (FLASH_SIZE >> 1) /* 1 MB */
1392313927
#define FLASH_SECTOR_SIZE 0x00020000UL /* 128 KB */
1392413928
#define FLASH_LATENCY_DEFAULT FLASH_ACR_LATENCY_7WS /* FLASH Seven Latency cycles */

0 commit comments

Comments
 (0)