Perfect SDK setup in WSL (almost)

I have spent several months researching and experimenting with creating a working nRF Connect SDK environment in Windows WSL, and finally have everything configured flawlessly, including hardware forwarding so that I can even flash my Audio DK directly from the extension in my Debian VM.

Well, almost everything. For some reason that I cannot fathom, the moment that I create a build configuration, the extension complains that my "SDK is out of sync", even though literally every piece of infrastructure is the absolute latest stable release.

If I ignore the notification, everything continues to work perfectly: editing, building, and flashing all function exactly as designed. However, if I try to run "west update", even though I'm already using the newest toolchain and SDK, many more additional GB are downloaded and several repos confusingly timeout and fail to update, ruining my carefully curated configuration.

I know this is an unsupported setup, so I understand if Nordic cannot offer to assist me, but I feel like I'm just one hidden setting away from development Nirvana. I can tolerate just ignoring the "out of sync" message, but is there anyone with a better understanding of West able to offer suggestions?

Below are a few illustrative screenshots showing before and after, and I've also attached my system's generated Support Information for inspection.

Here's the view of a pristine install, where one can see that the command-line-tools, toolchain, and SDK are all up to date.

Pristine setup shows latest software all up to date.

Here I've added the "hello_world" sample, but before creating a build configuration.

Before creating build configuration, no SDK notifications.

And here's the result after building. Notice that there are no build problems, only the baffling "SDK out of sync" message.

After creating build configuration, SDK is out of sync?

Finally, here's the view from Source Control, mistakenly marking several repos in need of updating.

Source Control now shows several repos out of sync?

