From 226e969ad339678404a4ad9153cf9a40a31fc1da Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 1 Jul 2022 14:28:58 -0500 Subject: [PATCH] cc3200: Use MP_REGISTER_ROOT_POINTER(). This uses MP_REGISTER_ROOT_POINTER() to register all port-specific root pointers for the cc3200 port. Signed-off-by: David Lechner --- ports/cc3200/application.mk | 2 +- ports/cc3200/hal/cc3200_hal.c | 2 ++ ports/cc3200/misc/mpirq.c | 1 + ports/cc3200/mods/modmachine.c | 1 + ports/cc3200/mods/pybsleep.c | 1 + ports/cc3200/mods/pybtimer.c | 1 + ports/cc3200/mods/pybuart.c | 2 ++ ports/cc3200/mpconfigport.h | 9 --------- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ports/cc3200/application.mk b/ports/cc3200/application.mk index 25a9925ea0..428367d66a 100644 --- a/ports/cc3200/application.mk +++ b/ports/cc3200/application.mk @@ -166,7 +166,7 @@ OBJ += $(BUILD)/shared/runtime/gchelper_m3.o OBJ += $(BUILD)/pins.o # List of sources for qstr extraction -SRC_QSTR += $(APP_MODS_SRC_C) $(APP_MISC_SRC_C) $(APP_STM_SRC_C) $(APP_SHARED_SRC_C) +SRC_QSTR += $(APP_MODS_SRC_C) $(APP_MISC_SRC_C) $(APP_STM_SRC_C) $(APP_SHARED_SRC_C) $(APP_HAL_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += diff --git a/ports/cc3200/hal/cc3200_hal.c b/ports/cc3200/hal/cc3200_hal.c index 3a35e39e1f..4694235eeb 100644 --- a/ports/cc3200/hal/cc3200_hal.c +++ b/ports/cc3200/hal/cc3200_hal.c @@ -195,3 +195,5 @@ static void hal_TickInit (void) { MAP_SysTickEnable(); } #endif + +MP_REGISTER_ROOT_POINTER(struct _os_term_dup_obj_t *os_term_dup_obj); diff --git a/ports/cc3200/misc/mpirq.c b/ports/cc3200/misc/mpirq.c index de30ebc499..eb93e5eef0 100644 --- a/ports/cc3200/misc/mpirq.c +++ b/ports/cc3200/misc/mpirq.c @@ -197,3 +197,4 @@ const mp_obj_type_t mp_irq_type = { .locals_dict = (mp_obj_t)&mp_irq_locals_dict, }; +MP_REGISTER_ROOT_POINTER(mp_obj_list_t mp_irq_obj_list); diff --git a/ports/cc3200/mods/modmachine.c b/ports/cc3200/mods/modmachine.c index 782ccc55a1..3e483e0a23 100644 --- a/ports/cc3200/mods/modmachine.c +++ b/ports/cc3200/mods/modmachine.c @@ -215,3 +215,4 @@ const mp_obj_module_t mp_module_machine = { }; MP_REGISTER_MODULE(MP_QSTR_umachine, mp_module_machine); +MP_REGISTER_ROOT_POINTER(mp_obj_t machine_config_main); diff --git a/ports/cc3200/mods/pybsleep.c b/ports/cc3200/mods/pybsleep.c index 2d4b1ca8a9..76fe0849a4 100644 --- a/ports/cc3200/mods/pybsleep.c +++ b/ports/cc3200/mods/pybsleep.c @@ -652,3 +652,4 @@ STATIC bool setup_timer_hibernate_wake (void) { return false; } +MP_REGISTER_ROOT_POINTER(mp_obj_list_t pyb_sleep_obj_list); diff --git a/ports/cc3200/mods/pybtimer.c b/ports/cc3200/mods/pybtimer.c index 55caa6de13..b2725ae166 100644 --- a/ports/cc3200/mods/pybtimer.c +++ b/ports/cc3200/mods/pybtimer.c @@ -728,3 +728,4 @@ STATIC const mp_obj_type_t pyb_timer_channel_type = { .locals_dict = (mp_obj_t)&pyb_timer_channel_locals_dict, }; +MP_REGISTER_ROOT_POINTER(mp_obj_list_t pyb_timer_channel_obj_list); diff --git a/ports/cc3200/mods/pybuart.c b/ports/cc3200/mods/pybuart.c index b8e8cbb682..6e774b70d9 100644 --- a/ports/cc3200/mods/pybuart.c +++ b/ports/cc3200/mods/pybuart.c @@ -666,3 +666,5 @@ const mp_obj_type_t pyb_uart_type = { .protocol = &uart_stream_p, .locals_dict = (mp_obj_t)&pyb_uart_locals_dict, }; + +MP_REGISTER_ROOT_POINTER(struct _pyb_uart_obj_t *pyb_uart_objs[2]); diff --git a/ports/cc3200/mpconfigport.h b/ports/cc3200/mpconfigport.h index a9daca88b5..8059daeec7 100644 --- a/ports/cc3200/mpconfigport.h +++ b/ports/cc3200/mpconfigport.h @@ -139,16 +139,7 @@ #define MICROPY_PORT_CONSTANTS \ { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \ -// vm state and root pointers for the gc #define MP_STATE_PORT MP_STATE_VM -#define MICROPY_PORT_ROOT_POINTERS \ - mp_obj_t machine_config_main; \ - mp_obj_list_t pyb_sleep_obj_list; \ - mp_obj_list_t mp_irq_obj_list; \ - mp_obj_list_t pyb_timer_channel_obj_list; \ - struct _pyb_uart_obj_t *pyb_uart_objs[2]; \ - struct _os_term_dup_obj_t *os_term_dup_obj; \ - // type definitions for the specific machine #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))