[其他ST产品] 在STM32MP157 DK1上跑了个Coremark

[复制链接]
 楼主| zhanzr21 发表于 2020-4-24 13:00 | 显示全部楼层 |阅读模式
在STM32MP157 DK1上跑了个Coremark. 把过程分享下.
我的开发机是Ubuntu 18.04
第一步,下载Coremark代码.
  1. ubuntu@VM-0-6-ubuntu:~/c_prj/$git clone https://github.com/eembc/coremark.git
  2.     Cloning into 'coremark'...
  3.     remote: Enumerating objects: 15, done.
  4.     remote: Counting objects: 100% (15/15), done.
  5.     remote: Compressing objects: 100% (13/13), done.
  6.     Receiving objects: 100% (219/219), 440.44 KiB | 4.00 KiB/s, done.
  7.     remote: Total 219 (delta 3), reused 10 (delta 2), pack-reused 204
  8.     Resolving deltas: 100% (130/130), done.

第二步, 建立STM32MP157的移植文件夹:
  1. ubuntu@VM-0-6-ubuntu:~/c_prj/$cd coremark
  2.     ubuntu@VM-0-6-ubuntu:~/c_prj/coremark$ mkdir stm32mp157
  3.     ubuntu@VM-0-6-ubuntu:~/c_prj/coremark$ cd stm32mp157/
  4.     ubuntu@VM-0-6-ubuntu:~/c_prj/coremark/stm32mp157$ cp ../linux/* .
  5.     ubuntu@VM-0-6-ubuntu:~/c_prj/coremark/stm32mp157$ ls
  6.     core_portme.c core_portme.h core_portme.mak

   
 楼主| zhanzr21 发表于 2020-4-24 13:02 | 显示全部楼层
第三步, 修改平台相关定义, Cortex A7属于32bit内核.
  1. ubuntu@VM-0-6-ubuntu:~/c_prj/coremark/stm32mp157$ vim core_portme.h

  2. #include <stdint.h>

  3. typedef int16_t ee_s16;
  4. typedef uint16_t ee_u16;
  5. typedef int32_t ee_s32;
  6. typedef float ee_f32;
  7. typedef uint8_t ee_u8;
  8. typedef uint32_t ee_u32;
  9. typedef uint32_t ee_ptr_int;
  10. typedef size_t ee_size_t;
修改makefile
  1. ubuntu@VM-0-6-ubuntu:~/c_prj/coremark/stm32mp157$ cd ..
  2. ubuntu@VM-0-6-ubuntu:~/c_prj/coremark$ vim stm32mp157/core_portme.mak

  3. CC = arm-linux-gnueabihf-gcc
  4. EXE = .elf


 楼主| zhanzr21 发表于 2020-4-24 13:03 | 显示全部楼层
第四步, 交叉编译,连接
  1. ubuntu@VM-0-6-ubuntu:~/c_prj/coremark$ make PORT_DIR=stm32mp157 compile link
  2. arm-linux-gnueabihf-gcc  -O2 -Istm32mp157 -I. -DFLAGS_STR=""-O2   -lrt"" -DITERATIONS=0  core_list_join.c core_main.c core_matrix.c core_state.c core_util.c stm32mp157/core_portme.c -o ./coremark.elf -lrt
  3. Link performed along with compile

  4. ubuntu@VM-0-6-ubuntu:~/c_prj/coremark$ file coremark.elf
  5. coremark.elf: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.2.0, BuildID[sha1]=a3ca7fb324643f7b756b62688e47c54e03d02f45, not stripped

 楼主| zhanzr21 发表于 2020-4-24 13:06 | 显示全部楼层
第五步, 把build好的可执行文件传输到板子上, 执行
  1. root@stm32mp1:~# chmod +x coremark.elf
  2. root@stm32mp1:~# ./coremark.elf  0x0 0x0 0x66 0 7 1 2000 > ./run1.log  
  3. root@stm32mp1:~# ./coremark.elf  0x3415 0x3415 0x66 0 7 1 2000  > ./run2.log
看结果:
  1. root@stm32mp1:~# cat run1.log
  2. 2K performance run parameters for coremark.
  3. CoreMark Size    : 666
  4. Total ticks      : 16475
  5. Total time (secs): 16.475000
  6. Iterations/Sec   : 1820.940819
  7. Iterations       : 30000
  8. Compiler version : GCC7.5.0
  9. Compiler flags   : -O2   -lrt
  10. Memory location  : Please put data memory location here
  11.                         (e.g. code in flash, data on heap etc)
  12. seedcrc          : 0xe9f5
  13. [0]crclist       : 0xe714
  14. [0]crcmatrix     : 0x1fd7
  15. [0]crcstate      : 0x8e3a
  16. [0]crcfinal      : 0x5275
  17. Correct operation validated. See README.md for run and reporting rules.
  18. CoreMark 1.0 : 1820.940819 / GCC7.5.0 -O2   -lrt / Heap

  19. root@stm32mp1:~# cat run2.log
  20. 2K validation run parameters for coremark.
  21. CoreMark Size    : 666
  22. Total ticks      : 16429
  23. Total time (secs): 16.429000
  24. Iterations/Sec   : 1826.039321
  25. Iterations       : 30000
  26. Compiler version : GCC7.5.0
  27. Compiler flags   : -O2   -lrt
  28. Memory location  : Please put data memory location here
  29.                         (e.g. code in flash, data on heap etc)
  30. seedcrc          : 0x18f2
  31. [0]crclist       : 0xe3c1
  32. [0]crcmatrix     : 0x0747
  33. [0]crcstate      : 0x8d84
  34. [0]crcfinal      : 0xff48
  35. Correct operation validated. See README.md for run and reporting rules.
1820的分数, 属于单核的性能.
除以主频, 1820/650 = 2.8 Coremarks/ MHz
考虑到这是用户模式下, 说的过去吧.

wowu 发表于 2020-5-9 14:32 | 显示全部楼层
非常感谢楼主分享
xiaoqizi 发表于 2020-5-9 14:32 | 显示全部楼层
牛人啊 很好
磨砂 发表于 2020-5-9 14:33 | 显示全部楼层
coremark是什么呢
晓伍 发表于 2020-5-9 14:33 | 显示全部楼层
真的看不动啊
八层楼 发表于 2020-5-9 14:33 | 显示全部楼层
非常感谢楼主分享
 楼主| zhanzr21 发表于 2020-7-7 23:44 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:每天都進步

91

主题

1017

帖子

34

粉丝
快速回复 在线客服 返回列表 返回顶部