linux

To be able to compile the cross-compiler toolchain, some extra packages are required. These packages can be installed under Ubuntu 24.04 LTS by opening a terminal and type:

sudo apt install gcc guile-3.0 libgmp-dev libmpfr-dev libmpc-dev zlib1g-dev build-essential texinfo git

For other linux distributions please look-up the equivalent packages.

Building the cross-compile tool-chain

After having installed the above packages we can download the sources for the cross-compile tool-chain by typing in a terminal:

git clone https://github.com/EPFL-LAP/or1kToolchain.git

We can now download the required packages by:

cd or1kToolchain/gnu_src
wget ftp.gnu.org/gnu/binutils/binutils-2.44.tar.bz2
wget mirror.koddos.net/gcc/releases/gcc-15.1.0/gcc-15.1.0.tar.gz
git clone git://sourceware.org/git/cgen.git

Finally we can build the tool-chain by:

cd ../patch
sudo ./compile_linux.sh

Note

Compiling the cross-compiler tool-chain takes a long time.

To be able to use the tool-chain we have to add it to the PATH-variable. Open your .bashrc-file with your favorit editor and add at the end:

export PATH=/opt/or1k_toolchain/bin:$PATH

To check that all is okay, open a new terminal and type:

or1k-elf-gcc --version

The output should be:

or1k-elf-gcc (GCC) 15.1.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The convert_or32 utility

For the virtual prototype we require the utility convert_or32. To build this utility type in the terminal that you used to compile the cross-compile tool-chain:

cd ../convert_or32
gcc -O2 -o convert_or32 read_elf.c convert_or32.c
sudo mv convert_or32 /opt/or1k_toolchain/bin/

You are now completely set-up.