summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/stm32/boardctrl.h4
-rw-r--r--ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h2
-rw-r--r--ports/stm32/modmachine.c5
-rw-r--r--ports/stm32/modmachine.h1
4 files changed, 10 insertions, 2 deletions
diff --git a/ports/stm32/boardctrl.h b/ports/stm32/boardctrl.h
index 0878a453b..bc901f1c3 100644
--- a/ports/stm32/boardctrl.h
+++ b/ports/stm32/boardctrl.h
@@ -37,6 +37,10 @@
#define MICROPY_BOARD_STARTUP powerctrl_check_enter_bootloader
#endif
+#ifndef MICROPY_BOARD_ENTER_BOOTLOADER
+#define MICROPY_BOARD_ENTER_BOOTLOADER(nargs, args)
+#endif
+
#ifndef MICROPY_BOARD_EARLY_INIT
#define MICROPY_BOARD_EARLY_INIT()
#endif
diff --git a/ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h b/ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h
index 30c909913..31e19c9eb 100644
--- a/ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h
+++ b/ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h
@@ -38,7 +38,7 @@ void PORTENTA_board_startup(void);
#define MICROPY_BOARD_EARLY_INIT PORTENTA_board_early_init
void PORTENTA_board_early_init(void);
-#define MICROPY_BOARD_ENTER_BOOTLOADER PORTENTA_board_enter_bootloader
+#define MICROPY_BOARD_ENTER_BOOTLOADER(nargs, args) PORTENTA_board_enter_bootloader()
void PORTENTA_board_enter_bootloader(void);
void PORTENTA_board_low_power(int mode);
diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c
index 5fca9b3e0..91061a310 100644
--- a/ports/stm32/modmachine.c
+++ b/ports/stm32/modmachine.c
@@ -46,6 +46,7 @@
#include "gccollect.h"
#include "irq.h"
#include "powerctrl.h"
+#include "boardctrl.h"
#include "pybthread.h"
#include "rng.h"
#include "storage.h"
@@ -270,7 +271,7 @@ STATIC mp_obj_t machine_soft_reset(void) {
MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset);
// Activate the bootloader without BOOT* pins.
-STATIC NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
+NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
#if MICROPY_HW_ENABLE_USB
pyb_usb_dev_deinit();
#endif
@@ -280,6 +281,8 @@ STATIC NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args)
__disable_irq();
+ MICROPY_BOARD_ENTER_BOOTLOADER(n_args, args);
+
#if MICROPY_HW_USES_BOOTLOADER
if (n_args == 0 || !mp_obj_is_true(args[0])) {
// By default, with no args given, we enter the custom bootloader (mboot)
diff --git a/ports/stm32/modmachine.h b/ports/stm32/modmachine.h
index 0e6c000a8..9fa785158 100644
--- a/ports/stm32/modmachine.h
+++ b/ports/stm32/modmachine.h
@@ -36,6 +36,7 @@ extern const mp_obj_type_t machine_i2s_type;
void machine_init(void);
void machine_deinit(void);
void machine_i2s_init0();
+NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj);
MP_DECLARE_CONST_FUN_OBJ_0(machine_unique_id_obj);