Skip to content

Commit 5751e14

Browse files
Vincenzo Frascinod3zd3z
authored andcommitted
arm: soc: nxp k6x: Add Allow write on Flash
This patch adds the allow flash write CONFIG option to the NXP MPU configuration in privileged mode. Signed-off-by: Vincenzo Frascino <[email protected]> Signed-off-by: David Brown <[email protected]>
1 parent e06ece0 commit 5751e14

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

arch/arm/core/cortex_m/mpu/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,10 @@ config NXP_MPU
3838
default n
3939
help
4040
MCU has NXP MPU
41+
42+
config MPU_ALLOW_FLASH_WRITE
43+
bool "Add MPU access to write to flash"
44+
depends on NXP_MPU
45+
default n
46+
help
47+
Enable this to allow MPU RWX access to flash memory

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,25 @@
6262
#define ENDADDR_ROUND(x) (x - 0x1F)
6363

6464
/* Some helper defines for common regions */
65+
#if defined(CONFIG_MPU_ALLOW_FLASH_WRITE)
66+
#define REGION_RAM_ATTR (MPU_REGION_READ | \
67+
MPU_REGION_WRITE | \
68+
MPU_REGION_EXEC | \
69+
MPU_REGION_SU)
70+
71+
#define REGION_FLASH_ATTR (MPU_REGION_READ | \
72+
MPU_REGION_WRITE | \
73+
MPU_REGION_EXEC | \
74+
MPU_REGION_SU)
75+
#else
6576
#define REGION_RAM_ATTR (MPU_REGION_READ | \
6677
MPU_REGION_WRITE | \
6778
MPU_REGION_SU)
6879

6980
#define REGION_FLASH_ATTR (MPU_REGION_READ | \
7081
MPU_REGION_EXEC | \
7182
MPU_REGION_SU)
83+
#endif
7284

7385
#define REGION_IO_ATTR (MPU_REGION_READ | \
7486
MPU_REGION_WRITE | \
@@ -80,7 +92,6 @@
8092

8193
#define REGION_DEBUG_ATTR MPU_REGION_SU
8294

83-
8495
/* Region definition data structure */
8596
struct nxp_mpu_region {
8697
/* Region Base Address */

0 commit comments

Comments
 (0)