Skip to content

RP2040 (Raspberry Pi Pico) firmware that manages a Wildbits/Foenix FPGA

License

Notifications You must be signed in to change notification settings

wildbitscomputing/fpga-manager

Repository files navigation

fpga_mgr

RP2040 (Raspberry Pi Pico) firmware that programs a Wildbits/Foenix FPGA from an SD card, with an optional fallback to preloaded LZ4 images stored in flash.

What it does

  • Reads a 2-bit context DIP switch to select one of four FPGA slots.
  • Attempts SD card programming first (LZ4 blocks, gzip, then raw .bin).
  • Falls back to LZ4 images stored in fixed flash slots if SD is unavailable.
  • Prints the chosen method and timing over USB stdio if enabled.

SD card layout

The loader looks for these base paths (it tries .lz4, then .gz, then raw):

  • CNTX1/CFP95600C.bin
  • CNTX2/CFP95616E.bin
  • CNTX3/f256k2t9.bin
  • CNTX4/foenix138.bin

The .lz4 format is a simple block format generated by tools/mk_lz4_blocks.c (not the LZ4 frame format).

Flash slots

LZ4 blobs can be built into flash at fixed addresses (2 MiB each):

  • Slot 0: 0x10800000
  • Slot 1: 0x10A00000
  • Slot 2: 0x10C00000
  • Slot 3: 0x10E00000

CMakeLists.txt reserves the top 8 MiB for these blobs.

Build

Prereqs:

  • Raspberry Pi Pico SDK
  • CMake + a build tool (Ninja or Make)
  • Python 3 (for UF2 concatenation)
  • picotool (optional, for combined UF2 with FPGA blobs)

Example build:

mkdir -p build
cd build
cmake ..
cmake --build .

Artifacts (in build/):

  • fpga_mgr.uf2 (main firmware)
  • fpga_mgr.elf / fpga_mgr.bin
  • fpga_mgr_with_fpga.uf2 (if picotool + Python are found)

Combined UF2 with FPGA images

If picotool and Python 3 are available, CMake exposes a target that bundles the firmware UF2 with the LZ4 images from fpga/ into one UF2:

cmake --build . --target fpga_mgr_with_fpga_uf2

Tools

  • tools/mk_lz4_blocks.c: converts a raw .bin to the block-based .lz4 format the loader expects.
  • tools/concat_uf2.py: concatenates UF2 files to form a single image.

About

RP2040 (Raspberry Pi Pico) firmware that manages a Wildbits/Foenix FPGA

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages