Skip to content

Commit 27f2d94

Browse files
committed
ports/all: deinit builtin modules on soft-reset.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
1 parent f66ea31 commit 27f2d94

File tree

11 files changed

+41
-0
lines changed

11 files changed

+41
-0
lines changed

ports/esp32/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ void mp_task(void *pvParameter) {
182182
mp_thread_deinit();
183183
#endif
184184

185+
#if MICROPY_MODULE_BUILTIN_INIT
186+
mp_module_builtin_deinit();
187+
#endif
188+
185189
gc_sweep_all();
186190

187191
// Free any native code pointers that point to iRAM.

ports/esp8266/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ static void mp_reset(void) {
8888
}
8989

9090
void soft_reset(void) {
91+
#if MICROPY_MODULE_BUILTIN_INIT
92+
mp_module_builtin_deinit();
93+
#endif
9194
gc_sweep_all();
9295
mp_hal_stdout_tx_str("MPY: soft reboot\r\n");
9396
mp_hal_delay_us(10000); // allow UART to flush output

ports/mimxrt/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ int main(void) {
159159
machine_uart_deinit_all();
160160
machine_pwm_deinit_all();
161161
soft_timer_deinit();
162+
#if MICROPY_MODULE_BUILTIN_INIT
163+
mp_module_builtin_deinit();
164+
#endif
162165
gc_sweep_all();
163166
mp_deinit();
164167
}

ports/nrf/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ void NORETURN _start(void) {
292292
pwm_deinit_all();
293293
#endif
294294

295+
#if MICROPY_MODULE_BUILTIN_INIT
296+
mp_module_builtin_deinit();
297+
#endif
298+
299+
gc_sweep_all();
295300
mp_deinit();
296301

297302
printf("MPY: soft reboot\n");

ports/qemu/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ int main(int argc, char **argv) {
6060

6161
mp_printf(&mp_plat_print, "MPY: soft reboot\n");
6262

63+
#if MICROPY_MODULE_BUILTIN_INIT
64+
mp_module_builtin_deinit();
65+
#endif
6366
gc_sweep_all();
6467
mp_deinit();
6568
}

ports/renesas-ra/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@ int main(void) {
435435
pyb_thread_deinit();
436436
#endif
437437

438+
#if MICROPY_MODULE_BUILTIN_INIT
439+
mp_module_builtin_deinit();
440+
#endif
441+
438442
MICROPY_BOARD_END_SOFT_RESET(&state);
439443

440444
gc_sweep_all();

ports/rp2/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ int main(int argc, char **argv) {
242242
mp_usbd_deinit();
243243
#endif
244244

245+
#if MICROPY_MODULE_BUILTIN_INIT
246+
mp_module_builtin_deinit();
247+
#endif
248+
245249
// Hook for resetting anything right at the end of a soft reset command.
246250
MICROPY_BOARD_END_SOFT_RESET();
247251

ports/samd/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ void samd_main(void) {
9898
#if MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE
9999
mp_usbd_deinit();
100100
#endif
101+
#if MICROPY_MODULE_BUILTIN_INIT
102+
mp_module_builtin_deinit();
103+
#endif
101104
gc_sweep_all();
102105
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_UART
103106
sercom_deinit_all();

ports/stm32/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,10 @@ void stm32_main(uint32_t reset_mode) {
698698
MP_STATE_PORT(pyb_stdio_uart) = NULL;
699699
#endif
700700

701+
#if MICROPY_MODULE_BUILTIN_INIT
702+
mp_module_builtin_deinit();
703+
#endif
704+
701705
MICROPY_BOARD_END_SOFT_RESET(&state);
702706

703707
gc_sweep_all();

ports/unix/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,10 @@ MP_NOINLINE int main_(int argc, char **argv) {
774774
mp_thread_deinit();
775775
#endif
776776

777+
#if MICROPY_MODULE_BUILTIN_INIT
778+
mp_module_builtin_deinit();
779+
#endif
780+
777781
#if defined(MICROPY_UNIX_COVERAGE)
778782
gc_sweep_all();
779783
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy