简体   繁体   English

如何为RV32I指令集构建峰值?

[英]How to build spike for RV32I instruction set?

I have installed riscv-gnu-toolchain with the following settings, which works as expected: 我已经安装了具有以下设置的riscv-gnu-toolchain,该设置可以正常运行:

./configure --prefix=/opt/riscv --enable-multilib --with-arch=rv32i --with-abi=ilp32

Now I am trying to build a version of spike that is capable of running executables compiled with this toolchain. 现在,我正在尝试构建一个能够运行使用此工具链编译的可执行文件的spike版本。

  • riscv-fesvr doesn't seem to have any ISA-specific settings. riscv-fesvr似乎没有任何特定于ISA的设置。 I compiled it with ../configure --prefix=/opt/riscv 我用../configure --prefix=/opt/riscv编译了它

  • riscv-isa-sim offers --with-isa, so I set that: ../configure --prefix=/opt/riscv --with-isa=RV32I This builds fine, aside from some problems with missing include paths to fesvr that I had to fix manually in the makefile. riscv-isa-sim提供--with-isa,因此我将其设置为: ../configure --prefix=/opt/riscv --with-isa=RV32I除了一些缺少缺少包含fesvr路径的问题之外,此方法还不错我必须在makefile中手动修复。

  • riscv-pk I built with ../configure --prefix=/opt/riscv --host=riscv32-unknown-elf , also no problems compiling. 我用../configure --prefix=/opt/riscv --host=riscv32-unknown-elf构建的riscv-pk,也没有编译问题。

Unfortunately, if I try to run the resulting spike executable, it segmentation faults. 不幸的是,如果我尝试运行生成的峰值可执行文件,它将导致分段错误。 If I don't put in any arguments, I do get the "usage" print, but nothing else works. 如果我不添加任何参数,则可以得到“用法”打印,但没有其他效果。

$ echo -e '#include <stdio.h>\n int main(void) { printf("Hello world!\\n"); return 0; }' > hello.c
$ riscv32-unknown-elf-gcc -o hello hello.c
$ spike pk hello
$ Segmentation fault (core dumped)
$ spike pk
$ Segmentation fault (core dumped)
$ spike hello
$ Segmentation fault (core dumped)
$ spike --isa=RV32 pk hello
$ Segmentation fault (core dumped)
$ spike --isa=RV32 pk
$ Segmentation fault (core dumped)
$ spike --isa=RV32 hello
$ Segmentation fault (core dumped)

I'm not sure where to even start debugging this. 我不知道从哪里开始调试它。

I guess it is the riscv-isa-sim failed that led to show the message "core dumped". 我猜是riscv-isa-sim失败导致显示消息“ core dumped”。 Because I added one of my own instruction and its format was wrong, when I used this instruction the message "core dumped" occurred. 因为我添加了一条自己的指令,并且其格式错误,所以当我使用该指令时,会出现消息“ core dumped”。 I suggest that you don't need to install them one by one. 我建议您不需要一一安装。 You can install entire tool-chain by cloning from https://github.com/riscv/riscv-tools 您可以通过从https://github.com/riscv/riscv-tools进行克隆来安装整个工具链

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM