[英]How to compile dhrystone benchmark for RV32I
when i am trying to compile the dhrystone benchmark in riscv-sodor for -march RV32I, an unrecognized opcode 'amoadd' error exits the compilation. 当我尝试为-march RV32I在riscv-sodor中编译dhrystone基准时,无法识别的操作码“ amoadd”错误退出了编译。
riscv-gcc -m32 -Wa,-march=RV32I -std=gnu99 -O2 -nostdlib -nostartfiles -DPREALLOCATE=1 -DHOST_DEBUG=0 \
-c -I../env -I./common -I./dhrystone ./dhrystone/dhrystone_main.c -o dhrystone_main.o
In file included from ./dhrystone/dhrystone_main.c:12:0:
./common/util.h:11:0: warning: "rdcycle" redefined [enabled by default]
./dhrystone/dhrystone.h:385:0: note: this is the location of the previous definition
/tmp/ccDLKK6P.s: Assembler messages:
/tmp/ccDLKK6P.s:16: Error: unrecognized opcode `amoadd'
make: *** [dhrystone_main.o] Error 1
Is there any way to compile the dhrystone for baremetal hardware of RV32I. 有什么办法可以为RV32I的裸机硬件编译模块。
Remove the -Wa,-march=RV32I
flag. 删除
-Wa,-march=RV32I
标志。
-Wa,-march=RV32I
is telling the assembler to only accept valid RV32I instructions. -Wa,-march=RV32I
告诉汇编程序仅接受有效的RV32I指令。 It has found an amoadd
instruction, so it properly errored out. 它找到了
amoadd
指令,因此正确地出错了。 The assembler is in no position to change out invalid instructions for valid instructions, that's the compiler's job. 汇编程序无法将无效指令更改为有效指令,这就是编译器的工作。
Unfortunately, as of 2014 Dec, the riscv-toolchain's gcc port does not yet support -march=RV32I
. 不幸的是,截至2014年12月,riscv-toolchain的gcc端口尚不支持
-march=RV32I
。
Instead, it is on the programmer to personally avoid writing code that will emit multiplies, AMOs, floating point, etc. In fact, the provided dhrystone code includes floating point instructions (I believe only in the initialization code) which would also cause -Wa,-march=RV32I
to fail as well. 取而代之的是,程序员自己避免编写会发出乘法,AMO,浮点数等的代码。实际上,提供的dhrystone代码包括浮点指令(我相信仅在初始化代码中),这也会导致
-Wa,-march=RV32I
将失败。 In this situation, the programmer of dhrystone checks whether the processor supports floating point instructions and branches around them as required. 在这种情况下,dhrystone的程序员检查处理器是否支持浮点指令并根据需要在它们周围分支。
On a more academic note, I believe the amoadd
is coming in from the common/util.h's "barrier" implementation. 从学术
amoadd
,我相信amoadd
来自common / util.h的“ barrier”实现。 However, since dhrystone does not call barrier, I'm unsure why the assembler is being passed an amoadd
instruction. 但是,由于dhrystone不会调用barrier,因此我不确定为什么
amoadd
汇编程序传递amoadd
指令。 I certainly don't see it in my own disassemblies of dhrystone. 我当然在我自己的dhrystone拆卸中看不到它。 I also was unable to reproduce your error on my own RISCV compilers.
我也无法在我自己的RISCV编译器上重现您的错误。 I am using a riscv-gcc from early August 2014 ( https://github.com/ucb-bar/riscv-tools ) and a newer gcc4.9 found at ( https://github.com/ucb-bar/riscv-tools/tree/new-abi ), which is in testing, but will soon be moved to master (~Jan 2015).
我从2014年8月上旬开始使用riscv-gcc( https://github.com/ucb-bar/riscv-tools ),并在( https://github.com/ucb-bar/riscv -tools / tree / new-abi ),正在测试中,但很快将移交给master(〜2015年1月)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.