Skip to main content
KMill
Senior
July 27, 2026
Question

How do I create debug and release profiles for a project?

  • July 27, 2026
  • 2 replies
  • 15 views

So I have an STM32 project in VSC and when I first set up this project and started debugging, I vaguely remember being asked by VSC to create a launch.json file.

Now it seems I can build a ‘debug’ session, and launch it, and debug with all the usual features like step-in, step-out, continue, and so on. But how do I now add a ‘release’ build, which strips debug info and allows me to program a device without debugging it?

 

[I am trying to be a good citizen and get along with STM32 for VSC, but so far it seems like i) A retrograde step ii)A mix of modern UI’s and very old looking Java (MX) and iii)You need a science degree in CMAKE to understand anything. ]

My launch.json looks like this:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"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}"
}
]
}
]
}

 

2 replies

Cartu38 OpenDev
Graduate II
July 27, 2026

@KMill 

Thanks this line 

"imageFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"

used binary (flashed one) at debug session launch time is dynamic.

It relies on your active project context. Active context is mastered by CMake Tools extension:

Elect the one you want to shoot for !

If you dislike this you can just hard code kind it:
 

 

Cartu38 OpenDev
Graduate II
July 27, 2026

@KMill 

Since you're a "good citizen" here, I’d love it if you could elaborate on your points: "i) A retrograde step, ii) A mix of modern UIs and very old-looking Java (MX), and iii) You need a science degree in CMake to understand anything."

Whether or not I agree, all feedback matters. Explicit comments are the only way we can drive progress.

Feel free to share more—don't be shy!