From f856b89723f4be62cb53a0d9f70647aeee7279b3 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 31 Aug 2021 18:01:06 -0400 Subject: [PATCH] boards: Holybro H7 boards clear MPU early in board init - needed if the bootloader configures the memory protection unit (MPU) --- boards/holybro/durandal-v1/src/init.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/boards/holybro/durandal-v1/src/init.c b/boards/holybro/durandal-v1/src/init.c index 05746c4959..3f1eccc180 100644 --- a/boards/holybro/durandal-v1/src/init.c +++ b/boards/holybro/durandal-v1/src/init.c @@ -75,6 +75,8 @@ #include #include +#include + /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ @@ -160,6 +162,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); + } + board_on_reset(-1); /* Reset PWM first thing */ /* configure LEDs */