Skip to content

Commit 0e89ad7

Browse files
Vincenzo Frascinorsalveti
authored andcommitted
[LTD fromlist] 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 <vincenzo.frascino@linaro.org> Signed-off-by: Michael Scott <michael.scott@linaro.org> Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
1 parent 5a80229 commit 0e89ad7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

arch/arm/core/cortex_m/mpu/Kconfig

Lines changed: 1 addition & 1 deletion
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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,14 @@ struct arm_mpu {
8686
#define REGION_RAM_ATTR(size) \
8787
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | \
8888
NOT_EXEC | size | FULL_ACCESS)
89+
#if defined(CONFIG_MPU_ALLOW_FLASH_WRITE)
90+
#define REGION_FLASH_ATTR(size) \
91+
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | size | \
92+
P_RW_U_RO)
93+
#else
8994
#define REGION_FLASH_ATTR(size) \
9095
(NORMAL_OUTER_INNER_NON_CACHEABLE_NON_SHAREABLE | size | RO)
96+
#endif
9197
#define REGION_PPB_ATTR(size) (STRONGLY_ORDERED_SHAREABLE | size | FULL_ACCESS)
9298
#define REGION_IO_ATTR(size) (DEVICE_NON_SHAREABLE | size | FULL_ACCESS)
9399

0 commit comments

Comments
 (0)