From a819a7b7c421fbc9b99bf219a216740f27088d0a Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 31 Aug 2021 14:57:34 -0400 Subject: [PATCH] boards: cube orange fully clear any existing MPU configuration as soon as possible --- boards/cubepilot/cubeorange/src/init.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/boards/cubepilot/cubeorange/src/init.c b/boards/cubepilot/cubeorange/src/init.c index 7d4487f432..392c4b3654 100644 --- a/boards/cubepilot/cubeorange/src/init.c +++ b/boards/cubepilot/cubeorange/src/init.c @@ -60,6 +60,8 @@ #include #include +#include + __BEGIN_DECLS extern void led_init(void); extern void led_on(int led); @@ -118,6 +120,16 @@ __EXPORT void board_on_reset(int status) ************************************************************************************/ __EXPORT void stm32_boardinitialize(void) { + // clear all existing MPU configuration from bootloader + for (int region = 0; region < CONFIG_ARM_MPU_NREGIONS; region++) { + putreg32(region, MPU_RNR); + putreg32(0, MPU_RBAR); + putreg32(0, MPU_RASR); + + // save + putreg32(0, MPU_CTRL); + } + /* Reset PWM first thing */ board_on_reset(-1);