Generated 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": "linux",
    "osVersion": "#1 SMP Thu Oct 5 21:02:42 UTC 2023",
    "osKernel": "5.15.133.1-microsoft-standard-WSL2",
    "vscode": "1.86.0",
    "node": "v18.17.1"
  },
  "system": {
    "date": "2024-02-03T00:42:38.272Z",
    "vscodeRoot": "/home/ace/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937",
    "nrfConnectForDesktopInstalled": "unknown",
    "vscodeUptime": "00:23:36",
    "osUptime": "00:24:48",
    "cpu": "Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz"
  },
  "workspace": {
    "name": "code [WSL: Debian-nRF_SDK]",
    "workspaceFile": null,
    "folders": [
      "/home/ace/code"
    ]
  },
  "sdks": [
    {
      "version": "v2.5.2",
      "path": "/home/ace/ncs/v2.5.2"
    }
  ],
  "activeBuild": "/home/ace/code/hello_world/build",
  "apps": [
    {
      "workspace": "/home/ace/code",
      "uri": "/home/ace/code/hello_world",
      "buildConfigurations": [
        {
          "id": "/home/ace/code/hello_world/build",
          "name": "build",
          "boardId": "nrf5340_audio_dk_nrf5340_cpuapp",
          "type": "Zephyr",
          "isChild": false,
          "isStale": false,
          "taskBindings": {
            "build": [],
            "pristineBuild": [],
            "flash": [],
            "eraseAndFlash": []
          }
        }
      ]
    }
  ],
  "topdir": "/home/ace/ncs/v2.5.2",
  "workspaceState": "freestanding-ready",
  "toolchains": [
    {
      "version": "2.5.2",
      "path": "/home/ace/ncs/toolchains/7795df4459"
    }
  ],
  "connectedDevices": [
    {
      "serialNumber": "001050113026",
      "boardVersion": "PCA10121",
      "deviceFamily": "NRF53_FAMILY",
      "deviceVersion": "NRF5340_xxAA_ENGD",
      "jlinkObFirmwareVersion": "J-Link OB-nRF5340-NordicSemi compiled Oct 30 2023 12:13:06"
    }
  ],
  "deviceProvider": "nrfutil",
  "tools": {
    "/home/ace/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc": "0.16.1",
    "/opt/SEGGER/JLink/JLinkExe": "7.94e",
    "/usr/local/bin/nrfjprog": "10.24.0",
    "nrfutil": "Not found",
    "/home/ace/ncs/toolchains/7795df4459/usr/local/bin/cmake": "3.20.5",
    "/home/ace/ncs/toolchains/7795df4459/usr/local/bin/west": "1.1.0",
    "/home/ace/ncs/toolchains/7795df4459/usr/local/bin/python3": "3.8.2",
    "/home/ace/ncs/toolchains/7795df4459/usr/local/bin/ninja": "1.9.0",
    "/home/ace/ncs/toolchains/7795df4459/usr/bin/gperf": "3.1",
    "/home/ace/ncs/toolchains/7795df4459/usr/bin/dtc": "1.4.7",
    "/home/ace/ncs/toolchains/7795df4459/opt/bin/gn": "1871",
    "/home/ace/ncs/toolchains/7795df4459/usr/local/bin/git": "2.37.3",
    "gdbPath": "/home/ace/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb"
  },
  "nrfutil": {
    "nrfutil-device": {
      "version": "2.0.0",
      "binPath": "/home/ace/.vscode-server/extensions/nordic-semiconductor.nrf-connect-2023.11.301-linux-x64/platform/nrfutil/bin/nrfutil-device"
    },
    "nrfutil-toolchain-manager": {
      "version": "0.14.1",
      "binPath": "/home/ace/.vscode-server/extensions/nordic-semiconductor.nrf-connect-2023.11.301-linux-x64/platform/nrfutil/bin/nrfutil-toolchain-manager"
    }
  },
  "environment": {
    "westEnv": {
      "ELECTRON_RUN_AS_NODE": "1",
      "GIT_EXEC_PATH": "/home/ace/ncs/toolchains/7795df4459/usr/local/libexec/git-core",
      "HOME": "/home/ace",
      "PATH": "/home/ace/ncs/toolchains/7795df4459/usr/bin:/home/ace/ncs/toolchains/7795df4459/usr/bin:/home/ace/ncs/toolchains/7795df4459/usr/local/bin:/home/ace/ncs/toolchains/7795df4459/opt/bin:/home/ace/ncs/toolchains/7795df4459/opt/nanopb/generator-bin:/home/ace/ncs/toolchains/7795df4459/opt/zephyr-sdk/aarch64-zephyr-elf/bin:/home/ace/ncs/toolchains/7795df4459/opt/zephyr-sdk/x86_64-zephyr-elf/bin:/home/ace/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin:/home/ace/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/PuTTY/:/mnt/c/Program Files/AdoptOpenJDK/jdk-8.0.292.10-hotspot/bin:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/usbipd-win/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/JRAnderson/bin:/mnt/c/Users/JRAnderson/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files (x86)/serialplot/bin:/mnt/c/Users/JRAnderson/AppData/Local/Programs/Microsoft VS Code/bin:/home/ace/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/PuTTY/:/mnt/c/Program Files/AdoptOpenJDK/jdk-8.0.292.10-hotspot/bin:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/usbipd-win/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/JRAnderson/bin:/mnt/c/Users/JRAnderson/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files (x86)/serialplot/bin:/mnt/c/Users/JRAnderson/AppData/Local/Programs/Microsoft VS Code/bin",
      "ZEPHYR_BASE": "/home/ace/ncs/v2.5.2/zephyr",
      "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
      "ZEPHYR_SDK_INSTALL_DIR": "/home/ace/ncs/toolchains/7795df4459/opt/zephyr-sdk",
      "PYTHONPATH": "/home/ace/ncs/toolchains/7795df4459/usr/local/lib/python3.8:/home/ace/ncs/toolchains/7795df4459/usr/local/lib/python3.8/site-packages",
      "USER": "ace"
    },
    "inherited": {
      "ELECTRON_RUN_AS_NODE": "1",
      "HOME": "/home/ace",
      "PATH": "/home/ace/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/PuTTY/:/mnt/c/Program Files/AdoptOpenJDK/jdk-8.0.292.10-hotspot/bin:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/usbipd-win/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/JRAnderson/bin:/mnt/c/Users/JRAnderson/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files (x86)/serialplot/bin:/mnt/c/Users/JRAnderson/AppData/Local/Programs/Microsoft VS Code/bin",
      "USER": "ace"
    },
    "toolchainPath": "/home/ace/ncs/toolchains/7795df4459",
    "toolchainBinPath": "/home/ace/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin",
    "toolchainVersion": "2.5.2"
  },
  "terminal": {
    "defaultProfile": null
  },
  "config": {
    "nordic-semiconductor.nrf-connect": {
      "topdir": "",
      "toolchain": {
        "path": ""
      },
      "ozonePath": "",
      "applications": [
        "${workspaceFolder}/hello_world"
      ],
      "applicationOptions": {},
      "kconfig": {
        "interface": "kconfig"
      },
      "west": {
        "env": {
          "$base": "terminal"
        }
      },
      "boardRoots": [],
      "taskBindings": {},
      "debugging": {
        "flash": true,
        "bindings": {},
        "justMyCode": true
      },
      "activeAppFollowActiveEditor": true,
      "deviceProvider": "",
      "flash": {
        "softreset": false,
        "erase": false,
        "recover": false
      },
      "enableTelemetry": true,
      "thirdpartyIntegration": {},
      "toolchainManager": {
        "indexURL": null,
        "installDirectory": null
      },
      "nrfutil": {
        "home": null
      },
      "defaultOpenAction": "ask"
    },
    "nordic-semiconductor.nrf-terminal": {
      "terminalMode": "character"
    }
  },
  "extensions": {
    "internal": {
      "nordic-semiconductor.nrf-connect": {
        "version": "2023.11.301",
        "path": "/home/ace/.vscode-server/extensions/nordic-semiconductor.nrf-connect-2023.11.301-linux-x64",
        "isActive": true
      },
      "nordic-semiconductor.nrf-terminal": {
        "version": "2023.10.17",
        "path": "/home/ace/.vscode-server/extensions/nordic-semiconductor.nrf-terminal-2023.10.17",
        "isActive": true
      },
      "nordic-semiconductor.nrf-devicetree": {
        "version": "2023.11.120",
        "path": "/home/ace/.vscode-server/extensions/nordic-semiconductor.nrf-devicetree-2023.11.120",
        "isActive": true
      },
      "nordic-semiconductor.nrf-kconfig": {
        "version": "2023.11.64",
        "path": "/home/ace/.vscode-server/extensions/nordic-semiconductor.nrf-kconfig-2023.11.64",
        "isActive": true
      }
    },
    "external": {
      "marus25.cortex-debug": null,
      "ms-vscode.cpptools": "1.18.5",
      "ms-vscode.js-debug": "1.86.1",
      "ms-vscode.vscode-js-profile-table": "1.0.8",
      "trond-snekvik.gnu-mapfiles": "1.1.0",
      "twxs.cmake": "0.0.17"
    }
  }
}

