cancel
Showing results for 
Search instead for 
Did you mean: 

VSCode launch.json for running/debuging with flash offset

Javier1
Principal

 

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.



Javier1_0-1753098029075.png

 

hit me up in https://www.linkedin.com/in/javiermu%C3%B1oz/
1 ACCEPTED SOLUTION

Accepted Solutions
Javier1
Principal

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": []
    }
  ]
}

 

hit me up in https://www.linkedin.com/in/javiermu%C3%B1oz/

View solution in original post

5 REPLIES 5
Cartu38 OpenDev
Lead III

Not sure to understand what you are tryi.g to do here. Please be explicit more. Maybe a chance to get help then.

Javier1
Principal

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": []
    }
  ]
}

 

hit me up in https://www.linkedin.com/in/javiermu%C3%B1oz/

I changpticed it for you @Cartu38 OpenDev , i was tired and not good articulating my problem

hit me up in https://www.linkedin.com/in/javiermu%C3%B1oz/

good catch

hit me up in https://www.linkedin.com/in/javiermu%C3%B1oz/