Home > Tools > Programmation > Pre-compiled RISC-V GNU toolchain and spike
Tuesday 17 September 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 550 Mb of disk space). It also contains ANTLR4, Python 3.10 and Pyright, for use in the MIF08 and CAP courses.
Ubuntu 20.04, 20.10 & 22.04
It was generated and tested on Ubuntu 20.04, tested on Ubuntu 22.04, and may or may not run elsewhere. Use at your own risk.
This archive needs to be extracted in /opt/ and will create a /opt/riscv directory:
wget 'https://matthieu-moy.fr/spip/IMG/xz/riscv.tar.xz' -O /tmp/riscv.tar.xz
cd /opt/
sudo tar -xJvf /tmp/riscv.tar.xz
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.xz
.
RiscV Executables are installed in /opt/riscv/bin/
, and Pyright in /opt/bin
, which you need to add to your $PATH
(in ~/.bashrc
):
PATH=/opt/bin:/opt/riscv/bin:"$PATH"
Quick test to check that the toolchain is working:
echo '#include <stdio.h>' > /tmp/foo.c; printf 'int main() {printf("Hello");}' >> /tmp/foo.c; riscv64-unknown-elf-gcc /tmp/foo.c -o /tmp/foo; spike pk /tmp/foo; echo; pyright --version
Must output:
bbl loader
Hello
pyright 1.1.300
If this works, you can stop reading here.
If you want to uninstall the toolchain, run (as root) :
rm -fr /opt/riscv/ /opt/node-v14.17.3-linux-x64/ /opt/bin/pyright
Fedora 34
This archive was generated on Fedora 34, 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/
. This assumes you have permission to write to /home/tpetu/Enseignants/matthieu.moy/
, use sudo
if needed.
wget 'https://matthieu-moy.fr/spip/IMG/xz/riscv-fedora.tar.xz' -O /tmp/riscv-fedora.tar.xz
mkdir -p /home/tpetu/Enseignants/matthieu.moy/mif08/
cd /home/tpetu/Enseignants/matthieu.moy/mif08/
tar -xJvf /tmp/riscv-fedora.tar.xz