Chris
Chris

Reputation: 135

Debugging simple C and Assembly Programs with Spike (riscv-isa-sim)

I am running Simple C and Assembly programs on spike (this works fine). I am having trouble to run spikes debug mode. I always get the same output although I am trying to debug different programs. I am using the riscv64-unknown-elf-gcc to generate the executable binaries from C and Assembly code and the following commands also described on: http://riscv.org/download.html#tab_isa-sim to run the debug mode:

$ spike -d pk simpleprogram

I also get the same output if I just type:

$ spike -d pk 

I get error messages if I type the following command (without pk):

$ spike -d simpleprogram 

Upvotes: 3

Views: 3977

Answers (1)

user2548418
user2548418

Reputation: 1571

The pk is actually the proxy kernel. It is a single process OS that allows makes it easier to run programs. The pk is a RISC-V binary that executes on top of spike.

When you run spike with pk, it runs pk first, and once everything is ready, pk hands off execution to your program (which is an argument to pk). You are seeing the same output because you haven't executed far enough to get past pk booting up and into your program.

Running without pk is possible, but your program must be compiled specially to run in this bare metal mode. For example of how to do that, I would look at the riscv-tests repo to see how to run minimal programs.

Upvotes: 5

Related Questions