nrfutil: Error: Failed to find default toolchain

I'm using nrf SDK v2.4.1, when I use "nrfutil toolchain-manager  list" command I get the below 

However when I try to use command like launch or env, I got the below:

Also from vs code extension, when I try to use the Manage toolchains button, I got the below error

Any Idea how to fix this?

Parents
  • Hello,

    I spoke to the team who develops nrfutil, and they wrote the following:

    ------------------------

    The default version of the nrfutil toolchain should have an asterix in front of it when you use nrfutil toolchain-manager list. The user doesn't have that, so I believe they do not have a default toolchain set. It seems like the nrfutil toolchain version that you install latest is always the default version. If you install a new (or old) version, and then uninstall it, there is no mechanism to set another version to the default version. 

    Two ways of fixing this:

    -When running things like launch or env, you can specify the version of the toolchain to use. E.g. run "nrfutil toolchain-manager launch --ncs-version v2.4.1 --terminal"

    -you can issue to install the already installed toolchain, v2.4.1. It will say that it is already installed, but after this it wil set v2.4.1 as the default version again.

    ------------------------

    Can this be the case, that you installed another version at some point?

    Can you try to run "nrfutil toollchain-manager install --ncs-version v2.4.1", and then "nrfutil toolchain-manager list" to see if it now has an asterix in front of " * v2.4.1"?

    Best regards,

    Edvin

  • Hi,

    When I posted the problem, I had only one toolchain installed, but after I posted the issue I was trying to find a fix by installing different versions.

    I tried the second solution to reinstall the same version. Now I see the asterix right next to v2.4.1

    even after this, I'm still getting the below error, when I try the Manage toolchains button on the UI

    However the "nrfutil toolchain-manager launch --terminal" command now doesn't throw the error, It didn't launch the terminal. When I try west command it fails.

  • Hello,

    How/from where did you install nrfutil.exe, and what version is it? nrfutil --version shold tell you what version it is:

    Can you show a larger portion of the screen when you try to use the UI from VS Code? What nordic extension did you install in VS Code?

    Best regards,

    Edvin

  • You ran `nrfutil toolchain-manager launch --terminal` and tried to then call `west` in the same terminal in which you called `nrfutil`. But `nrfutil toolchain-manager launch --terminal` will open another terminal window and you can run `west` in there.

    On other platforms you an also use `--shell` but that doesn't seem to be available on Windows.

    What you can also do is to specify the commands to run instead of `--terminal` directly after a `--`, e.g. `nrfutil toolchain-manager launch -- west --version`. But this doesn't seem very practical to me for many commands.

    What seems possible, since I see that you use powershell: Run `nrfutil toolchain-manager launch powershell` to directly create a new instance of powershell in the current window with the correct environment.

    What also might be an option for you: Use the output of `nrfutil toolchain-manager env` to set up an environment in which all needed paths are correctly set for your toolchain.

Reply
  • You ran `nrfutil toolchain-manager launch --terminal` and tried to then call `west` in the same terminal in which you called `nrfutil`. But `nrfutil toolchain-manager launch --terminal` will open another terminal window and you can run `west` in there.

    On other platforms you an also use `--shell` but that doesn't seem to be available on Windows.

    What you can also do is to specify the commands to run instead of `--terminal` directly after a `--`, e.g. `nrfutil toolchain-manager launch -- west --version`. But this doesn't seem very practical to me for many commands.

    What seems possible, since I see that you use powershell: Run `nrfutil toolchain-manager launch powershell` to directly create a new instance of powershell in the current window with the correct environment.

    What also might be an option for you: Use the output of `nrfutil toolchain-manager env` to set up an environment in which all needed paths are correctly set for your toolchain.

