VS Code workflow extension with ncs-example-application

Hi DevZone,

I have been looking at ways to use the NCS and VS Code Extension with our git provider to set up a project repo which will be buildable in a reproducible way across our team. My current goal is to set up a workspace application as suggested in your tutorials with the structure recommended in the ncs-example-application repository.

Following the tutorial found here but instead of using the Zephyr example repo I use the NRF one found here, all good so far but my issue is then trying to open up the workspace folder using VS Code I do not get the custom_plank board when trying to set up a build config for the app and I can not build the application.

Steps to reproduce:

  1. Follow tutorial found above, substituting the git URL of the ncs-example-application
  2. Once I have run west update inside the my-workspace I launch VS code inside the same folder with code .
  3. Open the nRF Connect extension, confirm that the SDK used is the one inferred from the workspace
  4. Click Open Application and navigate to ./my-manifest-repo/app
  5. Add a build configuration, no custom boards appear
  6. Try to build with nrf52840dk_nrf52840 instead, errors with the following

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Building app
/bin/sh -c west build --build-dir <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app --pristine --board nrf52840dk_nrf52840 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="<HOME_PATH>/ncs-workspaces/my-workspace"
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app
-- CMake version: 3.20.5
-- Found Python3: /opt/nordic/ncs/toolchains/4ef6631da0/opt/python@3.9/bin/python3.9 (found suitable exact version "3.9.6") found components: Interpreter
-- Cache files will be written to: <HOME_PATH>/Library/Caches/zephyr
-- Zephyr version: 3.4.99 (<HOME_PATH>/ncs-workspaces/my-workspace/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.14.0")
CMake Warning at <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/cmake/modules/boards.cmake:88 (message):
BOARD_ROOT element without a 'boards' subdirectory:
<HOME_PATH>/ncs-workspaces/my-workspace
Hints:
- if your board directory is '/foo/bar/boards/<ARCH>/my_board' then add '/foo/bar' to BOARD_ROOT, not the entire board directory
- if in doubt, use absolute paths
Call Stack (most recent call first):
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Any info on how to set this up properly would be greatly appreciated! Am I opening the wrong folder with VS Code or do I need to set up a proper VS Code workspace somehow? Also after attempting the build the folde ./my-manifest-repo/app/build gets generated but does not get .gitignored so I am probably doing something wrong here...

On a side note what does work very well is using the extension to create a new application, but with this method I end up with a repo which has a different structure than the recommended ncs-example-application:

  1. Open new window of VS Code in no folder
  2. Use nRF Connect extension to create a new workspace application
  3. This opens up VS Code in the generated workspace/application folder, in my case I used hello_world
  4. I can set up a build config and build it no problem

But as said above, then the repo ends up much simpler than the ncs-example-application:

Fullscreen
1
2
3
4
5
6
7
8
hello_world
├── CMakeLists.txt
├── README.rst
├── prj.conf
├── sample.yaml
├── src
·· └── main.c
└── west.yml
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Maybe it is just simpler for now to work with that but I would like to understand if there is a nice way to work with the ncs-example-application and the extension.

Thanks in advance,

Jonas

Support information as provided by the VS code extension:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"platform": {
"os": "darwin",
"osVersion": "Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000",
"osKernel": "22.5.0",
"vscode": "1.81.0",
"electron": "22.3.18",
"node": "v16.17.1"
},
"system": {
"date": "2023-08-04T08:41:41.941Z",
"vscodeRoot": "/Applications/Visual Studio Code.app/Contents/Resources/app",
"nrfConnectForDesktopInstalled": true,
"vscodeUptime": "00:00:13",
"osUptime": "479:45:21",
"cpu": {
"model": "Apple M1 Pro",
"speed": "24 MHz",
"count": 5
},
"memory": {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX