Coder Social home page Coder Social logo

gba's Introduction

License:Zlib License:Apache2 License:MIT

ci crates.io docs.rs

  • 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.

gba's People

Contributors

bors[bot] avatar dhs92 avatar eevee avatar felixjones avatar hpmason avatar ketsuban avatar lokathor avatar lymia avatar mattlgy avatar mogenson avatar nicopap avatar npars avatar parasyte avatar ruin0x11 avatar shadlock0133 avatar shinysaana avatar sp00ph avatar sphinxc0re avatar traviscibot avatar zesterer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.