esp32/mpthreadport: Fix TCB cleanup function so thread_mutex is ready.
esp32/mpthreadport: Fix TCB cleanup function so thread_mutex is ready.

Because vPortCleanUpTCB is called by the FreeRTOS idle task, and it checks
thread, but didn't check the thread_mutex.

And if thread is not NULL, but thread_mutex not ready then it will crash
with an error when calling mp_thread_mutex_lock(&thread_mutex, 1).

As suggested by @dpgeorge, move the thread = &thread_entry0 line to the end
of mp_thread_init().

Signed-off-by: leo chung <3ce2e9c74852762cb6ad50be864bc2f8750895c9@gmail.com>

bvernoux/micropython,adafruit/circuitpython,adafruit/circuitpython,adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,bvernoux/micropython,bvernoux/micropython,adafruit/circuitpython,adafruit/circuitpython,bvernoux/micropython