Mac JLink Debugger Nothing Happens - please help

When I run the task Start Debugging, the compilation is done without error but after nothing happens.

I have successfully installed JlinkJDBServer & …

My platform.io looks like

[env:adafruit_feather_m0_debug]

platform = atmelsam
board = adafruit_feather_m0
framework = arduino
upload_protocol = jlink
debug_tool = jlink
debug_server =
/usr/local/bin/JLinkGDBServerCL
-device Cortex-M0
-speed auto
-if SWD
build_flags = -O0 -ggdb3 -g3

Even when I change to debug_tool = custom

I am knocking my head on the wall on this one, please help

VIncent

Did you indent these or not? Multi-line arguments must be indented with at least 3 spaces.


debug_server =
   /usr/local/bin/JLinkGDBServerCL
   -device Cortex-M0
   -speed auto
   -if SWD

Also, check that the GDB server is opened at the expected port (I think localhost:3333). Check the output of /usr/local/bin/JLinkGDBServerCL -device Cortex-M0 -speed auto -if SWD manually to check that and adapt debug_port accordingly.

Also check that you are not running the latest extension version because there are issues with that: Cannot debug STM32: "Failed to launch GDB: Error: write EPIPE" - #7 by maxgerhardt

Wait, okay, one second. Why do you have to manually declare debug_server after all? By setting debug_tool = jlink, PlatformIO already configures its local JlinkExe sever, with the appropriate script to run.

For uploading:

And for debugging:

Can you completely remove the debug_server lines and retry?

I have change my config to

[env:adafruit_feather_m0_debug]
build_type = debug
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
upload_protocol = jlink
debug_tool = jlink
build_flags = -O0 -ggdb3 -g3
debug_init_break = tbreak loop
monitor_port = /dev/cu.SLAB_USBtoUART
monitor_speed = 19200

But nothing happens when I do “start Debbguing”, the JLinkGDBServer is running

That you manually started yourself or appeared when clicking on “Start Debugging”? Did you check you PIO extension version as per above?

The PIO extension is 2.1.2 (the latest)
I have installed it from vscode, how do I install a previous version ?
Vincent

See the thread I linked you to in my first post. Cannot debug STM32: "Failed to launch GDB: Error: write EPIPE" - #4 by maxgerhardt

I have downgrade to 2.1.0,
Still the same, the debugger window opens for a few sec but without any breakpoints and it stops after 5 sec

Can you open a shell and do

cd ~/.platformio/pacakges/tool-jlink
./JLinkGDBServer -singlerun -if SWD -select USB -device ATSAMD21G18 -port 2331 

(~/ is your home directory, that should work in Mac too I guess) and post the output?

It is working,
I found out that the .gdbinit in my home directory was causing some trouble

Now I have the following when start debugging

Failed to read memory @ address 0xDEADBEEE

WARNING: Unsupported remote command “init”

.pioinit:14: Error in sourced command file:

Target does not support this command.

The error message is
PlatformIO: Initializing remote target…
0x00007e78 in micros () at /Users/xxxxx/.platformio/packages/framework-arduino-samd-adafruit/cores/arduino/delay.c:45
45 ticks2 = SysTick->VAL;
.pioinit:14: Error in sourced command file:
Target does not support this command.

OK Now it is working ! :wink:
Thanks maxgerhardt for your support
My Config file

[env:adafruit_feather_m0_debug]
build_type = debug
platform = atmelsam
board = adafruit_feather_m0
framework = arduino

upload_protocol = custom
debug_tool = jlink

debug_port = :2331
debug_server =
   /usr/local/bin/JLinkGDBServerCL
   -singlerun
   -device Cortex-M0
   -speed auto
   -if SWD

build_flags = -O0 -ggdb3 -g3

monitor_port = /dev/cu.SLAB_USBtoUART
monitor_speed = 19200

That’s weird. So either your JLinkGDBServerCL is newer than the one provided in the tool-jlink package and thus has some bugs fixed, or reducing the device to -device Cortex-M0 instead of -device ATSAMD21G18 helped.

Can you change the Cortex-M0 to ATSAMD21G18 so that we find out whether it’s the one or the other?

It does not work with ATSAMD21G18