west build is invalid choice

Hi,

I have installed the nRF Connect SDK v2.0.0 with Visual Studio and can now successfully, build, flash and run the nrf9160 at_client sample application. But when I try to build it from the command line west says that 'build' is an invalid choice. When building from the command line, I select "Open Terminal" from the nRF Connect SDK line in the toolchain manager. Then when I try to build, I get this:

at_client [master●] % west build -b nrf9160dk_nrf9160_ns
usage: west [-h] [-z ZEPHYR_BASE] [-v] [-V] <command> ...
west: error: argument <command>: invalid choice: 'build' (choose from 'init', 'update', 'list', 'manifest', 'diff', 'status', 'forall', 'help', 'config', 'topdir', 'selfupdate')
Any ideas why this is happening?
Thanks
Greg
  • I'm pretty sure ZEPHYR_BASE just tells west where Zephyr is installed. I've followed Nordic's instructions and used their Tool Chain Manager GUI to install the SDK. And it appears that if you do that, you need to add the ZEPHYR_BASE env variable so west can find it.

    It looks like as an alternative, we maybe could use a manifest and do west init/west update. Perhaps that will be the better solution in the end. Thanks for your sample manifest, that will save me a bunch of time as I experiment with this.

    I do think there is still an issue here for Nordic. I would think that when you use "Open Terminal" from the Toolchain Manager SDK drop down, that the ZEPHYR_BASE env variable should have been set. If Nordic agrees, maybe you can add that to their TODO list.

  • Hi Greg,

    Thank you for educating me on ZEPHYR_BASE environment variable. I must have seen that when I stepped through the toolchain installation a handful of times, but a few months have passed.  Checking my environment however I find that ZEPHYR_BASE is not set.  Somehow I have been building without it.  I can compile via `west build . . .`, both my custom project and Nordic Semi's various sample apps.  These are all however within the hierarchy of a west workspace which I initialized after `git clone`ing the custom app.

    Just to clarify, a west manifest file is only necessary when you are creating a Zephyr based project of your own, either from scratch or starting out with a copy of a Nordic sample.  I needed a stand alone instance of a sample app I was working to extend, because without a stand alone project I was not able to put project sources under my choice of git repository control.

    It sounds like you may not need that.

    You mention a Nordic "TODO list".  I have not heard of this.  Is there a place where we as developers can submit a "to do" request?

    - Ted

  • A late addition to use west from the command line:

    source <(nrfutil toolchain-manager env --as-script --ncs-version v2.6.0)
    source <PATH-TO-NRF-CONNECT-SDK-v2.6.0>/zephyr/zephyr-env.sh

    This way ZEPHYR_BASE and PATH (<...>zephyr/scripts is added) are set correctly.

Related