summaryrefslogtreecommitdiff
path: root/extmod/modmachine.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-11-24 18:24:40 +1100
committerDamien George <damien@micropython.org>2023-11-30 16:11:11 +1100
commit48b5a7b06079f0d0aa4780016f015ff023875680 (patch)
tree225d52f68ff3f8744b26aed3bbca7b10a34567df /extmod/modmachine.c
parente68aa40d2a6fa37fc551006f9c6f8928a75220a9 (diff)
extmod/modmachine: Provide common Python bindings for bootloader().
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/modmachine.c')
-rw-r--r--extmod/modmachine.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/extmod/modmachine.c b/extmod/modmachine.c
index e3baea521..789d324d6 100644
--- a/extmod/modmachine.c
+++ b/extmod/modmachine.c
@@ -39,6 +39,10 @@
STATIC void mp_machine_idle(void);
+#if MICROPY_PY_MACHINE_BOOTLOADER
+NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args);
+#endif
+
// The port can provide additional machine-module implementation in this file.
#ifdef MICROPY_PY_MACHINE_INCLUDEFILE
#include MICROPY_PY_MACHINE_INCLUDEFILE
@@ -50,6 +54,13 @@ STATIC mp_obj_t machine_soft_reset(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset);
+#if MICROPY_PY_MACHINE_BOOTLOADER
+NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
+ mp_machine_bootloader(n_args, args);
+}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_bootloader_obj, 0, 1, machine_bootloader);
+#endif
+
STATIC mp_obj_t machine_idle(void) {
mp_machine_idle();
return mp_const_none;
@@ -66,6 +77,9 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
// Reset related functions.
{ MP_ROM_QSTR(MP_QSTR_soft_reset), MP_ROM_PTR(&machine_soft_reset_obj) },
+ #if MICROPY_PY_MACHINE_BOOTLOADER
+ { MP_ROM_QSTR(MP_QSTR_bootloader), MP_ROM_PTR(&machine_bootloader_obj) },
+ #endif
// Power related functions.
{ MP_ROM_QSTR(MP_QSTR_idle), MP_ROM_PTR(&machine_idle_obj) },