Skip to content

Commit

Permalink
stm32h7:Support CONFIG_MPU_RESET and CONFIG_ARM_MPU_EARLY_RESET
Browse files Browse the repository at this point in the history
  • Loading branch information
davids5 committed Oct 22, 2021
1 parent db06ec2 commit 626893b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/arm/src/stm32h7/Make.defs
Expand Up @@ -66,7 +66,7 @@ ifeq ($(CONFIG_STM32H7_PROGMEM),y)
CMN_CSRCS += stm32_flash.c
endif

ifeq ($(CONFIG_ARM_MPU),y)
ifneq ($(filter y,$(CONFIG_ARM_MPU) $(CONFIG_ARM_MPU_EARLY_RESET)),)
CMN_CSRCS += arm_mpu.c
endif

Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32h7/stm32_mpuinit.c
Expand Up @@ -70,6 +70,10 @@ void stm32_mpuinitialize(void)

mpu_showtype();

/* Reset MPU if enabled */

mpu_reset();

/* Configure user flash and SRAM space */

mpu_user_flash(USERSPACE->us_textstart,
Expand Down
7 changes: 6 additions & 1 deletion arch/arm/src/stm32h7/stm32_start.c
Expand Up @@ -36,6 +36,7 @@
#include "arm_internal.h"
#include "barriers.h"
#include "nvic.h"
#include "mpu.h"

#include "stm32_rcc.h"
#include "stm32_userspace.h"
Expand Down Expand Up @@ -276,7 +277,11 @@ void __start(void)
"r"(CONFIG_IDLETHREAD_STACKSIZE - 64) :);
#endif

/* Clear .bss. We'll do this inline (vs. calling memset) just to be
/* If enabled reset the MPU */

mpu_early_reset();

/* Clear .bss. We'll do this inline (vs. calling memset) just to be
* certain that there are no issues with the state of global variables.
*/

Expand Down

0 comments on commit 626893b

Please sign in to comment.