extmod/modmachine: Add MICROPY_PY_MACHINE_RESET configuration option.
Disabled by default, but enabled on all boards that previously had `MICROPY_PY_MACHINE_BARE_METAL_FUNCS` enabled. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
dd134e4836
commit
bfc3dde2c9
@ -43,10 +43,13 @@ static void mp_machine_idle(void);
|
||||
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args);
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_MACHINE_BARE_METAL_FUNCS
|
||||
static mp_obj_t mp_machine_unique_id(void);
|
||||
#if MICROPY_PY_MACHINE_RESET
|
||||
NORETURN static void mp_machine_reset(void);
|
||||
static mp_int_t mp_machine_reset_cause(void);
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_MACHINE_BARE_METAL_FUNCS
|
||||
static mp_obj_t mp_machine_unique_id(void);
|
||||
static mp_obj_t mp_machine_get_freq(void);
|
||||
static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args);
|
||||
static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args);
|
||||
@ -77,12 +80,7 @@ static mp_obj_t machine_idle(void) {
|
||||
}
|
||||
static MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);
|
||||
|
||||
#if MICROPY_PY_MACHINE_BARE_METAL_FUNCS
|
||||
|
||||
static mp_obj_t machine_unique_id(void) {
|
||||
return mp_machine_unique_id();
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(machine_unique_id_obj, machine_unique_id);
|
||||
#if MICROPY_PY_MACHINE_RESET
|
||||
|
||||
NORETURN static mp_obj_t machine_reset(void) {
|
||||
mp_machine_reset();
|
||||
@ -94,6 +92,15 @@ static mp_obj_t machine_reset_cause(void) {
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
|
||||
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_MACHINE_BARE_METAL_FUNCS
|
||||
|
||||
static mp_obj_t machine_unique_id(void) {
|
||||
return mp_machine_unique_id();
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(machine_unique_id_obj, machine_unique_id);
|
||||
|
||||
static mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
|
||||
if (n_args == 0) {
|
||||
return mp_machine_get_freq();
|
||||
@ -154,7 +161,7 @@ static const mp_rom_map_elem_t machine_module_globals_table[] = {
|
||||
#if MICROPY_PY_MACHINE_BOOTLOADER
|
||||
{ MP_ROM_QSTR(MP_QSTR_bootloader), MP_ROM_PTR(&machine_bootloader_obj) },
|
||||
#endif
|
||||
#if MICROPY_PY_MACHINE_BARE_METAL_FUNCS
|
||||
#if MICROPY_PY_MACHINE_RESET
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) },
|
||||
#endif
|
||||
|
@ -127,6 +127,7 @@
|
||||
#define MICROPY_PY_VFS (1)
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/cc3200/mods/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_DISABLE_IRQ_ENABLE_IRQ (1)
|
||||
#define MICROPY_PY_MACHINE_WDT (1)
|
||||
|
@ -114,6 +114,7 @@
|
||||
#define MICROPY_PY_OS_URANDOM (1)
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/esp32/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_DISABLE_IRQ_ENABLE_IRQ (1)
|
||||
#define MICROPY_PY_MACHINE_ADC (1)
|
||||
|
@ -66,6 +66,7 @@
|
||||
#define MICROPY_PY_LWIP_SOCK_RAW (1)
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/esp8266/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_DISABLE_IRQ_ENABLE_IRQ (1)
|
||||
#define MICROPY_PY_MACHINE_ADC (1)
|
||||
|
@ -79,6 +79,7 @@ uint32_t trng_random_u32(void);
|
||||
#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (trng_random_u32())
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/mimxrt/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_BOOTLOADER (1)
|
||||
#define MICROPY_PY_MACHINE_DISABLE_IRQ_ENABLE_IRQ (1)
|
||||
|
@ -174,6 +174,7 @@
|
||||
#define MICROPY_PY_TIME (1)
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/nrf/modules/machine/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_BOOTLOADER (1)
|
||||
#define MICROPY_PY_MACHINE_PULSE (0)
|
||||
|
@ -131,6 +131,7 @@
|
||||
#ifndef MICROPY_PY_MACHINE
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/renesas-ra/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_BOOTLOADER (1)
|
||||
#define MICROPY_PY_MACHINE_ADC (1)
|
||||
|
@ -115,6 +115,7 @@
|
||||
#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (rosc_random_u32())
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/rp2/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_BOOTLOADER (1)
|
||||
#define MICROPY_PY_MACHINE_DISABLE_IRQ_ENABLE_IRQ (1)
|
||||
|
@ -73,6 +73,7 @@
|
||||
#define MICROPY_PY_TIME_INCLUDEFILE "ports/samd/modtime.c"
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/samd/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_BOOTLOADER (1)
|
||||
#define MICROPY_PY_MACHINE_DISABLE_IRQ_ENABLE_IRQ (1)
|
||||
|
@ -111,6 +111,7 @@
|
||||
#ifndef MICROPY_PY_MACHINE
|
||||
#define MICROPY_PY_MACHINE (1)
|
||||
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/stm32/modmachine.c"
|
||||
#define MICROPY_PY_MACHINE_RESET (1)
|
||||
#define MICROPY_PY_MACHINE_BARE_METAL_FUNCS (1)
|
||||
#define MICROPY_PY_MACHINE_BOOTLOADER (1)
|
||||
#define MICROPY_PY_MACHINE_ADC (1)
|
||||
|
@ -1692,6 +1692,11 @@ typedef double mp_float_t;
|
||||
#define MICROPY_PY_MACHINE (0)
|
||||
#endif
|
||||
|
||||
// Whether to include: reset, reset_cause
|
||||
#ifndef MICROPY_PY_MACHINE_RESET
|
||||
#define MICROPY_PY_MACHINE_RESET (0)
|
||||
#endif
|
||||
|
||||
// Whether to include: bitstream
|
||||
#ifndef MICROPY_PY_MACHINE_BITSTREAM
|
||||
#define MICROPY_PY_MACHINE_BITSTREAM (0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user