macOS
Before installing the cross-compile tool-chain make sure that your MAC is up to date.
Important
If you have installed MACPorts, uninstall it as it will break compilation!
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:
chsh -s /bin/bash
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install gcc mpc texinfo git wget guile gnu-sed
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_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.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.