The Game Boy Advance is a very different piece of hardware from the computers you typically use. It has a different processor architecture, and does not have an operating system. Because of this, programs compiled for other machines cannot run on it. gcc and other compilers you have used are not able to produce code that runs on the GBA by default.
Because of this, we need to use a cross-compiler which is a compiler which generates code for a machine different from the one it is running on. This is a different version of gcc which has been configured to produce GBA code. The instructions below show how to set this up.
Unfortunately, the cross-compiler only works on Linux machines. We could use the cs server for this, but the GBA emulator can not be run on the server. There are three different ways you could get around this problem, depending on your preference:
Using the B13 Lab or another Linux Machine
If you are OK using the B13 lab computers, or if you have your own Linux machine already set up, then you can follow these instructions to compile and run GBA games on these machines.
Using the CPSC 305 Virtual Machine
I created a virtual machine containing a full installation of Linux with the GBA compiler and emulator included. You can then run the virtual Linux machine on your own computer. To take this option, follow this set of instructions.
Using your Windows or Mac Laptop
If you want to use your laptop or other computer, but can't or don't want to use the virtual machine above, then you can compile your code on the cs server, then copy the file over to your local machine, and then run it locally in the emulator. I recommend using the virtual machine instead as this will prove to be a bit of a hassle. If you want to follow this route, you can use this set of instructions.
Copyright © 2022 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.