Parents
  • SUCCESS! I have finally found the setting that eluded me for so long.

    I added the following line to my workspace folder's "/.vscode/settings.json" file:

    {
        "nrf-connect.topdir": "${nrf-connect.sdk:2.5.2}"
    }

    This completely eliminated all of the "SDK is out of sync" notifications I had been receiving, and now my WSL environment is operating without issue. I hope this helps anyone else chasing a similar problem.

    My case is solved. This ticket can be closed.

  • it'd be great if you could share your setup as a tutorial? I'm trying to get twister running and it seems like windows compatibility isn't great.

  • For setting up WSL, I followed Microsoft's WSL documentation to get a working Debian environment, then using APT installed:

    I also followed VS Code's WSL documentation, then installed the WSL extension, connected to my Debian VM, and finally installed the nRF Connect extension which offers easy one-click installation of both the toolchain and SDK.

    The only tedious part was learning how to forward my USB-connected DK to the WSL environment, but a package named USBIP solved that nicely. There's even a GUI that further simplifies its setup and configuration.

    It literally required several weeks of study to understand the entire architecture, but it was a very worthwhile endeavor; I now have separate WSL environments for all my development needs, complete with customized VS Code profiles for each. Highly recommended.

  • Hello ace.johnny,

    I came across your post here while I was experimenting with WSL. First, I should congratulate you on your success with getting your stuff to work.

    My situation is as follows: I have a dual-boot laptop; Windows and Linux. I noticed that my NCS builds under Linux proceed much faster than they do under Windows. The only problem I have is the inconvenience of a dual boot system. Mollified by the fact that I have other laptops that are Windows single boot--but still! So, I felt it made sense to see if a Linux VM or WSL will provide the performance of Linux but the convenience of a Windows computer. I have not had good luck. On WSL during C compilations where ccache was used, I saw high performance during that period of time. But the configurations done at the start of a build seemed to be sluggish in WSL and Windows; and yet, quite fast under Linux. I do not believe that I am prepared to understand the phenomenon, much less fix it.

    I think Mac is even worse than Windows given similar hardware. Actually, both Windows and Mac appear to require

    ignore_options=--specs=picolibc.specs #double check my syntax using ccache -p

    in ccache.conf, but that leaves us with the other problem unresolved.

    Burt Silverman

  • Ace.johnny,

    Please accept my apologies--I was working "blind" and "by feel" when I said that the configuration time was slower on WSL than native Linux. I went back and ran both cases with a stop watch, and I did not see any difference. I think I was in some sort of depressed, pessimistic mood and didn't realize that things were working as they should! Sorry for the craziness!!

    Burt

  • Except that now I again see that native Linux is faster than WSL! I only can say that I don't carefully document every experiment I do, making it hard to replicate past results. Maybe someone else will record their results more carefully!

    Burt

Reply Children
No Data
Related