How huming2207/ch32v305_dap works
This is CH32V305 firmware for a CMSIS-DAP debug probe, with USB device support and a USB-to-UART bridge. The main loop initializes the probe and repeatedly handles DAP and UART-bridge work; DAP commands ultimately support target debug access over SWD. The tree also includes SWO/UART DAP support and optional mass-storage code. Some implementation files were not sampled, so uncertain runtime links are omitted or marked unverified rather than inferred from naming.
Main entry points: DAP.c CMSIS-DAP commands · dap_main.c DAP orchestration · usbd_core.c USB device core · main.c Firmware main
Components 20
Firmware runtime
- Firmware main
User/main.c - Transfer buffers
CherryRB/chry_ringbuffer.c - UART bridge
User/usb2uart.c
DAP and debug
- DAP orchestration
CherryDAP/dap_main.c - CMSIS-DAP commands
CherryDAP/DAP/Source/DAP.c - SWD target access
DAPHost/swd_host.c - SWO trace
CherryDAP/DAP/Source/SWO.c - DAP UART
CherryDAP/DAP/Source/UART.c - Vendor commands
CherryDAP/DAP/Source/DAP_vendor.c - JTAG-DP
CherryDAP/DAP/Source/JTAG_DP.c - SW-DP
CherryDAP/DAP/Source/SW_DP.c
USB device
- USB device core
CherryUSB/core/usbd_core.c - USB CDC
CherryUSB/class/cdc/usbd_cdc.c - USB mass storage
CherryUSB/class/msc/usbd_msc.c - USBHS controller
CherryUSB/port/ch32/usb_dc_usbhs.c
CH32V305 platform
- Probe configuration
User/DAP_config.h - Debug support
Debug/debug.c - RISC-V core support
Core/core_riscv.c - CH32 peripherals
Peripheral/inc/ch32v30x.h
Other components
- USB host
Connections 22
- USB host → USB device core: sends USB traffic
- Firmware main → DAP orchestration: initializes, handles
User/main.c - Firmware main → UART bridge: handles bridge
User/main.c - Firmware main → Debug support: uses support
User/main.c - DAP orchestration → CMSIS-DAP commands: dispatches commands
- DAP orchestration → USB device core: configures device
- DAP orchestration → USB CDC: uses CDC interface
- DAP orchestration → USB mass storage: uses MSC interface
- USB device core → USBHS controller: uses controller
- USB CDC → USB device core: registers class
- DAP orchestration → Transfer buffers: uses buffers
- UART bridge → Transfer buffers: uses buffers
- CMSIS-DAP commands → Probe configuration: uses configuration
CherryDAP/DAP/Source/DAP.c - SWD target access → Probe configuration: uses configuration
DAPHost/swd_host.c - CMSIS-DAP commands → SWD target access: accesses target
- CMSIS-DAP commands → SWO trace: supports trace
- CMSIS-DAP commands → DAP UART: supports UART
- CMSIS-DAP commands → Vendor commands: supports vendor commands
- CMSIS-DAP commands → JTAG-DP: supports JTAG-DP
- CMSIS-DAP commands → SW-DP: supports SW-DP
- Debug support → CH32 peripherals: uses device definitions
- CH32 peripherals → RISC-V core support: uses core definitions
Peripheral/inc/ch32v30x.h