RISC-V 32bit Simulation with Spike failed with error

2.3k Views Asked by At

I just got the source from github and built pk with 32bit option and ran spike with following command:

$ spike --isa=RV32 pk hello

I got the following error:

terminate called after throwing an instance of 'std::runtime_error' what(): could not open pk

I used riscv32-unknown-elf-gcc to compile pk for the 32b RISC-V target processor as follows:

$ ../configure --prefix=$RISCV/riscv32-unknown-elf --host=riscv32-unknown-elf

The old spike program which I got from the first RISCV workshop(last January) works ok.

2

There are 2 best solutions below

1
On

The error message suggests that spike can't find the pk. Try and provide an absolute path to the pk you compiled.

Spike assumes the pk is in a particular path relative to it. It's probably looking in ($RISCV/riscv64-unknown-elf/bin/pk).

0
On

Confirmed. The following code is a workaround:

mkdir -p $RISCV/riscv64-unknown-elf/bin
cp $RISCV/riscv32-unknown-elf/bin/pk $RISCV/riscv64-unknown-elf/bin/pk