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
Parents Reply Children
  • Ah ok,

    I think your exporting of $ZEPHYR_BASE probably informs `west` of the path needed to get to /opt/nordic/ncs/v2.0.0/zephyr/scripts/zephyr_module.py. I'm guessing such a script exists on your system.

    I'm not proficient in Python, but it looks like this script may be the entry point for `west` to obtain its build related extending commands, the one that was not available when you tried earlier from the nRF Connect terminal window.

    If you are good compiling and working in the arbitrary location then you're home!  If you need to version control your work, you may be faced with making the sample copy a fully stand alone Zephyr application.

    Glad to hear you have gotten things running as quickly!

    - 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