Toolchain bash prompt in NCS v2.0.0

I would like to be able to open a bash prompt with the nRF Connect SDK (NCS) v2.0.0 toolchain environment loaded without going through Toolchain Manager ("open bash" option).

Using NCS v1.9.1, I would run "git-bash.exe" located in the "v1.9.1/toolchain" folder. A bash prompt would open, the current directory would be the root NCS v1.9.1 folder, and I could run west commands just fin.

Using NCS v2.0.0, I run "git-bash.exe" located in the "toolchains/v2.0.0" folder. A bash prompt opens, but the current directory is "/" (the "toolchains/v2.0.0" folder) and when I run west, I get a "command not found" error. I also tried running "git-cmd.exe", which opens a command prompt, but again west is not recognized as a command.

For NCS v2.0.0, using Toolchain Manager to open bash or open command prompt works just fine.

Any suggestions? Is this a defect in NCS v2.0.0?

Thanks!

Parents
  • Hi,

    This is an issue in 2.0.0 that has been reported. We plan to fix this in the next release of the Toolchain manager. For now, you can work around it by running zephyr\zephyr-env.cmd.

  • Thanks for the update!

    Unfortunately, the work around you suggested did not work for me. I'm trying to open a bash prompt, so I did the following:

    1. Ran "git-bash.exe" from "toolchains/v2.0.0" to open a bash prompt.
    2. Navigated to the "v2.0.0/zephyr" folder.
    3. Ran "source zephyr-env.sh"

    Then I tried to run west and received the "command not found" error.

    What am I missing to get the workaround to work?

  • Ah, sorry - I forgot that you were using bash before writing the answer. For cmd you can do as I suggested. With bash, you just need to set the path to ZEPHYR_BASE. For instance, on my PC that would be:

    export ZEPHYR_BASE=/c/Users/eith/src/tcm_ncs/v2.0.0/zephyr/

  • Unfortunately that did not work either. I opened a prompt using "git-bash.exe" and then ran

    export ZEPHYR_BASE=/c/Users/abkirchhoff/NordicSdk/v2.0.0/zephyr/

    I also ran 

    source /c/Users/abkirchhoff/NordicSdk/v2.0.0/zephyr/zephyr-env.sh

    After both steps, attempting to run west resulted in a "command not found" error.

    I believe there may be PATH or other environment variables not being set up correctly. These may be hard to chase down and may have a more complicated workaround than just using Toolchain Manager to launch the bash prompt. So I'll just wait for that next release of Toolchain Manager. :-)

    Thanks for your help!

  • I'm not 100% sure this is still the case, but with previous versions I had a build set up where I used a custom ZEPHYR_BASE, ZEPHYR_TOOLCHAIN_VARIANT and GNUARMEMB_TOOLCHAIN_PATH. The only way this worked was if I also appended the following to the end of the west build command. Worth a try?

    -- -DNCS_TOOLCHAIN_VERSION=NONE
  • I did not specify, but did you start the terminal from the toolchain manager? That is always required, and is a pre-requisite for what I described in my previous post:

  • Einar,

    The point of my original post was that I would like to start a bash prompt that loads the correct Zephyr/west environment WITHOUT using Toolchain Manager. This was possible in NCS v1.9.1 by running "git-bash.exe", but this does not work in v2.0.0.

    After running "git-bash.exe in NCS v1.9.1:

    abkirchhoff@xxxxIND MINGW64 ~/NordicSdk/v1.9.1
    $ west -V
    West version: v0.12.0

    After running "git-bash.exe in NCS v2.0.0:

    abkirchhoff@xxxxIND MINGW64 /
    $ west -V
    bash: west: command not found

    Hopefully, that clarifies the issue. If an update to NCS and/or Toolchain Manager is required, that is fine, but if you have a workaround, that would be great! Using Toolchain Manager to open the bash prompt works fine, but I don't know how to re-create what it is doing to load the correct environment for the bash prompt. 

Reply
  • Einar,

    The point of my original post was that I would like to start a bash prompt that loads the correct Zephyr/west environment WITHOUT using Toolchain Manager. This was possible in NCS v1.9.1 by running "git-bash.exe", but this does not work in v2.0.0.

    After running "git-bash.exe in NCS v1.9.1:

    abkirchhoff@xxxxIND MINGW64 ~/NordicSdk/v1.9.1
    $ west -V
    West version: v0.12.0

    After running "git-bash.exe in NCS v2.0.0:

    abkirchhoff@xxxxIND MINGW64 /
    $ west -V
    bash: west: command not found

    Hopefully, that clarifies the issue. If an update to NCS and/or Toolchain Manager is required, that is fine, but if you have a workaround, that would be great! Using Toolchain Manager to open the bash prompt works fine, but I don't know how to re-create what it is doing to load the correct environment for the bash prompt. 

Children
  • Ah, sorry. It seems I only skimmed the original post before replying (as there is a known issue with building out of tree projects even when opening from Toolchain Manager that came to mind).

    As you write, opening the correct environment without going through the Toolchain Manager GUI was straightforward earlier, but not in 2.0.0. There has been a couple of complaints about this but we do not have any other method at the time being. That said, most of what you need should be in <Toolchain manager install location>\toolchains\v2.0.0\environment.json, so it should be possible to extract that info and put it into your own script, setting those environment variables.

  • Thanks for pointing me to the environment.json file. I was able to add that list of paths and create the other two environment variables with my own script that I can source after opening a bash prompt. I also source the "zephyr/zephyr-env.sh" file to create additional variables. Thanks again!

Related