Host EnvironmentI'm using Ubuntu Linux 8.04 for my host environment. It's free software, and I find it very useful and convenient for software development. Microsoft Windows is another common host environment for Game Boy Advance development. Because I do not use it for development, I won't comment on it any further.
ToolchainA toolchain is a set of the software tools that translate source code and binary resource files (graphics, sounds, etc) into a form that can be used by the Game Boy Advance. This usable form is commonly called a ROM, and often ends with the extension ".gba". devkitPro is the most advanced toolchain available for Game Boy Advance development. devkitPro for Linux is available for download from SourceForge, a popular site for open source and free software. The following table will help you obtain the toolchain packages you will need for Game Boy Advance development:
NOTE: I've included the Nintendo DS (nds) libraries and examples, because that is today's most common hardware for playing Game Boy Advance games; Slot 2 on the Nintendo DS. Also, after I master Game Boy Advance development, I plan to leverage this into Nintendo DS development. As I understand it, the hardware and concepts involved are quite similar.
NOTE: I've indicated the source packages of the libraries libgba and libnds. Compiling them is an important step that confirms the toolchain has been installed properly. If you can't compile the libraries from source, you probably won't be able to compile a program for the Game Boy Advance either. Better to work out the problems now, as it will save you lots of trouble later.
Toolchain InstallationOnce you've downloaded the packages, it's time to install them. Although it's possible to make the toolchain available to every user on the system, I am the only user on my system. So, to save myself the hassle, I just install them in my home directory.
TODO: Add instructions for installing the toolchain for the system instead of just one user.In order to use the script I've provided below, you'll need to save the packages to your home directory (~).
#!/bin/bash # install-devkitPro.sh cd ~ mkdir devkitPro cd devkitPro tar xjf ~/devkitARM_r23b-i686-linux.tar.bz2 mkdir examples cd examples mkdir gba cd gba tar xjf ~/gba-examples-20060718.tar.bz2 cd .. mkdir nds cd nds tar xjf ~/nds-examples-20080427.tar.bz2 cd .. cd .. mkdir libgba cd libgba tar xjf ~/libgba-src-20060720.tar.bz2 cd .. mkdir libnds cd libnds tar xjf ~/libnds-src-20071023.tar.bz2 cd ~ echo "DONE: devkitPro installed! Be sure to modify ~/.bashrc and ~/.gnomerc"
CAVEAT: Some people have warned against using graphical tools to unpack the packages, as they don't preserve the structure properly. If you don't use the script above, you may want to consider still using the command line for this task.When the script is finished, you should have a structure similar to the one in the devkitPro wiki: ~/.bashrc and ~/.gnomerc
You may need to create the file ~/.gnomerc. On my Ubuntu system, it didn't exist by default.
# define variables for devkitPro export DEVKITPRO=$HOME/devkitPro export DEVKITARM=$DEVKITPRO/devkitARM
Library CompilationHere is the litmus test. Assuming the toolchain has been installed properly, you should now be able to compile the libraries libgba and libnds from the source packages. Change into the ~/devkitPro/libgba directory and issue the following command:
make && make installIt should run through a compilation sequence and end with a list of files installed to the ~/devkitPro/libgba directory. If it did, congratulations; you have a working Game Boy Advance development toolchain at your disposal! At your option, you may also compile the libnds library.
Example CompilationWith the libraries fully compiled, you should be able to compile the Game Boy Advance examples as well. Change into the ~/devkitPro/examples/gba directory and issue the following command:
makeIt should recursively compile all of the examples.
CAVEAT: Some of the examples do not compile properly for me. /gba/audio/ApexAudio and /gba/audio/Krawall do not compile properly. I don't know why yet.
EmulatorIn order to test your programs for the Game Boy Advance, it is necessary to run them. The host environment has no direct support for running Game Boy Advance programs, so most developers use an emulator. An emulator is itself a program, designed to mimic the hardware and software of the Game Boy Advance. Your host environment runs the emulator, and the emulator runs your program in ROM format, allowing you to test it.
Visual Boy AdvanceVisual Boy Advance is the most comprehensive and stable emulator for the Game Boy Advance as of this writing. On Ubuntu Linux, it is easy to install Visual Boy Advance with the following command:
sudo apt-get install visualboyadvance-gtkThe emulator can then be run from the command line with the following command:
gvba [optional-rom]If the path to a ROM file is provided on the command-line, Visual Boy Advance will automatically load and execute the ROM when it starts. Otherwise, you can use the GUI menus to find and open the ROM file you want to run.
CAVEAT: Very few emulators are 100% perfect, and Visual Boy Advance is no exception. If you plan to run your program on a Game Boy Advance, you will need to test on a Game Boy Advance. The emulator is quick and convenient for development, but it is not a substitute for testing on the actual hardware.
Integrated Development Environment (IDE)An Integrated Development Environment (IDE) is a program software developers use to create software. Technically, any text editor can be used to create source code files. However, an IDE usually provides tools that highlight mistakes, allow you to browse the source code, and even automate some simple repetitive programming tasks.
NetBeans 6.0.1I was able to get the devkitARM toolchain working from NetBeans 6.0.1. On Ubuntu Linux, it is easy to install NetBeans with the following command:
sudo apt-get install netbeansAfter this you need to install C/C++ development support. The commands are: Tools | PlugIns (menu), Available Plugins (tab), C/C++ (checkbox). The rest is just clicking Next until it decides to install.
NetBeans ProjectSetting up a NetBeans project that makes use of the devkitARM toolchain is not difficult. The commands are: File | New Project (menu), Categories: C/C++ (list), Projects: C/C++ Project From Existing Code, Browse... (button), Find the Makefile for your project. The rest is just clicking Next until it creates the project.
TIP: The examples installed to $DEVKITPRO/examples/gba/ can be made into NetBeans projects this way.
TIP: John Philpott wrote to inform me about getting NetBeans to find devkitPro when launched from GNOME instead of the command line. The modifications to ~/.gnomerc enable this, so if you want NetBeans to know where to find devkitPro, it is important to create this file.
TODO: Figure out how to get NetBeans to launch the emulator with the ROM built by the project.
DocumentationThe second most important thing for development is documentation. Tutorials teach you what you need to know. Reference documents allow you to leverage that knowledge into working programs. Here is a list of sites I've found with very useful documentation:
CommunityThe most important thing for development is community. Here is a list of sites where you can discuss Game Boy Advance development:
TIP: Use the right forum. devkitpro.org supports the devkitPro toolchain. gbadev.org is a community of people who develop for the Game Boy Advance and Nintendo DS.
CAVEAT: The toolchain is provided to you for free by the generosity of the community. Participation in the gbadev.org community is voluntary. Strolling in with an arrogant attitude and/or ordering people to fix things for you is a faux pas and unlikely to work out as you hope. Likewise, discussion of methods for making illegal copies of commercial games or how to locate an illegal copy of the Official Nintendo SDK, is likely to get you banned. These forums are an invaluable resource to beginners and experts alike. Don't abuse it, ever.