你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【NUCLEO-H533RE评测】coremark 跑分

[复制链接]
andey 发布时间:2024-7-2 00:10

简介

CoreMark 是由 Embedded Microprocessor Benchmark Consortium (EEMBC) 开发的一种标准化嵌入式处理器基准测试工具。它通过模拟常见的嵌入式任务(如循环、矩阵操作、状态机和 CRC 校验)来评估处理器性能。CoreMark 的设计注重简单性、易移植性和准确性,确保了测试结果的可重复性和公正性。作为开源软件,CoreMark 可免费下载使用,且其测试结果可以提交至 EEMBC 的中央数据库,以便全球对比。广泛用于嵌入式系统开发、学术研究和行业标准制定,CoreMark 已成为评估嵌入式处理器性能的重要工具。

CoreMark 移植适配

源文件加入工程编译

CoreMark 代码可在该链接获取(https://github.com/eembc/coremark),移植适配只要把这几个文件加入工程编译,并参照其他平台适配core_portme.c core_portme.h文件即可,core_port_me.h 里定义了依赖平台的时间相关函数我们基于STM32H533实现对应的接口即可。

本地使用的iar对应文件如下: coremark.jpg

portme 文件主要实现coremark 依赖的运行时长的统计函数对应代码如下:



/*
Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Original Author: Shay Gal-on
*/
#include "coremark.h"
#include "core_portme.h"
#include "stm32h5xx_hal.h"

#if VALIDATION_RUN
volatile ee_s32 seed1_volatile = 0x3415;
volatile ee_s32 seed2_volatile = 0x3415;
volatile ee_s32 seed3_volatile = 0x66;
#endif
#if PERFORMANCE_RUN
volatile ee_s32 seed1_volatile = 0x0;
volatile ee_s32 seed2_volatile = 0x0;
volatile ee_s32 seed3_volatile = 0x66;
#endif
#if PROFILE_RUN
volatile ee_s32 seed1_volatile = 0x8;
volatile ee_s32 seed2_volatile = 0x8;
volatile ee_s32 seed3_volatile = 0x8;
#endif
volatile ee_s32 seed4_volatile = ITERATIONS;
volatile ee_s32 seed5_volatile = 0;
/* Porting : Timing functions
        How to capture time and convert to seconds must be ported to whatever is
   supported by the platform. e.g. Read value from on board RTC, read value from
   cpu clock cycles performance counter etc. Sample implementation for standard
   time.h and windows.h definitions included.
*/

/* Define : TIMER_RES_DIVIDER
        Divider to trade off timer resolution and total time that can be
   measured.

        Use lower values to increase resolution, but make sure that overflow
   does not occur. If there are issues with the return value overflowing,
   increase this value.
        */
#define GETMYTIME(_t)              (*_t = HAL_GetTick())
#define MYTIMEDIFF(fin, ini)       ((fin) - (ini))
#define TIMER_RES_DIVIDER          1000
#define SAMPLE_TIME_IMPLEMENTATION 1
#define EE_TICKS_PER_SEC           (1000)

/** Define Host specific (POSIX), or target specific global time variables. */
static CORETIMETYPE start_time_val, stop_time_val;

/* 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)
{
    GETMYTIME(&start_time_val);
}
/* 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)
{
    GETMYTIME(&stop_time_val);
}
/* 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 <time_in_secs>. This
   methodology is taken to accommodate any hardware or simulated platform. The
   sample implementation returns millisecs by default, and the resolution is
   controlled by <TIMER_RES_DIVIDER>
*/
CORE_TICKS
get_time(void)
{
    CORE_TICKS elapsed
        = (CORE_TICKS)(MYTIMEDIFF(stop_time_val, start_time_val));
    return elapsed;
}
/* Function : time_in_secs
        Convert the value returned by get_time to seconds.

        The <secs_ret> type is used to accommodate systems with no support for
   floating point. 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;
}

ee_u32 default_num_contexts = 1;

/* Function : portable_init
        Target specific initialization code
        Test for some common mistakes.
*/
void
portable_init(core_portable *p, int *argc, char *argv[])
{
    (void)argc; // prevent unused warning
    (void)argv; // prevent unused warning

    if (sizeof(ee_ptr_int) != sizeof(ee_u8 *))
    {
        ee_printf(
            "ERROR! Please define ee_ptr_int to a type that holds a "
            "pointer!\n");
    }
    if (sizeof(ee_u32) != 4)
    {
        ee_printf("ERROR! Please define ee_u32 to a 32b unsigned type!\n");
    }
    p->portable_id = 1;
}
/* Function : portable_fini
        Target specific final code
*/
void
portable_fini(core_portable *p)
{
    p->portable_id = 0;
}

下载运行

从官网的数据可以看出coremark 跑分结果可以达到1017的高分

COREMARK22.jpg

为了跑出做高分,IAR 本地编译器配置如下:

coremarkops.jpg

板卡运行结果

coremarkdata.jpg

从运行结果看本地的跑分结果为1018,和 官网的数据是吻合的,从跑分结果1018看这颗MCU的性能没得说比一般的mcu几百的跑分还是要高很多的,对于用于对性能要求比较高的应用场景。

收藏 评论2 发布时间:2024-7-2 00:10

举报

2个回答
shenxiaolin_mai 回答时间:2024-7-2 10:52:17

可以的,你还专门用IAR跑一遍也是费了心思,我的Keil才1001分

andey 回答时间:2024-7-2 11:49:29

shenxiaolin_mai 发表于 2024-7-2 10:52
可以的,你还专门用IAR跑一遍也是费了心思,我的Keil才1001分

嗯 IAR的跑分结果相对keil gcc 会高些,更接近官方的数据

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版