3

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 
tod
  • 1,539
  • 4
  • 17
  • 43
Chris
  • 135
  • 1
  • 6
  • 1
    What are the error messages? What do you mean "same output"? – Chris Mar 04 '15 at 02:01
  • error messages: come up when using spike without pk **core 0: 0x0000000000002000 (0x00000000) unknown core 0: exception trap_illegal_instruction, epc 0x0000000000002000** same Output: the command: $ **spike -d -pk simpleprogram** prints out information on the terminal like: **core 0: 0x0000000000003f74 (0x00878793) addi a5, a5, 8** (i can't post them all because a huge amount of these are produced) the problem is that if I compare this output (which i can't do in detail because there is just too much information) of two programs i can't find any difference. – Chris Mar 04 '15 at 11:57

1 Answers1

4

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.

user2548418
  • 1,531
  • 10
  • 17
  • I looked up the riscv-tools repo but i couldn't find any example of how to run a simple program directly on spike. In the repo the authors only describe the usage of spike with pk (proxy kernel). Can you maybe tell me if there is a way to figure out when my program is executed on spike and not pk? Do you maybe know and could tell me how to run programs directly on spike. Thank you in advance. – Chris Mar 04 '15 at 11:36
  • Running a simple program without pk is easy, you can do spike -d simpleprogram (as you already tried). The tricky part is compiling it to run without pk. Check out the benchmarks directory of riscv-tools for example programs that can run without pk. For example, try make median.riscv. – user2548418 Mar 04 '15 at 19:48