雅特力AT32A403开发板评测 02 CoreMark移植测试

02-雅特力AT32A403A开发板 CoreMark移植评测

1. 软硬件平台

  1. AT32A403A Board开发板

  2. MDK-ARM Keil

  3. CoreMark源码
    在这里插入图片描述

2. CoreMark

CoreMark是一款用于评估CPU性能的基准测试程序,它包含了多种不同的计算任务,包括浮点数、整数、缓存、内存等方面的测试。CoreMark的测试结果通常被用来作为CPU性能的参考,它可以帮助开发人员和系统管理员评估不同处理器和系统的性能,比较不同处理器之间的性能差异,也可以用来测试处理器在多线程并行计算方面的性能。

官方网站 https://www.eembc.org/

Github仓库地址 https://github.com/eembc/coremark

其中 simple为接口移植文件,比较重要,重要的修改在这里面,下面的core_main.c、core_matrix.c等文件是测试的重要文件

在这里插入图片描述

3. CoreMark移植

  1. 在支持printf的工程上进行修改,搭建自己的工程模板,主要是修改路径,建立at32a403a_coremark_tempalte工程模板。

    在这里插入图片描述

    1. Application 主函数,应用层代码
    2. BspDrivers 板级驱模块动文件
    3. Drivers 底层驱动库文件 Firmware Library
    4. Project 工程文件

    在这里插入图片描述

  2. 添加CoreMark源代码,其中core_portme.c core_portme.h为需要修改的文件(sample文件)

    在这里插入图片描述
    在这里插入图片描述

  3. 打开工程,添加文件

    在这里插入图片描述
    在这里插入图片描述

  4. 修改core_portme.c文件的内容

    1. 修改部分宏定义

      其中ITERATIONS数值视情况而定。

      如果出现ERROR! Must execute for at least 10 secs for a valid result!,那么需要将此数值变大使程序运行时间至少在10秒以上。

      #define SysTick_Counter_Disable ((uint32_t)0xFFFFFFFE)#define SysTick_Counter_Enable ((uint32_t)0x00000001)#define SysTick_Counter_Clear ((uint32_t)0x00000000)__IO uint32_t Ticks;#define ITERATIONS 5000;
      
    2. 屏蔽部分代码

      //#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 Host specific (POSIX), or target specific global time variables. */
      //static CORETIMETYPE start_time_val, stop_time_val;//changed
      
    3. 添加start_time,stop_time,get_time函数主体,主要是用于时间的计时

      __IO uint32_t Ticks;/* Function : start_timeThis function will be called right before starting the timed portion ofthe benchmark.Implementation may be capturing a system timer (as implemented in theexample code) or zeroing some system parameters - e.g. setting the cpu clockscycles to 0.
      */
      void start_time(void)//changed
      {//GETMYTIME(&start_time_val);Ticks++;SysTick_Config(SystemCoreClock / 1000);//1ms中断
      }
      /* Function : stop_timeThis function will be called right after ending the timed portion of thebenchmark.Implementation may be capturing a system timer (as implemented in theexample code) or other system parameters - e.g. reading the current value ofcpu cycles counter.
      */
      void stop_time(void)//changed
      {//GETMYTIME(&stop_time_val);/* Stop the Timer and get the encoding time */SysTick->CTRL &=SysTick_Counter_Disable;/* Clear the SysTick Counter */SysTick->VAL = SysTick_Counter_Clear;
      }
      /* Function : get_timeReturn an abstract "ticks" number that signifies time on the system.Actual value returned may be cpu cycles, milliseconds or any othervalue, as long as it can be converted to seconds by <time_in_secs>. Thismethodology is taken to accomodate any hardware or simulated platform. Thesample implementation returns millisecs by default, and the resolution iscontrolled by <TIMER_RES_DIVIDER>
      */
      CORE_TICKS get_time(void)//changed
      {CORE_TICKS elapsed=(CORE_TICKS) Ticks;//(MYTIMEDIFF(stop_time_val, start_time_val));return elapsed;
      }

      需要在中断服务函数中添加下面代码

      extern __IO uint32_t Ticks;
      void SysTick_Handler(void)
      {   Ticks++; 
      }
      
    4. 在portable_init函数中执行芯片初始化功能(如系统时钟,串口配置)

      /* Function : portable_initTarget specific initialization codeTest for some common mistakes.
      */
      void portable_init(core_portable *p, int *argc, char *argv[])
      {system_clock_config();delay_init();uart_print_init(115200);printf("at32a403a_board hardware_init [ok] \r\n");printf("at_start_a403a board coremark testing 2024-1-29\r\n");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;
      }
      
    5. 总体移植部分结束了,可能存在部分宏定义的修改,我也是参考别人的案例写的,可能会存在一些问题,需要自行判断

      core_portme.c完整代码如下:

      /*
      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 athttp://www.apache.org/licenses/LICENSE-2.0Unless 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 <stdio.h>
      #include <stdlib.h>
      #include "coremark.h"
      #include "main.h"#define SysTick_Counter_Disable ((uint32_t)0xFFFFFFFE)//changed
      #define SysTick_Counter_Enable ((uint32_t)0x00000001)//changed
      #define SysTick_Counter_Clear ((uint32_t)0x00000000)//changed
      __IO uint32_t Ticks;//changed//define ITERATIONS
      #define ITERATIONS 5000;//changed#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;void assert_failed(uint8_t* file, uint32_t line)
      { /* User can add his own implementation to report the file name and line number,ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) *//* Infinite loop */while (1){}
      }/* Porting : Timing functionsHow to capture time and convert to seconds must be ported to whatever issupported by the platform. e.g. Read value from on board RTC, read value fromcpu clock cycles performance counter etc. Sample implementation for standardtime.h and windows.h definitions included.
      */
      /* Define : TIMER_RES_DIVIDERDivider to trade off timer resolution and total time that can bemeasured.Use lower values to increase resolution, but make sure that overflowdoes not occur. If there are issues with the return value overflowing,increase this value.*///changed
      //#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 Host specific (POSIX), or target specific global time variables. */
      //static CORETIMETYPE start_time_val, stop_time_val;//changed
      #define EE_TICKS_PER_SEC 1000.0//changed
      /* Function : start_timeThis function will be called right before starting the timed portion ofthe benchmark.Implementation may be capturing a system timer (as implemented in theexample code) or zeroing some system parameters - e.g. setting the cpu clockscycles to 0.
      */
      void start_time(void)//changed
      {//GETMYTIME(&start_time_val);Ticks++;SysTick_Config(SystemCoreClock / 1000);//1ms中断
      }
      /* Function : stop_timeThis function will be called right after ending the timed portion of thebenchmark.Implementation may be capturing a system timer (as implemented in theexample code) or other system parameters - e.g. reading the current value ofcpu cycles counter.
      */
      void stop_time(void)//changed
      {//GETMYTIME(&stop_time_val);/* Stop the Timer and get the encoding time */SysTick->CTRL &=SysTick_Counter_Disable;/* Clear the SysTick Counter */SysTick->VAL = SysTick_Counter_Clear;
      }
      /* Function : get_timeReturn an abstract "ticks" number that signifies time on the system.Actual value returned may be cpu cycles, milliseconds or any othervalue, as long as it can be converted to seconds by <time_in_secs>. Thismethodology is taken to accomodate any hardware or simulated platform. Thesample implementation returns millisecs by default, and the resolution iscontrolled by <TIMER_RES_DIVIDER>
      */
      CORE_TICKS get_time(void)//changed
      {CORE_TICKS elapsed=(CORE_TICKS) Ticks;//(MYTIMEDIFF(stop_time_val, start_time_val));return elapsed;
      }
      /* Function : time_in_secsConvert the value returned by get_time to seconds.The <secs_ret> type is used to accomodate systems with no support forfloating point. Default implementation implemented by the EE_TICKS_PER_SECmacro 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_initTarget specific initialization codeTest for some common mistakes.
      */
      void portable_init(core_portable *p, int *argc, char *argv[])
      {system_clock_config();delay_init();uart_print_init(115200);printf("at32a403a_board hardware_init [ok] \r\n");printf("at_start_a403a board coremark testing 2024-1-29\r\n");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_finiTarget specific final code
      */
      void
      portable_fini(core_portable *p)
      {p->portable_id = 0;
      }
    6. 由于原工程有main函数,core_main也有main函数,则需要注释吊main.c的函数。

      在这里插入图片描述

    7. 修改编译器版本和优化等级(与MDK工程设置保持一致)

在这里插入图片描述

在这里插入图片描述

  1. 编译,下载程序,测试

    在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/537306.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

实测C++虚函数与内存布局(完整源码)

C虚函数究竟是如何实现的&#xff1f;有虚函数的对象的内存结构是什么样的&#xff1f;写几行代码测试一下就很容易理解了。 目录 一、测试代码 二、运行测试 三、分析结果 四、结论 一、测试代码 首先用VS2022建立一个C控制台项目&#xff08;或者随便什么C项目&#xff…

2024考研计算机考研复试-每日重点(第二十期)

公众号“准研计算机复试”&#xff0c;超全大佬复试资料&#xff0c;保姆级复试&#xff0c;80%的题目都是上岸大佬提供的。 研宝们&#xff0c;App更新啦&#xff01; 计算机组成原理&#xff1a; 10.☆什么是数据存储的大端模式和小端模式&#xff1f; 大端模式&#xff1a;数…

如何从 Mac 电脑外部硬盘恢复删除的数据文件

本文向您介绍一些恢复 Mac 外置硬盘数据的快速简便的方法。 Mac 的内部存储空间通常不足以存储所有数据。因此&#xff0c;许多用户通过外部驱动器扩展存储或创建数据备份。然而&#xff0c;与几乎所有其他设备一样&#xff0c;从外部硬盘驱动器丢失有价值的数据并不罕见。由于…

基于SpringBoot+MYSQL+Vue的校园管理系统

目录 1、前言介绍 2、主要技术 3、系统流程分析 3.1、操作流程 3.2、添加信息流程 3.3、删除信息流程 4、系统设计 4.1 系统体系结构 4.2开发流程设计 4.3 数据库设计原则 4.4 数据表 5、运行截图(部分) 5.1管理员功能模块 5.2用户功能模块 5.3院校管理员功能模块…

群晖 Synology Photos DSM7 自定义文件夹管理照片

背景 众所周知&#xff0c;目前群晖DSM7中使用Synology Photos做照片管理时&#xff0c;个人照片只能默认索引 /home/Photos 文件夹&#xff0c;但是如果个人照片很多或者用户很多时&#xff0c;共享文件夹/homes 所在的存储空间就会不够用 当然&#xff0c;如果你的存…

【python】anaconda安装过程

【运行环境】Windows11 文章目录 一、anaconda下载二、anaconda安装三、环境变量配置四、测试环境变量是否配置成功五、总结 一、anaconda下载 1、输入网址“https://www.anaconda.com”进入Anaconda官网。 2、找到【Free Download】点击进入&#xff1a; 3、点击对应系统的…

蓝桥杯-质因数问题

约数&#xff0c;又称因数&#xff1a;a % b 0,则b称为a的约数&#xff0c;包括1和a。 例如4的正约数有&#xff1a;1、2、4。6的正约数有&#xff1a;1、2、3、6。质因数&#xff1a; 质因数&#xff08;素因数或质因子&#xff09;在数论里是指能整除给定正整数&#xff08;…

从零开始学习深度学习库-2:反向传播

欢迎来到本系列的第二篇文章&#xff0c;我们将从头开始构建一个深度学习库。 本博客系列的代码可以在这个Github仓库中找到。 上一篇文章 在上一篇文章中&#xff08;链接见这里&#xff09;&#xff0c;我们实现了线性层和常见的激活函数&#xff0c;并成功构建了神经网络的…

【C语言步行梯】C语言实现三子棋游戏(含详细分析)

&#x1f3af;每日努力一点点&#xff0c;技术进步看得见 &#x1f3e0;专栏介绍&#xff1a;【C语言步行梯】专栏用于介绍C语言相关内容&#xff0c;每篇文章将通过图片代码片段网络相关题目的方式编写&#xff0c;欢迎订阅~~ 文章目录 需求分析具体实现主函数体菜单实现游戏实…

高级JAVA工程师解决生产环境JVM宕机Java进程挡掉操作系统内存异常实例讲解

高级JAVA工程师解决生产环境JVM宕机Java进程挡掉内存溢出实例讲解 一、事故描述 生产环境Java进程莫名挡掉&#xff0c;JVM宕机。监控平台报警。生产停了&#xff0c;老板急了&#xff0c;客户爆了&#xff0c;怎么迅速解决事故&#xff1f;每次出现生产事故&#xff0c;都是…

IT廉连看——Uniapp——模板语法

IT廉连看——Uniapp——模板语法 众所周知&#xff0c;Uniapp是使用vue.js框架开发出来的&#xff0c;所以说它可以使用vue中的语法和指令来开发我们的项目。如果没有学习过vue的话开发起来会比较吃力&#xff0c;所以这节课就带大家学习几个常用的vue知识。如果有学习过vue&a…

【五、接口自动化测试】

大家好&#xff0c;我是山茶&#xff0c;一个探索AI 测试的程序员 在网上看到了许多关于post与get之间区别的帖子&#xff0c;也有很多帖子是直接粘贴复制的&#xff0c;甚至连标题、符号都没改&#xff0c;甚至还有很多争议 一、post、get 关于post与get之间区别&#xff0c;…