Hey All,
I've been debugging a Cortex M4 micrcocontroller using a J-Link probe connected over USB and the cortex debug plugin for VS Code. I like it a lot, but the launch.json file still confuses me. As does the interaction between all the J-Link command line utilities and VS Code.
For the J-Link connected locally over USB, I can use this in my launch.json
{
"name" : "JLink: debug over usb",
"cwd" : "${workspaceFolder}",
"request" : "launch",
"type" : "cortex-debug",
"servertype" : "jlink",
"executable" : "${workspaceFolder}/build/app.elf",
"interface" : "swd",
"device" : "Cortex-M4",
"runToEntryPoint" : "main",
"svdFile" : "scripts/my.svd",
},
And it looks like this is causing the command
JLinkGDBServer -singlerun -nogui -if swd -port 50000 -swoport 50001 -telnetport 50002 -device Cortex-M4 to be run behind the scenes, and I guess VS Code connects to this GDB server?
It would be great if I could debug something in my home network, while out and about. Looks like it is possible:
https://wiki.segger.com/J-Link_Remote_ServerI've started by connecting the J-Link over USB to a Raspberry pi, then making a tunnel with
JLinkRemoteServerCLExe -UseTunnel -TunnelByName <name_of_tunnel> -TunnelPW <password>
And I can even connect to it with the JLinkGDBServer command line on my laptop
JLinkGDBServer -singlerun -nogui -if swd -port 50000 -swoport 50001 -telnetport 50002 -device Cortex-M4 -select "ip=tunnel:<name_of_tunnel>:<password>"
But the launch.json I've tried doesn't work, it says failed to launch GDB server: Timeout. But it seems close to working!
{
"name" : "REMOTE: JLink",
"cwd" : "${workspaceFolder}",
"request" : "launch",
"type" : "cortex-debug",
"servertype" : "jlink",
"executable" : "${workspaceFolder}/build/app.elf",
"device" : "Cortex-M4",
"runToEntryPoint" : "main",
"ipAddress" : "tunnel:<name_of_tunnel>:<password>",
"svdFile" : "scripts/my.svd",
},
Kind of a weird obscure question, but maybe someone understands how J-Link software works better than I do.
Thanks!
-Hunter