Windows native
In native windows we can install the cross-compile tool-chain. For this purpose we are going to use MSYS2. If you already have set-up MSYS2 you can continue with Building the cross-compile tool-chain.
Installing MSYS2
Download and install MSYS2 from the official website. It’s recommended to not change the default installation path, as this guide will assume that MSYS2 is installed in the default directory: C:\msys64.
Note
MSYS2 is used to provide commands such as mkdir, ls, etc.
Building the cross-compile tool-chain
To be able to build the cross-compile tool-chain, we require some additional packages. To install these packages open an MSYS2 MSYS terminal, and type:
pacman -S git gcc diffutils guile gmp-devel mpfr-devel mpc-devel zlib texinfo patch rsync make
After having installed these packages we can download the sources for the cross-compile tool-chain by typing in the MSYS2 MSYS 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
Finally we can build the tool-chain by:
cd ../patch
./compile_linux.sh
Note
Compiling the cross-compiler tool-chain takes a long time.
Important
The cross-compile tool-chain must be build in a MSYS2 MSYS terminal, in other MSYS2 terminals it will fail to build!
To be able to use the tool-chain we have to add it to the %PATH%-variable. open a MSYS2 MSYS terminal and type:
echo "export PATH=/opt/or1k_toolchain/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
To check that all is okay, open a MSYS2 MSYS 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 above MSYS2 MSYS terminal:
cd ../convert_or32
gcc -O2 -o convert_or32 read_elf.c convert_or32.c
mv convert_or32.exe /opt/or1k_toolchain/bin/
You are now completely set-up.