diff options
| author | Damien George <damien@micropython.org> | 2021-03-11 09:04:36 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-03-11 09:04:36 +1100 |
| commit | c33c749f64fc664e46529885d84e499ea2c3d461 (patch) | |
| tree | 54577306b953fc7756ba186effe6c850451be084 | |
| parent | 79c186f5c962b514cde21415d7a262cfdbddbd97 (diff) | |
stm32/boardctrl: Add MICROPY_BOARD_STARTUP hook.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | ports/stm32/boardctrl.h | 4 | ||||
| -rw-r--r-- | ports/stm32/main.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ports/stm32/boardctrl.h b/ports/stm32/boardctrl.h index 6f79dfb89..f1cbc3b95 100644 --- a/ports/stm32/boardctrl.h +++ b/ports/stm32/boardctrl.h @@ -28,6 +28,10 @@ #include "py/mpconfig.h" +#ifndef MICROPY_BOARD_STARTUP +#define MICROPY_BOARD_STARTUP powerctrl_check_enter_bootloader +#endif + #ifndef MICROPY_BOARD_EARLY_INIT #define MICROPY_BOARD_EARLY_INIT() #endif diff --git a/ports/stm32/main.c b/ports/stm32/main.c index bdf7328f6..888b20513 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -313,8 +313,9 @@ void stm32_main(uint32_t reset_mode) { // Enable 8-byte stack alignment for IRQ handlers, in accord with EABI SCB->CCR |= SCB_CCR_STKALIGN_Msk; - // Check if bootloader should be entered instead of main application - powerctrl_check_enter_bootloader(); + // Hook for a board to run code at start up, for example check if a + // bootloader should be entered instead of the main application. + MICROPY_BOARD_STARTUP(); // Enable caches and prefetch buffers |
