Coremark v1.01移植+2K1000跑分
本文档以在龙芯2K1000的平台下做交叉编译为例,最终使用coremark工具测试龙芯2K1000 性能编写。
1、获取源码
$ git clone https://github.com/eembc/coremark.git
$ tar -jxf coremark_v1.0.tar.bz2
$ cd coremark_v1.0
2、预备编译环境
$ export PATH=/root/cross/loongson2K1000/gcc-4.9.3-64-gnu/bin:$PATH
3、创建mips64el分支
$ cp linux64 mips64el -frd
4、修改Makefile
$ vim mips64el/core_portme.mak
OUTFLAG= -o
# Flag: CC
# Use this flag to define compiler to use
-CC = gcc
+CC = mips64el-linux-gcc
# Flag: CFLAGS
# Use this flag to define compiler options. Note, you can add compiler options from the command line using XCFLAGS="other flags"
PORT_CFLAGS = -O2
FLAGS_STR = "$(PORT_CFLAGS) $(XCFLAGS) $(XLFLAGS) $(LFLAGS_END)"
-CFLAGS = $(PORT_CFLAGS) -I$(PORT_DIR) -I. -DFLAGS_STR=\"$(FLAGS_STR)\"
+CFLAGS = $(PORT_CFLAGS) -I$(PORT_DIR) -I. -DFLAGS_STR=\"$(FLAGS_STR)\" -static
# Flag: LFLAGS_END
5、编译
$ make PORT_DIR=mips64el
已经生成了交叉编译的coremark.exe可执行程序,错误原因是其在PC上直接自动运行了该程序。在PC上运行交叉编译的可执行程序,必然会出错,不予理会即可。
$ file coremark.exe
6、测试性能
在龙芯2k1000的板子上执行如下命令:
# ./coremark.exe