First, things that stm32 passively executes (equivalent to stm32 resources), such as peripheral register description and kernel register description, library functions, etc. We can mobilize these resources in the main function or interrupt function.
Next is to define systemlnit, main and interrupt handling functions. Of course, you can also define some user files to encapsulate some modules for main functions and interrupt calls.
The startup startup file (which defines the interrupt vector table, interrupt service function, etc.) contains the reset interrupt: when stm32 is powered on and reset or the reset key is pressed, the program will enter the reset interrupt function for execution. The function of reset interrupt is to call systemlnit function and main function. Other interrupts will be automatically executed when they meet the trigger conditions.