Understanding the Firmware Library (1) and the Firmware Library
When we use the STM32 Firmware Library, we need to understand the structure of the Firmware Library package officially provided.
Folder introduction:
The Libraries of the Firmware Library package has two directories: CMSIS and STM32F10x-StdPeriph-Driver, which contain all subfolders of the kernel of the Firmware Library.
STM32F10x-StdPeriph-Driver // directory for the Firmware Library source code;
CMSIS // Startup File with inc and src folders, placed in stm32f10x-xxx.h and stm32f10x-xxx.c, each peripherals corresponds to a file;
Project // store the instance Source Code officially provided by ST;
File introduction:
Core-cm3.c core-cm3.h // provides access to the Cortex-M3 kernel interface, under the Coresupport directory
System-stm32f10x.c system-stm32f10x.h // set system and clock bus, under DeviceSupport directory
Stm32f10x. h // multi-struct and macro definition, under the DeviceSupport directory
Startup-stm32f10x-ld.s
Startup-stm32f10x-md.s
Startup-stm32f10x-hd.s // For the 103 series there are three main startup files respectively small, medium, large
The Startup File is mainly used to initialize the stack, interrupt vector table, and interrupt function definition. The Startup file should be directed to the main function. The Rest-Handler interrupt function is the only interrupt Handler implemented. Other interrupt functions are basically endless loops:
Rest handler
Reset-Handler PROC
EXPORT Reset-Handler
IMPORT --main
IMPORT SystemInit
LDR R0,=SystemInit
BLX R0
LDR R0,=--main
BX R0
ENDP
After the above Code is started, the system first calls the SystemInit system initialization function and then enters the main function.