Skip to content

Commit c33c749

Browse files
committed
stm32/boardctrl: Add MICROPY_BOARD_STARTUP hook.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 79c186f commit c33c749

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

ports/stm32/boardctrl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
#include "py/mpconfig.h"
3030

31+
#ifndef MICROPY_BOARD_STARTUP
32+
#define MICROPY_BOARD_STARTUP powerctrl_check_enter_bootloader
33+
#endif
34+
3135
#ifndef MICROPY_BOARD_EARLY_INIT
3236
#define MICROPY_BOARD_EARLY_INIT()
3337
#endif

ports/stm32/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ void stm32_main(uint32_t reset_mode) {
313313
// Enable 8-byte stack alignment for IRQ handlers, in accord with EABI
314314
SCB->CCR |= SCB_CCR_STKALIGN_Msk;
315315

316-
// Check if bootloader should be entered instead of main application
317-
powerctrl_check_enter_bootloader();
316+
// Hook for a board to run code at start up, for example check if a
317+
// bootloader should be entered instead of the main application.
318+
MICROPY_BOARD_STARTUP();
318319

319320
// Enable caches and prefetch buffers
320321

0 commit comments

Comments
 (0)