Skip to content

Commit

Permalink
[LTD fromlist] arm: soc: nxp k6x: Add Allow write on Flash
Browse files Browse the repository at this point in the history
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: Marti Bolivar <[email protected]>
LTD: some conflict resolution on top of what was posted to the list.
  • Loading branch information
Vincenzo Frascino authored and rsalveti committed Jun 1, 2017
1 parent e97c7b6 commit 5a80229
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/arm/core/cortex_m/mpu/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ config NXP_MPU
default n
help
MCU has NXP MPU

config MPU_ALLOW_FLASH_WRITE
bool "Add MPU access to write to flash"
depends on NXP_MPU
default n
help
Enable this to allow MPU RWX access to flash memory
16 changes: 16 additions & 0 deletions include/arch/arm/cortex_m/mpu/nxp_mpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,29 @@
#define ENDADDR_ROUND(x) (x - 0x1F)

/* Some helper defines for common regions */
#if defined(CONFIG_MPU_ALLOW_FLASH_WRITE)
/*
* This config option enables the possibility to write in flash and to execute
* from RAM since it is required to initialize the flash driver.
*/
#define REGION_RAM_ATTR (MPU_REGION_READ | \
MPU_REGION_WRITE | \
MPU_REGION_EXEC | \
MPU_REGION_SU)

#define REGION_FLASH_ATTR (MPU_REGION_READ | \
MPU_REGION_WRITE | \
MPU_REGION_EXEC | \
MPU_REGION_SU)
#else
#define REGION_RAM_ATTR (MPU_REGION_READ | \
MPU_REGION_WRITE | \
MPU_REGION_SU)

#define REGION_FLASH_ATTR (MPU_REGION_READ | \
MPU_REGION_EXEC | \
MPU_REGION_SU)
#endif

#define REGION_IO_ATTR (MPU_REGION_READ | \
MPU_REGION_WRITE | \
Expand Down

0 comments on commit 5a80229

Please sign in to comment.