Skip to main content
Associate II
September 8, 2025
Solved

SWO output not working with VSCode Cortex-Debug

  • September 8, 2025
  • 3 replies
  • 1510 views

Hello,

I am trying to get SWO output working in VSCode using the Cortex-Debug plugin (v1.12.1).
My setup:

  • Debugger: STLink V3-MINIE

  • MCU: STM32H747IIT6

  • IDE: VSCode with Cortex-Debug

  • GDB Server: OpenOCD

  • Debug config: Trace Asynchronous SW enabled in CubeMX

When I run the project in STM32CubeIDE, the SWO output works as expected.
However, in VSCode I don’t see any SWO output in the terminal.

I overrode the write function like this:

int _write(int file, char *ptr, int len) {
 int dataIdx;
 for (dataIdx = 0; dataIdx < len; dataIdx++) {
 ITM_SendChar(*ptr++);
 }
 return len;
}

My launch.json:

{
 "name": "CM7 SWO",
 "cwd": "${workspaceRoot}/CM7",
 "type": "cortex-debug",
 "executable": "build/Printf_CM7.elf",
 "request": "launch",
 "servertype": "openocd",
 "gdbPath": "/opt/ST/STM32CubeCLT_1.19.0/GNU-tools-for-STM32/bin/arm-none-eabi-gdb",
 "device": "STM32H747IITx",
 "svdFile": "/opt/ST/STM32CubeCLT_1.19.0/STMicroelectronics_CMSIS_SVD/STM32H747_CM7.svd",
 "configFiles": [
 "interface/stlink.cfg",
 "target/stm32h7x.cfg"
 ],
 "runToEntryPoint": "main",
 "preLaunchTask": "Build All Debug",
 "showDevDebugOutput": "raw",
 "swoConfig": {
 "enabled": true,
 "source": "socket",
 "swoFrequency": 2000000,
 "cpuFrequency": 480000000,
 "decoders": [
 {
 "port": 0,
 "type": "console"
 }
 ]
 }
}

When I launch debugging, I get this error message from the GDB server:

marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl: 
Error: Could not find TPIU/SWO names. Perhaps it hasn't been created?

Does anyone know what I might be missing in the launch.json or OpenOCD configuration to get SWO working with Cortex-Debug and STLink V3-MINIE?

Thanks in advance!

Best regards 

OskarP.

Best answer by Cartu38 OpenDev
As far i can see no SWO support (yet at least)
Per release note semihosting is supported but not tracing in real at that
time

3 replies

Nawres GHARBI
Technical Moderator
September 15, 2025

@OskarP  Thanks for contributing to this forum—it’s the right place to get answers!
The best way to start is by installing STM32Cube for Visual Studio Code.

 

https://marketplace.visualstudio.com/items?itemName=stmicroelectronics.stm32-vscode-extension&ssr=false#overview

OskarPAuthor
Associate II
September 16, 2025

@Nawres GHARBI  Thanks for your reply, Nawres!
I already have STM32Cube for VS Code installed. The actual issue is that the cortex-debug extension, which STM32Cube also relies on, unfortunately does not support SWO when using the STLink server. Therefore, I switched to OpenOCD to get SWO capabilities.

Nawres GHARBI
Technical Moderator
September 16, 2025

could you share the extension version please ? seems you are using a very old one

OskarPAuthor
Associate II
September 16, 2025

@Nawres GHARBI Sure. I'm using the following versions:

- STM32Cube for Visual Studio Code Core Version 0.17.1

- STMCubeMX 6.15

- STMCubeCLT 1.19.0

Nawres GHARBI
Technical Moderator
September 23, 2025

Please update to the latest one on the Marketplace and switch to pre-release version

OskarPAuthor
Associate II
September 30, 2025

Hello Nawres,

sorry for the late reply. I have updated STM32Cube for Visual Studio Code to Core Version 1.0.3.

Could you please provide me with an example of a working launch configuration with SWO for the STM32H747IIT6?

Thank you very much for your help.

Best regards,
Oskar