ports/stm32: Call gc_sweep before deinitializing networking drivers.

* Move GC before any deinitializing any drivers as some of them
still need IRQs to clean up.
This commit is contained in:
iabdalkader 2023-06-28 17:17:27 +02:00
parent 5e8ba825ed
commit 8c34e2b713

View File

@ -644,6 +644,11 @@ soft_reset:
// soft reset
storage_flush();
// Call GC sweep first, before deinitializing networking drivers
// such as WINC/CYW43 which need to be active to close sockets
// when their finalizers are called by GC.
gc_sweep_all();
// Disable all other IRQs except Systick
irq_set_base_priority(IRQ_PRI_SYSTICK+1);
@ -658,6 +663,7 @@ soft_reset:
#endif
timer_deinit();
i2c_deinit_all();
spi_deinit_all();
uart_deinit_all();
#if MICROPY_HW_ENABLE_CAN
can_deinit_all();
@ -670,12 +676,6 @@ soft_reset:
#endif
imlib_deinit_all();
// Call GC sweep first, before deinitializing the SPI peripheral.
// For the WINC1500, we still need the SPI active to close sockets
// when their finalizers are called by GC.
gc_sweep_all();
spi_deinit_all();
mp_deinit();
first_soft_reset = false;