2025-07-21 4:41 AM - edited 2025-07-22 1:12 AM
I’m currently developing a template to help developers debug code located at address 0x8011000 using VSCode.
So far, I haven’t had any success getting the debugger to work properly.
The .elf file itself is fine, when I flash it using STM32CubeProgrammer and enable "Run after programming", the code executes as expected.
I’ve tried multiple solutions, including suggestions from ChatGPT, but nothing has worked yet.
Solved! Go to Solution.
2025-07-22 1:15 AM - edited 2025-07-22 1:20 AM
Got it to work, in case someone has a similar issue:
In my case Reset_Handler is defined in startup_stm32g474xx.s
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug UserApp at an offset (no full reset)",
"type": "cortex-debug",
"request": "launch",
"servertype": "stlink", // you're using ST-LINK GDB server, not openocd
"executable": "build/Debug/${workspaceFolderBasename}.elf",
"device": "STM32G474RE",
"gdbPath": "arm-none-eabi-gdb",
"runToEntryPoint": "Reset_Handler",
"postLaunchCommands": [
"monitor halt",
"break main"
],
"overrideLaunchCommands": [
"load"
],
"showDevDebugOutput": "raw"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "flash-userapp",
"type": "shell",
"command": "STM32_Programmer_CLI",
"args": [
"-c", "port=SWD",
"-w", "build/Debug/${workspaceFolderBasename}.elf", // or .hex or .bin
"-rst"
],
"problemMatcher": []
}
]
}
2025-07-21 10:43 PM
Not sure to understand what you are tryi.g to do here. Please be explicit more. Maybe a chance to get help then.
2025-07-22 1:15 AM - edited 2025-07-22 1:20 AM
Got it to work, in case someone has a similar issue:
In my case Reset_Handler is defined in startup_stm32g474xx.s
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug UserApp at an offset (no full reset)",
"type": "cortex-debug",
"request": "launch",
"servertype": "stlink", // you're using ST-LINK GDB server, not openocd
"executable": "build/Debug/${workspaceFolderBasename}.elf",
"device": "STM32G474RE",
"gdbPath": "arm-none-eabi-gdb",
"runToEntryPoint": "Reset_Handler",
"postLaunchCommands": [
"monitor halt",
"break main"
],
"overrideLaunchCommands": [
"load"
],
"showDevDebugOutput": "raw"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "flash-userapp",
"type": "shell",
"command": "STM32_Programmer_CLI",
"args": [
"-c", "port=SWD",
"-w", "build/Debug/${workspaceFolderBasename}.elf", // or .hex or .bin
"-rst"
],
"problemMatcher": []
}
]
}
2025-07-22 1:16 AM - edited 2025-07-22 1:25 AM
I changpticed it for you @Cartu38 OpenDev , i was tired and not good articulating my problem
2025-07-23 12:17 AM
Thanks for sharing.
I note you are not using latest extension set proposal : https://community.st.com/t5/stm32cube-for-visual-studio-code/new-stm32cube-for-visual-studio-code-extenstion-released-3-5-1/td-p/819484
2025-07-23 5:13 AM
good catch