---
title: Using GCC with MinGW for the GeMRTOS Windows Simulation
description: "GeMRTOS ships a **Windows simulation layer** that runs the same kernel sources as the FPGA target, so you can explore the API, the scheduling behaviour and the example catalogue without a board. Building it on Windows needs GCC from MSYS2…"
url: "https://rcayssials.hopto.org/gemrtosdocs/using-gcc-with-mingw/"
updated: "2026-08-12"
category: General
---

# Using GCC with MinGW for the GeMRTOS Windows Simulation

GeMRTOS ships a **Windows simulation layer** that runs the same kernel sources as the FPGA target, so you can explore the API, the scheduling behaviour and the example catalogue without a board. Building it on Windows needs GCC from MSYS2 — and it needs the **32-bit** toolchain specifically.

**This is the step most often gotten wrong.** The general MinGW instructions you will find elsewhere install the 64-bit compiler (`mingw-w64-x86_64-gcc`) and use the *MINGW64* environment. GeMRTOS's supplied build scripts require `C:\msys64\mingw32\bin\gcc.exe` and the *MINGW32* environment. If you install only the 64-bit package, the build stops before it starts.

### Install MSYS2 and the 32-bit GCC

1. Download and install **MSYS2** from [msys2.org](https://www.msys2.org/). Accept the default location, `C:\msys64` — the GeMRTOS scripts look there.
2. Open the **MSYS2 MINGW32** terminal from the Start menu. Not MINGW64, and not the plain MSYS terminal.
3. Install the 32-bit compiler and make:
   ```
   pacman -S mingw-w64-i686-gcc make
   ```
4. Confirm what you actually installed:
   ```
   gcc -dumpmachine
   # expected: i686-w64-mingw32
   ```
    If this prints `x86_64-w64-mingw32`, you are in the MINGW64 terminal. Close it and open MINGW32.

### Build and run the tests

From the project root, `tests\run_tests.bat` sets up the MINGW32 environment for you and invokes `make`. It checks for `C:\msys64\mingw32\bin\gcc.exe` first and tells you exactly which package to install if it is missing, so it is the quickest way to confirm your toolchain is correct.

A healthy run ends with a per-binary summary and a final pass line. If the compiler is wrong, you will see the missing-GCC message instead of compiler errors — the script fails early on purpose rather than producing confusing link failures later.

### Optional: Visual Studio Code

If you prefer an editor with debugging, install [Visual Studio Code](https://code.visualstudio.com/download) and its **C/C++** extension, then add `C:\msys64\mingw32\bin` to your `PATH` so the extension finds the same compiler the build scripts use. Microsoft's [Using GCC with MinGW](https://code.visualstudio.com/docs/cpp/config-mingw) guide covers the editor setup — but follow the package and environment names above rather than the 64-bit ones in that guide.

Adding `mingw32\bin` to `PATH` is only needed for the editor. The GeMRTOS build scripts locate the compiler themselves.
