arch: arm: mpu: declare and define nxp_mpu_config as const

Declare and define nxp_mpu_config and nxp_mpu_regions
structs as const, as they are not modified in run-time.

Fixes #10320

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2018-11-21 09:27:33 +01:00 committed by Anas Nashif
commit d51f138703
2 changed files with 4 additions and 4 deletions

View file

@ -146,7 +146,7 @@ struct nxp_mpu_config {
/* Number of regions */ /* Number of regions */
u32_t num_regions; u32_t num_regions;
/* Regions */ /* Regions */
struct nxp_mpu_region *mpu_regions; const struct nxp_mpu_region *mpu_regions;
/* SRAM Region */ /* SRAM Region */
u32_t sram_region; u32_t sram_region;
}; };
@ -159,6 +159,6 @@ struct nxp_mpu_config {
* for Thread Stack, Stack Guards, etc.) are programmed during runtime, thus, * for Thread Stack, Stack Guards, etc.) are programmed during runtime, thus,
* not kept here. * not kept here.
*/ */
extern struct nxp_mpu_config mpu_config; extern const struct nxp_mpu_config mpu_config;
#endif /* ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_M_MPU_NXP_MPU_H_ */ #endif /* ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_M_MPU_NXP_MPU_H_ */

View file

@ -6,7 +6,7 @@
#include <soc.h> #include <soc.h>
#include <arch/arm/cortex_m/mpu/nxp_mpu.h> #include <arch/arm/cortex_m/mpu/nxp_mpu.h>
static struct nxp_mpu_region mpu_regions[] = { static const struct nxp_mpu_region mpu_regions[] = {
/* Region 0 */ /* Region 0 */
MPU_REGION_ENTRY("DEBUGGER_0", MPU_REGION_ENTRY("DEBUGGER_0",
0, 0,
@ -48,7 +48,7 @@ static struct nxp_mpu_region mpu_regions[] = {
REGION_RAM_ATTR), REGION_RAM_ATTR),
}; };
struct nxp_mpu_config mpu_config = { const struct nxp_mpu_config mpu_config = {
.num_regions = ARRAY_SIZE(mpu_regions), .num_regions = ARRAY_SIZE(mpu_regions),
.mpu_regions = mpu_regions, .mpu_regions = mpu_regions,
.sram_region = 4, .sram_region = 4,