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. in a windows terminal.

We will be using make. To install it open an MSYS2 MSYS terminal. In this terminal execute following command:

pacman -S make

To be able to use MSYS2 in a windows terminal we have to add it to the %PATH% variable. To do so:

  1. type <windows>-i, following window should appear:

windows system

  1. scroll down to the bottom and click on About, following window should appear:

windows system

  1. click on Advanced system settings, following window should appear:

windows system

  1. click on Environment Variables…, following window should appear:

windows system

  1. under system variables scroll down such that you can see the entry Path. Click on this entry, and click on the Edit… button, following window should appear:

windows system

  1. Click on New and type in here: C:\msys64\usr\bin\

  2. Click on OK

To test if your set-up is okay, open a terminal and type make. Your output should look like this:

make: *** No targets specified and no makefile found.   Stop.

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

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.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
./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. To do so follow the points 1..5 under Installing MSYS2 above. You should now see following window:

windows system

  1. Click on New and type in here: C:\msys64\opt\or1k_toolchain\bin\

  2. Click on OK

To check that all is okay, open a 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 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.