完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
在完成了开发环境安装和运行demo步骤后,接下来就是测试RK2206的性能,这里将使用常见的方法就是用CoreMark测试,所以接下来就是移植CoreMark了。在正式介绍移植CoreMark之前,有几点需要说明一下:1)、目前小凌派的SDK中无法修改系统主频;2)、目前小凌派的RK2206硬件库不支持硬件浮点; /*-------------------------------------------------------------------------------------------------------------------------*/ 简单介绍一下CoreMark的源码目录如下图,其中coremark_si为本人查看源码所新建文件夹: 其中core_list_join.c、core_main.c、core_state.c、core_util.c正常情况下都是不需要修改的,主要修改core_portme.c/h文件。 用户可以根据自己的需求选择不同平台下的例程。 用户移植好程序后只需要调用core_main.c中的main函数接口完成,CoreMark整体的函数调用关系core_main.c中的main函数先调用core_portme.c完成硬件适配工作,再调用其他文件的函数进行测试。 core_portme.c主要修改时间获取相关的函数具体修改如下: /* #define NSECS_PER_SEC CLOCKS_PER_SEC #define CORETIMETYPE clock_t #define GETMYTIME(_t) (*_t=clock()) #define MYTIMEDIFF(fin,ini) ((fin)-(ini)) #define TIMER_RES_DIVIDER 1 #define SAMPLE_TIME_IMPLEMENTATION 1 #define EE_TICKS_PER_SEC (NSECS_PER_SEC / TIMER_RES_DIVIDER) */ #define EE_TICKS_PER_SEC ((uint32_t)1000) #define SYSTICK_1MS ((uint32_t)1000) /** Define Host specific (POSIX), or target specific global time variables. */ // static CORETIMETYPE start_time_val, stop_time_val; volatile CORE_TICKS Tick; /* Function : start_time This function will be called right before starting the timed portion of the benchmark. Implementation may be capturing a system timer (as implemented in the example code) or zeroing some system parameters - e.g. setting the cpu clocks cycles to 0. */ void start_time(void) { Tick = LOS_Tick2MS(LOS_TickCountGet()); } /* Function : stop_time This function will be called right after ending the timed portion of the benchmark. Implementation may be capturing a system timer (as implemented in the example code) or other system parameters - e.g. reading the current value of cpu cycles counter. */ void stop_time(void) { CORE_TICKS end_ms = LOS_Tick2MS(LOS_TickCountGet()); Tick = end_ms - Tick; } /* Function : get_time Return an abstract "ticks" number that signifies time on the system. Actual value returned may be cpu cycles, milliseconds or any other value, as long as it can be converted to seconds by This methodology is taken to accomodate any hardware or simulated platform. The sample implementation returns millisecs by default, and the resolution is controlled by */ CORE_TICKS get_time(void) { CORE_TICKS elapsed = (CORE_TICKS)Tick; return elapsed; } /* Function : time_in_secs Convert the value returned by get_time to seconds. The Default implementation implemented by the EE_TICKS_PER_SEC macro above. */ secs_ret time_in_secs(CORE_TICKS ticks) { secs_ret retval = ((secs_ret)ticks) / (secs_ret)EE_TICKS_PER_SEC; return retval; } /*-----------------------------------------------------------------------------------------------------------------------*/ core_portme.h文件中主要是适配相应的数据类型,修改如下: 包含stddef.h文件主要是为了定义后面的size_t类型,这里也可以不包含stddef.h文件,直接将size_t类型定义为unsigned int类型。 接下来就是添加源码和构建脚本到SDK中,构建脚本和最后的bin文件链接脚本和E53模块例程一致,这里CoreMark例程也是添加到“lockzhiner-rk2206-openhARMony3.0lts/vendor/lockzhiner/rk2206/samples”目录下,例程源码见附件。 最后bin文件的链接脚本在“lockzhiner-rk2206-openharmony3.0lts/device/rockchip/rk2206/sdk_liteos”目录下的Makefile中,修改如下: 另外,为了避免core_main.c中main函数引起非预期的问题,这里将main函数名称修改为了CoreMark函数。 最后烧录运行,运行结果如下图: 如果通过SystemCoreClock变量获取的系统时钟是正确的,则CoreMark的测试结果大概为150.69/40=3.76 CoreMarks/ MHz,基本符合Cortex-M4内核的性能,测试的源码如下所附。
coremark.zip
(25.39 KB, 下载次数: 0
)
|
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
【小凌派RK2206开发板试用体验】1.通过API接口获取天气信息
6343 浏览 1 评论
6061 浏览 0 评论
【小凌派RK2206开发板试用体验】1.Ubuntu22.04搭建编译环境遇到的问题及解决方法
5605 浏览 0 评论
【小凌派RK2206开发板试用体验】第5章 使用WiFi联网
5205 浏览 0 评论
7240 浏览 0 评论
【小凌派RK2206开发板试用体验】小凌派隔空操作迪文COF智能屏
6612浏览 10评论
【小凌派RK2206开发板试用体验】小凌派手势应用之原力控制星球大战BB-8机器人
11310浏览 3评论
8001浏览 2评论
4374浏览 2评论
【小凌派RK2206开发板试用体验】OpenHarmony华为云IoT应用开发-智慧井盖
5283浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-23 20:17 , Processed in 0.630494 second(s), Total 51, Slave 42 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号