How to select a specific STLInk for debugging in VSCode
I have multiple STLinks on multiple Nucleo boards. I can debug only if I connect one at a time, but it is tedious to connect and reconnect to switch boards. When I plug in multiple devices I see them listed (bottom left) but I can’t work out how to select a specific STLink to use. If I try to debug it fails with a “bound doStepConnectToTarget Failed: could not connect: Operation timed out.” and suggests I open launch.json.
Disconnecting the cables is additionally tedious because I’m using the VCP on each, and disconnecting breaks the connection to the terminals, which then all need to be reconnected.
I know that with the stand-alone STM32CubeIDE it possible to have separate configurations for each STLink (defined by Serial ID) and then I select the one to use as needed, without having to disconnect any hardware (and the VCPs for the devices I’m not debugging stay connected).
Is there a way to specify the STLink serial ID to use in the launch.json file? In VSCode I notice there is a button to copy the Serial ID to the clipboard - but how do I use that?
There’s a Knowledge base article here by
I’m using this launch configuration that was auto generated:
"configurations": [
{
"type": "stlinkgdbtarget",
"request": "launch",
"name": "STM32Cube: Launch ST-Link GDB Server",
"origin": "snippet",
"cwd": "${workspaceFolder}",
"preBuild": "${command:st-stm32-ide-debug-launch.build}",
"runEntry": "main",
"imagesAndSymbols": [
{
"imageFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
}
]
}
]
I’m on macOS, and using two NUCLEO-F303K boards and two NUCLEO-H7S3L8 boards. VSCode 1.123.1 and STM32CubeIDE for VSCode v3.9.0
