mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
MRO: Set up MPU after boot to app
This is needed in case the bootloader configured the MPU, which could interfere with the app as the bootloader memory map / configuration is different.
This commit is contained in:
committed by
Daniel Agar
parent
b9e7063237
commit
15e6ca9e1e
@@ -60,6 +60,8 @@
|
||||
#include <px4_platform/gpio.h>
|
||||
#include <px4_platform/board_dma_alloc.h>
|
||||
|
||||
#include <mpu.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern void led_init(void);
|
||||
extern void led_on(int led);
|
||||
@@ -121,6 +123,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);
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
#include <px4_platform/gpio.h>
|
||||
#include <px4_platform/board_dma_alloc.h>
|
||||
|
||||
#include <mpu.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern void led_init(void);
|
||||
extern void led_on(int led);
|
||||
@@ -121,6 +123,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);
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
#include <px4_platform/gpio.h>
|
||||
#include <px4_platform/board_dma_alloc.h>
|
||||
|
||||
#include <mpu.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern void led_init(void);
|
||||
extern void led_on(int led);
|
||||
@@ -121,6 +123,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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user