nrfutil toolchain-manager launch --terminal does not work on Windows

My understanding is that the Toolchain Manager provided by the nRF Connect GUI desktop app is deprecated. I have uninstalled all toolchains and SDKs installed by that app and reinstalled them using the nRF Connect extension in VS Code. My understanding also is that I can still get CLI functionality using nrfutil.

I downloaded the nrfutil executable and made it available via the system path. I have also installed the "toolchain-manager" and "device" modules for nrfutil. I am now trying to start an interactive terminal with proper build environment set up. No matter what I do, I just get immediately dumped back to the Windows command prompt. I have tried both from cmd.exe and Git bash.

When I do use `nrfutil toolchain-manager launch --shell` in WSL/Ubuntu, it works properly and I get a new shell environment.

Here is trace log output from the Windows version of nrfutil after attempting to start a shell. The shell is closed within 50ms with exit code 0. There is no other error information.

[2024-03-27T15:24:30.667Z] [nrfutil-toolchain-manager] INFO - nrfutil-toolchain-manager (version = 0.14.2, platform = x86_64-pc-windows-msvc) invoked with launch --log-level trace --log-output=file --ncs-version v2.5.0 --terminal
[2024-03-27T15:24:30.668Z] [nrfutil-toolchain-manager] INFO - Retrieving toolchains from file C:\ncs\toolchains\toolchains.json
[2024-03-27T15:24:30.668Z] [nrfutil-toolchain-manager] TRACE - Opening and locking file: C:\ncs\toolchains\toolchains.json
[2024-03-27T15:24:30.714Z] [nrfutil-toolchain-manager] INFO - Exit code: exit code: 0

Here is a similar log from the Linux version of nrfutil running in WSL2/Ubuntu 22.04. The shell is not closed until I type `exit` three seconds later and this time it has an exit code of 127.

[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] INFO - nrfutil-toolchain-manager (version = 0.14.1, platform = x86_64-unknown-linux-gnu) invoked with launch --log-level trace --log-output=file --ncs-version v2.5.0 --shell
[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] DEBUG - Constructing the configuration from the defaults
[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] DEBUG - Current config: Config { install_dir: "/home/afont/ncs", toolchain_index: None }
[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] INFO - Retrieving toolchains from file /home/afont/ncs/toolchains/toolchains.json
[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] TRACE - Opening and locking file: /home/afont/ncs/toolchains/toolchains.json
[2024-03-27T15:25:29.736Z] [nrfutil-toolchain-manager] INFO - Exit code: exit status: 127

Is there something I am doing wrong that is preventing this from working in Windows?

Parents Reply Children
  • Executing "cmd.exe /c start" from Windows run dialog (i.e. dialog opened by Windows-x, r). This opens a cmd.exe shell that remains open.

    aaronf@DESKTOP-RNAG27J MINGW64 ~/Documents/Learning/NCS/ncs-low-power (ncs-v2.5.0)
    $ nrfutil toolchain-manager list
      Version  Toolchain
      v2.5.0   C:\ncs\toolchains\c57af46cb7
      v2.2.0   C:\ncs\toolchains\v2.2.0
    * v2.6.0   C:\ncs\toolchains\cf2149caf2

    Edition    Windows 10 Pro
    Version    22H2
    Installed on    ‎4/‎10/‎2021
    OS build    19045.4170
    Experience    Windows Feature Experience Pack 1000.19054.1000.0

  • Additional info:

    If I run "cmd.exe /c start" from within Git Bash (run from Windows Terminal app) it opens a subshell in the same window. I can then "exit" back to Git Bash.

    If I run "cmd.exe /c start" from a cmd.exe window, it spawns a new cmd.exe window.

  • Hello,

    So it looks like that is not the issue then. I have discussed this a bit with some colleagues, and we figured that the nrfutil toolchain-manager tool doesn't work out of tree, meaning if your application is outside the SDK root folder you can't use this tool to set up the toolchain. Is that the case for your application? Is the application located outside the SDK? If so, I believe that the only way to "easily" set up the toolchain is to do so using nRF Connect for Desktop -> Toolchain manager. If you keep your application inside the SDK root folder, I can ask the nrfutil if they have any other ideas as to why the new window closes itself.

    BR,
    Edvin

  • Yes, it is out of tree. That's pretty normal, I think. The toolchain and SDK versions are selected in VS Code and VS Code is able to make all the correct references and set up the build environment properly.

    When using nrfutil toolchain-manager, I'm running it from the root of the repo. I suppose I could try it from the NCS folder and the cd to the repo root, but that seems a little clunky.

  • My understanding is that nRF Connect for Desktop -> Toolchain manager is handling both installing the SDK and the toolchain. Therefore it knows what paths to set e.g. for the Zephyr base. The nrfutil toolchain manager, however, is only in charge of the toolchains, and it is used by the VS Code extention, which installs and activates toolchains separately. This is why it isn't a "simple fix" to have nrfutil toolchain-manager to work out of tree, because it wouldn't know where the location of the SDK. 

    Aaron F said:
    I suppose I could try it from the NCS folder and the cd to the repo root, but that seems a little clunky.

    That wouldn't help. The window it opens will only work inside the tree. If you cd out of it, it stops working.

    Best regards,

    Edvin

Related