# CMSIS-DAP TCP

通过 Wi-Fi 把 ESP32 变成 CMSIS-DAP JTAG/SWD 调试探针。

CMSIS-DAP programmer using TCP/IP rather than USB connection to the host. Runs on ESP32 and connects over WiFi to OpenOCD using the cmsis-dap-tcp backend. Supports JTAG and SWD.

通过 Wi-Fi 把 ESP32 变成 CMSIS-DAP JTAG/SWD 调试探针。

- id: bkuschak-cmsis-dap-tcp-esp32
- author: bkuschak
- repository: https://github.com/bkuschak/cmsis_dap_tcp_esp32
- license: Apache-2.0
- shape: headless
- scenes: tools
- boards: ESP32
- browser_playable: no
- preview: Project screenshots
- html: https://esp32gallery.com/projects/bkuschak-cmsis-dap-tcp-esp32/
- html_zh: https://esp32gallery.com/zh/projects/bkuschak-cmsis-dap-tcp-esp32/
- json: https://esp32gallery.com/data/catalog/projects/bkuschak-cmsis-dap-tcp-esp32.json

## Hardware

ESP32-class board. Verify the exact board revision, display, power source and wiring in the upstream build guide.

ESP32 类开发板；请在上游构建文档中核对具体板型、屏幕、供电与接线。

## English

```
OpenOCD normally talks CMSIS-DAP to a programmer on the end of a USB cable; here the far end is an ESP32 on Wi-Fi. The board bit-bangs SWD or JTAG onto an ARM target, and OpenOCD's cmsis_dap_tcp backend connects over TCP, so flashing and debugging happen across the network. Tested with ESP32-S3, C3 and C6 boards against STM32 F4xx, F103 and G0xx parts, and a Lattice ECP5 FPGA. SWD needs two GPIO, JTAG at least four; up to three interfaces and three UART bridges can run at once, and an optional pin drives an activity LED. Building needs ESP-IDF, with per-board CMake presets and pin choices in menuconfig. Measured on an ESP32-S3 at 240 MHz: about 200 KB/sec writing SRAM, a 512 KB STM32F401RE image in roughly 13.4 seconds. SWO is unsupported and the clock tops out near 6 MHz.
```

## 中文

```
把 CMSIS-DAP 调试器从 USB 线上挪到网线另一端：ESP32 用 GPIO 模拟 SWD 或 JTAG 时序去连 ARM 目标板，OpenOCD 通过 cmsis_dap_tcp 后端用 TCP 连上来，于是烧写和调试都走网络，目标板可以放在别处，调试器接个 USB 充电头就能单独跑。在 ESP32-S3、C3、C6 上测过，目标是 STM32 F4xx、F103、G0xx，也带过 Lattice ECP5 FPGA。SWD 占 2 个 GPIO，JTAG 至少 4 个；最多可同时开 3 路调试接口和 3 路串口桥，还能用一个引脚驱动活动指示灯。编译要 ESP-IDF，按板子选 CMake preset，引脚在 menuconfig 里改。S3 跑 240 MHz 时写 SRAM 约 200 KB/s，512 KB 的 STM32F401RE 镜像连擦带校验约 13.4 秒。SWO 不支持，时钟最高约 6 MHz，JTAG 比 SWD 慢得多。
```
