Build instructions
GCC Toolchain
Native build
This chapter refers to building the Tricore cross-compiler directly from the host architecture.
Instructions showed here are tested on Ubuntu 22.04 (see Github Actions script), but should ideally work on other Linux distributions and also MSYS2 Windows environment.
Clone the repository:
git clone --recursive https://github.com/NoMore201/tricore-gcc-toolchain
Install build dependencies:
sudo ./scripts/install-apt-dependencies
Create a temporary build directory and call the configure
script
mkdir build && cd build
../configure --prefix=/path/to/prefix
make -j$(nproc) stamps/build-gcc-stage2
This will build and install everything into /path/to/prefix
.
It is also possible to compile single components of the toolchain. For further information on the available options, refer to configure
script help page and
the Makefile.
MinGW canadian cross build
Sometimes it may be useful to build a cross-compiler from architecture B to architecture C, by performing the build on a third architecture A. The reason is that setting up architecture B for cross-compilation may be not as easy as on architecture A. This is called a canadian cross.
In this case, the idea is to build Win32 tricore-elf-gcc (cross-compiler from
Win32 to tricore-elf
) directly on Linux due to easier setup and the
reproducibility of the environment.
You can see an example of a canadian cross build in the Github Actions script. First clone the toolchain repository:
git clone --recursive https://github.com/NoMore201/tricore-gcc-toolchain
Install build dependencies, including MinGW cross-compiler:
sudo ./scripts/install-apt-dependencies
First we need to build the linux -> tricore cross-compiler. Refer to the Native build chapter on how to do so.
When linux -> tricore cross-compiler is ready, we need to install the newlib also into the final Win32 prefix. To do so, switch to the linux build directory and call make by swapping the prefix variable:
cd build-linux/build-newlib
make install prefix=/path/to/win32-prefix
Now modify PATH
environment variable with the PATH to linux cross-compiler:
export PATH="/path/to/linux-prefix:$PATH"
Finally we configure and build the missing components with the following commands
mkdir build-win32 && cd build-win32
../configure --prefix /path/to/win32-prefix --with-host=x86_64-w64-mingw32
make -j$(nproc) stamps/build-binutils-tc
export PATH="/opt/gcc/linux/bin:$PATH"
make -j$(nproc) stamps/build-gcc-stage2-only
QEMU
Native build
QEMU native build is pretty straightforward. First install dependencies, either manually or by running:
sudo ./scripts/install-apt-dependencies
Note: this will install meson through pip system-wide, since QEMU needs a recent meson version that ubuntu repositories do not have. If you don't want to install system-wide packages through pip, proceed with virtualenv
Once dependencies are installed, proceed with build command:
mkdir build-linux && cd build-linux
../configure --prefix /path/to/linux-prefix
make -j$(nproc) stamps/build-qemu
Cross-compile with MinGW
To cross-compile QEMU for Windows, follow the native build instructions, with the only difference that you need to specify host target to the configure command:
mkdir build-win32 && cd build-win32
../configure --prefix /path/to/win32-prefix --with-host=x86_64-w64-mingw32
make -j$(nproc) stamps/build-qemu