Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pret/pokeemerald/llms.txt

Use this file to discover all available pages before exploring further.

Default build

From the pokeemerald directory, run:
make
If the build succeeds, pokeemerald.gba will be produced in the project folder.
The default build uses agbcc — the custom GBA C compiler originally used by Game Freak — which is required to produce output that is byte-identical to the original retail ROM. The modern build (described below) uses the system arm-none-eabi-gcc and produces a functionally equivalent but not byte-identical ROM.

Parallel builds

Building with multiple CPU cores significantly reduces compile times. First, get your core count:
nproc
Then pass that number to make -j:
make -j4
Replace 4 with the number returned by your core-count command.

Verify against the original

To confirm your build is byte-identical to the original Pokémon Emerald ROM, run:
make compare
If it matches, you will see:
pokeemerald.gba: OK
If there are any differences from the original, you will instead see:
pokeemerald.gba: FAILED
shasum: WARNING: 1 computed checksum did NOT match

Modern compiler build

This project also supports the arm-none-eabi-gcc compiler included with devkitARM. If devkitARM is installed, run:
make modern
This produces pokeemerald_modern.gba. Build output is placed in build/modern/ instead of build/emerald/.

Debug build

To build with debug symbols under a modern toolchain:
make modern DINFO=1
This produces pokeemerald_modern.elf with full debug symbols attached. Debug symbols are included by default in non-modern builds without needing DINFO=1.

Custom toolchain

To build using a toolchain other than devkitARM, override the TOOLCHAIN variable with the path to your toolchain. The path must contain a bin/ subdirectory:
make TOOLCHAIN="/path/to/toolchain"
For example:
make TOOLCHAIN="/usr/local/arm-none-eabi"
To use a custom toolchain for the modern target, the toolchain directory must also contain lib/, include/, and arm-none-eabi/ subdirectories.

Build output

DirectoryContents
build/emerald/Object files for the default (agbcc) build
build/modern/Object files for the modern (arm-none-eabi-gcc) build

Switching terminals on Windows

If you switch terminals between builds (for example, from msys2 to WSL1), you must run the following command once before any subsequent make invocations:
make clean-tools
Failing to do this after switching terminals may result in build errors caused by incompatible tool binaries.

Preserving intermediate files

By default, intermediate files (.i preprocessed sources and .s assembly files) are deleted after compilation. To keep them for inspection, set KEEP_TEMPS=1:
make KEEP_TEMPS=1
Intermediate files will be written alongside the object files in the build/ directory.