Skip to main content
Graduate
November 27, 2025
Solved

New STM32 VScode launch script

  • November 27, 2025
  • 2 replies
  • 456 views

Hello,

With the latest release of the extension (3.6.4), the pre-release version (based on bundle manager) was moved to be the official release, thus making CLT obsolete.

My original launch file (based on CLT) does not work anymore, it included a Debug script, an Attach script, and a build+flash-only script.

To create a compatible launch file, I used the preset script - "STM32Cube: STM32 Launch ST-Link GDB Server" by using vscode's "create a launch.json file" option.

This does work for debugging, but creates a few issues-

a. Doe's not contain an "Attach" option - I could not find any help on the options for configuring the "stlinkgdbtarget" script type.

b. The "Memory Inspector" which is part of the extension pack, does not work anymore with the generated launch file. I get a "No debugger attached" while debugging.

c. The vscode reset debug button does not reset the core anymore - it re-flashes the device.

 

Can anyone help me create a launch file that will contain these features based on the new "stlinkgdbtarget" or some other script type?

It's pretty annoying that the pre-release was pushed to release, while it removes some useful features and also does not include a separate release for the "cube" CLI.

    This topic has been closed for replies.
    Best answer by Florent V

    Hi Sharon,

    Sorry I misunderstood.


    What you provided, if I understand correctly, is to connect to a running gdb server that is currently connected to the device?


    Exactly.

    Your use case is the "hot attach".
    Here the template for this mode:

    {
     "type": "stlinkgdbtarget",
     "request": "launch",
     "name": "STM32Cube: STM32 Launch ST-Link GDB Server",
     "origin": "snippet",
     "cwd": "${workspaceFolder}",
     "serverReset": "None",
     "imagesAndSymbols": [
     {
     "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
     }
     ]
    }

     

    Note the specific value for:

    • serverReset: set to "None" to avoid resetting the board when you launch the debug session
    • imagesAndSymbols: replace "imageFileName" with "symbolFileName" to load only the symbols
    • runEntry: not required in hot attach mode
    • preBuild: not required in hot attach mode

     

    KR,
    Flo

    2 replies

    Graduate II
    November 28, 2025

    @SharonVEC 
    About memory inspector takes care to rely on CDT one. Works for me.
    If former (2.x.y) STM32Cube extension end user  you may get x2 installed what maybe confusing. 3.6.x is pulling CDT one and I guess stuff is validated for usage of such.
    Cartu38OpenDev_0-1764311134089.png

     

    ST Employee
    November 28, 2025

    Hi Sharon,

    About the attach option:
    You need to change the value of the "request" attribute to "attach".
    By doing this, you will have access only to the attributes related to the attach option with autocompletion.
    attach_mode.png
    The restart button indeed stops the debug session and restarts it, so it reflashes the target.
    However, in the next release, the reset button will be available.
    restart_button3.png

    Here the template of the debug configuration using attach mode:

    {
    	"type": "stlinkgdbtarget",
    	"request": "attach",
    	"name": "STM32Cube: STM32 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}"
    		}
    	],
    	"serverHost": "localhost",
    	"serverPort": "61234"
    }



    Kind Regards,
    Flo

    SharonVECAuthor
    Graduate
    December 1, 2025

    Thank you for the responses

    @Cartu38 OpenDev This indeed was my issue, and the CDT one works fine, thank you!

    @Florent V Thanks, but I think the word "attach" was misused in my questions.

    What I need is the ability to debug the device without re-downloading and resetting the device, more like "attaching" to the running code on the device.

    What you provided, if I understand correctly, is to connect to a running gdb server that is currently connected to the device?

    Thanks.

    Florent VAnswer
    ST Employee
    December 1, 2025

    Hi Sharon,

    Sorry I misunderstood.


    What you provided, if I understand correctly, is to connect to a running gdb server that is currently connected to the device?


    Exactly.

    Your use case is the "hot attach".
    Here the template for this mode:

    {
     "type": "stlinkgdbtarget",
     "request": "launch",
     "name": "STM32Cube: STM32 Launch ST-Link GDB Server",
     "origin": "snippet",
     "cwd": "${workspaceFolder}",
     "serverReset": "None",
     "imagesAndSymbols": [
     {
     "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
     }
     ]
    }

     

    Note the specific value for:

    • serverReset: set to "None" to avoid resetting the board when you launch the debug session
    • imagesAndSymbols: replace "imageFileName" with "symbolFileName" to load only the symbols
    • runEntry: not required in hot attach mode
    • preBuild: not required in hot attach mode

     

    KR,
    Flo