Thank you both for your replies!
I looked for platform.txt and can find them under user profile under
AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0
and
AppData\Local\Arduino15\packages\arduino\hardware\mbed\2.0.0
(as I wrote, I had to install both packages, no matter which one of them I choose, the IDE requested me to install the other one as well).
So I added the lines of your post to both, just in case (I also attach them for verification. To distinguish them, I appended "_nano" to the platform.txt of mbed_nano folder in the attachment).
I enabled (already previously) from Sketch menu Optimize for debugging.
The Debug button (right of "New" button) is now not grayed out anymore and I could press it. I needed to adjust Firewall and then got the info that Device Indicator is needed for Segger J-Link:
So added: "device": "nRF52840_xxAA", to debug_custom.json:
{
"servertype": "jlink",
"interface": "swd",
"device": "nRF52840_xxAA",
"serverpath": "C:/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe"
}
And this did the trick. I can pause and continue the code, put a breakpoint and do stepping.
This is great. Thank you both for your excellent help!
Update: modified the code a bit to try a variable watch. I noticed that I cannot stop and upload the modified sketch, without detaching the USB port of Nano and J-Link and reconnecting (just closing the IDE v2b4 and relaunching was not enough).
Also I just added int i and i++ into the loop and added i to watch. It says it's optimized out, thus I guess for debugging, it might be better to have optimizations off.
I tried:
compiler.optimization_flags.debug=-Og -g0
and
compiler.optimization_flags.debug=-O0 -g0
but these did not help yet (i in watch window is still not available).
Do you have tips how to turn all optimizations off for debugging so that also such simple variables remain watchable?
platform.txt (9.59 KB)
platform_nano.txt (9.6 KB)