1

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.

nengel
  • 136
  • 7
  • FWIW, Spike's `--with-isa=` configure option just changes the default ISA. Spike always supports setting a different ISA at runtime with the `--isa` command line option. – maxschlepzig Feb 15 '20 at 17:27

1 Answers1

0

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

Bin Wu
  • 11