Skip to content

Commit d51f138

Browse files
ioannisgnashif
authored andcommitted
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 <[email protected]>
1 parent 8204ecb commit d51f138

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ struct nxp_mpu_config {
146146
/* Number of regions */
147147
u32_t num_regions;
148148
/* Regions */
149-
struct nxp_mpu_region *mpu_regions;
149+
const struct nxp_mpu_region *mpu_regions;
150150
/* SRAM Region */
151151
u32_t sram_region;
152152
};
@@ -159,6 +159,6 @@ struct nxp_mpu_config {
159159
* for Thread Stack, Stack Guards, etc.) are programmed during runtime, thus,
160160
* not kept here.
161161
*/
162-
extern struct nxp_mpu_config mpu_config;
162+
extern const struct nxp_mpu_config mpu_config;
163163

164164
#endif /* ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_M_MPU_NXP_MPU_H_ */

soc/arm/nxp_kinetis/k6x/nxp_mpu_regions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <soc.h>
77
#include <arch/arm/cortex_m/mpu/nxp_mpu.h>
88

9-
static struct nxp_mpu_region mpu_regions[] = {
9+
static const struct nxp_mpu_region mpu_regions[] = {
1010
/* Region 0 */
1111
MPU_REGION_ENTRY("DEBUGGER_0",
1212
0,
@@ -48,7 +48,7 @@ static struct nxp_mpu_region mpu_regions[] = {
4848
REGION_RAM_ATTR),
4949
};
5050

51-
struct nxp_mpu_config mpu_config = {
51+
const struct nxp_mpu_config mpu_config = {
5252
.num_regions = ARRAY_SIZE(mpu_regions),
5353
.mpu_regions = mpu_regions,
5454
.sram_region = 4,

0 commit comments

Comments
 (0)