Unable to start debugging in VS Code when not executed as admin

Hi community,

I was changing the IDE from SES to VS Code and got everything running fine except debugging.

If i execute VS Code as administrator debugging works as supposed.

Starting debugging in VS Code as user will emit the following error message:

Well, J-Link is properly installed and the registry key seems to be properly defined, too:

Since i don't know how VS Code and OS registry work in this case, i cannot detect the error.

Please help me out here!

Thanks in advance, best greets

AleBeBu

Parents
  • Hi Øyvind,

    yes, I am working on a corporate computer and have a standard and local admin user for SW installing.

    {
      "platform": {
        "os": "win32",
        "osVersion": "Windows 10 Enterprise",
        "osKernel": "10.0.19044",
        "vscode": "1.64.2",
        "electron": "13.5.2",
        "node": "v14.16.0"
      },
      "system": {
        "date": "2022-02-28T13:51:22.926Z",
        "vscodeRoot": "c:\\Program Files\\Microsoft VS Code\\resources\\app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "01:04:51",
        "osUptime": "06:15:20",
        "cpu": {
          "model": "Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz",
          "speed": "2208 MHz",
          "count": 4
        },
        "memory": {
          "total": "15.65 GB",
          "free": "7.19 GB"
        }
      },
      "workspace": {
        "name": "nordic_wcp_demo",
        "workspaceFile": null,
        "folders": [
          "c:\\Users\\wn00181912\\Nordic\\Applications\\nordic_wcp_demo"
        ]
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2022.1.192",
            "path": "c:\\Users\\wn00181912\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2022.1.192",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2022.1.30",
            "path": "c:\\Users\\wn00181912\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2022.1.30",
            "isActive": true
          },
          "nordic-semiconductor.devicetree": null,
          "nordic-semiconductor.kconfig": null
        },
        "external": {
          "marus25.cortex-debug": "1.2.2",
          "ms-vscode.cpptools": "1.8.4",
          "ms-vscode-remote.remote-wsl-recommender": "0.0.12",
          "ms-vscode.js-debug": "1.64.3",
          "ms-vscode.js-debug-companion": "1.0.15",
          "ms-vscode.references-view": "0.0.81",
          "ms-vscode.vscode-js-profile-table": "0.0.18",
          "alefragnani.project-manager": "12.5.0",
          "codezombiech.gitignore": "0.7.0",
          "cschlosser.doxdocgen": "1.4.0",
          "donjayamanne.git-extension-pack": "0.1.3",
          "donjayamanne.githistory": "0.6.19",
          "eamodio.gitlens": "11.7.0",
          "jeff-hykin.better-cpp-syntax": "1.15.13",
          "ms-vscode-remote.remote-containers": "0.217.4",
          "ms-vscode-remote.remote-ssh": "0.74.0",
          "ms-vscode-remote.remote-ssh-edit": "0.74.0",
          "ms-vscode-remote.remote-wsl": "0.64.2",
          "ms-vscode.cmake-tools": "1.9.2",
          "ms-vscode.cpptools-extension-pack": "1.1.0",
          "ms-vscode.cpptools-themes": "1.0.0",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17",
          "ziyasal.vscode-open-in-github": "1.3.6"
        }
      },
      "tools": {
        "C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.15.0",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\cmake.exe": "3.20.5",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Scripts\\west.exe": "0.12.0",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\python.exe": "3.8.2",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\ninja.exe": "1.9.0",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\gperf.exe": "3.1",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\dtc.exe": "1.4.7",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\arm-none-eabi-gcc.exe": "9-2019-q4-major",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\gn.exe": "1975",
        "c:\\ncs\\v1.9.0\\toolchain\\mingw64\\bin\\git.exe": "2.26.2.windows.1"
      },
      "connectedDevices": [
        {
          "id": "683138305"
        }
      ],
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "c:\\ncs\\v1.9.0",
          "toolchain": {
            "path": "c:\\ncs\\v1.9.0\\toolchain"
          },
          "ozonePath": "",
          "applications": [
            "${workspaceFolder}",
            "c:\\Users\\wn00181912\\Nordic\\Applications\\blinky"
          ],
          "jlink": {
            "rtosPlugin": ""
          },
          "kconfig": {
            "interface": "kconfig"
          },
          "welcome": {
            "showOnStartup": false
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "enableTelemetry": false
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        },
        "nordic-semiconductor.devicetree": {
          "modules": [
            "${zephyrBase}",
            "${zephyrBase}/../nrf",
            "."
          ],
          "zephyr": "",
          "ctxFile": "",
          "defaultBoard": ""
        },
        "nordic-semiconductor.kconfig": {
          "root": "",
          "env": {},
          "cfiles": true,
          "disable": false,
          "zephyr": {
            "base": ""
          },
          "python": "",
          "liveValue": true
        },
        "marus25.cortex-debug": {
          "armToolchainPath": null,
          "armToolchainPrefix": "arm-none-eabi",
          "gdbPath": null,
          "objdumpPath": null,
          "JLinkGDBServerPath": null,
          "openocdPath": null,
          "pyocdPath": null,
          "PEGDBServerPath": null,
          "stutilPath": null,
          "stlinkPath": null,
          "stm32cubeprogrammer": null,
          "enableTelemetry": true,
          "flattenAnonymous": false,
          "registerUseNaturalFormat": true,
          "variableUseNaturalFormat": true,
          "dbgServerLogfile": null,
          "showDevDebugOutput": "none"
        }
      },
      "environment": {
        "westExe": "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Scripts\\west.exe",
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\wn00181912",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\wn00181912",
          "Path": "c:\\ncs\\v1.9.0\\toolchain\\mingw64\\bin;c:\\ncs\\v1.9.0\\toolchain\\mingw64\\libexec\\git-core;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Scripts;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files\\Python\\Scripts\\;C:\\Program Files\\Python\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\PuTTY\\;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files\\PowerShell\\7\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\SEGGER\\JLink;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\wn00181912\\AppData\\Local\\Microsoft\\WindowsApps",
          "ZEPHYR_BASE": "c:\\ncs\\v1.9.0\\zephyr",
          "GNUARMEMB_TOOLCHAIN_PATH": "c:\\ncs\\v1.9.0\\toolchain\\opt",
          "ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
          "PYTHONPATH": "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Lib;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Lib\\site-packages",
          "Python3_ROOT": "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin"
        },
        "toolchainPath": "c:\\ncs\\v1.9.0\\toolchain",
        "toolchainBinPath": "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin",
        "toolchainVersion": "1.9.0"
      },
      "terminal": {
        "shell": null,
        "defaultProfile": null
      }
    }

    Thanks in advanve

    Alebebu

  • Hi Alebebu, 
    Have not been able to look into your issue yet, but have not forgotten you. I need some time to discuss with the VS Code team.

    Kind regards,
    Øyvind

  • Note that both paths in your outputs show C:\Program Files (x86)\SEGGER\JLink\JLink.exe, but the administrator enabled version has C:\Program Files\SEGGER\JLink\JLink.exe

  • I deinstalled 64bit version and installed 32bit version of JLink. Issue is still there.

    Here the Output of nrf genereate support information, when VSCode is executed as local admin:

    {
      "platform": {
        "os": "win32",
        "osVersion": "Windows 10 Enterprise",
        "osKernel": "10.0.19044",
        "vscode": "1.64.2",
        "electron": "13.5.2",
        "node": "v14.16.0"
      },
      "system": {
        "date": "2022-03-03T12:27:20.357Z",
        "vscodeRoot": "c:\\Program Files\\Microsoft VS Code\\resources\\app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "00:00:44",
        "osUptime": "04:51:07",
        "cpu": {
          "model": "Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz",
          "speed": "2208 MHz",
          "count": 4
        },
        "memory": {
          "total": "15.65 GB",
          "free": "7.61 GB"
        }
      },
      "workspace": {
        "name": "blinky",
        "workspaceFile": null,
        "folders": [
          "c:\\Users\\la00181912\\Documents\\blinky"
        ]
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2022.1.192",
            "path": "c:\\Users\\la00181912\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2022.1.192",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2022.1.30",
            "path": "c:\\Users\\la00181912\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2022.1.30",
            "isActive": true
          },
          "nordic-semiconductor.devicetree": null,
          "nordic-semiconductor.kconfig": null
        },
        "external": {
          "marus25.cortex-debug": "1.2.2",
          "ms-vscode.cpptools": "1.8.4",
          "ms-vscode-remote.remote-wsl-recommender": "0.0.12",
          "ms-vscode.js-debug": "1.64.3",
          "ms-vscode.js-debug-companion": "1.0.15",
          "ms-vscode.references-view": "0.0.81",
          "ms-vscode.vscode-js-profile-table": "0.0.18",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17"
        }
      },
      "tools": {
        "C:\\Program Files (x86)\\SEGGER\\JLink\\JLink.exe": "7.62a",
        "C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.15.0",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\cmake.exe": "3.20.5",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Scripts\\west.exe": "0.12.0",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\python.exe": "3.8.2",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\ninja.exe": "1.9.0",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\gperf.exe": "3.1",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\dtc.exe": "1.4.7",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\arm-none-eabi-gcc.exe": "9-2019-q4-major",
        "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\gn.exe": "1975",
        "c:\\ncs\\v1.9.0\\toolchain\\mingw64\\bin\\git.exe": "2.26.2.windows.1"
      },
      "connectedDevices": [
        {
          "id": "683870415"
        }
      ],
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "c:\\ncs\\v1.9.0",
          "toolchain": {
            "path": "c:\\ncs\\v1.9.0\\toolchain"
          },
          "ozonePath": "",
          "applications": [
            "c:\\Users\\la00181912\\Documents\\blinky"
          ],
          "jlink": {
            "rtosPlugin": ""
          },
          "kconfig": {
            "interface": "kconfig"
          },
          "welcome": {
            "showOnStartup": false
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "enableTelemetry": false
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        },
        "nordic-semiconductor.devicetree": {
          "modules": [
            "${zephyrBase}",
            "${zephyrBase}/../nrf",
            "."
          ],
          "zephyr": "",
          "ctxFile": "",
          "defaultBoard": ""
        },
        "nordic-semiconductor.kconfig": {
          "root": "",
          "env": {},
          "cfiles": true,
          "disable": false,
          "zephyr": {
            "base": ""
          },
          "python": "",
          "liveValue": true
        },
        "marus25.cortex-debug": {
          "armToolchainPath": null,
          "armToolchainPrefix": "arm-none-eabi",
          "gdbPath": null,
          "objdumpPath": null,
          "JLinkGDBServerPath": null,
          "openocdPath": null,
          "pyocdPath": null,
          "PEGDBServerPath": null,
          "stutilPath": null,
          "stlinkPath": null,
          "stm32cubeprogrammer": null,
          "enableTelemetry": true,
          "flattenAnonymous": false,
          "registerUseNaturalFormat": true,
          "variableUseNaturalFormat": true,
          "dbgServerLogfile": null,
          "showDevDebugOutput": "none"
        }
      },
      "environment": {
        "westExe": "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Scripts\\west.exe",
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\la00181912",
          "Path": "c:\\ncs\\v1.9.0\\toolchain\\mingw64\\bin;c:\\ncs\\v1.9.0\\toolchain\\mingw64\\libexec\\git-core;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Scripts;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files\\Python\\Scripts\\;C:\\Program Files\\Python\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\PuTTY\\;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files\\PowerShell\\7\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\SEGGER\\JLink;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\la00181912\\AppData\\Local\\Microsoft\\WindowsApps",
          "ZEPHYR_BASE": "c:\\ncs\\v1.9.0\\zephyr",
          "GNUARMEMB_TOOLCHAIN_PATH": "c:\\ncs\\v1.9.0\\toolchain\\opt",
          "ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
          "PYTHONPATH": "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Lib;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Lib\\site-packages",
          "Python3_ROOT": "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin"
        },
        "toolchainPath": "c:\\ncs\\v1.9.0\\toolchain",
        "toolchainBinPath": "c:\\ncs\\v1.9.0\\toolchain\\opt\\bin",
        "toolchainVersion": "1.9.0"
      },
      "terminal": {
        "shell": null,
        "defaultProfile": null
      }
    }

    Thanks for your efforts on helping me!

  • What do you mean by 

    both paths in your outputs show C:\Program Files (x86)\SEGGER\JLink\JLink.exe

    ?

    I could't find this paths in the first two outputs i sent you.

    I only found C:\Program Files\SEGGER\JLink\JLink.exe in "tools" structure.

  • AleBeBu said:
    I could't find this paths in the first two outputs i sent you.

    I was referring to the windows path in the support information, line 154, under environment:
    Path": "c:\\ncs\\v1.9.0\\toolchain\\mingw64\\bin;c:\\ncs\\v1.9.0\\toolchain\\mingw64\\libexec\\git-core;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin;c:\\ncs\\v1.9.0\\toolchain\\opt\\bin\\Scripts;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Program Files\\Python\\Scripts\\;C:\\Program Files\\Python\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\PuTTY\\;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files\\PowerShell\\7\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\SEGGER\\JLink;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\la00181912\\AppData\\Local\\Microsoft\\WindowsApps",

    AleBeBu said:
    Thanks for your efforts on helping me!

    That's what we're here for. Note that you often not alone in having these kind of issues, and that it's good for our team to find a solution for this. Unfortunately, they have not found any solutions yet. 

    The only work-around at the moment is to run the environment as admin.

  • Another suggestion from our team is to rund the following command in e.g. PowerShell or Command Prompt:

    reg query HKEY_LOCAL_MACHINE\Software\SEGGER\J-Link

    Do this for both admin and non-admin, if possible.

    Also, can you try to completely remove JLink from your computer, then reboot and reinstall as standard user? 

Reply Children
Related