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

  1. Verify Zephyr support — Ensure your target MCU is supported by Zephyr.
  2. Implement linkLayer — Create a new linkLayer implementation in /src/layers/linkLayer_.c for your MCU’s PIO or GPIO capabilities.
  3. Provide a master clock — Implement a timing source for the link protocol’s bit-level requirements.
  4. Add board definition — Create a board entry in boards/ with correct pin mappings.
  5. Update device tree — Add bindings in dts/bindings/ if needed.

MCU-specific code

The only MCU-specific implementation resides in:

src/layers/linkLayer_.c

This 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.svd
  • STM32F0x0.svd
  • STM32G071.svd

These are useful for debugging and IDE integration.

Testing

After porting:

  1. Build with west build -b <your_board>
  2. Verify USB enumeration and WebUSB landing page
  3. Test each operating mode (GBA Link, GB Link, Printer, etc.)
  4. 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.