Porting to Other MCUs
The GB-Link firmware is designed to be largely MCU-agnostic thanks to Zephyr RTOS. The original Celio project targeted STM32F07; migrating to RP2040 required only minimal to moderate effort.
Porting steps
- Verify Zephyr support — Ensure your target MCU is supported by Zephyr.
- Implement
linkLayer— Create a newlinkLayerimplementation in/src/layers/linkLayer_.cfor your MCU’s PIO or GPIO capabilities. - Provide a master clock — Implement a timing source for the link protocol’s bit-level requirements.
- Add board definition — Create a board entry in
boards/with correct pin mappings. - Update device tree — Add bindings in
dts/bindings/if needed.
MCU-specific code
The only MCU-specific implementation resides in:
src/layers/linkLayer_.cThis file implements the low-level bit-layer handling of the Game Boy link protocol. Everything else — USB communication, mode management, LED control — is shared across targets.
Pin requirements
Your target MCU needs:
- At least 4 GPIO pins for SCK, SIN, SOUT, SD (plus a second SD pin for GBC cable auto-detection)
- 2 GPIO pins for voltage selection (3.3V / 5V)
- 1 GPIO pin for WS2812 LED (optional)
- Hardware support for precise timing (PIO preferred, as on RP2040)
See Hardware & Wiring for the RP2040 reference pinout.
Reference SVD files
The repository includes SVD files for supported MCUs:
RP2040.svdSTM32F0x0.svdSTM32G071.svd
These are useful for debugging and IDE integration.
Testing
After porting:
- Build with
west build -b <your_board> - Verify USB enumeration and WebUSB landing page
- Test each operating mode (GBA Link, GB Link, Printer, etc.)
- Run host tests in
tests/host/
Historical note
Zephyr’s hardware abstraction made the STM32F07 → RP2040 migration straightforward. A similar approach should work for other Zephyr-supported MCUs with adequate GPIO timing capabilities.