参考:https://blog.csdn.net/huangyangquan/article/details/78790443
https://www.cnblogs.com/dustinzhu/p/4149906.html
在系统启动阶段,在进入main函数之前,系统先进入SystemInit函数,代码如下:
; Reset handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT __main
IMPORT SystemInit
LDR R0, =SystemInit
BLX R0
LDR R0, =__main
BX R0
ENDP
在SystemInit函数中配置系统时钟,根据系统时钟定义自动选择系统时钟配置函数,代码如下所示(设置系统时钟为72MHz):
#if defined (STM32F10X_LD_VL) || (defined STM32F10X_MD_VL) || (defined STM32F10X_HD_VL)
/* #define SYSCLK_FREQ_HSE HSE_VALUE */
#define SYSCLK_FREQ_24MHz 24000000
#else
/* #define SYSCLK_FREQ_HSE HSE_VALUE */
/* #define SYSCLK_FREQ_24MHz 24000000 */
/* #define SYSCLK_FREQ_36MHz 36000000 */
/* #define SYSCLK_FREQ_48MHz 48000000 */
/* #define SYSCLK_FREQ_56MHz 56000000 */
#define SYSCLK_FREQ_72MHz 72000000
#endif
/*******************************************************************************
* Clock Definitions
*******************************************************