Spike

Building the GCC toolchain

  1. It is recommended to build the toolchain from source.

     git clone https://github.com/riscv/riscv-gnu-toolchain.git
     cd riscv-gnu-toolchain
     git submodule update --init --recursive
     export RISCV=/opt/riscv
     ./configure --prefix="${RISCV}" --enable-multilib
     make linux
    

    After it is built, add the $RISCV/bin folder to your PATH. The built toolchain works for both 32-bit and 64-bit.

  2. Alternatively, any pre-built toolchain with multilib enabled should work.

Getting the Simulator

You can use either RISC-V ISA Simulator or QEMU >= v4.2 shipped with your Linux distribution.

If you prefer to build qemu from source, make sure you have the correct target enabled.

git clone https://git.qemu.org/git/qemu.git
cd qemu
mkdir build
cd build
../configure --prefix=/opt/riscv --target-list=riscv64-softmmu,riscv32-softmmu
make

Building seL4test

Checkout the sel4test project using repo as per seL4Test

repo init -u https://github.com/seL4/sel4test-manifest.git
repo sync
mkdir cbuild
cd cbuild
../init-build.sh -DPLATFORM=spike -DRISCV64=1
# The default cmake wrapper sets up a default configuration for the target platform.
# To change individual settings, run `ccmake` and change the configuration
# parameters to suit your needs.
ninja
# If your target binaries can be executed in an emulator/simulator, and if
# our build system happens to support that target emulator, then this script
# might work for you:
./simulate

If you plan to use the ./simulate script, please be sure to add the -DSIMULATION=1 argument when running cmake.

Generated binaries can be found in the images/ directory.

You can also use run the tests on the 32-bit spike platform by replacing the -DRISCV64=TRUE option with -DRISCV32=TRUE.