目录
- AIR32F103(一) 合宙AIR32F103CBT6开发板上手报告
- AIR32F103(二) Linux环境和LibOpenCM3项目模板
- AIR32F103(三) Linux环境基于标准外设库的项目模板
- AIR32F103(四) 27倍频216MHz,CoreMark跑分测试
代码示例示例代码位于 Examples/NonFreeRTOS/RCC 下: https://gitee.com/iosetting/air32f103-template/tree/master/Examples/NonFreeRTOS/RCC
编译时遇到的问题编译器对
AIR_RCC_PLLConfig()
这个函数的优化会造成PLL设置失败.这个函数的源代码如下, 可以看到其中会对特定地址(例如 0x40016C00)进行连续的写操作, 编译时如果优化参数不是-O0, 就大概率会将这些写操作合并或调换位置.
uint32_t AIR_RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul, uint8_t Latency){uint32_t sramsize = 0;uint32_t pllmul = 0;FunctionalState pwr_gating_state = 0;/* Check the parameters */assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource));assert_param(IS_RCC_PLL_MUL(RCC_PLLMul));*(uint32_t *)(0x400210F0) = BIT(0);//开启sys_cfg门控*(uint32_t *)(0x40016C00) = 0xa7d93a86;//解一、二、三级锁*(uint32_t *)(0x40016C00) = 0xab12dfcd;*(uint32_t *)(0x40016C00) = 0xcded3526;sramsize = *(uint32_t *)(0x40016C18);*(uint32_t *)(0x40016C18) = 0x200183FF;//配置sram大小, 将BOOT使用对sram打开*(uint32_t *)(0x4002228C) = 0xa5a5a5a5;//QSPI解锁SysFreq_Set(RCC_PLLMul,Latency ,0,1);RCC->CFGR = (RCC->CFGR & ~0x00030000) | RCC_PLLSource;//恢复配置前状态*(uint32_t *)(0x40016C18) = sramsize;*(uint32_t *)(0x400210F0) = 0;//开启sys_cfg门控*(uint32_t *)(0x40016C00) = ~0xa7d93a86;//加一、二、三级锁*(uint32_t *)(0x40016C00) = ~0xab12dfcd;*(uint32_t *)(0x40016C00) = ~0xcded3526;*(uint32_t *)(0x4002228C) = ~0xa5a5a5a5;//QSPI解锁return 1;}
解决的方法- 在Keil5下, 可以对 air32f10x_rcc_ex.c 这个文件右键单独设置 AC6 编译选项. AC5可以使用 注解, AC6不再支持文件内部单个函数的优化设置
- 在GCC Arm中, 可以通过 Makefile 对 air32f10x_rcc_ex.c 设置单独的-O0参数, 也可以在代码中增加屏障避免优化(例如在两行代码之间增加
__NOP();
), 还可以通过int foo(int i) __attribute__((optimize("-O3")));
这样的形式, 参考GNU GCC文档
__attribute__((optimize("-O0"))) uint32_t AIR_RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLMul, uint8_t Latency)
CoreMark跑分结果示例中的 CoreMark_256MHz 项目, 可以将AIR32F103运行在最高256MHz主频下, 运行CoreMark性能测试. 以下是分别在 256MHz, 216MHz, 72MHz 不同编译器版本下的测试结果.32倍频, 256MHz编译器 GCC11.2.1【四 AIR32F103 27倍频216MHz,CoreMark跑分测试】
SYSCLK: 256000000, HCLK: 256000000, PCLK1: 128000000, PCLK2: 256000000, ADCCLK: 128000000?2K performance run parameters for coremark.?CoreMark Size: 666?Total ticks: 17054?Total time (secs): 17.054000?Iterations/Sec: 586.372698?Iterations: 10000?Compiler version : GCC11.2.1 20220111?Compiler flags: -O3?Memory location: STACK?seedcrc: 0xe9f5?[0]crclist: 0xe714?[0]crcmatrix: 0x1fd7?[0]crcstate: 0x8e3a?[0]crcfinal: 0x988c?Correct operation validated. See readme.txt for run and reporting rules.?CoreMark 1.0 : 586.372698 / GCC11.2.1 20220111 -O3 / STACK?IR32F103 CoreMark?
编译器 GCC11.3.1, 256MHzSYSCLK: 256000000, HCLK: 256000000, PCLK1: 128000000, PCLK2: 256000000, ADCCLK: 128000000?2K performance run parameters for coremark.?CoreMark Size: 666?Total ticks: 17054?Total time (secs): 17.054000?Iterations/Sec: 586.372698?Iterations: 10000?Compiler version : GCC11.3.1 20220712?Compiler flags: -O3?Memory location: STACK?seedcrc: 0xe9f5?[0]crclist: 0xe714?[0]crcmatrix: 0x1fd7?[0]crcstate: 0x8e3a?[0]crcfinal: 0x988c?Correct operation validated. See readme.txt for run and reporting rules.?CoreMark 1.0 : 586.372698 / GCC11.3.1 20220712 -O3 / STACK?
编译器 GCC12.2.0 256MHzSYSCLK: 256000000, HCLK: 256000000, PCLK1: 128000000, PCLK2: 256000000, ADCCLK: 128000000?2K performance run parameters for coremark.?CoreMark Size: 666?Total ticks: 15822?Total time (secs): 15.822000?Iterations/Sec: 632.031349?Iterations: 10000?Compiler version : GCC12.2.0?Compiler flags: -O3?Memory location: STACK?seedcrc: 0xe9f5?[0]crclist: 0xe714?[0]crcmatrix: 0x1fd7?[0]crcstate: 0x8e3a?[0]crcfinal: 0x988c?Correct operation validated. See readme.txt for run and reporting rules.?CoreMark 1.0 : 632.031349 / GCC12.2.0 -O3 / STACK?
27倍频, 216MHzGCC11.2.1 216MHzSYSCLK: 216000000, HCLK: 216000000, PCLK1: 108000000, PCLK2: 216000000, ADCCLK: 108000000?2K performance run parameters for coremark.?CoreMark Size: 666?Total ticks: 20213?Total time (secs): 20.213000?Iterations/Sec: 494.731114?Iterations: 10000?Compiler version : GCC11.2.1 20220111?Compiler flags: -O3?Memory location: STACK?seedcrc: 0xe9f5?[0]crclist: 0xe714?[0]crcmatrix: 0x1fd7?[0]crcstate: 0x8e3a?[0]crcfinal: 0x988c?Correct operation validated. See readme.txt for run and reporting rules.?CoreMark 1.0 : 494.731114 / GCC11.2.1 20220111 -O3 / STACK?
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 四十七 SpringCloud微服务实战——搭建企业级开发框架:【移动开发】整合uni-app搭建移动端快速开发框架-添加Axios并实现登录功能
- 三 AIR32F103 Linux环境基于标准外设库的项目模板
- 羊了个羊第四关怎么通关
- 云顶之弈黯灵四炮阵容怎么搭配
- 四 Selenium4.0+Python3系列 - 常见元素操作(含鼠标键盘事件)
- 四十六 SpringCloud微服务实战——搭建企业级开发框架:【移动开发】整合uni-app搭建移动端快速开发框架-环境搭建
- 四川话情话 四川天府情话聊天室
- 形容活力四射的成语-修饰活力的成语
- 原神导光四面体获取方法介绍
- sentinel的四种流控规则介绍