From 575fa61c6dc85662ce9ae4d81ef7c5cf740758c8 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 1 Jul 2022 15:24:28 -0500 Subject: [PATCH] renesas-ra: Use MP_REGISTER_ROOT_POINTER(). This uses MP_REGISTER_ROOT_POINTER() to register all port-specific root pointers in the renesas-ra port. Signed-off-by: David Lechner --- ports/renesas-ra/extint.c | 2 ++ ports/renesas-ra/machine_uart.c | 2 ++ ports/renesas-ra/main.c | 2 ++ ports/renesas-ra/mpconfigport.h | 17 ----------------- ports/renesas-ra/mphalport.c | 2 ++ ports/renesas-ra/timer.c | 2 ++ ports/renesas-ra/usrsw.c | 2 ++ 7 files changed, 12 insertions(+), 17 deletions(-) diff --git a/ports/renesas-ra/extint.c b/ports/renesas-ra/extint.c index 05e99eb655..19caa7a3b3 100644 --- a/ports/renesas-ra/extint.c +++ b/ports/renesas-ra/extint.c @@ -399,3 +399,5 @@ void extint_init0(void) { MP_STATE_PORT(pyb_extint_callback)[i] = mp_const_none; } } + +MP_REGISTER_ROOT_POINTER(mp_obj_t pyb_extint_callback[PYB_EXTI_NUM_VECTORS]); diff --git a/ports/renesas-ra/machine_uart.c b/ports/renesas-ra/machine_uart.c index d71562f201..4b4aa3396b 100644 --- a/ports/renesas-ra/machine_uart.c +++ b/ports/renesas-ra/machine_uart.c @@ -581,3 +581,5 @@ const mp_obj_type_t machine_uart_type = { .protocol = &uart_stream_p, .locals_dict = (mp_obj_dict_t *)&machine_uart_locals_dict, }; + +MP_REGISTER_ROOT_POINTER(struct _machine_uart_obj_t *machine_uart_obj_all[MICROPY_HW_MAX_UART + MICROPY_HW_MAX_LPUART]); diff --git a/ports/renesas-ra/main.c b/ports/renesas-ra/main.c index 6f4584b685..78af1a9639 100644 --- a/ports/renesas-ra/main.c +++ b/ports/renesas-ra/main.c @@ -397,3 +397,5 @@ soft_reset_exit: goto soft_reset; } + +MP_REGISTER_ROOT_POINTER(mp_obj_t pyb_config_main); diff --git a/ports/renesas-ra/mpconfigport.h b/ports/renesas-ra/mpconfigport.h index 9a8c025590..0f1d593033 100644 --- a/ports/renesas-ra/mpconfigport.h +++ b/ports/renesas-ra/mpconfigport.h @@ -168,23 +168,6 @@ #endif #define MICROPY_PORT_ROOT_POINTERS \ - mp_obj_t pyb_config_main; \ - \ - mp_obj_t pyb_switch_callback; \ - \ - mp_obj_t pyb_extint_callback[PYB_EXTI_NUM_VECTORS]; \ - \ - /* pointers to all Timer objects (if they have been created) */ \ - struct _pyb_timer_obj_t *pyb_timer_obj_all[MICROPY_HW_MAX_TIMER]; \ - \ - /* stdio is repeated on this UART object if it's not null */ \ - struct _machine_uart_obj_t *pyb_stdio_uart; \ - \ - /* pointers to all UART objects (if they have been created) */ \ - struct _machine_uart_obj_t *machine_uart_obj_all[MICROPY_HW_MAX_UART + MICROPY_HW_MAX_LPUART]; \ - \ - /* root pointers for sub-systems */ \ - \ /* root pointers defined by a board */ \ MICROPY_BOARD_ROOT_POINTERS \ diff --git a/ports/renesas-ra/mphalport.c b/ports/renesas-ra/mphalport.c index 6a416f431a..6e6a83aa26 100644 --- a/ports/renesas-ra/mphalport.c +++ b/ports/renesas-ra/mphalport.c @@ -118,3 +118,5 @@ void mp_hal_get_mac_ascii(int idx, size_t chr_off, size_t chr_len, char *dest) { *dest++ = hexchr[mac[chr_off >> 1] >> (4 * (1 - (chr_off & 1))) & 0xf]; } } + +MP_REGISTER_ROOT_POINTER(struct _machine_uart_obj_t *pyb_stdio_uart); diff --git a/ports/renesas-ra/timer.c b/ports/renesas-ra/timer.c index 93b378ac3f..1ae936525e 100644 --- a/ports/renesas-ra/timer.c +++ b/ports/renesas-ra/timer.c @@ -567,3 +567,5 @@ void timer_irq_handler(void *param) { // } } } + +MP_REGISTER_ROOT_POINTER(struct _pyb_timer_obj_t *pyb_timer_obj_all[MICROPY_HW_MAX_TIMER]); diff --git a/ports/renesas-ra/usrsw.c b/ports/renesas-ra/usrsw.c index b0e2396cde..5e11f48e63 100644 --- a/ports/renesas-ra/usrsw.c +++ b/ports/renesas-ra/usrsw.c @@ -144,4 +144,6 @@ const mp_obj_type_t pyb_switch_type = { .locals_dict = (mp_obj_dict_t *)&pyb_switch_locals_dict, }; +MP_REGISTER_ROOT_POINTER(mp_obj_t pyb_switch_callback); + #endif // MICROPY_HW_HAS_SWITCH