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>
This commit is contained in:
Alexandru Lastur 2024-10-31 13:47:08 +02:00 committed by Benjamin Cabé
commit 9cebb3ff63

View file

@ -10,6 +10,7 @@
#include <zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h>
static const struct arm_mpu_region mpu_regions[] = {
#ifdef CONFIG_XIP
/* Region 0 */
MPU_REGION_ENTRY("FLASH_0",
CONFIG_FLASH_BASE_ADDRESS,
@ -19,6 +20,8 @@ static const struct arm_mpu_region mpu_regions[] = {
#else
REGION_FLASH_ATTR(REGION_FLASH_SIZE)),
#endif
#endif
/* Region 1 */
MPU_REGION_ENTRY("SRAM_0",
CONFIG_SRAM_BASE_ADDRESS,