summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lechner <david@pybricks.com>2022-07-01 14:41:27 -0500
committerDamien George <damien@micropython.org>2022-07-18 13:50:34 +1000
commitb63282c36194b6388e97df66122ac05f973fe7ca (patch)
treea6527255741b3317434566b8db70166ef0efded7
parent226e969ad339678404a4ad9153cf9a40a31fc1da (diff)
esp32: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register all root pointers in the esp32 port. Signed-off-by: David Lechner <david@pybricks.com>
-rw-r--r--ports/esp32/machine_i2s.c2
-rw-r--r--ports/esp32/machine_pin.c2
-rw-r--r--ports/esp32/machine_timer.c2
-rw-r--r--ports/esp32/main.c2
-rw-r--r--ports/esp32/mpconfigport.h8
5 files changed, 8 insertions, 8 deletions
diff --git a/ports/esp32/machine_i2s.c b/ports/esp32/machine_i2s.c
index 8832ad5e9..933e68684 100644
--- a/ports/esp32/machine_i2s.c
+++ b/ports/esp32/machine_i2s.c
@@ -840,4 +840,6 @@ const mp_obj_type_t machine_i2s_type = {
.locals_dict = (mp_obj_dict_t *)&machine_i2s_locals_dict,
};
+MP_REGISTER_ROOT_POINTER(struct _machine_i2s_obj_t *machine_i2s_obj[I2S_NUM_MAX]);
+
#endif // MICROPY_PY_MACHINE_I2S
diff --git a/ports/esp32/machine_pin.c b/ports/esp32/machine_pin.c
index 865face96..b57562633 100644
--- a/ports/esp32/machine_pin.c
+++ b/ports/esp32/machine_pin.c
@@ -729,3 +729,5 @@ STATIC const mp_obj_type_t machine_pin_irq_type = {
.call = machine_pin_irq_call,
.locals_dict = (mp_obj_dict_t *)&machine_pin_irq_locals_dict,
};
+
+MP_REGISTER_ROOT_POINTER(mp_obj_t machine_pin_irq_handler[40]);
diff --git a/ports/esp32/machine_timer.c b/ports/esp32/machine_timer.c
index 100b2aa1f..8541bcbfd 100644
--- a/ports/esp32/machine_timer.c
+++ b/ports/esp32/machine_timer.c
@@ -272,3 +272,5 @@ const mp_obj_type_t machine_timer_type = {
.make_new = machine_timer_make_new,
.locals_dict = (mp_obj_t)&machine_timer_locals_dict,
};
+
+MP_REGISTER_ROOT_POINTER(struct _machine_timer_obj_t *machine_timer_obj_head);
diff --git a/ports/esp32/main.c b/ports/esp32/main.c
index 14b7e14c6..c543c5b64 100644
--- a/ports/esp32/main.c
+++ b/ports/esp32/main.c
@@ -265,3 +265,5 @@ void *esp_native_code_commit(void *buf, size_t len, void *reloc) {
memcpy(p, buf, len);
return p;
}
+
+MP_REGISTER_ROOT_POINTER(mp_obj_t native_code_pointers);
diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h
index 7cfce49d3..8dc3537e5 100644
--- a/ports/esp32/mpconfigport.h
+++ b/ports/esp32/mpconfigport.h
@@ -136,14 +136,6 @@
#define MP_STATE_PORT MP_STATE_VM
-struct _machine_timer_obj_t;
-
-#define MICROPY_PORT_ROOT_POINTERS \
- mp_obj_t machine_pin_irq_handler[40]; \
- struct _machine_timer_obj_t *machine_timer_obj_head; \
- struct _machine_i2s_obj_t *machine_i2s_obj[I2S_NUM_MAX]; \
- mp_obj_t native_code_pointers; \
-
// type definitions for the specific machine
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))