Accueil > Outils > Programmation > Pre-compiled RISC-V GNU toolchain and spike
mardi 17 septembre 2019
This is a precompiled version of the RISC-V GNU toolchain (gcc, as, ld, libc, ...) and spike simulator, generated from the sources https://github.com/riscv/riscv-gnu-toolchain and https://github.com/riscv/riscv-tools, with executables stripped to save disk space (the extracted /opt/riscv/ directory uses around 200 Mb of disk space).
Ubuntu 18.04 & 20.04
It was generated and tested on Ubuntu 18.04, tested on Ubuntu 20.04, and may or may not run elsewhere. Use at your own risk.
This archive needs to be extracted in /opt/riscv/ :
wget 'https://matthieu-moy.fr/spip/IMG/gz/riscv.tar.gz' -O /tmp/riscv.tar.gz
cd /opt/
sudo tar -xzvf /tmp/riscv.tar.gz
The device-tree-compiler
and libmpc3
packages need to be installed for spike to work. On Ubuntu, run :
sudo apt install libmpc3 device-tree-compiler
After installation, you can delete the file /tmp/riscv.tar.gz
.
Executables are installed in /opt/riscv/bin/
, which you need to add to your $PATH
(in ~/.bashrc
) :
PATH=/opt/riscv/bin:$PATH
Quick test to check that the toolchain is working :
echo '#include <stdio.h>' > foo.c; printf 'int main() {printf("Hello");}' >> foo.c; riscv64-unknown-elf-gcc foo.c -o foo; spike pk ./foo; echo
Must output :
bbl loader
Hello
Fedora 30
This archive was generated on Fedora 30, but is meant to be as self-contained as possible, it is likely to work on other systems. GCC should work regardless of the place where the archive is extracted, but spike pk
won’t find pk nor the dtc executable unless the archive is extracted in /home/tpetu/Enseignants/matthieu.moy/mif08/
.
wget 'https://matthieu-moy.fr/spip/IMG/gz/riscv-fedora.tar.gz' -O /tmp/riscv-fedora.tar.gz
sudo mkdir -p /home/tpetu/Enseignants/matthieu.moy/mif08/
cd /home/tpetu/Enseignants/matthieu.moy/mif08/
sudo tar -xzvf /tmp/riscv-fedora.tar.gz