macOS
Before installing the cross-compile tool-chain make sure that your MAC is up to date.
Important
This description is based on MacPort, the same thing can also be done with Homebrew.
If you have not done so, install MacPort. The install instructions can be found here.
To be able to compile the cross-compiler toolchain, some extra packages are required. These packages can be installed by opening a terminal and type:
sudo port install gcc15 git wget guile-2.2 gsed
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.45.tar.bz2
wget mirror.koddos.net/gcc/releases/gcc-15.2.0/gcc-15.2.0.tar.gz
git clone git://sourceware.org/git/cgen.git
Important
Before building the tool-chain we have to make sure that we use the port version of gcc, g++ and sed.
To use the port version of gcc, g++ and sed we can do following in the terminal:
sudo su
cd /opt/local/bin
ln -s g++-mp-15 g++
ln -s gcc-mp-15 gcc
ln -s gsed sed
exit
export PATH=/opt/local/bin:$PATH
To control that everything is set-up correctly type om the terminal:
gcc --version
The result should be:
gcc (MacPorts gcc15 15.1.0_3+stdlib_flag) 15.1.0
Finally we can build the tool-chain by:
cd ../patch
sudo ./compile_mac.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 /etc/paths-file with sudo in your favorite editor and add at the end:
/opt/or1k_toolchain/bin
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.2.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.