How team-resurgent/modxo works
Purpose and runtime
Modxo is bare-metal C firmware that makes RP2040/RP2350 boards behave as an Original Xbox LPC peripheral. It serves BIOS data and exposes optional LPC-addressable peripherals. The firmware runs on Raspberry Pi Pico SDK targets, with board-selected GPIO pinouts and UF2 firmware output.
Paths: src/main.c, modxo/modxo.c, external/pico-sdk
Build and board specialization
The root CMake project imports the Pico SDK and composes the core firmware plus modular peripherals. Board CMake definitions select supported physical pin mappings, including Pico, Pico 2, RP2040 Zero/Tiny, XIAO, and other variants. Generated pinout headers isolate board wiring from protocol logic.
Paths: CMakeLists.txt, pico_sdk_import.cmake, boards/modxo_pinout.h.in
Firmware entry and core coordination
src/main.c is the application entry point. The core Modxo layer owns initialization and shared firmware-facing definitions, while its queue provides deferred/event-style coordination between timing-sensitive LPC activity and higher-level module work.
Paths: src/main.c, modxo/modxo.c, modxo/modxo_queue.c
LPC transport boundary
The LPC subsystem is the hardware/protocol boundary to the Xbox. It implements the LPC interface, register-level protocol handling, and transaction logging. Its CMake input template indicates generated/compiled LPC communication configuration. This layer converts bus activity into normalized requests for feature modules.
Paths: modxo/lpc/lpc_interface.c, modxo/lpc/lpc_regs.c, modxo/lpc/lpc_log.c
LPC request routing and emulated devices
lpc_mapper is the central dispatch layer for LPC-visible address/function mappings. Handlers implement BIOS flash access, expansion I²C, heap/PSRAM or internal RAM mappings, random data, SD-card access/configuration, and echo behavior. This is the main extensibility boundary: new Xbox-visible services belong as mapper handlers rather than in LPC transport.
Paths: modxo_modules/lpc_mapper/lpc_mapper.c, modxo_modules/lpc_mapper/handlers/flash.c, modxo_modules/lpc_mapper/handlers/sdcard.c
Persistent BIOS/configuration storage
The flash-ROM module provides the BIOS-image-facing storage service exposed through the mapper. Separately, configuration NVM persists firmware configuration, allowing runtime state to remain independent of the flashed executable and LPC transaction engine.
Paths: modxo_modules/flashrom/flashrom.c, modxo/config/config_nvm.c, modxo/include/modxo/config_nvm.h
Peripheral integrations
Optional hardware services include an I²C expansion interface, HD44780-style legacy display support, WS2812 LEDs, serial IRQ, and an LPC Super I/O implementation with 16550 UART support. These modules bridge LPC-side software expectations to RP2040 peripherals and PIO programs where timing requires it.
Paths: modxo/expansion_i2c/expansion_i2c.c, modxo_modules/superio/LPC47M152.c, modxo_modules/serirq/serirq.pio.in
SD-card stack and delivery infrastructure
An embedded SD/FAT stack supports SPI and RP2040 SDIO card transports, DMA, and FatFs-backed file access; it is consumed through the mapper rather than being the firmware entry path. Docker and GitHub Actions provide build/bundle automation, though the primary SDK dependency is the Pico SDK submodule.
Paths: modxo/sdcard/src/sd_driver/sd_card.c, modxo/sdcard/src/ff15/source/ff.c, Dockerfile
Main entry points: lpc_interface.c LPC interface · lpc_mapper.c LPC mapper · modxo.c Modxo core · CMakeLists.txt CMake build
Components 20
Build & Boards
- CMake build · Composes firmware modules and UF2 targets.
CMakeLists.txt - Pico SDK
external/pico-sdk - Generated pinouts · Board-specific GPIO mappings are generated separately from protocol logic.
boards/modxo_pinout.h.in - Container build
Dockerfile
Firmware Runtime
- Firmware entry
src/main.c - Modxo core · Owns shared initialization and firmware-facing definitions.
modxo/modxo.c - Deferred work queue · Decouples timing-sensitive LPC work from higher-level modules.
modxo/modxo_queue.c
LPC Boundary
- LPC interface · Xbox LPC hardware and protocol boundary.
modxo/lpc/lpc_interface.c - LPC registers
modxo/lpc/lpc_regs.c - LPC transaction log
modxo/lpc/lpc_log.c
LPC Services
- LPC mapper · Central extensibility boundary for Xbox-visible mappings.
modxo_modules/lpc_mapper/lpc_mapper.c - Flash handler
modxo_modules/lpc_mapper/handlers/flash.c - SD-card handler
modxo_modules/lpc_mapper/handlers/sdcard.c - Expansion I²C
modxo/expansion_i2c/expansion_i2c.c - Super I/O / UART · LPC Super I/O implementation with 16550 UART support.
modxo_modules/superio/LPC47M152.c - Serial IRQ PIO
modxo_modules/serirq/serirq.pio.in
Storage
- BIOS flash ROM
modxo_modules/flashrom/flashrom.c - Configuration NVM · Persists firmware state independently of executable and LPC engine.
modxo/config/config_nvm.c - SD transport
modxo/sdcard/src/sd_driver/sd_card.c - FatFs
modxo/sdcard/src/ff15/source/ff.c
Connections 21
- CMake build → Pico SDK: imports
- CMake build → Generated pinouts: generates
- CMake build → Firmware entry: builds
- Container build → CMake build: automates build
- Firmware entry → Modxo core: initializes
- Modxo core → Deferred work queue: coordinates via
- Modxo core → LPC interface: starts
- Generated pinouts → LPC interface: supplies GPIO mapping
- LPC interface → LPC registers: handles protocol registers
- LPC interface → LPC transaction log: records transactions
- LPC interface → LPC mapper: normalizes requests
- LPC interface → Deferred work queue: defers work
- LPC mapper → Flash handler: dispatches
- LPC mapper → SD-card handler: dispatches
- Flash handler → BIOS flash ROM: accesses BIOS data
- SD-card handler → SD transport: accesses card
- SD transport → FatFs: provides block transport
- LPC mapper → Expansion I²C: exposes
- LPC mapper → Super I/O / UART: exposes
- Super I/O / UART → Serial IRQ PIO: uses IRQ signaling
- Modxo core → Configuration NVM: loads and persists config