riscv-isa-sim icon indicating copy to clipboard operation
riscv-isa-sim copied to clipboard

Not able to simulate hello program

Open rahulraveendran15-coder opened this issue 4 years ago • 2 comments

Hi, I am getting the below error when running the command spike pk hello_world

terminate called after throwing an instance of 'std::runtime_error'
  what():  could not open pk (did you misspell it? If VCS, did you forget +permissive/+permissive-off?)

How to overcome this? I want to run with 32imc

My Tool chain paths are as below:


export PATH=${PATH}:/home/rr/.local/opt/riscv32/lowrisc-toolchain-gcc-rv32imc-20200904-1/bin
export PATH=${PATH}:/home/rr/.local/opt/riscv32/lowrisc-toolchain-gcc-rv32imc-20200904-1/riscv32-unknown-elf/bin ##path for pk

export RISCV_TOOLCHAIN=$HOME/.local/opt/riscv32/lowrisc-toolchain-gcc-rv32imc-20200904-1/

export RISCV_GCC="$RISCV_TOOLCHAIN/bin/riscv32-unknown-elf-gcc"

The build commands I tried is below

./configure --prefix=$RISCV_TOOLCHAIN/riscv32-unknown-elf --enable-commitlog --enable-misaligned 
./configure --prefix=$RISCV_TOOLCHAIN--enable-commitlog --enable-misaligned (tried this command also later)
make
sudo make install
riscv32-unknown-elf-gcc -o hello hello.c
spike pk hello

Can anyone please let me know where I am missing something?

Also when I tried spike $(which pk) hello it is running continuosuly without exiting nothing is getting displayed in terminal. For a simple hello program why it is running continuously how can I see the status of the run?

When I tried running spike --isa=rv32i $(which pk) hello, it is throwing the below error

bbl loader
z  00000000 ra 8000c1b0 sp 800120b0 gp 00000000
tp 00000000 t0 80000000 t1 8001210b t2 00000000
s0 8000de10 s1 8000e0f5 a0 0000002e a1 00000000
a2 0000000a a3 00000000 a4 00000025 a5 8000c188
a6 00000000 a7 00000000 s2 80012100 s3 8001223c
s4 80010018 s5 00000015 s6 00000009 s7 00000000
s8 0000002e s9 0000000c sA 8000e0f4 sB 00000100
t3 8001226c t4 00000000 t5 00000003 t6 00000000
pc 8000c524 va 00008e2a insn       00008e2a sr 80046100
An illegal instruction was executed!

Could you please help me on this? I am in the ibex branch of the git

Installed pk using the following command : ./configure --prefix=$RISCV_TOOLCHAIN --with-arch=rv32i --host=riscv32-unknown-elf

rahulraveendran15-coder avatar Nov 03 '20 21:11 rahulraveendran15-coder

Hi, my environment for riscv32-unknown-elf-gcc is export PATH=$PATH:$RISCV/bin for pk installation I used: ../configure --prefix=$RISCV --with-arch=rv32i --host=riscv32-unknown-elf --target=riscv32-unknown-elf for spike installation: ../configure --prefix=$RISCV --with-isa=rv32i --target=riscv32-unknown-elf --enable-histogram After installation implemented this workaround:

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

Now it's working:

$ riscv32-unknown-elf-gcc -o hello hello.c
$ spike pk hello
bbl loader
Hello world!

emelcher avatar Apr 12 '21 16:04 emelcher

for spike installation use:

../configure --prefix=$RISCV --with-isa=rv32i --target=riscv32-unknown-elf --enable-histogram CXXFLAGS="-DTARGET_ARCH=\\\"riscv32-unknown-elf\\\""

The workaround from my previous comment is not needed any more.

emelcher avatar Apr 15 '21 20:04 emelcher