Hmm… it’s working for me. The error indicates that OpenOCD tried to perform a DMI read, and it got failure as a result. I don’t think I’ve ever seen that when connecting to spike, where these things always succeed. Is spike still running after OpenOCD exits? Can you try again but run spike as openocd -d -f spike.cfg. This should result in a lot more debug output, and at least we can see exactly what OpenOCD is seeing.
–>The error is riscv-013.c:547 dmi_op_timeout(): failed read (NOP) at 0x11, status=2
After running spike there is warning : tohost and fromhost symbols not in ELF ; can’t communicate with target . Is it the reason for that error? If that is the reason how do I add tohost and fromhost symbols ?
I removed the existing toolchain, updated and rebuilt everything. The error remains same, do I need to enable something while running build.sh ? If so what are the options that should be enabled ?
Looking at the spike source, I have no idea how this can happen. What version of spike are you using? Do you have a git hash for the source it was built from?
That version should work. riscv-tools hasn’t been updated in a few months, and every time it does it automatically runs tests which include testing gdb->openocd->spike. (You can see the latest results here.)
I think it’s fair to say that you’re running into some problem unique to your system. The next troubleshooting step I’d take is to rebuild spike, enabling debug printfs in riscv/debug_module.cc by changing #if 0 on line 12 to #if 1, then rerun and see what output shows up.
@tim as you said, the problem is unique to my machine as I am using toolchain on older version of ubuntu. Later I installed toolchain on ubuntu 18.04 and now openOCD is working fine.
hi, i also have an issue with spike compiling, hope it’s ok that i am asking for help as a reply
when I try to compile a simple c program, i get this error:
rotemshahar@asic2-serv3:~$ ./rocket-chip/riscv-tools/bin/riscv64-unknown-elf-gcc -g -Og -o hello-64.o -c hello.c
rotemshahar@asic2-serv3:~$ ./rocket-chip/riscv-tools/bin/riscv64-unknown-elf-gcc -g -Og -T spike.lds -nostartfiles -o hello-64 hello-64.o
/home/rotemshahar/rocket-chip/riscv-tools/lib/gcc/riscv64-unknown-elf/7.2.0/…/…/…/…/riscv64-unknown-elf/bin/ld: cannot open linker script file spike.lds: No such file or directory
collect2: error: ld returned 1 exit status
can any of you guys can help me figure out what am I doing wrong here?
your error says that there is no linker script file.
follow the steps mentioned in the following link. you will get it. https://github.com/riscv/riscv-isa-sim
Hi @chakri
I followed the instructions in the link you sent before I tried to compile
I can try to remove it all and then download & install again, but I am not sure if it will help
Make one separate directory outside and then follow the steps provided in link given by @chakri. Your spike.lds should be in same directory where you are compiling.
@sharinoz you have to create spike.lds file. If you follow this link https://github.com/riscv/riscv-isa-sim spike.lds and spike.cfg files are given under cat command. so follow those steps, create rot13.c, spike.lds, spike.cfg files and execute the commands. It will work.
thanks @chakri, it is working now
but there is this message:
rotemshahar@asic2-serv3:~/riscv-isa-sim$ spike --rbb-port=9824 -m0x10000000:0x20000 rot13-64
Listening for remote bitbang connection on port 9824.
warning: tohost and fromhost symbols not in ELF; can’t communicate with target
Received nothing. Quitting.
@sharinoz even I got same message Received nothing. Quitting . I don’t know exact reason but I installed toolchain on ubuntu 18.04 and now I am able to debug my program through openOCD.
hi @chakri
do you know where I can find the files of rot13.c, spike.lds and spike.cfg, do I need to use the command “vim rot13.c”, "vim spike.lds ", “vim spike.cfg”?
thank you