Skip to content

Commit 9cebb3f

Browse files
alxlasturkartben
authored andcommitted
arm: mpu: Remove FLASH_0 mpu region when XIP=n
When not using CONFIG_XIP (CONFIG_XIP=n) the FLASH_0 mpu region needs to be removed, otherwise it will have the default base address = 0, which means that MPU will try to configure the region with address 0. We don't want this as in some situations address 0 can be a restricted memory region such as ROM code. Signed-off-by: Alexandru Lastur <alexandru.lastur@nxp.com>
1 parent da43d97 commit 9cebb3f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm/core/mpu/arm_mpu_regions.c

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

1212
static const struct arm_mpu_region mpu_regions[] = {
13+
#ifdef CONFIG_XIP
1314
/* Region 0 */
1415
MPU_REGION_ENTRY("FLASH_0",
1516
CONFIG_FLASH_BASE_ADDRESS,
@@ -19,6 +20,8 @@ static const struct arm_mpu_region mpu_regions[] = {
1920
#else
2021
REGION_FLASH_ATTR(REGION_FLASH_SIZE)),
2122
#endif
23+
#endif
24+
2225
/* Region 1 */
2326
MPU_REGION_ENTRY("SRAM_0",
2427
CONFIG_SRAM_BASE_ADDRESS,

0 commit comments

Comments
 (0)