Stumbling with Spike
31 Oct 2022 #modelling #architecture #micro #architectureThis post is intended to act as a quick reference guide to
installing dependencies, in case you want to build Spike
on a machine where you do not have sudo
priviledges.
Assumptions:
riscv64-unknown-linux-gnu
toolchain is already built and availble on the PATH.Boost
is already available- A decent version of
GCC
is available In my case, I usedGCC-10.3.0
, withBoost-1.76.0
.
Install DTC
The device tree compiler (dtc) executable is a requirement for Spike. It can be compiled from scratch. The binary should be made available in the PATH environment variable.
export PATH=$PATH:<path to the binary>
Install ProxyKernel
mkdir build
cd build
../configure --prefix=<install prefix> --host=riscv64-unknown-linux-gnu
make -j all
make install
export PATH=$PATH:<install prefix>/bin
Note
- If you try to build in the root of the repository, the output file for
pk
does not get generated, as there is a directory with the same name. Hence, using a build folder helps!
Install spike.
./configure --prefix=<install prefix> --with-boost=<path to boost root> --enable-commitlog --with-isa=RV64IMAFDCP
make -j all
make install
export PATH=$PATH:<install prefix>/bin
Note:
- In my specific installation, Boost libraries could not be found even after setting appropriate LD_LIBRARY_PATH. Explictly specifiying the path solved the issue.
- Take a look at the output of
./configure --help
to find options of Spike that might be relevant. For example,--enable-commitlog
was something that was relevant for me.
Spike Execution
Creating the executable
riscv64-unknown-elf-gcc -o hello hello.c
Actual execution
To run spike with a program and log the commits to a file:
spike -m 1G --log-commits --log=spike_log.txt $(\which pk) hello