nRF Connect SDK Intermediate Lesson 1 Exercise 1 Debugging Issues

Hi

This is my first time using nRF connect and Visual studio but I have been following through first the Fundamentals course on the Dev Academy using the nRF52840 DK with no issues.

However in exercise 1 of lesson 1 of the Intermediate course, when attempting to debug i do not end up in "main" function but in the file ".../zephyr/arch/arm/core/cortex_m/reset.S". I also do not have any of the functions showing in the call stack or any threads in the thread view of the NRF Debug terminal.

The code appears to run correctly if i stop debugging and i get the LEDs toggling and the terminal outputs as expected and i get the same behavior using the solution code so i assume it is something to do with my setup rather than the code itself.

I am connected to the nRF52840 DK directly via USB.

I would be grateful for an suggestions on how to go about resolving this.

Parents Reply
  • Here is the screenshot of the terminal window after starting debugging and having continued to the breakpoint in main():

    I only have a single project open so i dont think that has been an issue but doing as you suggest seems not to make a difference, still not threads available for display.

    Not sure if it is useful but here is the debug terminal output as well:

    Cheers,

    Tom

Children
  • Hello Tom,

    Ok, try opening a new nRF Connect terminal by pressing the little plus sign at the far right:

    And kill all other terminals than the nRF Connect one. Then start the debug session all over. See if that helps. If not, can you please try to generate some support information:

    Save that information to a file, and upload it here. 

    TomSansome said:

    Not sure if it is useful but here is the debug terminal output as well:

    What does this say if you press the play button so that the breakpoint in main is hit? And after it is hit, does the NRF DEBUG terminal still doesn't show anything?

    BR,
    Edvin

  • Hi Edvin,

    Closing the other terminals and the opening a new nRF connect terminal does not make any difference, but it does appear to be named differently than the terminal in your screenshot. When i start a new debug session it creates a new terminal that does not start with "nRF Connect:" not sure if this matters?

    here is the support information:

    IMPORTANT: The data below could contain sensitive or confidential information about your environment.
    If you do not wish this to be seen by others, please make sure to remove it before sharing.
    
    For help and support, visit the Nordic DevZone at https://devzone.nordicsemi.com/.
    
    {
      "platform": {
        "os": "win32",
        "osVersion": "Windows 10 Home",
        "osKernel": "10.0.19045",
        "vscode": "1.89.1",
        "electron": "28.2.8",
        "node": "v18.18.2"
      },
      "system": {
        "date": "2024-05-13T09:04:46.842Z",
        "vscodeRoot": "c:\\Users\\Tom Sansome\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "nrfConnectForDesktopInstalled": false,
        "vscodeUptime": "00:02:37",
        "osUptime": "00:03:51",
        "cpu": "AMD Ryzen 5 5600 6-Core Processor"
      },
      "workspace": {
        "name": "inter_less1_exer1",
        "workspaceFile": null,
        "folders": [
          "c:\\ncs\\myApps\\inter_less1_exer1"
        ]
      },
      "sdks": [
        {
          "version": "v2.6.1",
          "path": "c:\\ncs\\v2.6.1"
        }
      ],
      "activeBuild": "c:\\ncs\\myApps\\inter_less1_exer1\\build",
      "apps": [
        {
          "workspace": "c:\\ncs\\myApps\\inter_less1_exer1",
          "uri": "c:\\ncs\\myApps\\inter_less1_exer1",
          "buildConfigurations": [
            {
              "id": "c:\\ncs\\myApps\\inter_less1_exer1\\build",
              "name": "build",
              "boardId": "nrf52840dk_nrf52840",
              "type": "Zephyr",
              "isChild": false,
              "isStale": false,
              "taskBindings": {
                "build": [],
                "pristineBuild": [],
                "flash": [],
                "eraseAndFlash": []
              }
            }
          ]
        }
      ],
      "topdir": "c:\\ncs\\v2.6.1",
      "workspaceState": "freestanding-ready",
      "toolchains": [
        {
          "version": "2.6.1",
          "path": "c:\\ncs\\toolchains\\cf2149caf2"
        }
      ],
      "connectedDevices": [
        {
          "serialNumber": "001050270477"
        }
      ],
      "deviceProvider": "nrfutil",
      "tools": {
        "C:\\ncs\\toolchains\\cf2149caf2\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gcc.exe": "0.16.5",
        "C:\\Program Files\\SEGGER\\JLink_V796f\\JLink.exe": "7.96f",
        "C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.24.2",
        "nrfutil": "Not found",
        "C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\cmake.exe": "3.21.0",
        "C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\Scripts\\west.exe": "1.2.0",
        "C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\python.exe": "3.9.13",
        "C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\ninja.exe": "1.10.2",
        "C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\gperf.exe": "3.1",
        "C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\dtc.exe": "1.4.7",
        "C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\gn.exe": "2154",
        "C:\\ncs\\toolchains\\cf2149caf2\\mingw64\\bin\\git.exe": "2.37.3.windows.1",
        "gdbPath": "c:\\ncs\\toolchains\\cf2149caf2\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gdb.exe"
      },
      "nrfutil": {
        "nrfutil-device": {
          "version": "2.0.0",
          "binPath": "c:\\Users\\Tom Sansome\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.3.25-win32-x64\\platform\\nrfutil\\bin\\nrfutil-device"
        },
        "nrfutil-toolchain-manager": {
          "version": "0.14.1",
          "binPath": "c:\\Users\\Tom Sansome\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.3.25-win32-x64\\platform\\nrfutil\\bin\\nrfutil-toolchain-manager"
        }
      },
      "environment": {
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\Tom Sansome",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\Tom Sansome",
          "PATH": "C:\\ncs\\toolchains\\cf2149caf2;C:\\ncs\\toolchains\\cf2149caf2\\mingw64\\bin;C:\\ncs\\toolchains\\cf2149caf2\\bin;C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin;C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\Scripts;C:\\ncs\\toolchains\\cf2149caf2\\opt\\nanopb\\generator-bin;C:\\ncs\\toolchains\\cf2149caf2\\opt\\zephyr-sdk\\aarch64-zephyr-elf\\bin;C:\\ncs\\toolchains\\cf2149caf2\\opt\\zephyr-sdk\\x86_64-zephyr-elf\\bin;C:\\ncs\\toolchains\\cf2149caf2\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin;C:\\ncs\\toolchains\\cf2149caf2\\opt\\zephyr-sdk\\riscv64-zephyr-elf\\bin;c:\\Users\\Tom Sansome\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.3.25-win32-x64\\platform\\nrfutil\\lib\\nrfutil-toolchain-manager;C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.8.10-hotspot\\bin;C:\\Program Files\\Microsoft MPI\\Bin\\;C:\\SIMULIA\\Commands;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\DTS\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\MATLAB\\R2016a\\bin;C:\\Program Files\\Calibre2\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\SIMULIA\\Abaqus\\Commands;C:\\Program Files\\Elmer 8.4-Release\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Users\\Tom Sansome\\AppData\\Local\\Programs\\Python\\Python310;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\Tom Sansome\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\FAHClient;C:\\Users\\Tom Sansome\\AppData\\Local\\Programs\\Microsoft VS Code\\bin",
          "ZEPHYR_BASE": "c:\\ncs\\v2.6.1\\zephyr",
          "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
          "ZEPHYR_SDK_INSTALL_DIR": "C:\\ncs\\toolchains\\cf2149caf2\\opt\\zephyr-sdk",
          "PYTHONPATH": "C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin;C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\Lib;C:\\ncs\\toolchains\\cf2149caf2\\opt\\bin\\Lib\\site-packages"
        },
        "inherited": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\Tom Sansome",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\Tom Sansome",
          "Path": "C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.8.10-hotspot\\bin;C:\\Program Files\\Microsoft MPI\\Bin\\;C:\\SIMULIA\\Commands;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\DTS\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\MATLAB\\R2016a\\bin;C:\\Program Files\\Calibre2\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\SIMULIA\\Abaqus\\Commands;C:\\Program Files\\Elmer 8.4-Release\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Users\\Tom Sansome\\AppData\\Local\\Programs\\Python\\Python310;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\Tom Sansome\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\FAHClient;C:\\Users\\Tom Sansome\\AppData\\Local\\Programs\\Microsoft VS Code\\bin",
          "PATH": "C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.8.10-hotspot\\bin;C:\\Program Files\\Microsoft MPI\\Bin\\;C:\\SIMULIA\\Commands;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\120\\DTS\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\MATLAB\\R2016a\\bin;C:\\Program Files\\Calibre2\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\SIMULIA\\Abaqus\\Commands;C:\\Program Files\\Elmer 8.4-Release\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Users\\Tom Sansome\\AppData\\Local\\Programs\\Python\\Python310;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\Tom Sansome\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\FAHClient;C:\\Users\\Tom Sansome\\AppData\\Local\\Programs\\Microsoft VS Code\\bin"
        },
        "toolchainPath": "c:\\ncs\\toolchains\\cf2149caf2",
        "toolchainBinPath": "c:\\ncs\\toolchains\\cf2149caf2\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin",
        "toolchainVersion": "2.6.1"
      },
      "terminal": {
        "defaultProfile": null
      },
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "${nrf-connect.sdk:2.6.1}",
          "toolchain": {
            "path": "${nrf-connect.toolchain:2.6.1}"
          },
          "ozonePath": "",
          "applications": [],
          "applicationOptions": {},
          "kconfig": {
            "interface": "kconfig"
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "taskBindings": {},
          "buildTerminal": {
            "condensedProgress": true
          },
          "debugging": {
            "flash": true,
            "bindings": {},
            "justMyCode": true
          },
          "activeAppFollowActiveEditor": true,
          "deviceProvider": "",
          "flash": {
            "softreset": false,
            "erase": false,
            "recover": false
          },
          "enableTelemetry": false,
          "thirdpartyIntegration": {},
          "toolchainManager": {
            "indexURL": null,
            "installDirectory": null
          },
          "nrfutil": {
            "home": null
          },
          "defaultOpenAction": "ask",
          "welcome": {
            "showOnStartup": false
          }
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        }
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2024.3.25",
            "path": "c:\\Users\\Tom Sansome\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.3.25-win32-x64",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2024.3.15",
            "path": "c:\\Users\\Tom Sansome\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2024.3.15",
            "isActive": true
          },
          "nordic-semiconductor.nrf-devicetree": {
            "version": "2024.3.78",
            "path": "c:\\Users\\Tom Sansome\\.vscode\\extensions\\nordic-semiconductor.nrf-devicetree-2024.3.78",
            "isActive": true
          },
          "nordic-semiconductor.nrf-kconfig": {
            "version": "2024.3.21",
            "path": "c:\\Users\\Tom Sansome\\.vscode\\extensions\\nordic-semiconductor.nrf-kconfig-2024.3.21",
            "isActive": true
          }
        },
        "external": {
          "marus25.cortex-debug": null,
          "ms-vscode.cpptools": "1.20.5",
          "ms-vscode.js-debug": "1.89.0",
          "ms-vscode.js-debug-companion": "1.1.2",
          "ms-vscode.vscode-js-profile-table": "1.0.9",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17"
        }
      }
    }
    
    

    What does this say if you press the play button so that the breakpoint in main is hit? And after it is hit, does the NRF DEBUG terminal still doesn't show anything?

    I had continued to the breakpoint in main() in the previous screenshot (the breakpoint was not right at the start of main() but it makes no difference where i place it in main(). The NRF DEBUG window still shows no threads available at this breakpoint.

    Many thanks,

    Tom

  • Hello Tom,

    Sorry for the late reply. We have had several public days off the last couple of weeks, and the backlog has grown proportionally with that.

    Have you tried this on another computer? I ran this by the team that wrote the DevAcademy course that you refer to, and we didn't find anything that stood out as a mistake. Perhaps there is something wrong with the way that the toolchain is set up. Your project works as intended on my computer.

    So for debugging (the debugging) purposes, can you please try to run the application on a different computer?

    Best regards,

    Edvin

  • Hi Edvin,

    No worries, thanks again for helping with this.

    I have not tried on another computer as I unfortunately don't have access to one at the moment.

    Would removing and then reinstalling everything be worth trying in the mean time? If so are there any specific steps i should take to ensure a fresh install (i.e. just re-install VS code or remove the command line tools and jlink drivers as well)?

    I had previously setup VS code and nRF Connect around a year or two ago but at the time found out that ANT+ was not supported so had to use SES instead. When i set it up this time i wanted to start fresh and uninstalled VS code, the command line tools, jlink drivers etc. and then reinstalled them as per the instructions on the dev academy but found that VS code came back with all my previous extensions and settings for some reason. Do you know if there is a way to do a clean install of VS code?

    Many thanks

    Tom

  • Hello Tom,

    I don't know all the quirks with VS Code, but perhaps you can try some of the hints here:

    https://stackoverflow.com/questions/47689536/how-to-completely-uninstall-vs-code-on-windows

    Also, J-Link is a bit weird some times. I have v7.94e and v7.88j installed on this computer, so perhaps you can try that combination.

    Best regards,

    Edvin

Related