Unable to get started using PIO Unified Debugger with Segger J-Link

I have a very basic Arduino application (blink) that I am attempting to test using a Segger J-LINK Plus with a Arduino MKR1000. Ideally, I would like to use the JLink for both uploading and debugging. So far, not getting very far.

I have tried several settings I have found in the documentation and community pages. Based on my last read I have removed any extra_script.py and only have settings in my platformio.ini as follows…

platform = atmelsam
board = mkr1000USB
framework = arduino
upload_protocol = jlink
debug_tool = jlink

I have J-Link V634f installed and have started the JLinkGDBServer.exe (GUI) before starting the debug from within VSCode\PlatformIO.

When I attempt to start debugging I receive a pop-up after the successful build steps with this message…
Failed to launch GDB: .pioinit: 12 Error in sourced command file: Remote communication error. Target disconnected.: No error. (from interpreter-exec console “source.pioinit”)

FYI… Just learning PlatformIO.



I do not have a [home_dir]/packages/tool-jlink folder.

This our issue, we forgot to add tool-jlink to atmelsam dev/platform. Do you have JLinkGDBServerCL.exe in a system environment PATH? Could you add this folder? Just a temporary solution.

I can add the JLink folder to the PATH (it is not currently).

I don’t quite understand what folder “Could you add this folder?” applies to. Should I create a tool-jlink folder and put the J-Link utilities in that folder, then add it to the PATH?


The path to J-Link folder where JLinkGDBServerCL.exe is located. You should see this path when do echo %PATH% in cmd.exe.

I added C:\Program Files (x86)\SEGGER\JLink_V634f to my PATH and verified by opening a new CMD window. From that window I was able to type jlinkgdbservercl.exe from my user home directory and the J-Link GDB server started successfully.

I started a new VSCode\PlatformIO session, loaded my simple blink test and still get an error when Debug>>Start Debugging (Debug Console output below).

Reading symbols from c:\Users\GT\Documents\PlatformIO\Projects\180919-153931- 
PlatformIO Unified Debugger > http://bit.ly/pio-debug
PlatformIO: Initializing remote target...
GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00392-gbe9ef0b0 (2018-01-12-15:03)
Licensed under GNU GPL v2
For bug reports, read
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
none separate
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
Info : tcl server disabled
Info : telnet server disabled
Warn : Failed to open device: LIBUSB_ERROR_NOT_SUPPORTED.
Error: No J-Link device found.
.pioinit:12: Error in sourced command file:
Remote communication error.  Target disconnected.: No error.

Sorry, sorry, sorry. Let me add normal support of J-Link for this dev/platform. I see that we did that for all J-Link supported dev/platform and totally missed Atmel SAM :frowning:

Temporary solution is to update your platformio.ini to

platform = atmelsam
board = mkr1000USB
framework = arduino
debug_tool = custom
debug_server =

Debugging should work now.

First off, thank you for your help Ivan!

Getting close, the J-Link is now detected and I can tell that it is programming the MKR1000. Step seems to be working for Arduino library code, after correctly stopping at the default break in main().

However, strange behaviors once the device application moves into our application. The execution position stops on different lines from the breakpoints. It is as if the .ELF file symbols don’t match the source .c file.

Quick separate question… any support for JLink RTT, now or planned?

Thanks again,

We added native support for J-Link Probe to Atmel SAM dev/platform. Let’s test it:

  1. Please remove J-Link from system environment variable PATH
  2. Switch to upstream version for dev/platform
  3. Update platformio.ini wtih
board = ...
upload_protocol = jlink
debug_tool = jlink

Debugging and firmware uploading should work through J-Link now.

I believe that the upstream version successfully is supporting the JLink natively.

I removed my path edit and made the changes to the platformio.ini as suggested. The debug task downloaded and installed the jlink-tool support, built and then executed the test application.

The only outstanding issue is the breaks inside the test blink application are not matching source lines. Maybe a compiler optimization switch???

Thanks for your help and super fast fix,

Could you provide a screenshot? Thanks!

Sure, they are attached. The first one is were the debugger correctly stops an the arduino library main() application entrance, then I hit Continue, the program cursor goes to the blink.ino linenext line 59 and skips the breakpoints at lines 30, 53.

debug-blink-main debug-blink-setup


Could you convert INO to CPP? See

INO is not C++ extension, we do preprocessing on the fly and convert your INO to real CPP where lines are changing.

Nailed it.

I saw the preprocessor converting the .ino to .cpp on the fly and did not consider that having a further effect downstream thanks.

Looking forward to PlatformIO as our new development platform.

Happy coding with PlatformIO! :blush:

Please don’t hesitate contact us for any issues.