Children
  • Hi,

    Here is the nrfutil --version

    nrfutil toolchain-manager launch powershell command seems to work. 

    The question now, how to fix the extension UI to work with powershell? or if the powershell is the problem, how to make the extension uses command prompt?

    I'm asking about fixing the extension UI, as the debug button is not working as well and I feel that all these issues are related to one root case.

    Here is the output of the nrfutil toolchian-manger env

    PS D:\src_code\firmware_kfob> nrfutil toolchain-manager env
    PATH                     : C:\ncs\toolchains\31f4403e35;C:\ncs\toolchains\31f4403e35\mingw64\bin;C:\ncs\toolchains\31f4403e35\bin;C:\ncs\toolchains\31f4403e35\opt\bin;C:\ncs\toolchains\31f4403e35\opt\bin\Scripts;C:\ncs\toolchains\31f4403e35\opt\nanopb\generator-bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\aarch64-zephyr-elf\bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\x86_64-zephyr-elf\bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\arm-zephyr-eabi\bin;C:\Users\ahmedsamir\.nrfutil\lib\nrfutil-toolchain-manager;C:\ncs\toolchains\31f4403e35;C:\ncs\toolchains\31f4403e35\mingw64\bin;C:\ncs\toolchains\31f4403e35\bin;C:\ncs\toolchains\31f4403e35\opt\bin;C:\ncs\toolchains\31f4403e35\opt\bin\Scripts;C:\ncs\toolchains\31f4403e35\opt\nanopb\generator-bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\aarch64-zephyr-elf\bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\x86_64-zephyr-elf\bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\arm-zephyr-eabi\bin;C:\Users\ahmedsamir\.nrfutil\lib\nrfutil-toolchain-manager;C:\ncs\toolchains\31f4403e35;C:\ncs\toolchains\31f4403e35\mingw64\bin;C:\ncs\toolchains\31f4403e35\bin;C:\ncs\toolchains\31f4403e35\opt\bin;C:\ncs\toolchains\31f4403e35\opt\bin\Scripts;C:\ncs\toolchains\31f4403e35\opt\nanopb\generator-bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\aarch64-zephyr-elf\bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\x86_64-zephyr-elf\bin;C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\arm-zephyr-eabi\bin;C:\Users\ahmedsamir\.nrfutil\lib\nrfutil-toolchain-manager;c:\Users\ahmedsamir\.vscode\extensions\ms-python.python-2024.0.1\pythonFiles\deactivate\powershell;D:\src_code\firmware_kfob\venv\Scripts;C:\Program Files\Amazon Corretto\jdk21.0.2_13\bin;C:\Program Files\Amazon Corretto\jdk1.8.0_402\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\TASKING\TriCore v6.3r1\ctc\bin;C:\Program Files\mingw64\bin;C:\Program Files\dotnet\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\uncrustify-0.71.0;C:\Program Files\PuTTY\;C:\Program Files (x86)\Vector CANdb++ 3.1\Exec32;C:\Program Files\Nordic Semiconductor\nrf-command-line-tools\bin\;C:\ncs;C:\ncs\downloads;C:\Users\ahmedsamir\AppData\Local\Microsoft\WindowsApps;C:\Users\ahmedsamir\AppData\Local\Programs\Git\cmd;C:\Users\ahmedsamir\AppData\Local\Programs\Git LFS;C:\Users\ahmedsamir\AppData\Roaming\uncrustify-0.71.0_f-win32;C:\Users\ahmedsamir\Infineon\LauncherService;C:\Users\ahmedsamir\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\ahmedsamir\Downloads\hexdump-2.1.0;
    PYTHONPATH               : C:\ncs\toolchains\31f4403e35\opt\bin;C:\ncs\toolchains\31f4403e35\opt\bin\Lib;C:\ncs\toolchains\31f4403e35\opt\bin\Lib\site-packages
    ZEPHYR_SDK_INSTALL_DIR   : C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk
    ZEPHYR_TOOLCHAIN_VARIANT : zephyr

  • Based on the title of the post my understanding was, that you wanted to make `nrfutil` run. And that seems to work now?!?

    But while `nrfutil` is a command line tool and only partially connected to the VS Code extension, my understanding now is that your actual goal is to make “nRF Connect for VS Code” work correctly for you? (I don't have the impression that why `nrfutil` didn't work before and why some things in the VS Code extension do not work correctly for you have are related to one root case.)

    If this really is about “nRF Connect for VS Code” then please provide more information about that: Which version of VS Code and the VS Code extension are you using? Did you try to reinstall the VS Code extension and restart VS Code after that? 

  • It occurs to me now that you are trying to use this from the terminal inside VS Code. Is that necessary? You know that you can use the IDE itself to build and flash, right?

    You can use nrfutil if you want to build in a terminal outside of VS Code, such as in a normal cmd window in Windows.

    I am not able to build from the terminal inside VS Code either (but I guess I never tried it). 

    So if you want to set up your environment in a terminal outside VS Code, you can use nrfutil toolchain-manager.

    Disclaimer:

    I still use the "old" environment workaround to set up the environment, becuase I find it more convenient. In nRF Connect for Desktop -> Toolchain Manager, you can download and install the different NCS versions. There you can also "Generate environment scripts". This generates a file called "env.cmd". If you save the file to a folder in your environment path, you can call this file from any terminal, and it will set up the environment in that terminal. 

    Best regards,

    Edvin

  • my goal is to get nrfutil to work and VS Code extension as well. I was under the impression that both issues related, but you are the expert :D 

    Now nrfutil works fine.

    For VS Code extenstion, yes I tried to re-install and close/open VS Code, but this didn't help.

    The extension currently works fine for build and flashing, but it doesn't work for manage toolchains, manage west workspace and debugging. 

    Actually the most important feature missing is the debugging.

    Here is the extension details:

  • I have a problem with the toolchain manager, it doesn't open. Do I need to modify any folder paths in the extension settings to get it to work. I installed the ncs folder in C:/ as recommended.

    For the environment file, what is the usage of this file. Is this to call west from terminal?

Related