All Projects → rust-console → min-gba

rust-console / min-gba

Licence: other
A minimal setup to build Rust into a GBA ROM.

Programming Languages

rust
11053 projects
assembly
5116 projects

min-gba

A minimal setup to build Rust into a GBA ROM.

This crate is not for general use!

If you'd like to program a GBA game try the gba crate. The point of this repo is just to ensure that crater runs which break the thumbv4t-none-eabi target get caught.

What's Needed

  • rustup default nightly (or run all commands with cargo +nightly)
  • rustup component add rust-src
  • arm-none-eabi binutils (either via The ARM Website, or your linux package manager).
  • The following files:
    • .cargo/config.toml
    • src/rsrt0.S
    • linker_script.ld
    • build.rs

Rust Analyzer

It'll go nuts, here's how you fix it:

.vscode/settings.json:

{
  "rust-analyzer.checkOnSave.allTargets": false,
  "rust-analyzer.checkOnSave.extraArgs": [
    "--lib"
  ]
}

Final ROM

What you get with the project setup is an executable ELF file, but mgba can run it directly, so that's fine.

For a finalized ROM there's some post-processing steps:

  • objcopy must be used to extact just the binary guts from the ELF file.

    • The command you want is probably something like this (change main to your binary's own name):
    • arm-none-eabi-objcopy -O binary target/thumbv4t-none-eabi/release/main target/main.gba
  • gbafix should be used to apply the correct header.

    • You can get a Rust version of gbafix via cargo: cargo install gbafix
    • You can also get the C version of gbafix from the DevKitPro folks.
    • Either way, gbafix main.gba will ensure that the gba file has the correct header info.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].