使用coremark来测试下芯片在100MHz下的性能https://github.com/eembc/coremark 获取源码
在工程下裁剪下载的文件,新建coremark文件夹,只保留如下文件

在过程中添加c文件和头文件路径
使用coremark需要用到时间,这里我是用systick,使用定时器也是可以的
先配置systick,这里直接在Keil里配置
初始化函数,延时函数,systick中断函数,获取tick的函数
volatile uint32_t dwTick = 0;
fsp_err_t SysTick_Init(void)
{
uint32_t uwSysclk= R_BSP_SourceClockHzGet(FSP_PRIV_CLOCK_PLL);
if(SysTick_Config(uwSysclk/1000) != 0)
{
return FSP_ERR_ASSERTION;
}
return FSP_SUCCESS;
}
void Delay_ms(uint32_t dwTime)
{
uint32_t dwStart = dwTick;
uint32_t dwWait = dwTime;
if (dwWait < HAL_MAX_DELAY)
{
dwWait += (uint32_t)(1);
}
while((dwTick - dwStart) < dwWait)
{
}
}
void SysTick_Handler(void)
{
dwTick += 1;
}
uint32_t get_tick(void)
{
return dwTick;
}
修改core_portme.c文件
修改获取tick的函数
EE_TICKS_PER_SEC 改成 1000

修改core_portme.h文件
这里优化等级选择 -0max

Keil里也要进行配置

修改 core_main.c 中main函数,改为 coremark_main

在 RASC中把栈大小改为0x4000
太小的画代码无法正常运行

#include "coremark.h"
void hal_entry(void)
{
assert(UART_Init() == 0);
assert(SysTick_Init() == 0);
printf("RA4M2 run coremark..\\n\\r");
coremark_main();
while(1)
{
}
#if BSP_TZ_SECURE_BUILD
R_BSP_NonSecureEnter();
#endif
}
最终跑分截图(100MHz)

这是在默认开启cache的前提下
BSP_FEATURE_BSP_FLASH_CACHE宏定义被用于函数中。R_BSP_FlashCacheDisable 和 R_BSP_FlashCacheDisable 在 bsp_common.h 文件中。如果该宏定义为0,缓存闪存就不能被禁用和启用。
R_BSP_FlashCacheEnable() 使用该函数开启,在时钟初始化函数中调用
若自行修改,关闭,使用 R_BSP_FlashCacheDisable

|