MCPcopy Index your code
hub / github.com/adamgreig/ffp

github.com/adamgreig/ffp @v1.3.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3.2 ↗ · + Follow
457 symbols 1,044 edges 29 files 164 documented · 36% updated 5y agov1.3.2 · 2020-07-24★ 728 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

FFP: Flash/FPGA Programmer

FFP is a dead-simple USB to bidirectional SPI bridge for programming iCE40 FPGAs and SPI flashes. The hardware is an STM32F042 and not much else. Firmware and host software is written in Rust.

The firmware additionally supports SWD via the CMSIS-DAP v1 and v2 protocols, so many debuggers such as probe-rs, OpenOCD, and pyOCD are able to use an FFP to debug and program Cortex-M and other microcontrollers.

Photo of FFP PCB

See software/ for the host-side software, firmware/ for the embedded device firmware, and hardware/ for the hardware design files.

Pinout

The FFP r1 hardware uses a 5x2 pin 0.05"-pitch connector, which is also commonly used for Cortex family microcontrollers for SWD and JTAG. The pinout is deliberately compatible (though note RESET is moved) to allow hardware reuse and for compatibility with tools such as TagConnect cables.

          ______
    3v3 --|1  2|-- FLASH DI / FPGA DO / SWDIO
    GND --|3  4|-- CLK / SWCLK
    GND --|5  6|-- CS / SWO
        x-|7  8|-- FPGA nRST
    GND --|9 10|-- FLASH DO / FPGA DI / nRESET
          ------

This is the same pinout used by amp_flashprog, a custom firmware for Black Magic Probes to bitbang SPI to the same ends.

Licence

Software and firmware is licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Hardware design files are licensed under the Creative Commons Attribution license (CC-BY).

Extension points exported contracts — how you extend this code

ToBytes (Interface)
Trait for structs which can be safely cast to &[u8]. Traits implementing ToBytes must be repr(packed). [7 implementers]
firmware/src/hal/usb/packets.rs
Endpoint (Interface)
(no doc) [5 implementers]
firmware/src/hal/usb/mod.rs
CheckResult (Interface)
(no doc) [1 implementers]
firmware/src/dap.rs

Core symbols most depended-on inside this repo

len
called by 42
firmware/src/hal/usb/packets.rs
write_u8
called by 23
firmware/src/dap.rs
set_mode_input
called by 22
firmware/src/hal/gpio.rs
next_u8
called by 18
firmware/src/dap.rs
write_ok
called by 15
firmware/src/dap.rs
stall
called by 14
firmware/src/hal/usb/control_endpoint.rs
set
called by 12
software/src/programmer.rs
to_bytes
called by 11
firmware/src/hal/usb/packets.rs

Shape

Method 368
Class 41
Enum 31
Function 14
Interface 3

Languages

Rust89%
Python11%

Modules by API surface

firmware/src/dap.rs56 symbols
scripts/prog.py50 symbols
firmware/src/hal/gpio.rs48 symbols
software/src/flash.rs30 symbols
firmware/src/hal/usb/packets.rs29 symbols
firmware/src/swd.rs28 symbols
firmware/src/hal/usb/mod.rs26 symbols
software/src/programmer.rs24 symbols
firmware/src/hal/spi.rs23 symbols
firmware/src/hal/usb/control_endpoint.rs22 symbols
firmware/src/hal/flash.rs13 symbols
firmware/src/hal/usb/swo_endpoint.rs11 symbols

For agents

$ claude mcp add ffp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page