SPIKE RISC-V ISA Simulator

Setting up SPIKE RISC-V ISA Simulator.

Setting up the GNU GCC RISC-V Toolchin

I use Ubuntu on my X13s laptop, so, the logical choice developing RISC-V C programs on the move. Below is the instructions of how I set up SPIKE so I can run RISC-V binaries on my X13s ARM laptop.

If you have not set up the GCC Toolchain for RISC-V go and do that now.

As always with Ubuntu we should do an update: sudo apt update followed by sudo apt upgrade

Next we install some prerequisites:
sudo apt install device-tree-compiler libboost-all-dev

I am assuming you are using the RISCV directory created when you built the toolchain, so, next we set the environment

export PATH=/opt/riscv/bin:$PATH
export RISCV=/home/username/RISCV
cd $RISCV

Now we clone the repository and build SPIKE

git clone https://github.com/riscv-software-src/riscv-isa-sim.git
cd riscv-isa-sim
mkdir build
cd build
sudo ../configure --prefix=$RISCV --host=riscv64-unknown-elf --with-boost-libdir=/usr/lib/aarch64-linux-gnu/
make -j$(nproc)
sudo make install
cd ../..
git clone https://github.com/riscv/riscv-pk.git
cd riscv-pk
mkdir build
cd build
../configure --prefix=$RISCV --host=riscv64-unknown-elf
make -j$(nproc)
sudo make install

SPIKE is now buit and ready to test.
spike --isa=RV64IMACV $RISCV/riscv-pk/build/pk ./main

Mission Accomplished

And there we have it, you can now run RISC-V binaries on an ARM ubuntu laptop.