This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF Connect VS Code extension no connected devices

Hello,

I recently installed the nRF Connect extension for VS Code on my Mac M1. I am unable to see my connected board as part of the nRF Connect extension.

Setup

  • nrfjprog version: 10.14.0 external
  • JLinkARM.dll version: 7.54c
  • M1 Macbook

Something odd I noticed is when I ran the nrfjprog command in the terminal I get:

nrfjprog --version --log
ERROR: [SeggerBackend] - The J-Link library does not support execution inside rosetta 2. Try executing with arch -arch arm64 nrfjprog...
ERROR: An internal error has occurred, please try again.

If I run with the suggested option then it completes successfully:

arch -arch arm64 nrfjprog -v
nrfjprog version: 10.14.0 external
JLinkARM.dll version: 7.54c

I am then also able to see the serial number of the debugger connected:

arch -arch arm64 nrfjprog --ids
683511319

Am I missing something in my VS Code setup? Is there a known issue with the VS Code extension on M1 mac?

Parents
  • Hi julien.h,

    Thanks for this report. It looks like you're using a version of VS Code compiled for Intel processors. Running this on an M1 machine causes VS Code, and all child processes launched by the extension, to be run inside the Rosetta 2 translation environment. As the error message you received states, nrfjprog isn't compatible with this environment.

    Please try uninstalling your current VS Code installation, and instead install the Universal version. That will prevent nrfjprog running inside Rosetta 2, so the connected devices should appear.

    Kind regards,

    Dee

    VS Code Team

  • Hi Dee,

    Thank you for the answer. I was indeed running the x86 version. I installed the ARM version of VS Code now. However, I am still unable to find the device in VS Code. I still it connected when running "nrfjprog" tool direclty.

    Here is the VS Code version I am running:

    Version: 1.60.2 (Universal)
    Commit: 7f6ab5485bbc008386c4386d08766667e155244e
    Date: 2021-09-22T11:59:27.195Z
    Electron: 13.1.8
    Chrome: 91.0.4472.164
    Node.js: 14.16.0
    V8: 9.1.269.39-electron.0
    OS: Darwin arm64 20.2.0

    Kind regards

  • Hi,

    This sounds similar to another issue that we're investigating. We'll hopefully have a fix soon. Just so we have an additional data point to work with, could you please run the following steps:

    1. Open the command palette, and run the "nRF Connect: Generate Support Information" command.

    2. Find the "tools" and "environment" entries in the JSON entry that should have opened up.

    3. Paste that in a reply here

    It would be particularly interesting to see if the extension can find nrfjprog in your PATH.

    Kind regards,

    Dee,

    VS Code Team

  • Hi Dee,

    It looks like the tools section doesn't find the different paths. Why is that?

    "tools": {
    "jlink": null,
    "nrfjprog": null,
    "cmake": null,
    "west": null,
    "python": null,
    "ninja": null,
    "gperf": null,
    "dtc": null,
    "gnuarmemb": null,
    "gn": null
    },

    "environment": {
    "westExe": "/opt/nordic/ncs/v1.6.1/toolchain/bin/west",
    "westEnv": {
    "ELECTRON_RUN_AS_NODE": "1",
    "GIT_EXEC_PATH": "/opt/nordic/ncs/v1.6.1/toolchain/Cellar/git/2.32.0_1/libexec/git-core",
    "HOME": "/Users/user",
    "PATH": "/opt/nordic/ncs/v1.6.1/toolchain/bin:/usr/bin:/bin:/usr/sbin:/sbin",
    "ZEPHYR_BASE": "/opt/nordic/ncs/v1.6.1/zephyr",
    "GNUARMEMB_TOOLCHAIN_PATH": "/opt/nordic/ncs/v1.6.1/toolchain",
    "ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
    "USER": "user"
    },
    "toolchainPath": "/opt/nordic/ncs/v1.6.1/toolchain",
    "toolchainBinPath": "/opt/nordic/ncs/v1.6.1/toolchain/bin",
    "toolchainVersion": "1.6.1"
    },
    Kind regards
  • Hi,

    It looks like your PATH is missing the /usr/local/bin directory. When I run which on the various tools, they are all located there. If that directory is not in your PATH, please add it and try again.

    If you still have problems, can you confirm which shell you are using? If you're using zsh, please try copying your environment variables to your ~/.profile file.  The extension currently has a few issues with picking up variables defined in .zshrc, which we're working to improve.

    -Dee

Reply
  • Hi,

    It looks like your PATH is missing the /usr/local/bin directory. When I run which on the various tools, they are all located there. If that directory is not in your PATH, please add it and try again.

    If you still have problems, can you confirm which shell you are using? If you're using zsh, please try copying your environment variables to your ~/.profile file.  The extension currently has a few issues with picking up variables defined in .zshrc, which we're working to improve.

    -Dee

Children
  • Hi, 

    My tools are indeed in /usr/local/bin directory which is missing from "PATH": "/opt/nordic/ncs/v1.6.1/toolchain/bin:/usr/bin:/bin:/usr/sbin:/sbin" in westEnv. However, I don't know how this west environemnt path is generated. I know the first part is based on the settings for the toolchain (/opt/nordic/ncs/v1.6.1/toolchain/bin) however I don't know how the second part is picked up (/usr/bin:/bin:/usr/sbin:/sbin). 

    I put in my ~/.profile:

    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH

    Which seems to be working fine when I do:

    echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/opt/X11/bin

    But still not updating the PATH in westEnv and not seeing the tools picked up.

    Thanks.

Related