Navigating the startup code

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 ...

Get MicroPython Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.