[其他ST产品]

在STM32MP157 DK1上跑了个Coremark

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

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

   

使用特权

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

#include <stdint.h>

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

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


使用特权

评论回复
zhanzr21|  楼主 | 2020-4-24 13:03 | 显示全部楼层
第四步, 交叉编译,连接
ubuntu@VM-0-6-ubuntu:~/c_prj/coremark$ make PORT_DIR=stm32mp157 compile link
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
Link performed along with compile

ubuntu@VM-0-6-ubuntu:~/c_prj/coremark$ file coremark.elf
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好的可执行文件传输到板子上, 执行
root@stm32mp1:~# chmod +x coremark.elf
root@stm32mp1:~# ./coremark.elf  0x0 0x0 0x66 0 7 1 2000 > ./run1.log  
root@stm32mp1:~# ./coremark.elf  0x3415 0x3415 0x66 0 7 1 2000  > ./run2.log
看结果:
root@stm32mp1:~# cat run1.log
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 16475
Total time (secs): 16.475000
Iterations/Sec   : 1820.940819
Iterations       : 30000
Compiler version : GCC7.5.0
Compiler flags   : -O2   -lrt
Memory location  : Please put data memory location here
                        (e.g. code in flash, data on heap etc)
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0x5275
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 1820.940819 / GCC7.5.0 -O2   -lrt / Heap

root@stm32mp1:~# cat run2.log
2K validation run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 16429
Total time (secs): 16.429000
Iterations/Sec   : 1826.039321
Iterations       : 30000
Compiler version : GCC7.5.0
Compiler flags   : -O2   -lrt
Memory location  : Please put data memory location here
                        (e.g. code in flash, data on heap etc)
seedcrc          : 0x18f2
[0]crclist       : 0xe3c1
[0]crcmatrix     : 0x0747
[0]crcstate      : 0x8d84
[0]crcfinal      : 0xff48
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

主题

1005

帖子

34

粉丝