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 <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2019-03-01 15:26:53 +01:00 committed by Carles Cufí
commit 1d50b92890

View file

@ -14,9 +14,8 @@
#elif CONFIG_FLASH_SIZE == 128
#define REGION_FLASH_SIZE REGION_128K
#elif CONFIG_FLASH_SIZE == 192
#define REGION_FLASH_SIZE REGION_128K
#define REGION_FLASH_1_SIZE REGION_64K
#define REGION_FLASH_1_START CONFIG_FLASH_BASE_ADDRESS + KB(128)
/* Use the next power-of-two size, to save one MPU region. */
#define REGION_FLASH_SIZE REGION_256K
#elif CONFIG_FLASH_SIZE == 256
#define REGION_FLASH_SIZE REGION_256K
#elif CONFIG_FLASH_SIZE == 512
@ -31,9 +30,8 @@
/* SRAM Region Definitions */
#if CONFIG_SRAM_SIZE == 24
#define REGION_SRAM_0_SIZE REGION_16K
#define REGION_SRAM_1_SIZE REGION_8K
#define REGION_SRAM_1_START CONFIG_SRAM_BASE_ADDRESS + KB(16)
#define REGION_SRAM_0_SIZE REGION_32K
/* Use the next power-of-two size, to save one MPU region. */
#elif CONFIG_SRAM_SIZE == 32
#define REGION_SRAM_0_SIZE REGION_32K
#elif CONFIG_SRAM_SIZE == 64