summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/rp2/main.c3
-rw-r--r--ports/rp2/mpthreadport.c5
-rw-r--r--ports/rp2/mpthreadport.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/ports/rp2/main.c b/ports/rp2/main.c
index 8fddeaa56..7709a478b 100644
--- a/ports/rp2/main.c
+++ b/ports/rp2/main.c
@@ -138,6 +138,9 @@ int main(int argc, char **argv) {
mp_printf(MP_PYTHON_PRINTER, "MPY: soft reboot\n");
rp2_pio_deinit();
machine_pin_deinit();
+ #if MICROPY_PY_THREAD
+ mp_thread_deinit();
+ #endif
gc_sweep_all();
mp_deinit();
}
diff --git a/ports/rp2/mpthreadport.c b/ports/rp2/mpthreadport.c
index fb4428772..8a36cfca7 100644
--- a/ports/rp2/mpthreadport.c
+++ b/ports/rp2/mpthreadport.c
@@ -46,6 +46,11 @@ void mp_thread_init(void) {
core1_entry = NULL;
}
+void mp_thread_deinit(void) {
+ multicore_reset_core1();
+ core1_entry = NULL;
+}
+
void mp_thread_gc_others(void) {
if (get_core_num() == 0) {
// GC running on core0, trace core1's stack, if it's running.
diff --git a/ports/rp2/mpthreadport.h b/ports/rp2/mpthreadport.h
index 5eb0bff39..868f8d141 100644
--- a/ports/rp2/mpthreadport.h
+++ b/ports/rp2/mpthreadport.h
@@ -34,6 +34,7 @@ typedef struct mutex mp_thread_mutex_t;
extern void *core_state[2];
void mp_thread_init(void);
+void mp_thread_deinit(void);
void mp_thread_gc_others(void);
static inline void mp_thread_set_state(struct _mp_state_thread_t *state) {