Accueil > Outils > Programmation > Pre-compiled RISC-V GNU toolchain and spike

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 550 Mb of disk space). It also contains ANTLR4 and Pyright, for use in the MIF08 and CAP courses.

Ubuntu 20.04 & 20.10

It was generated and tested on Ubuntu 20.04, tested on Ubuntu 20.10, 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/riscv/bin:/opt/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.165

If this works, you can stop reading here.

Uninstallation

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

Documents joints


Valid XHTML 1.0 Transitional
SPIP | | Plan du site | Suivre la vie du site RSS 2.0
Habillage visuel © styleshout sous Licence Creative Commons Attribution 2.5 License