目的

手里有调试STM32的DAP-LINK,想试试通过JTAG调试ESP32

OpenOCD支持CMSIS-DAP

DAP-LINK支持的芯片,我手上这款描述如下,应该JTAG协议的都支持

平台

windows10 + ESP-IDF

ESP-WROOM-32E模组 + 烧录底座

DAP-LINK

乐鑫OpenOCD

使用乐鑫官方的OpenOCD,结果无法识别CMSIS-DAP设备

F:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20220706\openocd-esp32\share\openocd\scripts>F:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20220706\openocd-esp32\bin\openocd.exe -f interface/cmsis-dap.cfgOpen On-Chip Debugger  v0.11.0-esp32-20220706 (2022-07-06-15:48)Licensed under GNU GPL v2For bug reports, read        http://openocd.org/doc/doxygen/bugs.htmladapter speed: 1000 kHzInfo : Listening on port 6666 for tcl connectionsInfo : Listening on port 4444 for telnet connectionsError: unable to find a matching CMSIS-DAP deviceF:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20220706\openocd-esp32\share\openocd\scripts>

官方OpenOCD

官方接口支持CMSIS-DAP,但是芯片并不支持ESP32

有cmsis-dap.cfg

没有esp32的cfg

使用官方OpenOCD,配置文件使用乐鑫的,CMSIS-DAP可以正常识别,但确实不支持ESP32芯片

F:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20220706\openocd-esp32\share\openocd\scripts>openocd -f interface/cmsis-dap.cfgOpen On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]Licensed under GNU GPL v2libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3For bug reports, read        http://openocd.org/doc/doxygen/bugs.htmladapter speed: 1000 kHzInfo : Listening on port 6666 for tcl connectionsInfo : Listening on port 4444 for telnet connectionsInfo : CMSIS-DAP: SWD  supportedInfo : CMSIS-DAP: JTAG supportedInfo : CMSIS-DAP: Atomic commands supportedInfo : CMSIS-DAP: FW Version = 1.10Info : CMSIS-DAP: Interface Initialised (JTAG)Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1Info : CMSIS-DAP: Interface readyInfo : clock speed 1000 kHzError: session transport was not selected. Use 'transport select 'Error: Transports available:Error: swdError: jtagF:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20220706\openocd-esp32\share\openocd\scripts>openocd -f interface/cmsis-dap.cfg -f board/esp-wroom-32.cfgOpen On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]Licensed under GNU GPL v2libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3For bug reports, read        http://openocd.org/doc/doxygen/bugs.htmladapter speed: 1000 kHzWARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.target/esp32.cfg:53: Error: Unknown target type esp32, try one of arm7tdmi, arm9tdmi, arm920t, arm720t, arm966e, arm946e, arm926ejs, fa526, feroceon, dragonite, xscale, cortex_m, cortex_a, cortex_r4, arm11, ls1_sap, mips_m4k, avr, dsp563xx, dsp5680xx, testee, avr32_ap7k, hla_target, nds32_v2, nds32_v3, nds32_v3m, or1k, quark_x10xx, quark_d20xx, stm8, riscv, mem_ap, esirisc, arcv2, aarch64,  or mips_mips64in procedure 'script'at file "embedded:startup.tcl", line 26at file "board/esp-wroom-32.cfg", line 5at file "target/esp32.cfg", line 53F:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20220706\openocd-esp32\share\openocd\scripts>

结论

  1. 乐鑫OpenOCD不支持CMSIS-DAP

  2. 官方OpenOCD支持CMSIS-DAP,但是不支持乐鑫的芯片

  3. 寄,还是下单了ESPLink