crawfxrd/gba-dev-rs

Embedded Rust development targeting the Nintendo Game Boy Advance

An arm-none-eabi GCC toolchain (e

untitled

.

Dependencies

  • Rust and Cargo
  • An arm-none-eabi GCC toolchain (e.g., devkitARM)
  • mGBA for running the binary

A script is provided to install the dependencies for Fedora and Ubuntu.

./scripts/deps.sh

Why GCC?

GCC is used for compiling the non-Rust code. Assembly must be used to write the ROM header and the master ISR. Any addition ARM functions would also have to be written in assembly or C, as mixing Thumb and ARM states in Rust is unusably inefficient.

GCC is also required for linking the object files into the final ELF binary. rust-lld cannot be used for linking because it will emit a blx instruction for interworking (Ref: arm-blx-v4t.s). This instruction is not available on ARMv4T.

Building

Cargo is configured to run with the ARM7TDMI target thumbv4t-none-eabi.

To make it a GBA ROM file, build in release mode and convert the target from ELF to binary.

cargo build --release
arm-none-eabi-objcopy -O binary target/thumbv4t-none-eabi/release/untitled target/untitled.gba

Running

Cargo is configured to run the target with mGBA, and assumes the binary is called mgba-qt. If the mGBA binary uses a different name (e.g., mgba, mgba-sdl), modify the runner value in .cargo/config.

cargo run --release -- -3

Debugging

Run a debug build with a GDB session. mGBA will wait for a connection on the localhost port 2345.

cargo run -- -g

In another window, attach to the session. The file .gdbinit specifies the binary to load debug symbols from and the remote target. GDB must be configured to allow loading this file (local-gdbinit, safe-path).

gdb -q -iex "set auto-load safe-path ."
0x00000000 in ?? ()
(gdb) c
Continuing.

Resources

  • AGB Programming Manual v1.1
  • GBATEK
  • TONC

Information - Updated Aug 03, 2022

Stars: 10
Forks: 0
Issues: 0

rust_embedded_starter

Boilerplate für Embedded Entwicklung mit Rust mit Flash und Debug automatik

rust_embedded_starter

Embedded rust HAL (hardware abstraction layer) for the STM32WL

This is a work in progress, it is unstable, incomplete, and (mostly) untested

Embedded rust HAL (hardware abstraction layer) for the STM32WL

Embedded Rust Template

This template is based on stm32f4xx-hal

Embedded Rust Template

A Rust embedded-hal HAL for all MCUs in the STM32 F7 family

This crate is largely inspired by the awesome work done here:

A Rust embedded-hal HAL for all MCUs in the STM32 F7 family

embedded-rust-H2AL

Hardware abstraction layer - abstraction layer

embedded-rust-H2AL

cargo-pio = Cargo + PlatformIO

Build Rust embedded projects with PlatformIO!

cargo-pio = Cargo + PlatformIO

Embedded rust HAL (hardware abstraction layer) for the STM32WL series

This is still in development, the code that exists today covers basic usage of:

Embedded rust HAL (hardware abstraction layer) for the STM32WL series

Microchip MCP4725 DAC Driver for Rust Embedded HAL

This is a driver crate for embedded Rust

Microchip MCP4725 DAC Driver for Rust Embedded HAL

Rust Embedded HAL for Apache NuttX RTOS

This crate provides Rust Embedded HAL interfaces (GPIO, I2C, SPI and Delay) for Apache NuttX RTOS

Rust Embedded HAL for Apache NuttX RTOS

Using Rust to turn on an LED on the NUCLEO-F446RE by pressing a button

This example is mainly copied from the great Rust Embedded Embedded Rust: From Zero to Blinky

Using Rust to turn on an LED on the NUCLEO-F446RE by pressing a button
Facebook Instagram Twitter GitHub Dribbble
Privacy