diff --git a/ports/stm32f4/common-hal/microcontroller/__init__.c b/ports/stm32f4/common-hal/microcontroller/__init__.c index 75f6550df6..08f8f28f80 100644 --- a/ports/stm32f4/common-hal/microcontroller/__init__.c +++ b/ports/stm32f4/common-hal/microcontroller/__init__.c @@ -37,11 +37,13 @@ #include "shared-bindings/microcontroller/Processor.h" #include "supervisor/filesystem.h" +#include "supervisor/shared/safe_mode.h" // This routine should work even when interrupts are disabled. Used by OneWire // for precise timing. void common_hal_mcu_delay_us(uint32_t delay) { - //NRFX_DELAY_US(delay); + //TODO: implement equivalent of mp_hal_delay_us(delay); + //this is fairly annoying in the STM32 HAL } void common_hal_mcu_disable_interrupts() { @@ -51,12 +53,13 @@ void common_hal_mcu_enable_interrupts() { } void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { - // TODO: see atmel-samd for functionality + if(runmode == RUNMODE_SAFE_MODE) + safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); } void common_hal_mcu_reset(void) { - // filesystem_flush(); - // NVIC_SystemReset(); + filesystem_flush(); + NVIC_SystemReset(); } // The singleton microcontroller.Processor object, bound to microcontroller.cpu diff --git a/ports/stm32f4/mpconfigport.mk b/ports/stm32f4/mpconfigport.mk index 440d296f65..78c8e76300 100644 --- a/ports/stm32f4/mpconfigport.mk +++ b/ports/stm32f4/mpconfigport.mk @@ -20,4 +20,5 @@ CIRCUITPY_MINIMAL_BUILD = 1 CIRCUITPY_DIGITALIO = 1 CIRCUITPY_MICROCONTROLLER = 1 CIRCUITPY_BUSIO = 1 + CIRCUITPY_TIME = 1 #endif \ No newline at end of file diff --git a/ports/stm32f4/supervisor/port.c b/ports/stm32f4/supervisor/port.c index 6030547acf..e981318c08 100644 --- a/ports/stm32f4/supervisor/port.c +++ b/ports/stm32f4/supervisor/port.c @@ -69,6 +69,6 @@ uint32_t port_get_saved_word(void) { return _ebss; } -// void HardFault_Handler(void) { +void HardFault_Handler(void) { -// } +}