Skip to content

Commit

Permalink
boards: Holybro H7 boards clear MPU early in board init
Browse files Browse the repository at this point in the history
 - needed if the bootloader configures the memory protection unit (MPU)
  • Loading branch information
dagar committed Aug 31, 2021
1 parent 7476a29 commit ba0b512
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions boards/holybro/durandal-v1/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
#include <px4_platform/board_determine_hw_info.h>
#include <px4_platform/board_dma_alloc.h>

#include <mpu.h>

/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit ba0b512

Please sign in to comment.