Skip to content

Commit 1d50b92

Browse files
ioannisgcarlescufi
authored andcommitted
soc: arm: nrf52810: reduce number of boot-time configured MPU regions
nRF52810 Flash and SRAM sizes do not have power-of-two values. This commit reduces the amount of MPU regions reserved at boot time to enforce basic permissions in Flash and SRAM memory. It does this by selecting the next power-of-two size for the Flash and SRAM regions, respectively. In this way we can cover the entire Flash and SRAM space each with a single MPU region, thus, save two MPU regions to be used by the kernel/application. Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent fd7c443 commit 1d50b92

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

soc/arm/nordic_nrf/nrf52/mpu_mem_cfg.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
#elif CONFIG_FLASH_SIZE == 128
1515
#define REGION_FLASH_SIZE REGION_128K
1616
#elif CONFIG_FLASH_SIZE == 192
17-
#define REGION_FLASH_SIZE REGION_128K
18-
#define REGION_FLASH_1_SIZE REGION_64K
19-
#define REGION_FLASH_1_START CONFIG_FLASH_BASE_ADDRESS + KB(128)
17+
/* Use the next power-of-two size, to save one MPU region. */
18+
#define REGION_FLASH_SIZE REGION_256K
2019
#elif CONFIG_FLASH_SIZE == 256
2120
#define REGION_FLASH_SIZE REGION_256K
2221
#elif CONFIG_FLASH_SIZE == 512
@@ -31,9 +30,8 @@
3130

3231
/* SRAM Region Definitions */
3332
#if CONFIG_SRAM_SIZE == 24
34-
#define REGION_SRAM_0_SIZE REGION_16K
35-
#define REGION_SRAM_1_SIZE REGION_8K
36-
#define REGION_SRAM_1_START CONFIG_SRAM_BASE_ADDRESS + KB(16)
33+
#define REGION_SRAM_0_SIZE REGION_32K
34+
/* Use the next power-of-two size, to save one MPU region. */
3735
#elif CONFIG_SRAM_SIZE == 32
3836
#define REGION_SRAM_0_SIZE REGION_32K
3937
#elif CONFIG_SRAM_SIZE == 64

0 commit comments

Comments
 (0)