首先是由启动文件调用的来自“system_um324xF.c”的函数“SystemInit()”:
void SystemInit(void)
{
/* FPU settings ---------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
/* set CP10 and CP11 Full Access */
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));
#endif
(*(volatile uint32_t *)(0x400801c0)) = 0x77BBBB77;
(*(volatile uint32_t *)(0x40080000)) = 0xA5A55A5A;
(*(volatile uint32_t *)(0x40080038)) = (((*(volatile uint32_t *)(0x40080038)) & 0xFFFFFFF0) | 0xA);
/* Reset the RCM clock configuration to the default reset state ------------*/
/* Unlock protection register */
RCM->RCMPR = 0xA5A55A5A;//启动RCM寄存器写使能
/* CR0寄存器的初值为0x00200421:0010 0000 0000 0100 0010 0001
关闭RCH
禁止XTH时钟监视
XTH时钟异常时产生中断
禁止XTH时钟异常中断或复位
XTL 稳定时间选择16384 个周期
RCH 稳定时间选择4 个周期
RCH 稳定标志位置1,已经稳定
XTH 反馈电阻阻值选择500K欧 电阻配置信号
关闭XTH