Unable to build standard Nordic application: Blinky, using the nRF Connect SDK v2.9.1

Good day,

I tried to build the standard Nordic application: Blinky for the nrf52840dk/nrf52840 board from the following directory on my PC: c:\ncs\v2.9.1\zephyr\samples\basic\blinky.

I was using:

1. VS Code

2. nRF Connect SDK v2.9.1

3 nRF Connect SDK Toolchain v2.9.1

4. Board Target:  nrf52840dk/nrf52840

as shown on the attached Screenshot_3 and Screenshot_4.

However, some error messages came up, as shown in the attached Screenshot_5 and Screenshot_2.

I also attach the whole build log split between the attached Screenshot_1 and Screenshot_2 - as I could not find an easy way to save or print the whole log file.

What shall I do to successfully build that application?

Regards,

JM

  • Hi JM,

    Jacek Majda said:

    Now, when i click on "+Add Build configuration" I can select under the "Custom" board target, the following two custom boards that I have created: "my_xm126/nrf52840"  and "xm126/nrf52840".

    So I selected "my_xm126/nrf52840" as the board target and I clicked "build configuration"- but many errors came up.

    What were these errors? I also got many errors when using xm126 as a build target for blinky. The reason being that I have not edited the board files according to the datasheet for the custom board. Could you be missing some configurations in your custom files?

    Here is my full build log when using the extension to build blinky for the xm126 without modifying the board files:

    Building blinky
    C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir c:/ncs/devzone/344510/my_builds/build_2 c:/ncs/v2.9.1/zephyr/samples/basic/blinky --pristine --board xm126/nrf52840 -- -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD_ROOT=c:/ncs/devzone/344510/acconeer;c:/ncs/devzone/344894/light_bulb"
    
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: C:/ncs/toolchains/b620d30767/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: C:/ncs/v2.9.1/zephyr/.cache
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: xm126, qualifiers: nrf52840
    Parsing C:/ncs/v2.9.1/zephyr/share/sysbuild/Kconfig
    Loaded configuration 'C:/ncs/devzone/344510/my_builds/build_2/_sysbuild/empty.conf'
    Merged configuration 'C:/ncs/devzone/344510/my_builds/build_2/_sysbuild/empty.conf'
    Configuration saved to 'C:/ncs/devzone/344510/my_builds/build_2/zephyr/.config'
    Kconfig header saved to 'C:/ncs/devzone/344510/my_builds/build_2/_sysbuild/autoconf.h'
    -- 
       ****************************
       * Running CMake for blinky *
       ****************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/ncs/v2.9.1/zephyr/samples/basic/blinky
    -- CMake version: 3.21.0
    -- Found Python3: C:/ncs/toolchains/b620d30767/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: C:/ncs/v2.9.1/zephyr/.cache
    -- Zephyr version: 3.7.99 (C:/ncs/v2.9.1/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: xm126, qualifiers: nrf52840
    -- Found host-tools: zephyr 0.17.0 (C:/ncs/toolchains/b620d30767/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.17.0 (C:/ncs/toolchains/b620d30767/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/b620d30767/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
    -- Found BOARD.dts: C:/ncs/devzone/344510/acconeer/boards/Acconeer/xm126/xm126.dts
    -- Generated zephyr.dts: C:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: C:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/dts.cmake
    Parsing C:/ncs/v2.9.1/zephyr/Kconfig
    Loaded configuration 'C:/ncs/devzone/344510/acconeer/boards/Acconeer/xm126/xm126_defconfig'
    Merged configuration 'C:/ncs/v2.9.1/zephyr/samples/basic/blinky/prj.conf'
    Merged configuration 'C:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/.config.sysbuild'
    Configuration saved to 'C:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/.config'
    Kconfig header saved to 'C:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (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: C:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    -- Setting build type to 'MinSizeRel' as none was specified.
    CMake Warning at C:/ncs/v2.9.1/zephyr/CMakeLists.txt:952 (message):
      No SOURCES given to Zephyr library: drivers__gpio
    
      Excluding target from build.
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/ncs/devzone/344510/my_builds/build_2/blinky
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/ncs/devzone/344510/my_builds/build_2
    -- west build: building application
    [4/128] Generating include/generated/zephyr/version.h
    -- Zephyr version: 3.7.99 (C:/ncs/v2.9.1/zephyr), build: v3.7.99-ncs2-1
    [57/128] Building C object CMakeFiles/app.dir/src/main.c.obj
    FAILED: CMakeFiles/app.dir/src/main.c.obj 
    C:\ncs\toolchains\b620d30767\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DNRF52840_XXAA -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/include/generated/zephyr -IC:/ncs/v2.9.1/zephyr/include -IC:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/include/generated -IC:/ncs/v2.9.1/zephyr/soc/nordic -IC:/ncs/v2.9.1/zephyr/soc/nordic/nrf52/. -IC:/ncs/v2.9.1/zephyr/soc/nordic/common/. -IC:/ncs/v2.9.1/nrf/include -IC:/ncs/v2.9.1/nrf/tests/include -IC:/ncs/v2.9.1/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.9.1/zephyr/modules/cmsis/. -IC:/ncs/v2.9.1/modules/hal/nordic/nrfx -IC:/ncs/v2.9.1/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.9.1/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.9.1/zephyr/modules/hal_nordic/nrfx/. -isystem C:/ncs/v2.9.1/zephyr/lib/libc/common/include -isystem C:/ncs/v2.9.1/nrfxlib/crypto/nrf_cc310_platform/include -Os -DNDEBUG -fno-strict-aliasing -Os -imacros C:/ncs/devzone/344510/my_builds/build_2/blinky/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=C:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.9.1/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/ncs/v2.9.1/zephyr/samples/basic/blinky=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.9.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.9.1=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -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 C:/ncs/v2.9.1/zephyr/samples/basic/blinky/src/main.c
    In file included from C:/ncs/v2.9.1/zephyr/include/zephyr/toolchain/gcc.h:98,
                     from C:/ncs/v2.9.1/zephyr/include/zephyr/toolchain.h:50,
                     from C:/ncs/v2.9.1/zephyr/include/zephyr/kernel_includes.h:23,
                     from C:/ncs/v2.9.1/zephyr/include/zephyr/kernel.h:17,
                     from C:/ncs/v2.9.1/zephyr/samples/basic/blinky/src/main.c:8:
    C:/ncs/v2.9.1/zephyr/include/zephyr/device.h:92:41: error: '__device_dts_ord_DT_N_ALIAS_led0_P_gpios_IDX_0_PH_ORD' undeclared here (not in a function)
       92 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                         ^~~~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    C:/ncs/v2.9.1/zephyr/include/zephyr/device.h:92:33: note: in expansion of macro '_CONCAT'
       92 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                 ^~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/device.h:229:37: note: in expansion of macro 'DEVICE_NAME_GET'
      229 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
          |                                     ^~~~~~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/device.h:246:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
      246 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
          |                                  ^~~~~~~~~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/drivers/gpio.h:333:25: note: in expansion of macro 'DEVICE_DT_GET'
      333 |                 .port = DEVICE_DT_GET(DT_GPIO_CTLR_BY_IDX(node_id, prop, idx)),\
          |                         ^~~~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/drivers/gpio.h:369:9: note: in expansion of macro 'GPIO_DT_SPEC_GET_BY_IDX'
      369 |         GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, 0)
          |         ^~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/samples/basic/blinky/src/main.c:21:40: note: in expansion of macro 'GPIO_DT_SPEC_GET'
       21 | static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
          |                                        ^~~~~~~~~~~~~~~~
    In file included from C:/ncs/v2.9.1/zephyr/include/zephyr/arch/arm/arch.h:20,
                     from C:/ncs/v2.9.1/zephyr/include/zephyr/arch/cpu.h:19,
                     from C:/ncs/v2.9.1/zephyr/include/zephyr/kernel_includes.h:36:
    C:/ncs/v2.9.1/zephyr/include/zephyr/devicetree.h:240:32: error: 'DT_N_ALIAS_led0_P_gpios_IDX_0_VAL_pin' undeclared here (not in a function)
      240 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
          |                                ^~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/devicetree.h:4888:9: note: in definition of macro 'DT_CAT7'
     4888 |         a1 ## a2 ## a3 ## a4 ## a5 ## a6 ## a7
          |         ^~
    C:/ncs/v2.9.1/zephyr/include/zephyr/devicetree/gpio.h:110:9: note: in expansion of macro 'DT_PHA_BY_IDX'
      110 |         DT_PHA_BY_IDX(node_id, gpio_pha, idx, pin)
          |         ^~~~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/drivers/gpio.h:334:24: note: in expansion of macro 'DT_GPIO_PIN_BY_IDX'
      334 |                 .pin = DT_GPIO_PIN_BY_IDX(node_id, prop, idx),                 \
          |                        ^~~~~~~~~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/drivers/gpio.h:369:9: note: in expansion of macro 'GPIO_DT_SPEC_GET_BY_IDX'
      369 |         GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, 0)
          |         ^~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/samples/basic/blinky/src/main.c:21:40: note: in expansion of macro 'GPIO_DT_SPEC_GET'
       21 | static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
          |                                        ^~~~~~~~~~~~~~~~
    C:/ncs/v2.9.1/zephyr/include/zephyr/devicetree.h:240:25: note: in expansion of macro 'DT_CAT'
      240 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
          |                         ^~~~~~
    C:/ncs/v2.9.1/zephyr/samples/basic/blinky/src/main.c:15:19: note: in expansion of macro 'DT_ALIAS'
       15 | #define LED0_NODE DT_ALIAS(led0)
          |                   ^~~~~~~~
    C:/ncs/v2.9.1/zephyr/samples/basic/blinky/src/main.c:21:57: note: in expansion of macro 'LED0_NODE'
       21 | static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
          |                                                         ^~~~~~~~~
    [58/128] Building C object zephyr/CMakeFiles/zephyr.dir/lib/utils/bitarray.c.obj
    [59/128] Building C object zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.9.1/nrf/subsys/partition_manager/flash_map_partition_manager.c.obj
    [60/128] Linking C static library zephyr\lib\libc\picolibc\liblib__libc__picolibc.a
    [61/128] Building C object zephyr/CMakeFiles/zephyr.dir/lib/utils/rb.c.obj
    [62/128] Building C object zephyr/soc/soc/nrf52840/CMakeFiles/soc__nordic.dir/validate_binding_headers.c.obj
    [63/128] Building C object zephyr/CMakeFiles/zephyr.dir/lib/utils/onoff.c.obj
    [64/128] Building C object zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.9.1/nrf/lib/boot_banner/banner.c.obj
    [65/128] Building C object zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.9.1/nrfxlib/crypto/nrf_cc310_platform/src/nrf_cc3xx_platform_abort_zephyr.c.obj
    [66/128] Building C object zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.9.1/nrfxlib/crypto/nrf_cc310_platform/src/nrf_cc3xx_platform_mutex_zephyr.c.obj
    [67/128] Generating linker_zephyr_pre0.cmd
    [68/128] Building C object zephyr/arch/arch/arm/core/cortex_m/CMakeFiles/arch__arm__core__cortex_m.dir/exc_exit.c.obj
    [69/128] Building C object zephyr/soc/soc/nrf52840/CMakeFiles/soc__nordic.dir/validate_base_addresses.c.obj
    [70/128] Building C object zephyr/soc/soc/nrf52840/CMakeFiles/soc__nordic.dir/validate_enabled_instances.c.obj
    [71/128] Building C object zephyr/drivers/timer/CMakeFiles/drivers__timer.dir/sys_clock_init.c.obj
    [72/128] Building C object modules/nrf/drivers/hw_cc3xx/CMakeFiles/..__nrf__drivers__hw_cc3xx.dir/hw_cc3xx.c.obj
    [73/128] Building C object zephyr/soc/soc/nrf52840/CMakeFiles/soc__nordic.dir/nrf52/soc.c.obj
    [74/128] Building C object zephyr/arch/arch/arm/core/cortex_m/CMakeFiles/arch__arm__core__cortex_m.dir/fault.c.obj
    [75/128] Building C object zephyr/kernel/CMakeFiles/kernel.dir/xip.c.obj
    [76/128] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timeout.c.obj
    [77/128] Building C object zephyr/drivers/timer/CMakeFiles/drivers__timer.dir/nrf_rtc_timer.c.obj
    [78/128] Building C object zephyr/drivers/clock_control/CMakeFiles/drivers__clock_control.dir/clock_control_nrf.c.obj
    ninja: build stopped: subcommand failed.
    FAILED: _sysbuild/sysbuild/images/blinky-prefix/src/blinky-stamp/blinky-build C:/ncs/devzone/344510/my_builds/build_2/_sysbuild/sysbuild/images/blinky-prefix/src/blinky-stamp/blinky-build 
    cmd.exe /C "cd /D C:\ncs\devzone\344510\my_builds\build_2\blinky && C:\ncs\toolchains\b620d30767\opt\bin\cmake.exe --build ."
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\b620d30767\opt\bin\cmake.EXE' --build C:/ncs/devzone/344510/my_builds/build_2

    Jacek Majda said:
    west build -b my_xm126/52840 - but the following fatal error came up: "ninja:error: loading'build.ninja':The system can not find the file specified" - as shown on the attached Screenshot_3.

    If there is a failed build in the directory you are using, this error is common. By building pristinely, the build system creates 'build.ninja' again.

    Also, the nrf-connect.boardRoots setting are only applied when creating build configurations in the extension, to build from command line, add -- -DBOARD_ROOT="c:\Acconeer_SDK_v1_10\acconeer_xm126_a121-v1_10_0_(1)\xm126" to the build command (as well as pristine).

    So to summarize, your build should succeed if you have modified the board files to reflect the board hardware and use the following build command from the sample directory:

    west build -b xm126/nrf52840 -d c:\Acconeer\builds\example_control_helper\build -p -- -DBOARD_ROOT="c:\Acconeer_SDK_v1_10\acconeer_xm126_a121-v1_10_0_(1)\xm126"

    Best regards,

    Maria

Related