# raspberrypi/debugprobe architecture

> Architecture diagram of the GitHub repository raspberrypi/debugprobe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raspberrypi/debugprobe
- Repository: https://github.com/raspberrypi/debugprobe

## Overview

Debugprobe is firmware for a Raspberry Pi SWD/UART debug accessory, also usable on Pico boards. A host sends CMSIS-DAP commands over USB; firmware dispatches debug operations to target-facing SWD/JTAG support, while a separate CDC UART path carries serial traffic and supports optional AutoBaud. The excerpts show startup and DAP setup, but omit much runtime wiring, so uncertain links are dashed. CMSIS core headers and board configuration are represented as supporting layers rather than a build or delivery map.

Main entry points: [`CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP.c`](https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP.c) (DAP command engine), [`src/main.c`](https://github.com/raspberrypi/debugprobe/blob/master/src/main.c) (Firmware runtime), [`CMSIS_DAP/CMSIS/Core/Include`](https://github.com/raspberrypi/debugprobe/tree/master/CMSIS_DAP/CMSIS/Core/Include) (Cortex-M core support), [`src/usb_descriptors.c`](https://github.com/raspberrypi/debugprobe/blob/master/src/usb_descriptors.c) (USB descriptors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_usb["USB and runtime"]
  node_main["Firmware runtime<br/>[main.c]"]
  node_descriptors["USB descriptors<br/>[usb_descriptors.c]"]
  node_endpoints["USB DAP endpoints"]
  node_usb_stack["USB device service"]
end

subgraph group_debug["Debug protocol"]
  node_dap_engine["DAP command engine<br/>[DAP.c]"]
  node_dap_api["DAP interface<br/>[DAP.h]"]
  node_dap_config["DAP hardware config<br/>[DAP_config.h]"]
  node_swd["SWD transport<br/>[SW_DP.c]"]
  node_jtag["JTAG transport<br/>[JTAG_DP.c]"]
  node_swo["SWO trace<br/>[SWO.c]"]
  node_pio["PIO probe I/O<br/>[sw_dp_pio.c]"]
end

subgraph group_serial["UART and baud"]
  node_cdc["CDC UART service<br/>[cdc_uart.c]"]
  node_autobaud["AutoBaud detector<br/>[autobaud.c]"]
  node_serial_id["USB serial identity<br/>[get_serial.c]"]
end

subgraph group_platform["Platform support"]
  node_probe["Probe control<br/>[probe.c]"]
  node_probe_config["Board selection<br/>[probe_config.c]"]
  node_board_config["Board definitions<br/>[board_config.h]"]
  node_cmsis_core["Cortex-M core support"]
  node_compiler["CMSIS compiler layer<br/>[cmsis_compiler.h]"]
  node_version["CMSIS version<br/>[cmsis_version.h]"]
end

node_host(("Debug host"))

node_host -.->|"sends USB"| node_usb_stack
node_usb_stack -.->|"uses descriptors"| node_descriptors
node_usb_stack -.->|"dispatches transfers"| node_endpoints
node_main -->|"sets up and processes"| node_dap_engine
node_endpoints -.->|"queues commands"| node_dap_engine
node_dap_engine -.->|"uses SWD"| node_swd
node_dap_engine -.->|"uses JTAG"| node_jtag
node_dap_engine -.->|"handles trace"| node_swo
node_dap_engine -->|"implements interface"| node_dap_api
node_dap_engine -->|"uses configuration"| node_dap_config
node_swd -.->|"drives probe I/O"| node_pio
node_main -->|"initializes UART"| node_cdc
node_cdc -.->|"uses baud detection"| node_autobaud
node_main -->|"starts detection"| node_autobaud
node_descriptors -->|"gets serial identity"| node_serial_id
node_dap_config -->|"binds probe controls"| node_probe
node_probe_config -->|"selects board settings"| node_board_config
node_cmsis_core -.->|"uses compiler layer"| node_compiler
node_cmsis_core -.->|"uses version definitions"| node_version
node_compiler -->|"provides compiler abstractions"| node_cmsis_core

click node_main "https://github.com/raspberrypi/debugprobe/blob/master/src/main.c"
click node_descriptors "https://github.com/raspberrypi/debugprobe/blob/master/src/usb_descriptors.c"
click node_endpoints "https://github.com/raspberrypi/debugprobe/blob/master/src/tusb_edpt_handler.c"
click node_dap_engine "https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP.c"
click node_dap_api "https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Include/DAP.h"
click node_dap_config "https://github.com/raspberrypi/debugprobe/blob/master/include/DAP_config.h"
click node_swd "https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/SW_DP.c"
click node_jtag "https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/JTAG_DP.c"
click node_swo "https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/SWO.c"
click node_pio "https://github.com/raspberrypi/debugprobe/blob/master/src/sw_dp_pio.c"
click node_cdc "https://github.com/raspberrypi/debugprobe/blob/master/src/cdc_uart.c"
click node_autobaud "https://github.com/raspberrypi/debugprobe/blob/master/src/autobaud.c"
click node_serial_id "https://github.com/raspberrypi/debugprobe/blob/master/src/get_serial.c"
click node_probe "https://github.com/raspberrypi/debugprobe/blob/master/src/probe.c"
click node_probe_config "https://github.com/raspberrypi/debugprobe/blob/master/src/probe_config.c"
click node_board_config "https://github.com/raspberrypi/debugprobe/blob/master/include/board_config.h"
click node_cmsis_core "https://github.com/raspberrypi/debugprobe/tree/master/CMSIS_DAP/CMSIS/Core/Include"
click node_compiler "https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/Core/Include/cmsis_compiler.h"
click node_version "https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/Core/Include/cmsis_version.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_descriptors,node_endpoints,node_usb_stack toneBlue
class node_dap_engine,node_dap_api,node_dap_config,node_swd,node_jtag,node_swo,node_pio toneAmber
class node_cdc,node_autobaud,node_serial_id toneMint
class node_probe,node_probe_config,node_board_config,node_cmsis_core,node_compiler,node_version toneRose
class node_host toneIndigo
```

## Components

### USB and runtime

- [Firmware runtime](https://github.com/raspberrypi/debugprobe/blob/master/src/main.c): `src/main.c`
- [USB descriptors](https://github.com/raspberrypi/debugprobe/blob/master/src/usb_descriptors.c): `src/usb_descriptors.c`
- [USB DAP endpoints](https://github.com/raspberrypi/debugprobe/blob/master/src/tusb_edpt_handler.c): `src/tusb_edpt_handler.c`
- **USB device service**

### Debug protocol

- [DAP command engine](https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP.c): `CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP.c`
- [DAP interface](https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Include/DAP.h): `CMSIS_DAP/CMSIS/DAP/Firmware/Include/DAP.h`
- [DAP hardware config](https://github.com/raspberrypi/debugprobe/blob/master/include/DAP_config.h): `include/DAP_config.h`
- [SWD transport](https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/SW_DP.c): `CMSIS_DAP/CMSIS/DAP/Firmware/Source/SW_DP.c`
- [JTAG transport](https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/JTAG_DP.c): `CMSIS_DAP/CMSIS/DAP/Firmware/Source/JTAG_DP.c`
- [SWO trace](https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/DAP/Firmware/Source/SWO.c): `CMSIS_DAP/CMSIS/DAP/Firmware/Source/SWO.c`
- [PIO probe I/O](https://github.com/raspberrypi/debugprobe/blob/master/src/sw_dp_pio.c): `src/sw_dp_pio.c`

### UART and baud

- [CDC UART service](https://github.com/raspberrypi/debugprobe/blob/master/src/cdc_uart.c): `src/cdc_uart.c`
- [AutoBaud detector](https://github.com/raspberrypi/debugprobe/blob/master/src/autobaud.c): `src/autobaud.c`
- [USB serial identity](https://github.com/raspberrypi/debugprobe/blob/master/src/get_serial.c): `src/get_serial.c`

### Platform support

- [Probe control](https://github.com/raspberrypi/debugprobe/blob/master/src/probe.c): `src/probe.c`
- [Board selection](https://github.com/raspberrypi/debugprobe/blob/master/src/probe_config.c): `src/probe_config.c`
- [Board definitions](https://github.com/raspberrypi/debugprobe/blob/master/include/board_config.h): `include/board_config.h`
- [Cortex-M core support](https://github.com/raspberrypi/debugprobe/tree/master/CMSIS_DAP/CMSIS/Core/Include): `CMSIS_DAP/CMSIS/Core/Include`
- [CMSIS compiler layer](https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/Core/Include/cmsis_compiler.h): `CMSIS_DAP/CMSIS/Core/Include/cmsis_compiler.h`
- [CMSIS version](https://github.com/raspberrypi/debugprobe/blob/master/CMSIS_DAP/CMSIS/Core/Include/cmsis_version.h): `CMSIS_DAP/CMSIS/Core/Include/cmsis_version.h`

### Other components

- **Debug host**

## Connections

- Debug host → USB device service: sends USB
- USB device service → USB descriptors: uses descriptors
- USB device service → USB DAP endpoints: dispatches transfers
- Firmware runtime → DAP command engine: sets up and processes (evidence: `src/main.c`)
- USB DAP endpoints → DAP command engine: queues commands
- DAP command engine → SWD transport: uses SWD
- DAP command engine → JTAG transport: uses JTAG
- DAP command engine → SWO trace: handles trace
- DAP command engine → DAP interface: implements interface (evidence: `CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP.c`)
- DAP command engine → DAP hardware config: uses configuration (evidence: `CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP.c`)
- SWD transport → PIO probe I/O: drives probe I/O
- Firmware runtime → CDC UART service: initializes UART (evidence: `src/main.c`)
- CDC UART service → AutoBaud detector: uses baud detection (evidence: `src/cdc_uart.c`)
- Firmware runtime → AutoBaud detector: starts detection (evidence: `src/main.c`)
- USB descriptors → USB serial identity: gets serial identity (evidence: `src/usb_descriptors.c`)
- DAP hardware config → Probe control: binds probe controls (evidence: `include/DAP_config.h`)
- Board selection → Board definitions: selects board settings
- Cortex-M core support → CMSIS compiler layer: uses compiler layer (evidence: `CMSIS_DAP/CMSIS/Core/Include/core_cm55.h`)
- Cortex-M core support → CMSIS version: uses version definitions (evidence: `CMSIS_DAP/CMSIS/Core/Include/core_cm55.h`)
- CMSIS compiler layer → Cortex-M core support: provides compiler abstractions (evidence: `CMSIS_DAP/CMSIS/Core/Include/cmsis_compiler.h`)
