Skip to content

Commit be9506c

Browse files
committed
dts: stm32wb: Limit flash size to 812K
stm32wb55rg is a dual core SoC (M4/M0) with a radio/protocol stack running on M0 core. M0 FW starts at flash address 0x80CB000. So flash size available to zephyr is 812K instead of 1M. Configure package size to reflect this (flash size is now 812K) and update MPU setting to exclude M0 FW. From MPU point of view, we set flash size to 512K since we should chose a size being a power of 2. If we consider there will be 2 images partitions in a FOTA scheme, 512 K is beyond image-0 and hence is sufficient to cover application image. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent 30f98b9 commit be9506c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

dts/arm/st/wb/stm32wb55Xg.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
soc {
1515
flash-controller@58004000 {
1616
flash0: flash@8000000 {
17-
reg = <0x08000000 DT_SIZE_K(1024)>;
17+
reg = <0x08000000 DT_SIZE_K(812)>;
1818
};
1919
};
2020
};

soc/arm/st_stm32/common/arm_mpu_mem_cfg.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <arch/arm/cortex_m/mpu/arm_mpu.h>
1111

1212
/* Flash Region Definitions */
13+
#if !defined(CONFIG_SOC_SERIES_STM32WBX)
1314
#if CONFIG_FLASH_SIZE == 64
1415
#define REGION_FLASH_SIZE REGION_64K
1516
#elif CONFIG_FLASH_SIZE == 128
@@ -27,6 +28,16 @@
2728
#else
2829
#error "Unsupported configuration"
2930
#endif
31+
#else /* CONFIG_SOC_SERIES_STM32WBX */
32+
/* For STM32WBX SoCs, last 212K are resevred for M0 fw */
33+
/* and should not be covered by zephyr MPU. */
34+
/* So map only the first 512K, which is beyond partition 'image-0' */
35+
#if CONFIG_FLASH_SIZE == 812
36+
#define REGION_FLASH_SIZE REGION_1M
37+
#else
38+
#error "Unsupported configuration"
39+
#endif
40+
#endif /* CONFIG_SOC_SERIES_STM32WBX */
3041

3142
/* SRAM Region Definitions */
3243
#if CONFIG_SRAM_SIZE == 12

0 commit comments

Comments
 (0)