还是需要用SystemInit,因为系统初始化时钟的时候,全局变量还没来得及赋值初始值,那么就得函数内部设置初始值
This commit is contained in:
parent
122e250f85
commit
1ba19dc7f1
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
//uint32_t SystemCoreClock = 48000000;
|
uint32_t SystemCoreClock = 48000000;
|
||||||
//__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||||
|
|
||||||
void SysInit(void)
|
void SystemInit(void)
|
||||||
{
|
{
|
||||||
#ifndef TINY
|
#ifndef TINY
|
||||||
//SystemCoreClock = 48000000;
|
SystemCoreClock = 48000000;
|
||||||
|
|
||||||
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
|
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
|
||||||
SetSysClock(SystemCoreClock, 8000000);
|
SetSysClock(SystemCoreClock, 8000000);
|
||||||
|
|
|
@ -92,10 +92,10 @@ __Vectors_Size EQU __Vectors_End - __Vectors
|
||||||
; 启动函数
|
; 启动函数
|
||||||
Reset_Handler PROC
|
Reset_Handler PROC
|
||||||
EXPORT Reset_Handler [WEAK]
|
EXPORT Reset_Handler [WEAK]
|
||||||
IMPORT SysInit
|
IMPORT SystemInit
|
||||||
IMPORT __main
|
IMPORT __main
|
||||||
|
|
||||||
LDR R0, =SysInit
|
LDR R0, =SystemInit
|
||||||
BLX R0
|
BLX R0
|
||||||
LDR R0, =__main
|
LDR R0, =__main
|
||||||
BX R0
|
BX R0
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
//uint32_t SystemCoreClock = 48000000;
|
uint32_t SystemCoreClock = 48000000;
|
||||||
//__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||||
|
|
||||||
void SysInit(void)
|
void SystemInit(void)
|
||||||
{
|
{
|
||||||
#ifndef TINY
|
#ifndef TINY
|
||||||
//SystemCoreClock = 48000000;
|
SystemCoreClock = 48000000;
|
||||||
|
|
||||||
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
|
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
|
||||||
SetSysClock(SystemCoreClock, 8000000);
|
SetSysClock(SystemCoreClock, 8000000);
|
||||||
|
|
|
@ -92,10 +92,10 @@ __Vectors_Size EQU __Vectors_End - __Vectors
|
||||||
; 启动函数
|
; 启动函数
|
||||||
Reset_Handler PROC
|
Reset_Handler PROC
|
||||||
EXPORT Reset_Handler [WEAK]
|
EXPORT Reset_Handler [WEAK]
|
||||||
IMPORT SysInit
|
IMPORT SystemInit
|
||||||
IMPORT __main
|
IMPORT __main
|
||||||
|
|
||||||
LDR R0, =SysInit
|
LDR R0, =SystemInit
|
||||||
BLX R0
|
BLX R0
|
||||||
LDR R0, =__main
|
LDR R0, =__main
|
||||||
BX R0
|
BX R0
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
//unsigned int HSE_VALUE = 8000000;
|
unsigned int HSE_VALUE = 8000000;
|
||||||
//uint32_t SystemCoreClock = 72000000;
|
uint32_t SystemCoreClock = 72000000;
|
||||||
//__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||||
|
|
||||||
void SysInit(void)
|
void SystemInit(void)
|
||||||
{
|
{
|
||||||
//HSE_VALUE = 8000000;
|
HSE_VALUE = 8000000;
|
||||||
//SystemCoreClock = 72000000;
|
SystemCoreClock = 72000000;
|
||||||
|
|
||||||
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
|
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
|
||||||
SetSysClock(SystemCoreClock, HSE_VALUE);
|
SetSysClock(SystemCoreClock, HSE_VALUE);
|
||||||
|
|
|
@ -119,10 +119,10 @@ __Vectors_Size EQU __Vectors_End - __Vectors
|
||||||
; 启动函数
|
; 启动函数
|
||||||
Reset_Handler PROC
|
Reset_Handler PROC
|
||||||
EXPORT Reset_Handler [WEAK]
|
EXPORT Reset_Handler [WEAK]
|
||||||
IMPORT SysInit
|
IMPORT SystemInit
|
||||||
IMPORT __main
|
IMPORT __main
|
||||||
|
|
||||||
LDR R0, =SysInit
|
LDR R0, =SystemInit
|
||||||
BLX R0
|
BLX R0
|
||||||
LDR R0, =__main
|
LDR R0, =__main
|
||||||
BX R0
|
BX R0
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
//uint32_t HSE_VALUE = 25000000;
|
uint32_t HSE_VALUE = 25000000;
|
||||||
//uint32_t SystemCoreClock = 168000000;
|
uint32_t SystemCoreClock = 168000000;
|
||||||
//__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||||
|
|
||||||
void SysInit(void)
|
void SystemInit(void)
|
||||||
{
|
{
|
||||||
//HSE_VALUE = 25000000;
|
HSE_VALUE = 25000000;
|
||||||
//SystemCoreClock = 168000000;
|
SystemCoreClock = 168000000;
|
||||||
|
|
||||||
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
|
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
|
||||||
SetSysClock(SystemCoreClock, HSE_VALUE);
|
SetSysClock(SystemCoreClock, HSE_VALUE);
|
||||||
|
|
|
@ -138,10 +138,10 @@ __Vectors_Size EQU __Vectors_End - __Vectors
|
||||||
; 启动函数
|
; 启动函数
|
||||||
Reset_Handler PROC
|
Reset_Handler PROC
|
||||||
EXPORT Reset_Handler [WEAK]
|
EXPORT Reset_Handler [WEAK]
|
||||||
IMPORT SysInit
|
IMPORT SystemInit
|
||||||
IMPORT __main
|
IMPORT __main
|
||||||
|
|
||||||
LDR R0, =SysInit
|
LDR R0, =SystemInit
|
||||||
BLX R0
|
BLX R0
|
||||||
LDR R0, =__main
|
LDR R0, =__main
|
||||||
BX R0
|
BX R0
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void SysInit(void);
|
void SystemInit(void);
|
||||||
void SetSysClock(unsigned int clock, unsigned int cystalClock);
|
void SetSysClock(unsigned int clock, unsigned int cystalClock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue