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

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/[email protected]/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):
  <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:8 (find_package)


-- Board: nrf52840dk_nrf52840
-- Found host-tools: zephyr 0.16.0 (/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.0 (/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk)
-- Found Dtc: /opt/nordic/ncs/toolchains/4ef6631da0/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6") 
-- Found BOARD.dts: <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build/zephyr/dts.cmake
Parsing <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/Kconfig
Loaded configuration '<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
Merged configuration '<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/prj.conf'
Configuration saved to '<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build/zephyr/.config'
Kconfig header saved to '<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (found version "2.38") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
CMake Warning at <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/CMakeLists.txt:887 (message):
  No SOURCES given to Zephyr library:
  ..__modules__lib__wfa-qt-control-app__zephyr

  Excluding target from build.


-- Configuring done
-- Generating done
-- Build files have been written to: <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build
-- west build: building application
[1/175] Preparing syscall dependency handling

[2/175] Generating misc/generated/syscalls_subdirs.trigger
[3/175] Generating include/generated/version.h
-- Zephyr version: 3.4.99 (<HOME_PATH>/ncs-workspaces/my-workspace/zephyr), build: v3.3.99-ncs1-2858-gc9d01d05ce83
[4/175] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
[5/175] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
[6/175] Generating include/generated/driver-validation.h
[7/175] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h, include/generated/otype-to-size.h
[8/175] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
[9/175] Generating include/generated/offsets.h
[10/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/dec.c.obj
[11/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj
[12/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/timeutil.c.obj
[13/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.obj
[14/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/sem.c.obj
[15/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/thread_entry.c.obj
[16/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj
[17/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/multi_heap.c.obj
[18/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc32_sw.c.obj
[19/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc32c_sw.c.obj
[20/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc8_sw.c.obj
[21/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc16_sw.c.obj
[22/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc7_sw.c.obj
[23/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/rb.c.obj
[24/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/onoff.c.obj
[25/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/notify.c.obj
[26/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/heap-validate.c.obj
[27/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/bitarray.c.obj
[28/175] Building ASM object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/common/soc_nrf_common.S.obj
[29/175] Building C object zephyr/CMakeFiles/zephyr.dir/misc/generated/configs.c.obj
[30/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf.c.obj
[31/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/heap.c.obj
[32/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj
[33/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/assert.c.obj
[34/175] Generating linker_zephyr_pre0.cmd
[35/175] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/tracing/tracing_none.c.obj
[36/175] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
ccache /opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DNRF52840_XXAA -D__PROGRAM_START -D__ZEPHYR__=1 -Iapp/include -I../src -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include -Izephyr/include/generated -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/soc/arm/nordic_nrf/nrf52 -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/soc/arm/nordic_nrf/common/. -I<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/include -I<HOME_PATH>/ncs-workspaces/my-workspace/nrf/include -I<HOME_PATH>/ncs-workspaces/my-workspace/nrf/tests/include -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/hal/cmsis/CMSIS/Core/Include -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/hal/nordic/nrfx -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/hal/nordic/nrfx/drivers/include -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/hal/nordic/nrfx/mdk -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/modules/hal_nordic/nrfx/. -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/debug/segger/SEGGER -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/debug/segger/Config -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/modules/segger/. -isystem <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/lib/libc/minimal/include -isystem /opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem /opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -isystem <HOME_PATH>/ncs-workspaces/my-workspace/nrfxlib/crypto/nrf_cc310_platform/include -fno-strict-aliasing -Os -imacros <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app=CMAKE_SOURCE_DIR -fmacro-prefix-map=<HOME_PATH>/ncs-workspaces/my-workspace/zephyr=ZEPHYR_BASE -fmacro-prefix-map=<HOME_PATH>/ncs-workspaces/my-workspace=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles/app.dir/src/main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c ../src/main.c
In file included from <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain/gcc.h:92,
                 from <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain.h:50,
                 from <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/kernel_includes.h:19,
                 from <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/kernel.h:17,
                 from <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/src/main.c:6:
../src/main.c: In function 'main':
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:85:41: error: '__device_dts_ord_DT_N_NODELABEL_examplesensor0_ORD' undeclared (first use in this function)
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
  132 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
  211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/src/main.c:21:18: note: in expansion of macro 'DEVICE_DT_GET'
   21 |         sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
      |                  ^~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:85:41: note: each undeclared identifier is reported only once for each function it appears in
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
  132 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
  211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/src/main.c:21:18: note: in expansion of macro 'DEVICE_DT_GET'
   21 |         sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
      |                  ^~~~~~~~~~~~~
[37/175] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/state.c.obj
[38/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/reboot.c.obj
[39/175] Generating ../../../include/generated/libc/minimal/strerror_table.h
[40/175] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/cpu_idle.S.obj
[41/175] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_complete.c.obj
[42/175] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_base_addresses.c.obj
[43/175] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_enabled_instances.c.obj
[44/175] Building C object zephyr/CMakeFiles/zephyr.dir<HOME_PATH>/ncs-workspaces/my-workspace/nrfxlib/crypto/nrf_cc310_platform/src/nrf_cc3xx_platform_abort_zephyr.c.obj
[45/175] Building C object zephyr/CMakeFiles/zephyr.dir<HOME_PATH>/ncs-workspaces/my-workspace/nrfxlib/crypto/nrf_cc310_platform/src/nrf_cc3xx_platform_mutex_zephyr.c.obj
[46/175] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/pm.c.obj
[47/175] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/policy.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/4ef6631da0/bin/cmake --build <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: nRF Connect: Build: app/build (active) 

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

[1/129] Generating linker_zephyr_pre1.cmd
[2/129] Building C object zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj
[3/129] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/nmi_on_reset.S.obj
[4/129] Building C object zephyr/arch/common/CMakeFiles/arch__common.dir/sw_isr_common.c.obj
[5/129] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/prep_c.c.obj
[6/129] Building C object zephyr/arch/common/CMakeFiles/isr_tables.dir/isr_tables.c.obj
[7/129] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/swap_helper.S.obj
[8/129] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/isr_wrapper.S.obj
[9/129] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/nmi.c.obj
[10/129] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/irq_manage.c.obj
[11/129] Linking C static library zephyr/arch/common/libisr_tables.a
[12/129] Linking C static library zephyr/libzephyr.a
[13/129] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/swap.c.obj
[14/129] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fault_s.S.obj
[15/129] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/exc_exit.S.obj
[16/129] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/reset.S.obj
[17/129] Linking C static library zephyr/arch/common/libarch__common.a
[18/129] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/thread.c.obj
[19/129] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/vector_table.S.obj
[20/129] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/irq_init.c.obj
[21/129] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fpu.c.obj
[22/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/atoi.c.obj
[23/129] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/fatal.c.obj
[24/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/strtol.c.obj
[25/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/strtoul.c.obj
[26/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/strtoll.c.obj
[27/129] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/scb.c.obj
[28/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/bsearch.c.obj
[29/129] Linking C static library zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a
[30/129] Building C object zephyr/arch/arch/arm/core/aarch32/mpu/CMakeFiles/arch__arm__core__aarch32__mpu.dir/arm_core_mpu.c.obj
[31/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/strtoull.c.obj
[32/129] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/thread_abort.c.obj
[33/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/qsort.c.obj
[34/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/string/strncasecmp.c.obj
[35/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/string/strstr.c.obj
[36/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/string/strerror.c.obj
[37/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/string/strspn.c.obj
[38/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/string/string.c.obj
[39/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/math/sqrtf.c.obj
[40/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/math/sqrt.c.obj
[41/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/exit.c.obj
[42/129] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
ccache /opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DNRF52840_XXAA -D__PROGRAM_START -D__ZEPHYR__=1 -Iapp/include -I../src -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include -Izephyr/include/generated -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/soc/arm/nordic_nrf/nrf52 -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/soc/arm/nordic_nrf/common/. -I<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/include -I<HOME_PATH>/ncs-workspaces/my-workspace/nrf/include -I<HOME_PATH>/ncs-workspaces/my-workspace/nrf/tests/include -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/hal/cmsis/CMSIS/Core/Include -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/hal/nordic/nrfx -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/hal/nordic/nrfx/drivers/include -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/hal/nordic/nrfx/mdk -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/modules/hal_nordic/nrfx/. -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/debug/segger/SEGGER -I<HOME_PATH>/ncs-workspaces/my-workspace/modules/debug/segger/Config -I<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/modules/segger/. -isystem <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/lib/libc/minimal/include -isystem /opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem /opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -isystem <HOME_PATH>/ncs-workspaces/my-workspace/nrfxlib/crypto/nrf_cc310_platform/include -fno-strict-aliasing -Os -imacros <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app=CMAKE_SOURCE_DIR -fmacro-prefix-map=<HOME_PATH>/ncs-workspaces/my-workspace/zephyr=ZEPHYR_BASE -fmacro-prefix-map=<HOME_PATH>/ncs-workspaces/my-workspace=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles/app.dir/src/main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c ../src/main.c
In file included from <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain/gcc.h:92,
                 from <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain.h:50,
                 from <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/kernel_includes.h:19,
                 from <HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/kernel.h:17,
                 from <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/src/main.c:6:
../src/main.c: In function 'main':
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:85:41: error: '__device_dts_ord_DT_N_NODELABEL_examplesensor0_ORD' undeclared (first use in this function)
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
  132 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
  211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/src/main.c:21:18: note: in expansion of macro 'DEVICE_DT_GET'
   21 |         sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
      |                  ^~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:85:41: note: each undeclared identifier is reported only once for each function it appears in
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
  132 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
  211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
<HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/src/main.c:21:18: note: in expansion of macro 'DEVICE_DT_GET'
   21 |         sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
      |                  ^~~~~~~~~~~~~
[43/129] Building C object zephyr/lib/libc/common/CMakeFiles/lib__libc__common.dir/source/string/strnlen.c.obj
[44/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdout/sprintf.c.obj
[45/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdout/fprintf.c.obj
[46/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdout/stdout_console.c.obj
[47/129] Building C object zephyr/lib/libc/common/CMakeFiles/lib__libc__common.dir/source/stdlib/abort.c.obj
[48/129] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/time/gmtime.c.obj
[49/129] Building C object zephyr/soc/arm/common/cortex_m/CMakeFiles/soc__arm__common__cortex_m.dir/arm_mpu_regions.c.obj
[50/129] Building C object zephyr/arch/arch/arm/core/aarch32/mpu/CMakeFiles/arch__arm__core__aarch32__mpu.dir/arm_mpu.c.obj
[51/129] Building C object zephyr/lib/libc/common/CMakeFiles/lib__libc__common.dir/source/stdlib/malloc.c.obj
[52/129] Building C object zephyr/soc/arm/nordic_nrf/nrf52/CMakeFiles/soc__arm__nordic_nrf__nrf52.dir/soc.c.obj
[53/129] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fault.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/4ef6631da0/bin/cmake --build <HOME_PATH>/ncs-workspaces/my-workspace/my-manifest-repo/app/build

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:

hello_world
├── CMakeLists.txt
├── README.rst
├── prj.conf
├── sample.yaml
├── src
│   └── main.c
└── west.yml

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:

{
  "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": {
      "total": "32.00 GB",
      "free": "2.09 GB"
    }
  },
  "workspace": {
    "name": "my-workspace",
    "workspaceFile": null,
    "folders": [
      "<HOME_PATH>/ncs-workspaces/my-workspace"
    ]
  },
  "extensions": {
    "internal": {
      "nordic-semiconductor.nrf-connect": {
        "version": "2023.7.129",
        "path": "<HOME_PATH>/.vscode/extensions/nordic-semiconductor.nrf-connect-2023.7.129-darwin-arm64",
        "isActive": true
      },
      "nordic-semiconductor.nrf-terminal": {
        "version": "2023.7.47",
        "path": "<HOME_PATH>/.vscode/extensions/nordic-semiconductor.nrf-terminal-2023.7.47",
        "isActive": true
      },
      "nordic-semiconductor.nrf-devicetree": {
        "version": "2023.7.56",
        "path": "<HOME_PATH>/.vscode/extensions/nordic-semiconductor.nrf-devicetree-2023.7.56",
        "isActive": true
      },
      "nordic-semiconductor.nrf-kconfig": {
        "version": "2023.6.51",
        "path": "<HOME_PATH>/.vscode/extensions/nordic-semiconductor.nrf-kconfig-2023.6.51",
        "isActive": true
      }
    },
    "external": {
      "marus25.cortex-debug": null,
      "ms-vscode.cpptools": "1.16.3",
      "ms-vscode.js-debug": "1.81.0",
      "ms-vscode.js-debug-companion": "1.1.2",
      "ms-vscode.vscode-js-profile-table": "1.0.3",
      "cschlosser.doxdocgen": "1.4.0",
      "ghisguth.monkey-c": "0.4.0",
      "James-Yu.latex-workshop": "9.13.3",
      "janisdd.vscode-edit-csv": "0.7.6",
      "jeff-hykin.better-cpp-syntax": "1.17.2",
      "josetr.cmake-language-support-vscode": "0.0.9",
      "mathematic.vscode-latex": "1.2.0",
      "mechatroner.rainbow-csv": "3.7.0",
      "ms-dotnettools.vscode-dotnet-runtime": "1.6.0",
      "ms-python.isort": "2023.10.1",
      "ms-python.python": "2023.14.0",
      "ms-python.vscode-pylance": "2023.8.10",
      "ms-toolsai.jupyter": "2023.7.1002162226",
      "ms-toolsai.jupyter-keymap": "1.1.2",
      "ms-toolsai.jupyter-renderers": "1.0.17",
      "ms-toolsai.vscode-jupyter-cell-tags": "0.1.8",
      "ms-toolsai.vscode-jupyter-slideshow": "0.1.5",
      "ms-vscode-remote.remote-containers": "0.299.0",
      "ms-vscode-remote.remote-ssh": "0.102.0",
      "ms-vscode-remote.remote-wsl": "0.80.2",
      "ms-vscode.cmake-tools": "1.14.34",
      "ms-vscode.cpptools-extension-pack": "1.3.0",
      "ms-vscode.cpptools-themes": "2.0.0",
      "ms-vscode.remote-explorer": "0.4.1",
      "octref.vetur": "0.37.3",
      "trond-snekvik.gnu-mapfiles": "1.1.0",
      "twxs.cmake": "0.0.17",
      "vadimcn.vscode-lldb": "1.9.2",
      "well-ar.plantuml": "2.17.6",
      "Zhikui.vscode-openfoam": "0.0.6"
    }
  },
  "tools": {
    "/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc": "0.16.0",
    "/Applications/SEGGER/JLink/JLinkExe": "7.80c",
    "/usr/local/bin/nrfjprog": "10.21.0",
    "/opt/homebrew/bin/nrfutil": null,
    "/opt/nordic/ncs/toolchains/4ef6631da0/bin/cmake": "3.20.5",
    "/opt/nordic/ncs/toolchains/4ef6631da0/bin/west": "1.0.0",
    "/opt/nordic/ncs/toolchains/4ef6631da0/bin/python3": "3.9.6",
    "/opt/nordic/ncs/toolchains/4ef6631da0/bin/ninja": "1.10.2",
    "/opt/nordic/ncs/toolchains/4ef6631da0/bin/gperf": "3.1",
    "/opt/nordic/ncs/toolchains/4ef6631da0/bin/dtc": "1.6.1",
    "/opt/nordic/ncs/toolchains/4ef6631da0/bin/gn": "2106",
    "/opt/nordic/ncs/toolchains/4ef6631da0/bin/git": "2.37.3",
    "gdbPath": "/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb"
  },
  "sdks": [
    {
      "version": "2.4.1",
      "path": "/opt/nordic/ncs/v2.4.1"
    },
    {
      "version": "2.4.99",
      "path": "<HOME_PATH>/ncs-workspaces/my-workspace"
    }
  ],
  "toolchains": [
    {
      "version": "2.4.0",
      "path": "/opt/nordic/ncs/toolchains/4ef6631da0"
    }
  ],
  "connectedDevices": [],
  "deviceProvider": "nrfutil",
  "config": {
    "nordic-semiconductor.nrf-connect": {
      "topdir": "",
      "toolchain": {
        "path": ""
      },
      "ozonePath": "",
      "applications": [
        "${workspaceFolder}/ncs-repo-testing-according-to-tut/app"
      ],
      "applicationOptions": {},
      "kconfig": {
        "interface": "kconfig",
        "executeInDefaultShell": false
      },
      "welcome": {
        "showOnStartup": true
      },
      "west": {
        "env": {
          "$base": "terminal"
        }
      },
      "boardRoots": [
        "boards"
      ],
      "taskBindings": {},
      "debugging": {
        "flash": true,
        "bindings": {}
      },
      "activeAppFollowActiveEditor": true,
      "deviceProvider": "nrfutil"
    },
    "nordic-semiconductor.nrf-terminal": {
      "terminalMode": "character"
    }
  },
  "environment": {
    "westEnv": {
      "ELECTRON_RUN_AS_NODE": "1",
      "GIT_EXEC_PATH": "/opt/nordic/ncs/toolchains/4ef6631da0/Cellar/git/2.37.3/libexec/git-core",
      "HOME": "<HOME_PATH>",
      "PATH": "/opt/nordic/ncs/toolchains/4ef6631da0/bin:/opt/nordic/ncs/toolchains/4ef6631da0/usr/bin:/opt/nordic/ncs/toolchains/4ef6631da0/usr/local/bin:/opt/nordic/ncs/toolchains/4ef6631da0/opt/bin:/opt/nordic/ncs/toolchains/4ef6631da0/opt/nanopb/generator-bin:/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/aarch64-zephyr-elf/bin:/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/x86_64-zephyr-elf/bin:/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin:<HOME_PATH>/google-cloud-sdk/bin:<HOME_PATH>/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:<HOME_PATH>/Library/Application Support/Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-4.0.7-2021-11-29-437ff4cc4//bin:<HOME_PATH>/google-cloud-sdk/bin:<HOME_PATH>/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:<HOME_PATH>/Library/Application Support/Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-4.0.7-2021-11-29-437ff4cc4//bin",
      "ZEPHYR_BASE": "<HOME_PATH>/ncs-workspaces/my-workspace/zephyr",
      "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
      "ZEPHYR_SDK_INSTALL_DIR": "/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk",
      "USER": "<USER>"
    },
    "inherited": {
      "ELECTRON_RUN_AS_NODE": "1",
      "HOME": "<HOME_PATH>",
      "PATH": "<HOME_PATH>/google-cloud-sdk/bin:<HOME_PATH>/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:<HOME_PATH>/Library/Application Support/Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-4.0.7-2021-11-29-437ff4cc4//bin",
      "USER": "<USER>"
    },
    "toolchainPath": "/opt/nordic/ncs/toolchains/4ef6631da0",
    "toolchainBinPath": "/opt/nordic/ncs/toolchains/4ef6631da0/opt/zephyr-sdk/arm-zephyr-eabi/bin",
    "toolchainVersion": "2.4.0"
  },
  "terminal": {
    "defaultProfile": null
  }
}

Related