renesas-ra/modmachine: Allow boards to provide custom bootloader code.

And expose the machine_bootloader() C function so it can be used elsewhere.
pull/8756/head
iabdalkader 2022-06-07 19:13:08 +02:00 zatwierdzone przez Damien George
rodzic f522aabab2
commit c5d26ee5e7
3 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -47,6 +47,7 @@
#include "gccollect.h"
#include "irq.h"
#include "powerctrl.h"
#include "boardctrl.h"
#include "pybthread.h"
#include "storage.h"
#include "pin.h"
@ -182,13 +183,15 @@ 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_STORAGE
storage_flush();
#endif
__disable_irq();
MICROPY_BOARD_ENTER_BOOTLOADER(n_args, args);
#if MICROPY_HW_USES_BOOTLOADER
// ToDo: need to review how to implement

Wyświetl plik

@ -49,6 +49,7 @@ void machine_deinit(void);
void machine_pin_init(void);
void machine_pin_deinit(void);
void machine_i2s_init0(void);
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);