The startup code for the STM32 port can be found in main.c, which is located in the micropython/ports/stm32 directory. This folder also contains the code for various peripheral modules. In order to make heads or tails of the startup code, I recommend that you open main.c and locate the stm32_main function. stm32_main contains the initialization sequence for MicroPython.
In addition to stm32_main.c, the main.c module also contains several additional functions that are used to support the system startup. The support code in main.c includes additional initialization for items such as the following:
- A flash error state code
- A filesystem reset code, such as creating default main.py and boot.py files
- Filesystem initialization
- SD card initialization
The initialization sequence is not complicated, but it does contain quite a few steps. When I encounter a...