Skip to content

Commit 33b1164

Browse files
gmarullcarlescufi
authored andcommitted
arch: arm: cortex_m: scb: fix MPU code compilation guards
The implementation of `z_arm_clear_arm_mpu_config` was compiled for all ARM cores that declare to have an MPU. However, we only want to compile it if the MPU is actually enabled. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 40d2240 commit 33b1164

File tree

1 file changed

+4
-2
lines changed
  • arch/arm/core/aarch32/cortex_m

1 file changed

+4
-2
lines changed

arch/arm/core/aarch32/cortex_m/scb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ void __weak sys_arch_reboot(int type)
4141
NVIC_SystemReset();
4242
}
4343

44+
#if defined(CONFIG_ARM_MPU)
4445
#if defined(CONFIG_CPU_HAS_ARM_MPU)
4546
/**
4647
*
@@ -75,6 +76,7 @@ void z_arm_clear_arm_mpu_config(void)
7576
}
7677
}
7778
#endif /* CONFIG_CPU_HAS_NXP_MPU */
79+
#endif /* CONFIG_ARM_MPU */
7880

7981
#if defined(CONFIG_INIT_ARCH_HW_AT_BOOT)
8082
/**
@@ -96,10 +98,10 @@ void z_arm_init_arch_hw_at_boot(void)
9698

9799
/* Initialize System Control Block components */
98100

99-
#if defined(CONFIG_CPU_HAS_ARM_MPU) || defined(CONFIG_CPU_HAS_NXP_MPU)
101+
#if defined(CONFIG_ARM_MPU)
100102
/* Clear MPU region configuration */
101103
z_arm_clear_arm_mpu_config();
102-
#endif /* CONFIG_CPU_HAS_ARM_MPU */
104+
#endif /* CONFIG_ARM_MPU */
103105

104106
/* Disable NVIC interrupts */
105107
for (uint8_t i = 0; i < ARRAY_SIZE(NVIC->ICER); i++) {

0 commit comments

Comments
 (0)