aboutsummaryrefslogtreecommitdiff
path: root/stmhal/modmachine.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/modmachine.c')
-rw-r--r--stmhal/modmachine.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/stmhal/modmachine.c b/stmhal/modmachine.c
index cb7957681..407b62f52 100644
--- a/stmhal/modmachine.c
+++ b/stmhal/modmachine.c
@@ -202,6 +202,11 @@ STATIC NORETURN mp_obj_t machine_bootloader(void) {
HAL_RCC_DeInit();
HAL_DeInit();
+ #if (__MPU_PRESENT == 1)
+ // MPU must be disabled for bootloader to function correctly
+ HAL_MPU_Disable();
+ #endif
+
#if defined(MCU_SERIES_F7)
// arm-none-eabi-gcc 4.9.0 does not correctly inline this
// MSP function, so we write it out explicitly here.