2024-08-02 08:36 AM
I'm reading various posts about the cortex debug extension supporting SWO output, but maybe not on STLinks, and various ways to enable it for other types of ARMs. Are there any guides to how to set it up for STM32 within VSCode?
2024-08-02 09:11 AM
It doesn't work on CM0(+) cores
You'd need to get with VSCode devs to understand exactly what they'd implemented and support in current iterations.
If it works on Segger J-Link's then you might look at the ST-LINK/V2 to J-Link OB firmware conversion. Or look at CMSIS-DAP support
2024-08-02 09:50 AM
Right - thus my message here. Hopefully some of the ST Devs can weight in and suggest an existing set of instructions or some guidance on how best to set this up with what's in the current version of the extension.
2024-08-02 10:22 AM
I think VSCode has it's own forums and developer feeds
Perhaps @Nawres GHARBI knows?
2024-08-05 01:49 PM
Hi All,
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Jake
ST Support
2024-08-05 09:50 PM
It works with OpenOCD. This is the stanza I use in my launch.json file:
{
"name": "Build & Debug Microcontroller - OpenOCD",
"cwd": "${workspaceFolder}",
"type": "cortex-debug",
"executable": "${command:cmake.launchTargetPath}",
// Let CMake extension decide executable: "${command:cmake.launchTargetPath}"
// Or fixed file path: "${workspaceFolder}/path/to/filename.elf"
"request": "launch",
"servertype": "openocd",
"configFiles": [
"${workspaceFolder}/stlink.cfg"
],
"device": "STM32L4P5RETx", //MCU used
"interface": "swd",
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
"runToEntryPoint": "main",
"svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32L4P5.svd",
"v1": false, //Change it depending on ST Link version
"serverpath": "/usr/bin/openocd",
"stm32cubeprogrammer":"${config:STM32VSCodeExtension.cubeCLT.path}/STM32CubeProgrammer/bin",
"stlinkPath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
"armToolchainPath": "${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin",
"gdbPath":"${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin/arm-none-eabi-gdb",
"swoConfig": {
"enabled": true,
"cpuFrequency": 16000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
},
"preLaunchTask": "Build project"
/* If you use external loader, add additional arguments */
//"serverArgs": ["--extload", "path/to/ext/loader.stldr"],
},