Difference between revisions of "Board:emulation/spike-riscv"

From coreboot
Jump to: navigation, search
(Link to the RISCV.org spike tool page instead of spike's github repo)
(Build instructions)
Line 1: Line 1:
[https://riscv.org/software-tools/risc-v-isa-simulator/ SPIKE] is [https://riscv.org/ RISC-V]'s primary emulator.
+
[https://riscv.org/software-tools/risc-v-isa-simulator/ SPIKE] is [https://riscv.org/ RISC-V]'s primary emulator. The Spike support in coreboot is mostly being developed by [[User:Jn|jn]] as part of his GSoC 2016.
 +
 
 +
=Build instructions=
 +
 
 +
These instructions may easily become out of date as coreboot or RISC-V moves forward. If that happens, please complain on the [[Talk:Board:emulation/spike-riscv|discussion page]] or IRC (or just fix it).
 +
 
 +
==Building the toolchain==
 +
 
 +
* clone the coreboot git repository
 +
* download and apply [https://review.coreboot.org/#/c/14604/ this patch] and [https://review.coreboot.org/#/c/14257 this patch].
 +
* run <code>make crossgcc-riscv</code> and a have a cup of $BEVERAGE
 +
 
 +
==Building spike==
 +
 
 +
* download Spike from https://github.com/riscv/riscv-isa-sim
 +
* download and apply [https://github.com/neuschaefer/riscv-isa-sim/commit/664118976cd487c9dec8cc6b5b3b9d52bd3f861c this patch that implements an 8250 UART]
 +
* TODO: fesvr: patch device_list_t::handle_command to ignore HTIF writes
 +
* TODO: running make
 +
 
 +
==Building coreboot without a payload==
 +
 
 +
* TODO: patch patch patch
 +
* run <code>make menuconfig</code> and select <tt>Emulation</tt>/<tt>SPIKE ucb riscv</tt> from the Mainboard menu
 +
* run <code>make</code>
 +
* run <code>util/riscvtools/make-spike-elf.sh build/coreboot.rom build/coreboot.elf</code> to create an ELF file (spike can only load ELF files)
 +
* run <code>spike build/coreboot.elf</code>
 +
 
 +
For general spike usage, look at [https://github.com/riscv/riscv-isa-sim/ its GitHub page].
 +
 
 +
==Building Linux==
 +
 
 +
* <code>git clone https://github.com/riscv/riscv-linux</code>
 +
* download linux 4.6.x from [https://kernel.org kernel.org]
 +
* <code>cd linux-4.6.x/arch; ln -s ../../riscv-linux/arch/riscv .</code>
 +
* <code>make ARCH=riscv defconfig</code>
 +
* <code>make ARCH=riscv menuconfig</code>, configure <tt>General setup/Cross-compiler tool prefix</tt>
 +
* <code>make ARCH=riscv</code>
 +
 
 +
==Building bbl==
 +
 
 +
* TODO: libc stuff
 +
* TODO: payload linker script foo
 +
* TODO: patching the console output handler
 +
* mkdir build
 +
* cd build; ../configure --with-payload=path/to/vmlinux CC=path/to/riscv64-unknown-elf-gcc LD=path/to/riscv64-unknown-elf-ld
 +
* make
 +
 
 +
==Building coreboot with bbl==
 +
 
 +
* apply the same coreboot patches as above, and select <tt>Emulation</tt>/<tt>Spike ucb riscv</tt>
 +
* in the Payload menu of <code>menuconfig</code>, select "ELF Payload" and enter the path to the bbl binary
 +
 
 +
Block devices currently missing
 +
 
 +
===boot log===
 +
 
 +
<code>
 +
TODO
 +
</code>

Revision as of 22:40, 29 June 2016

SPIKE is RISC-V's primary emulator. The Spike support in coreboot is mostly being developed by jn as part of his GSoC 2016.

Build instructions

These instructions may easily become out of date as coreboot or RISC-V moves forward. If that happens, please complain on the discussion page or IRC (or just fix it).

Building the toolchain

  • clone the coreboot git repository
  • download and apply this patch and this patch.
  • run make crossgcc-riscv and a have a cup of $BEVERAGE

Building spike

Building coreboot without a payload

  • TODO: patch patch patch
  • run make menuconfig and select Emulation/SPIKE ucb riscv from the Mainboard menu
  • run make
  • run util/riscvtools/make-spike-elf.sh build/coreboot.rom build/coreboot.elf to create an ELF file (spike can only load ELF files)
  • run spike build/coreboot.elf

For general spike usage, look at its GitHub page.

Building Linux

  • git clone https://github.com/riscv/riscv-linux
  • download linux 4.6.x from kernel.org
  • cd linux-4.6.x/arch; ln -s ../../riscv-linux/arch/riscv .
  • make ARCH=riscv defconfig
  • make ARCH=riscv menuconfig, configure General setup/Cross-compiler tool prefix
  • make ARCH=riscv

Building bbl

  • TODO: libc stuff
  • TODO: payload linker script foo
  • TODO: patching the console output handler
  • mkdir build
  • cd build; ../configure --with-payload=path/to/vmlinux CC=path/to/riscv64-unknown-elf-gcc LD=path/to/riscv64-unknown-elf-ld
  • make

Building coreboot with bbl

  • apply the same coreboot patches as above, and select Emulation/Spike ucb riscv
  • in the Payload menu of menuconfig, select "ELF Payload" and enter the path to the bbl binary

Block devices currently missing

boot log

TODO