OpenOCD error on debug initialization

Hello,

Just starting with Platform.io, trying to use the debug feature to debug a blink program, but I’m getting this printout after the debug program is finished building:

PlatformIO Unified Debugger → link
PlatformIO: debug_tool = atmel-ice
PlatformIO: Initializing remote target…
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
link
at91samd51j19
C:/Users/myname/.platformio/packages/tool-openocd/scripts/target/atsame5x.cfg:9: Error: Can’t find target/swj-dp.tcl
in procedure ‘script’
at file “embedded:startup.tcl”, line 26
at file “C:/Users/myname/.platformio/packages/tool-openocd/scripts/target/atsame5x.cfg”, line 9
.pioinit:13: Error in sourced command file:
Remote communication error. Target disconnected.: Success.

I am using an Adafruit Metro M4 board with an Atmel ICE as a debugger. I was able to upload to the board just fine over USB but the Atmel ice does not seem to work as either a programmer or debug tool

Here is my platformio.ini:

[ env:adafruit_metro_m4]
platform = atmelsam
board = adafruit_metro_m4
framework = arduino
upload_protocol = atmel-ice
debug_tool = atmel-ice
build_type = debug
lib_extra_dirs =
C:\Users\myname\Documents\Arduino\libraries
C:\Users\myname\AppData\Local\Arduino15\packages

I just set up pio today, so everything is up to date, and my atmel ice is visible in my device manager as Atmel-ICE Data Gateway. It seems to throw this error whether the tool is plugged in or not.

Thank you!

This file exists for me.

Please delete your C:/Users/myname/.platformio/packages/tool-openocd folder so that PlatformIO will re-downloaded the OpenOCD package. Then start debugging again.

The file C:\Users\myname\.platformio\packages\tool-openocd\scripts\target\swj-dp.tcl should then exist.

Thank you Maxgerhardt, that actually solved the problem!

Of course, after that I then noticed that someone had crimped the ribbon cables for our Atmel Ice on backwards, so the pinout was also wrong, but thankfully we also have a J-Link, which works flawlessly.

Thank you again!


i am facing a similar problem and i don’t know why it is appearing . can you help me?

  1. post output as text in the future, not image
  2. you haven’t got any -f switches in your command to give OpenOCD the information of which debug adapter and which target device you’re using, e.g. -f interface/stlink.cfg -f target/stm32f1x.cfg or -f st_nucleo_f103rb.cfg as one. Without info on what hardware you have connected I can’t tell what switches you need. Take a look in the scripts folder to see which interfaces and targets or board configuration files are available.