gba/README.md
Lokathor fd3a308e8a
remove proc macro usage and finish out the mmio (#125)
* .

* more updates, much more to do soon.

* hello world works again.

* fix key interrupts.

* remove the old book

* don't forget timers.

* we can just use search, duh.

* cleanup

* more bios

* finished most mmio, finished bios.

* dump some old macros that shouldn't have been pub to begin with.

* Update README.md

* for now, just make this a u16

* timers

* fix hello_world

* timer fix

* docs on timers

* block resetting work ram for now.

* put preserves_flags on bios calls as appropriate

* add a code page 437 tile sheet.

* docs.

* sound :( it's all bad but we'll fix it in 0.5

* move most backup files back into the lib.

* CI might work now?

* fix up non-serial examples.

* oops, gotta check out the repo.

* readme.
2021-04-08 23:57:30 -06:00

3.6 KiB

License:Zlib License:Apache2 License:MIT

ci crates.io docs.rs

  • Built with cargo-make
  • Stability:None

gba

A crate to make GBA programming easy.

Currently we don't have as much documentation as we'd like. If you check out the awesome-gbadev repository they have many resources, though most are oriented towards C.

System Setup

There's a few extra things to install that you just need to do once per system.

Building for the GBA requires Nightly rust, and also uses the build-std feature, so you'll need the rust source available.

rustup install nightly
rustup +nightly component add rust-src

You'll also need the ARM binutils so that you can have the assembler and linker for the ARMv4T architecture. The way to get them varies by platform:

  • Ubuntu and other debian-like linux distros will usually have them in the package manager.
    sudo apt-get install binutils-arm-none-eabi
    
  • With OSX you can get them via homebrew.
    brew install --cask gcc-arm-embedded
    
  • On Windows you can get the installer from ARM's website and run that.
    • Download the GNU Arm Embedded Toolchain
    • When installing the toolchain, make sure to select "Add path to environment variable" during install.
    • You'll have to restart any open command prompts after you so run the installer so that they see the new PATH value.

Finally, rustc itself is only able to make ELF format files. These can be run in emulators, but aren't able to be played on actual hardware. You'll need to convert the ELF file into a GBA rom. There's a cargo-make file in this repository to do this, and it relies on a tool called gbafix to assign the right header data to the ROM when packing it.

cargo install cargo-make
cargo install gbafix

Project Setup

To build a GBA project, you'll want to copy the .cargo/config.toml file from this repo into your own project.

Then use one of the examples as a guide to get started.

When you build your project, cargo will put outputs in the target/thumbv4t-none-eabi/ directory. This includes the debug/ and release/ sub-directories. Your binary will be in there, but it'll be in ELF format. You can run this directly in an emulator such as mGBA if you'd like.

When you're ready to convert your program into a "proper" GBA rom you'll need to run an objcopy to extract just the raw binary data:

arm-none-eabi-objcopy -O binary [RUST_BINARY_NAME] [ROM_NAME].gba

Then you'll need to patch the header data with gbafix

gbafix [ROM_NAME].gba

And you'll be all done!

Contribution

This crate is tri-licensed under Zlib / Apache-2.0 / MIT. Any contributions you submit must be licensed the same.