Skip to content

Commit de81c16

Browse files
Vincenzo Frascinogalak
Vincenzo Frascino
authored andcommitted
arm: core: mpu: Add Allow write on Flash
This patch adds the allow flash write CONFIG option to the ARM MPU configuration in privileged mode. Signed-off-by: Vincenzo Frascino <[email protected]> Signed-off-by: Michael Scott <[email protected]> Signed-off-by: David Brown <[email protected]>
1 parent 6489b9a commit de81c16

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

arch/arm/core/cortex_m/mpu/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ config NXP_MPU
4141

4242
config MPU_ALLOW_FLASH_WRITE
4343
bool "Add MPU access to write to flash"
44-
depends on NXP_MPU
44+
depends on ARM_MPU || NXP_MPU
4545
default n
4646
help
4747
Enable this to allow MPU RWX access to flash memory

include/arch/arm/cortex_m/mpu/arm_mpu.h

+6
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,14 @@ struct arm_mpu {
8989
#define REGION_RAM_ATTR(size) \
9090
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | \
9191
NOT_EXEC | size | FULL_ACCESS)
92+
#if defined(CONFIG_MPU_ALLOW_FLASH_WRITE)
93+
#define REGION_FLASH_ATTR(size) \
94+
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | size | \
95+
P_RW_U_RO)
96+
#else
9297
#define REGION_FLASH_ATTR(size) \
9398
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | size | RO)
99+
#endif
94100
#define REGION_PPB_ATTR(size) (STRONGLY_ORDERED_SHAREABLE | size | FULL_ACCESS)
95101
#define REGION_IO_ATTR(size) (DEVICE_NON_SHAREABLE | size | FULL_ACCESS)
96102

0 commit comments

Comments
 (0)