Problem getting started making a build configuration in nrf Connect Extension for VS code

Screenshot of error message

Hello, I've followed the steps required on YouTube for setting up VS code with nrf Connect for desktop and the toolchain manager. It didn't work for me on Windows 10 and I've just updated to a clean install of Windows 11 and it doesn't seem to be working for me here either. I'm getting the following error message as you can see in the screenshot: 

Building blinky
west build --build-dir c:\Users\saulm\ncs\apps\blinky\build c:\Users\saulm\ncs\apps\blinky --pristine --board nrf52840dongle_nrf52840 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE"

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.

Additionally there are some errors VS code has in reading the program as shown here: 

#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\saulm\ncs\v1.8.0\apps-saul\blinky\src\main.c).

cannot open source file "zephyr.h"

cannot open source file "device.h"

cannot open source file "devicetree.h"

cannot open source file "drivers/gpio.h"

The SDK and toolchain are up to date as of 2022-02-07. And I"m using the Nrf52840 dongle which is recognized by VS code. My install  and application directory are visible in the first terminal output message. I would appreciate your help trouble shooting. Perhaps you'd know what commands I could type in the terminal (and which terminal to use) to see if west can be located. Any assistance would be appreciated.

  • Hi,

    Have you set nRF Connect SDK version and nRF Connect Toolchain in Quick Setup?

    Please see the nRF Connect extensions for VS Code Getting started guide and make sure you do all the steps.

    Best regards,

    Marte

  • Hi Marte,

    I have done so, and I did just try again with another install of everything, this time following the order of installation as shown in the video. Again I get the same error as above when I try to add a build configuration to my application. Your advice on the steps I could take to troubleshoot the problem would be appreciated.

  • Hi,

    From the west error you get, west is not initialized, which is why build is not a valid choice. If you were to open a terminal and build on command line with "west build ..." in your application folder, c:\Users\saulm\ncs\apps\blinky, then it would make sense that you are getting this error, since ncs\apps\blinky is not a west folder. However, when building in VS Code, either when when adding the build configuration or by selecting 'Build' under 'Actions', this should not be an issue, as the nRF Connect extension should fix this.

    There are some things you can check.

    Go to Settings > Workspace > Extensions > nRF Connect. Make sure that your blinky application is added to Applications there. Additionally, can you share what the Toolchain and Topdir settings are set to?

    You can also try some of the fixes in the guide Common fixes for nRF Connect SDK build problems. Specifically fixes number 3, 4 and 5. For number 4, using the command line, you must test this in an existing sample inside either nrf or zephyr, as you will not be able to use west build from command line in your sample folder. As for number 6, environment variables, if your toolchain in VS Code is set to the toolchain folder of the Toolchain Manager installation, you do not need to add the environment variables to your path.

    Can you also generate support information and upload it here? Open command palette (ctrl+shift+p or View > Command Palette) and write nRF Connect: Generate support information. When you select this the information should be generated in the output terminal windows. You can copy it and upload it here with Insert > Code, and then paste it there.

    Best regards,

    Marte

  • Thanks Marte, for your assistance. I have a few things to report. You are indeed right that it seems West was not initialized. When I opened a terminal from the toolchain manager and navigated to my application file and ran "west init" and then "west update" I was then able to build the application, but it then ran into errors of a different type. So it seems you're on the right track.

    Also, I tried installing the 1.7.1 toolchain and everything works fine for building an application with that version of the toolchain. However my nrf52840 doesn't show up in the Connected Devices window even though I have it connected through the COM port in VS code, and it is pulsing red. I can open a different ticket for that issue if you like.

    Of the fixes you suggested, I don't think it is fix 3 since 1.7.1 works fine. I'm going to try fix 4, building from the command line, and I can report back after I've completed that. And I tried fix 5 re-installing the toolchain and updating the sdk and that did not work.

    Thanks again for your assistance.

    Here is my NRF connect error report from before I installed 1.7.1 attached.

    Nordic Support Information.docx

  • Ok. I deleted the 1.8.0 folder and re-installed everything and now 1.8.0 is now working. I believe my problem was that I did not have Python3 installed at the time I installed 1.8.0 and so west didn`t initiate properly. 

Related