Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

GameBoy Advance Homebrew Toolchain

GitHub project page
Download latest version

What is this?

This is a CMake based toolchain for GBA development.
CMake is a "project generator" - so this means you can create GBA homebrew games from any CMake compatible IDE or generate a Unix Makefile for your GBA homebrew game for 1-command creation of GBA ROMs.

For example, Visual Studio supports CMake projects, so this toolchain lets you create GBA homebrew games in Visual Studio.

Visual Studio Tutorial

Download Visual Studio: https://visualstudio.microsoft.com/downloads/

When installing Visual Studio remember to select C++ CMake tools for Windows:
cmake-install-2019.png


Download and extract the latest version of gba-toolchain (link at top of this post).

In Visual Studio select File -> Open -> CMake... and navigate to the extracted gba-toolchain folder. Select the CMakeLists.txt file.

CMake will now download the GNU ARM Embedded Toolchain and some optional dependencies - please wait!

In the Solution Explorer, switch to CMake Targets View:
INGIW4s.png


Right click on rom.elf (executable) and select Build. Wait for the ROM to be built.

In your gba-toolchain folder, navigate into out\build\Debug and you'll see your ROM built as "rom.gba" - open this in a GBA emulator.

Coding for GBA in Visual Studio

Switch back out of CMake Targets View and open the source folder - this is where the code will live. At the moment a default main.cpp exists here.

If you add any new source files you will need to switch back to CMake Targets View, right click on GameBoyAdvance Project and select Generate Cache to re-detect the source files:
vnMVSRy.png


Debugging GBA code in Visual Studio

Install the mGBA emulator: https://mgba.io/

Add the path to your mGBA install directory as an Environment variables called MGBA, close and re-open Visual Studio for this variable to be recognised.

Now back in Visual Studio, right-click on the top level folder in the Solution Explorer and you'll see the Run mGBA [...] options. Run the ROM with the GDB Server - this launches mGBA and pauses it for a debugger to attach.

To connect the debugger, select the Remote Debug option in the run menu:
vvEVnqH.png


Click the green play button and the debugger will connect. Ironically the debugger is a bit buggy, so in mGBA reset the emulation (Ctrl R) and then everything should be settled. You can now place breakpoints in Visual Studio and use the standard debugging features.

Extra

If you have GCC installed on your system then the ROM fixing utility will be compiled during the dependency downloading phase and the ROMs produced can run on actual GBA hardware.

If you have LLVM installed on your system then any C/C++ files will compile with clang/clang++ (tends to produce better code for GBA).

My gbaplusplus project is included, however it requires some bleeding edge C++ stuff so likely won't work for now. I'm going to fix it up so it will be usable and then GBA games can be made easily.

Handy links

Everything GBA: http://problemkaputt.de/gbatek.htm
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top