简体   繁体   中英

How to build spike for RV32I instruction set?

I have installed riscv-gnu-toolchain with the following settings, which works as expected:

./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.

  • riscv-fesvr doesn't seem to have any ISA-specific settings. I compiled it with ../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-pk I built with ../configure --prefix=/opt/riscv --host=riscv32-unknown-elf , also no problems compiling.

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". Because I added one of my own instruction and its format was wrong, when I used this instruction the message "core dumped" occurred. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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