Skip to content

Commit

Permalink
stm32/boardctrl: Add MICROPY_BOARD_STARTUP hook.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Mar 10, 2021
1 parent 79c186f commit c33c749
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ports/stm32/boardctrl.h
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions ports/stm32/main.c
Expand Up @@ -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

Expand Down

0 comments on commit c33c749

Please sign in to comment.