build configuration and build fails in Visual Studio Code

Hello!

I started developing NRF Connect Mesh applications two years ago in Segger Embedded Studio then graduated to NRF Connect in Visual Studio Code, both in Windows and on Linux Ubuntu.

I have just upgraded my Linux to Ubuntu 20.04.06. Everything seemed to update fine including Visual Studio Code. I saw that NRF Connect for Desktop was now available for Linux so I happily downloaded and installed the appimage.

Though the Visual Code UI occasionally freezes and requires a restart from NRF for Desktop, I am able to open mesh examples such as sensor_server, add a build configuration, build it, flash it and connect to it from the mobile app - all from within Visual Code with the NRF extensions. I am using my custom board and RTT so there are a few changes I make to prj.conf and these changes are included in the build and work fine.

Issue:

When I "Create New Application" from the Welcome Window and choose a folder in my normal git directory, adding a Build Configuration fails:

_____________________________

* Executing task: nRF Connect: Generate config nrf52840dk_nrf52840 for /home/djcarlin/GitNew/sensor_server

Building sensor_server
west build --build-dir /home/djcarlin/GitNew/sensor_server/build /home/djcarlin/GitNew/sensor_server --pristine --board nrf52840dk_nrf52840 -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="/home/djcarlin/GitNew/sensor_server"

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')

* The terminal process failed to launch (exit code: 2).
* Terminal will be reused by tasks, press any key to close it.

______________________________________________

I have used the "Create New Application" many times with Visual Studio Code on Windows and Ubuntu 18 and was always able to add a build configuration and build.

My objective is to have a mesh project in a folder in my own repository. I am not concerned about automatically versioning it with West or a particular SDK version. 

I read that there are recommended ways of having your own ncs but I was not able to follow the methods provided. It also seemed overly complex for my use case. I did try the NRF recommended method: 

https://github.com/nrfconnect/ncs-example-application

The first step was:  west init -m github.com/.../ncs-example-application --mr main my-workspace

and it failed telling me west was already initialized.

Please advise me of the recommended way to create a mesh project based on one of the examples and share it between two workstations using Git.

It does not even have to be the whole project in Git, just the source code, make file and prj.conf would be a start, as long as I can create build
configurations and build them. That is what I have been doing until now.

The workaround I have at the moment is to modify the examples by cutting and pasting changes from my development code base. Not a good practice : )

This development code base was created by creating new applications using Visual Studio Code and putting them in folders outside of ncs then modifying them. I can add build configurations and build them at will on my Windows version of VS Code. I would like to be able to do that on my new Ubuntu 20 dev environment.

Regards,

David Carlin

  • Hello David,

    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')

    What happens here is that your west instance does not know your zephyr west extension commands.

    Did you choose the correct NCS version in VS Code? Are you using Toolchain Manager, or Manual Install?

    The first step was:  west init -m github.com/.../ncs-example-application --mr main my-workspace

    and it failed telling me west was already initialized.

    Could you tell me the error when you are trying to run west init?

    I assume what happens is that you are either trying to run it inside an existing west workspace or your ZEPHYR_BASE environmental variable is set.

    Please do it outside the existing NCS folder and/or set ZEPHYR_BASE temporarily to nothing by running export ZEPHYR_BASE=

    Best regards,

    Michal

Related