This is a tutorial on setting up development environment for working with the disassemblies. Please keep in mind that this is simply my way of doing things. There are always going to be different ways of setting things up. I am doing this on Windows but some steps may be similar on other operating systems. This setup should technically work for any console Makefile project that is C/C++ but you will have to make adjustments where necessary. If you have any improvements or suggestions, please let me know.
Download and Install DevkitPro/DevkitARM
The first thing you should do is download DevkitPro to install DevkitARM. It can be downloaded from here. The version shouldn’t matter, but I think I read somewhere that Pokeruby has issues with earlier versions of DevkitARM.
Download and run the installer. I personally install everything except for Programmer’s Notepad. All you should need is what is marked in the screenshot below.
Running through the installer should be straight forward. Once the installation is done, you will just need to make sure it installed properly. The quickest way is to make sure the environment variables are set and that make can be called from a command prompt.
Download and Install Eclipse
Eclipse is a free IDE that actually contains some advanced features. There are many different versions but the one we want is the C/C++ one. Downloads for it can be found here.
Something to keep in mind…
Eclipse actually supports GDB with a plugin. This means we may one day be able to do source level debugging with the disassemblies. Unfortunaley I have not been able to get it fully working yet. It seems that we will have to use Mars Eclipse and to make a custom Makefile. I have decided to tackle this further down the road. I will add it to this tutorial when done.
Download and install the version of Eclipse that you want to use. As long as it is the C/C++ one it should work. There is plenty of documentation out there on installing Eclipse so I won’t cover it here.
Setting up your workspace
Select a folder for your workspace. I tend to use “C:\devkitPro\GBAworkspace” but any location should work. I would recommend having a folder for each console you are going to be working on.
Once you click on “Launch”, you should see the following window. You should uncheck “Always show Welcome at startup”, then click on the icon in the screenshot below or close the welcome view.
Importing a Disassembly
At this point go ahead and download the disassembly you want to use. You can have multiple disassemblies in your workspace, but let’s only use one for now. Once downloaded, extract the disassembly and put it in your workspace folder. If your folder has a different name than what the ROM compiles to I would change to the final ROM name. For example, I am changing “pokeemerald-master” to “pokeemerald” as the ROM compiles to pokeemerald.gba in the end. If you are using Pokeruby or Pokeemerald, don’t forget to copy the tools.
Now let’s open the disassembly in Eclipse. Go to “File – New – Makefile Project with Existing Code”, as seen in the screenshot below.
On the window that opens, Click the browse button and select the folder of your disassembly. When done click finish.
At this point your disassembly is loaded and you can edit files in the IDE.
Setting up Build Targets and compiling the Disassembly
Right click on your disassembly in the Project Explorer and go to Properties.
In the Properties window click on “C/C++ Build” and change the settings to reflect the following screenshot. When done click on the “Apply and Close” button.
Click on the “Build Target” tab on the right of Eclipse. This is where we will create the build targets that let us compile the ROM.
Right click on the disassembly in the “Build Targets” view and clock on the “New” option.
Enter the settings for your build command. It should look similar to the screenshot below. When done, click the “OK” button.
Do the same for any other build targets you may need. An example is a making a build target to clean the project.
Now if you double click on your Build Target it should run.
Your ROM should now be compiled.
Configuring External Tools
You can configure external tools in Eclipse. This makes it so you can launch emulators and other things right from Eclipse. I’ll show you a quick example on how to set up an emulator.
In the menu go to the External Tools Configurations.
In the window that comes up, configure your emulator in a similar fashion as the screenshots below.
You will then be able to launch the tool from the menu. Please note that if you used the file name in the arguments like I did int eh screenshots above, you will need to select the project in the Project Explorer before trying to launch the tool.
Other tools can be configured in a similar matter.