Step-by-step Debugging Issue on VSCode with ARM GCC (nRF52811, SDK 17.1)

Hello everyone,

I’m facing an issue with step-by-step debugging in VSCode using the ARM GCC compiler with an nRF52811 microcontroller and Nordic’s SDK 17.1.

Here are the details of my setup:

  • Microcontroller: nRF52811
  • SDK: nRF5 SDK version 17.1
  • Development Environment: VSCode
  • Compiler: ARM GCC

The project builds successfully, and I can flash the code onto the microcontroller. However, when I attempt to debug step-by-step, it doesn’t work correctly. The debugger either skips lines or doesn’t match the source code I’m viewing in the editor.

Here’s what I’ve tried so far:

  1. Verified the symbol paths (.elf) and debug info mappings in the .launch.json file.
  2. Ensured that the -O0 optimization flag is set in the compilation options to avoid excessive code optimization during debugging.

Despite these efforts, the issue persists. Does anyone have suggestions on what might be causing this or how I could resolve it?

Thanks in advance for your help!

Best regards,

Here is the launch.json file  : 

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: go.microsoft.com/.../
    "version": "0.2.0",
    "configurations": [
        {
            //"showDevDebugOutput": "vscode",
            "name": "Cortex Debug",
            "cwd": "${workspaceRoot}",
            "executable": "C:/W/WorkspaceHW/KZA/BOOT_DFU_CONFIG/_build/nrf52811_xxaa_s112.out",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "jlink",
            "device": "nrf52",
            "interface": "swd",
           // "preLaunchTask": "flash application",
            "serverpath": "C:/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe",
            "armToolchainPath": "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin",
            "svdFile": "C:/W/WorkspaceHW/KZA/BOOT_DFU_CONFIG/nRF5_SDK_17/modules/nrfx/mdk/nrf52811.svd",
            //"runToEntryPoint": "main"
            "liveWatch": {
                "enabled": true,
                "samplesPerSecond": 4
            }
            /*"rttConfig": {
                "enabled": true,
                "address": "auto",
                "decoders": [
                    {
                        "port": 0,    
                        "type": "console",
                    }
                ]
            }*/

        }
    ]
}
Parents Reply Children
No Data
Related