ports: Call gc_sweep_all() when doing a soft reset.
This calls finalisers of things like files and sockets to cleanly close them.
This commit is contained in:
parent
522ea80f06
commit
b2fa1b50ed
@ -116,6 +116,8 @@ soft_reset:
|
|||||||
mp_thread_deinit();
|
mp_thread_deinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gc_sweep_all();
|
||||||
|
|
||||||
mp_hal_stdout_tx_str("PYB: soft reboot\r\n");
|
mp_hal_stdout_tx_str("PYB: soft reboot\r\n");
|
||||||
|
|
||||||
// deinitialise peripherals
|
// deinitialise peripherals
|
||||||
|
@ -88,6 +88,7 @@ STATIC void mp_reset(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void soft_reset(void) {
|
void soft_reset(void) {
|
||||||
|
gc_sweep_all();
|
||||||
mp_hal_stdout_tx_str("PYB: soft reboot\r\n");
|
mp_hal_stdout_tx_str("PYB: soft reboot\r\n");
|
||||||
mp_hal_delay_us(10000); // allow UART to flush output
|
mp_hal_delay_us(10000); // allow UART to flush output
|
||||||
mp_reset();
|
mp_reset();
|
||||||
|
@ -756,5 +756,7 @@ soft_reset_exit:
|
|||||||
pyb_thread_deinit();
|
pyb_thread_deinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gc_sweep_all();
|
||||||
|
|
||||||
goto soft_reset;
|
goto soft_reset;
|
||||||
}
|
}
|
||||||
|
@ -647,6 +647,10 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MICROPY_UNIX_COVERAGE)
|
||||||
|
gc_sweep_all();
|
||||||
|
#endif
|
||||||
|
|
||||||
mp_deinit();
|
mp_deinit();
|
||||||
|
|
||||||
#if MICROPY_ENABLE_GC && !defined(NDEBUG)
|
#if MICROPY_ENABLE_GC && !defined(NDEBUG)
|
||||||
|
Loading…
Reference in New Issue
Block a user