系统时钟配置64M,MDK优化选择了 -O3 -Otime,跑分结果是102,百度官方是142,差挺多,不知道是不是哪里没弄对,求指点。
工程使用 Projects\NUCLEO-G070RB\Examples_LL\USART\USART_Communication_Tx_Init
栈设置4K
Stack_Size EQU 0x00001000
以下是一些函数接口代码
- void SystemClock_Config(void)
- {
- LL_FLASH_SetLatency(LL_FLASH_LATENCY_2);
- /* HSI configuration and activation */
- LL_RCC_HSI_Enable();
- while(LL_RCC_HSI_IsReady() != 1)
- {
- };
- /* Main PLL configuration and activation */
- LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI, LL_RCC_PLLM_DIV_4, 80, LL_RCC_PLLR_DIV_5);
- LL_RCC_PLL_Enable();
- LL_RCC_PLL_EnableDomain_SYS();
- while(LL_RCC_PLL_IsReady() != 1)
- {
- };
- /* Set AHB prescaler*/
- LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
- /* Sysclk activation on the main PLL */
- LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
- while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
- {
- };
- /* Set APB1 prescaler*/
- LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
- // LL_Init1msTick(56000000);
- /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
- LL_SetSystemCoreClock(64000000);
- NVIC_SetPriority(SysTick_IRQn, 0);
- NVIC_EnableIRQ(SysTick_IRQn);
- }
复制代码
- void start_time(void)
- {
- //GETMYTIME(&start_time_val);
- Tick = 0; //每次初始化时让tick数从0开始
- start_time_val = Tick; //当前tick数保存到全局变量start_time_val
- SysTick_Config(SystemCoreClock/1000); //配置并启动SysTick,这里配置Systick每隔1ms中断一次
- }
复制代码
- void stop_time(void)
- {
- // GETMYTIME(&stop_time_val);
- SysTick->CTRL = 0; //停止SysTick
- stop_time_val = Tick; //当前tick数保存到全局变量stop_time_val
- }
复制代码
- void SysTick_Handler(void)
- {
- Tick++;
- }
复制代码
- volatile ee_s32 seed4_volatile = 2000;
复制代码
|