Hello,
I have created a custom board platform (Nordic nRF9160 chip) Nordic Demo Kit board (nrf9160dk) has a built in J-Link debugger probe and I thought it would be great to add debugging support for this board.
After a lot of stumbling around, I somehow managed to get a working debugging configuration for a sketch, but I am not sure how I did it and I am not able to replicate the process.
I have followed both tutorials on how to setup debugging, analysed SAMD configuration, read numerous forum posts and I am still stuck. The most relevant information appears here: https://forum.arduino.cc/t/debugging-project-out-of-iot-sktechbook/965173.
What I can do is manually find for the current sketch, C:\Users\my_username\AppData\Local\Temp\arduino-ide2-<temporary_directory_name>
, and copy into it a previously created launch.json. If this JSON contains all the right information, the IDE (both v2.2.1 and v2.1.1) immediately shows it in the list of available debugging configurations, and I can debug the sketch.
For the record, once launch.json is in place, the existence of debug_custom.json is irrelevant.
In Arduino IDE v2.2.1, the Debug button on the main toolbar is always disabled, no matter what I do. In v2.1.1 it is generally enabled, but when I place a known good launch.json into <sketch>/.theia
directory and click Debug, I get a 'Cannot read properties of undefined (reading 'script') error message.
So, my question is, is there a way to automatically create a working debugging configuration from profile.txt and GUI only. I cannot expect ordinary users to create launch.json themself and then be able to copy it into the exact one of hundreds of temporary directories.
I am happy to add post linking hooks into profile.txt that would create a correct launch.json and copy it into the correct location. The trouble is that I don't know what this correct location is.
So as a minimum, I would appreciate if someone could tell me how to get the name of the debugger's temporary directory where I could place launch.json automatically. I would appreciate if someone took the trouble to point me towards the details of cortex-debug plugin integration into Arduino.
A working launch.json looks something like this:
{
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceRoot}",
"name": "Dejan",
"executable": "C:/Users/username/AppData/Local/Temp/arduino/sketches/5D8829399059057C3570B582018D0B8D/AnalogInput.ino.elf",
"type": "cortex-debug",
"armToolchainPath": "C:/Users/username/AppData/Local/Arduino15/packages/platform_name/tools/gdb/1.0.0",
"request": "launch",
"device": "nrf9160",
"servertype": "jlink",
"serverpath": "C:/Program Files/SEGGER/JLink/JLinkGDBServerCL.exe",
"configFiles": [
null
]
}
]
}
If you read this far, thank you for your attention. If you can provide some information that can help me move forward, I'll be very, very grateful.
Regards,
Dejan