II. How to execute GBA compiled file.

Last change : 20/02/2002

Because the GBA and the PC are not compatible, we will not be able to test our compiled GBA file directly on the PC. To resolve this trouble, we have four way of solutions:

1) Using an Emulator

a- Download

The best emulator is without any doubt VisualBoy Advance , official homepage is: http://vboy.emuhq.com/index.shtml

b- Installation

uncompress it in the directory of your choice.

c- Running

2) The Dumb-Cable (and also the MBV2)

The Dumb-Cable is an home made cable. The only problem is that the PC-transfert-program can only be run under a real DOS window. Furthermore, the transfert doesn't success each time (i've read on internet this cable has 50% of success, my personal work let me has a success of 100% for the file less than 50Kbytes, and 50% for the file around 150 Kbytes). To get the construction instructions and the transfert software you have to follow this link (spanish web site, but interesting pages are posted in English): http://www.godsmaze.org/gba/harware/

The MBV2 cable have to be ordered through Lik-Sang, it cost around 45€ - it is supplied with all necessary sofware. It is more easier to use than the Dumb-Cable, because it works with all the Windows version and has 100% of transfer success. For more information about this product visit this link:
http://www.devrs.com/gba/files/mbv2faqs.php

b- Installation (Dumb-Cable)

And now, we just have to specially compile our program to work on the external RAM of the GBA. On the net this method is called Multiboot Compilation.

c- Multiboot Compilation (Dumb-Cable and MBV2)

The principle is quite simple, we just have to indicate to the linker that the start adress is 0x2000000 (witch is the External RAM start Address), instead of the usual 0x8000000 (witch is the ROM GamePack Address). The compiled file should have the extention ".MB" and not ".BIN" or ".GBA".

Keep in mind, your compiled file have limitation of 256 KBytes (corresponding to the size of the External Gba RAM).

With ARM SDT :

"Compil_MB_ARM_SDT.BAT" :


zarmasm -CPU ARM7TDMI -Littleend boot.asm
zarmcpp.exe -c -Wall -Otime -ansic -fpu none -Littleend -cpu ARM7TDMI -apcs /narrow/noswst main.c -o main.o
zarmlink -bin -first boot.o boot.o main.o -map -ro-base 0x02000000 -rw-base 0x03000000 -o Nom_Prg.mb

With GCC 3.0 :

"Compil_MB_GCC.BAT" :


as -mthumb-interwork -o crt0.o crt0.s

gcc -I C:\gccgba\include -c -g -O2 -mthumb-interwork -Wall -save-temps -fverbose-asm main.c
ld -L C:\gccgba\lib -Ttext 0x02000000 -Tbss 0x03000000 -o Nom_Prg.elf crt0.o main.o -lc -lgcc
objcopy -v -O binary Nom_Prg.elf Nom_Prg.mb

d- How To Use (Dumb-Cable)

- If everything work fine, you should see on your pc screen:
Sending data. Please Wait...
CRC Ok - Done
you can now, disconnect your GBA from the cable.

- If an error occur during the transfert, the pc told you:
Sending data. Please Wait...
CRC Bad ! - Abort
try again the transfert without turning off the power the GBA.

- If you've made a mistake during the conception of your cable, or if it is badly connected to the pc, the message "Sending data. Please Wait..." will not be displayed on the pc screen.

3) The development Cartridge.

a- Where to get:

There are several supplier for the cartridge:

b- Installation

### I don't have the cartridge, i don't know... :(((

c- To allow the compiled file running on a real GBA:

The compiled file can only be run on a real GBA if the CHECKSUM of the cartridge is valid.

For that, we have to use the file "Gbarm.exe" from "GBARM10.ZIP", witch can be downloaded from the "Credo'S Temporary Site".

To validate your rom (compiled file), you have to enter from a DOS prompt:
gbarm.exe -v name_of_file.bin
The file "name_of_file.bin" is modified. A valid checksum is created and written onto this file. You can now program this file on your development cartridge, and see the result on a real GBA.

In this tutorial, the compiled and executable file will have the extension ".GBA" (checksum OK), instead of ".BIN" witch is the extension for fresh compiled file.