Why this is not a duplicate
Some people seem to think this question is a duplicate, but there is an important difference:
The How to update the SWDAP firmware? question is all about how to update the firmware to the SWDAP probe. In the end we got a solution. The purpose of that question is therefore fulfilled. (I've edited the conclusion-section of that question to clarify this).
The question on this page is all about what firmware is being put on the probe - and more in particular - what is wrong with that firmware such that it malfunctions with OpenOCD.
Please take your time to read both questions completely (not just the titles) if you think this question is a duplicate.
1. Intro
1.1 SWDAP probe
I'm experimenting with the SWDAP probe from ARM (see https://www.l-tek.com/web-shop/l-tek-swdap-interface/). This flash/debug probe supports all Cortex-M microcontrollers. It uses the SWD protocol instead of JTAG.
At first I had some trouble updating the probe's firmware, but that has been solved in my previous question (see How to update the SWDAP firmware?). The firmware on the probe itself is named "DAPLink" (see https://github.com/ARMmbed/DAPLink).
1.2 My system
My computer has following software:
- Windows 10, 64-bit
- OpenOCD 0.10.0+dev-00921-gef8c69ff9 (2019-07-06-01:00)
2. Test with original firmware
The probe arrived to me with some firmware on it. I've plugged the probe into my computer while holding down the reset button. This way, I could access firmware.bin
and save a copy of it as a backup.
On the original firmware, the probe works perfectly with OpenOCD. This is my OpenOCD startup command:
openocd -f probe_swdap.cfg -f chip_stm32f767zi.cfg
-s "C:/.../scripts" -c "init; reset halt"
Note 1: I've splitted the command over two lines for readability.
Note 2: C:/.../scripts represents the path to the scripts subfolder in my OpenOCD installation folder.
This is my probe_swdap.cfg
file:
# OpenOCD probe config file for SWDAP
source [find interface/cmsis-dap.cfg]
transport select swd
And here is my chip_stm32f767zi.cfg
file:
# OpenOCD config file for STM32F767ZI
source [find target/stm32f7x.cfg]
reset_config srst_only
After running the OpenOCD startup command (see above), I get the following output in my console:
Open On-Chip Debugger 0.10.0+dev-00921-gef8c69ff9 (2019-07-06-01:00)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
swd
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 1.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 2000 kHz
Info : SWD DPIDR 0x5ba02477
Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
Info : stm32f7x.cpu: external reset detected
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08001848 msp: 0x20080000
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
This works perfectly. OpenOCD listens on port 3333 for GDB connections. So next thing I do is starting a GDB client and connect to OpenOCD. Then I can start flashing/debugging my target STM32F767ZI chip. All is well.
3. Test with newest v0254 firmware
I'll first say a word about the firmware name convention. You can download the latest firmware from the DAPLink GitHub page. The names have a specific meaning:
[Version]
_[Probe Chip]
_[Target Chip]
_[Offset]
.bin
more info see How to update the SWDAP firmware?
The Probe Chip
must match the chip on the probe itself. For me, that's the LPC11U35. The Target Chip
must only match the target chip if you're planning to use the drag-and-drop flashing feature. I'm just using OpenOCD, so this Target Chip
field doesn't matter to me.
The v0254 version has a "general" 0254_lpc11u35__0x0000.bin
firmware, being "target-agnostic". As I'm not using the drag-and-drop flashing, this choice makes most sense to me. So I update the SWDAP probe with this firmware.
Unfortunately, OpenOCD crashes immediately:
Open On-Chip Debugger 0.10.0+dev-00921-gef8c69ff9 (2019-07-06-01:00)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
swd
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Error: CMSIS-DAP command CMD_INFO failed.
I've used exactly the same OpenOCD startup command as before, with exactly the same config files. Something is wrong with the 0254_lpc11u35__0x0000.bin
firmware.
4. Test with v0253 firmware
There is no "general" 0253_lpc11u35__0x0000.bin
firmware. All are target-specific. But that doesn't matter because I'm not going to use the drag-and-drop feature anyway.
I chose 0253_lpc11u35_6lowpan_borderrouterethernet_0x0000.bin
and flashed it to my probe. I plug out the probe and plug it back in. Now I start OpenOCD with the same commands as before. I get the following output:
Open On-Chip Debugger 0.10.0+dev-00921-gef8c69ff9 (2019-07-06-01:00)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
swd
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 1.10
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 2000 kHz
In fact the output looks good. It's the exact same output I get with the original firmware up to the Info : clock speed 2000 kHz
line. But after that line, OpenOCD stops. It doesn't hang, it just terminates (this is clear because I get a new prompt in my console).
Something else that I noticed is the DAPLINK
drive showing up in my Windows file explorer:
That didn't happen with the original firmware, nor with v0254.
5. Test with v0252 firmware
For this test, I put the 0252_lpc11u35_tiny_0x0000.bin
firmware on my probe. I get the exact same output as with the v0253 firmware:
Open On-Chip Debugger 0.10.0+dev-00921-gef8c69ff9 (2019-07-06-01:00)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
swd
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 1.10
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 2000 kHz
OpenOCD terminates after the Info : clock speed 2000 kHz
line (again).
Also this time, I notice the DAPLINK
drive in my Windows file explorer as soon as I plug in the probe.
6. Conclusions
I conclude that:
- Original firmware works just fine with OpenOCD.
- Firmware
0254_lpc11u35 ... .bin
is plain dead. OpenOCD crashes immediately. - Firmware
0253_lpc11u35 ... .bin
is half-dead. OpenOCD terminates after outputting a few good lines. Also aDAPLINK
drive appears in Windows. - Firmware
0252_lpc11u35 ... .bin
reacts just like v0253.
I think firmware v0254 is defunct. But I don't want to jump into conclusions about firmware v0253 and v0252. Perhaps I need to issue a different startup command in OpenOCD to get them working? Or maybe I need to change something in my probe's config file?