Adding NVS in zigbee sample

We are making ZigBee product. The base we have took is from nrf connect sdk samples light_switch and coordniator example. everything works fine but we need to keep some information stored in NVS/flash.

Mainly for device list in network so that we can relate mac and short address and update it when rejoins. so that when coordinator  restarts it has network device list.

Issue we are facing is that when we add nvs sample code it gives error 

*** Booting nRF Connect SDK v3.5.99-ncs1-1 ***
[00:00:00.020,416] <err> flash_nrf: invalid address: 0x00100ff8:8
[00:00:00.037,841] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.038,604] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.039,306] <inf> fs_nvs: data wra: 0, 0
[00:00:00.040,039] <err> flash_nrf: invalid address: 0x00100ff8:8
No address found, adding 192.168.1.1 at id 1
[00:00:00.041,351] <err> flash_nrf: invalid address: 0x00100ff8:8
[00:00:00.042,236] <err> flash_nrf: invalid address: 0x00100ff8:8
No key found, adding it at id 2

After research found its due to multi build 
The nRF Connect SDK build system enables sysbuild by default, while Zephyr build system does not. You can select the build system default or choose to explicitly use --sysbuild or --no-sysbuild for your build configuration. 

I am not sure how to fix it still
Any suggestion idea will be helpful!

  • Hi,

    I am getting below error in mac

    CMakeLists.txt File

    # SPDX-License-Identifier: Apache-2.0

    cmake_minimum_required(VERSION 3.20.0)

    macro(app_set_runner_args)
    board_runner_args(dfu-util "--dfuse-modifiers=force:mass-erase")
    board_runner_args(pyocd "--erase")
    board_runner_args(nrfjprog "--erase")
    endmacro()

    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(nvs_2)


    target_sources(app PRIVATE src/main.c)
    target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/fs/nvs)



    Error 


    [{
    "resource": "/Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c",
    "owner": "C/C++: IntelliSense",
    "code": "20",
    "severity": 8,
    "message": "identifier \"__device_dts_ord_DT_N_NODELABEL_second_storage_PARENT_PARENT_ORD\" is undefined",
    "source": "C/C++",
    "startLineNumber": 81,
    "startColumn": 20,
    "endLineNumber": 81,
    "endColumn": 40
    },{
    "resource": "/Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c",
    "owner": "C/C++: IntelliSense",
    "code": "20",
    "severity": 8,
    "message": "identifier \"DT_N_NODELABEL_second_storage_REG_IDX_0_VAL_ADDRESS\" is undefined",
    "source": "C/C++",
    "startLineNumber": 86,
    "startColumn": 14,
    "endLineNumber": 86,
    "endColumn": 34
    }]


    Full Output

    * Executing task: nRF Connect: Generate config nrf21540dk_nrf52840 for /Users/nistantritech/Documents/Zigbee/nvs_2

    Building nvs_2
    west build --build-dir /Users/nistantritech/Documents/Zigbee/nvs_2/build /Users/nistantritech/Documents/Zigbee/nvs_2 --pristine --board nrf21540dk_nrf52840 -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DCONF_FILE=/Users/nistantritech/Documents/Zigbee/nvs_2/prj.conf -DDTC_OVERLAY_FILE=nrf21540dk_nrf52840.overlay -DBOARD_ROOT=/Users/nistantritech/Documents/Zigbee/nvs_2

    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /Users/nistantritech/Documents/Zigbee/nvs_2
    -- CMake version: 3.21.0
    -- Found Python3: /opt/nordic/ncs/toolchains/f8037e9b83/opt/[email protected]/bin/python3.9 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: /Users/nistantritech/Library/Caches/zephyr
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.1/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf21540dk_nrf52840
    -- Found host-tools: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk)
    -- Found Dtc: /opt/nordic/ncs/toolchains/f8037e9b83/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found BOARD.dts: /opt/nordic/ncs/v2.6.1/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840.dts
    -- Found devicetree overlay: nrf21540dk_nrf52840.overlay
    -- Generated zephyr.dts: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v2.6.1/zephyr/Kconfig
    Loaded configuration '/opt/nordic/ncs/v2.6.1/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840_defconfig'
    Merged configuration '/Users/nistantritech/Documents/Zigbee/nvs_2/prj.conf'
    Merged configuration '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/.config'
    Kconfig header saved to '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: /opt/nordic/ncs/toolchains/f8037e9b83/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/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Using ccache: /opt/nordic/ncs/toolchains/f8037e9b83/bin/ccache
    -- Found partition manager static configuration: /Users/nistantritech/Documents/Zigbee/nvs_2/pm_static.yml
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/nistantritech/Documents/Zigbee/nvs_2/build
    -- west build: building application
    [1/164] Preparing syscall dependency handling

    [4/164] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.1/zephyr), build: v3.5.99-ncs1-1
    [163/164] Linking C executable zephyr/zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 45652 B 1 MB 4.35%
    RAM: 12480 B 256 KB 4.76%
    IDT_LIST: 0 GB 32 KB 0.00%
    [164/164] Generating zephyr/merged.hex
    * Terminal will be reused by tasks, press any key to close it.

    * Executing task: nRF Connect: Build [pristine]: nvs_2/build (active)

    Building nvs_2
    west build --build-dir /Users/nistantritech/Documents/Zigbee/nvs_2/build /Users/nistantritech/Documents/Zigbee/nvs_2 --pristine --board nrf21540dk_nrf52840 -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=prj.conf -DDTC_OVERLAY_FILE=nrf21540dk_nrf52840.overlay -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DBOARD_ROOT=/Users/nistantritech/Documents/Zigbee/nvs_2

    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /Users/nistantritech/Documents/Zigbee/nvs_2
    -- CMake version: 3.21.0
    -- Found Python3: /opt/nordic/ncs/toolchains/f8037e9b83/opt/[email protected]/bin/python3.9 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: /Users/nistantritech/Library/Caches/zephyr
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.1/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf21540dk_nrf52840
    -- Found host-tools: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk)
    -- Found Dtc: /opt/nordic/ncs/toolchains/f8037e9b83/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found BOARD.dts: /opt/nordic/ncs/v2.6.1/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840.dts
    -- Found devicetree overlay: nrf21540dk_nrf52840.overlay
    -- Generated zephyr.dts: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v2.6.1/zephyr/Kconfig
    Loaded configuration '/opt/nordic/ncs/v2.6.1/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840_defconfig'
    Merged configuration '/Users/nistantritech/Documents/Zigbee/nvs_2/prj.conf'
    Merged configuration '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/.config'
    Kconfig header saved to '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: /opt/nordic/ncs/toolchains/f8037e9b83/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/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Using ccache: /opt/nordic/ncs/toolchains/f8037e9b83/bin/ccache
    -- Found partition manager static configuration: /Users/nistantritech/Documents/Zigbee/nvs_2/pm_static.yml
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/nistantritech/Documents/Zigbee/nvs_2/build
    -- west build: building application
    [1/164] Preparing syscall dependency handling

    [4/164] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.1/zephyr), build: v3.5.99-ncs1-1
    [163/164] Linking C executable zephyr/zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 45652 B 1 MB 4.35%
    RAM: 12480 B 256 KB 4.76%
    IDT_LIST: 0 GB 32 KB 0.00%
    [164/164] Generating zephyr/merged.hex
    * Terminal will be reused by tasks, press any key to close it.

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

    Building nvs_2
    west build --build-dir /Users/nistantritech/Documents/Zigbee/nvs_2/build /Users/nistantritech/Documents/Zigbee/nvs_2

    ninja: no work to do.
    * Terminal will be reused by tasks, press any key to close it.

    * Executing task: nRF Connect: Flash: nvs_2/build (active)

    Flashing build to 681596074
    west flash -d /Users/nistantritech/Documents/Zigbee/nvs_2/build --skip-rebuild --dev-id 681596074

    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: mass erase requested
    -- runners.nrfjprog: reset after flashing requested
    -- runners.nrfjprog: Flashing file: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/merged.hex
    [ #################### ] 0.218s | Erase file - Done erasing
    [ #################### ] 0.563s | Program file - Done programming
    [ #################### ] 0.552s | Verify file - Done verifying
    Enabling pin reset.
    Applying pin reset.
    -- runners.nrfjprog: Board with serial number 681596074 flashed successfully.
    * Terminal will be reused by tasks, press any key to close it.

    * Executing task: nRF Connect: Build [pristine]: nvs_2/build (active)

    Building nvs_2
    west build --build-dir /Users/nistantritech/Documents/Zigbee/nvs_2/build /Users/nistantritech/Documents/Zigbee/nvs_2 --pristine --board nrf21540dk_nrf52840 -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=prj.conf -DDTC_OVERLAY_FILE=nrf21540dk_nrf52840.overlay -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DBOARD_ROOT=/Users/nistantritech/Documents/Zigbee/nvs_2

    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /Users/nistantritech/Documents/Zigbee/nvs_2
    -- CMake version: 3.21.0
    -- Found Python3: /opt/nordic/ncs/toolchains/f8037e9b83/opt/[email protected]/bin/python3.9 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: /Users/nistantritech/Library/Caches/zephyr
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.1/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf21540dk_nrf52840
    -- Found host-tools: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk)
    -- Found Dtc: /opt/nordic/ncs/toolchains/f8037e9b83/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found BOARD.dts: /opt/nordic/ncs/v2.6.1/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840.dts
    -- Found devicetree overlay: nrf21540dk_nrf52840.overlay
    -- Generated zephyr.dts: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v2.6.1/zephyr/Kconfig
    Loaded configuration '/opt/nordic/ncs/v2.6.1/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840_defconfig'
    Merged configuration '/Users/nistantritech/Documents/Zigbee/nvs_2/prj.conf'
    Merged configuration '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/.config'
    Kconfig header saved to '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: /opt/nordic/ncs/toolchains/f8037e9b83/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/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Using ccache: /opt/nordic/ncs/toolchains/f8037e9b83/bin/ccache
    -- Found partition manager static configuration: /Users/nistantritech/Documents/Zigbee/nvs_2/pm_static.yml
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/nistantritech/Documents/Zigbee/nvs_2/build
    -- west build: building application
    [1/164] Preparing syscall dependency handling

    [4/164] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.1/zephyr), build: v3.5.99-ncs1-1
    [156/164] Building C object CMakeFiles/app.dir/src/main.c.obj
    FAILED: CMakeFiles/app.dir/src/main.c.obj
    ccache /opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DNRF52840_XXAA -DPICOLIBC_LONG_LONG_PRINTF_SCANF -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/opt/nordic/ncs/v2.6.1/zephyr/subsys/fs/nvs -I/opt/nordic/ncs/v2.6.1/zephyr/include -I/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated -I/opt/nordic/ncs/v2.6.1/zephyr/soc/arm/nordic_nrf/nrf52 -I/opt/nordic/ncs/v2.6.1/zephyr/soc/common/nordic_nrf/. -I/opt/nordic/ncs/v2.6.1/zephyr/soc/arm/nordic_nrf/common/. -I/opt/nordic/ncs/v2.6.1/nrf/include -I/opt/nordic/ncs/v2.6.1/nrf/tests/include -I/opt/nordic/ncs/v2.6.1/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v2.6.1/zephyr/modules/cmsis/. -I/opt/nordic/ncs/v2.6.1/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v2.6.1/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v2.6.1/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v2.6.1/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v2.6.1/modules/debug/segger/SEGGER -I/opt/nordic/ncs/v2.6.1/modules/debug/segger/Config -isystem /opt/nordic/ncs/v2.6.1/zephyr/lib/libc/common/include -isystem /opt/nordic/ncs/v2.6.1/nrfxlib/crypto/nrf_cc310_platform/include -fno-strict-aliasing -Og -imacros /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/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=/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v2.6.1/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 -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/Users/nistantritech/Documents/Zigbee/nvs_2=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v2.6.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v2.6.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 /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c
    In file included from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/toolchain/gcc.h:98,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/toolchain.h:50,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/kernel_includes.h:23,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/kernel.h:17,
    from /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:41:
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c: In function 'main':
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_DT_N_NODELABEL_second_storage_PARENT_PARENT_ORD' undeclared (first use in this function)
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
    137 | #define _DO_CONCAT(x, y) x ## y
    | ^
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
    216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
    | ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
    233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
    | ^~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/storage/flash_map.h:348:9: note: in expansion of macro 'DEVICE_DT_GET'
    348 | DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label)))
    | ^~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:52:33: note: in expansion of macro 'FIXED_PARTITION_DEVICE'
    52 | #define NVS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(NVS_PARTITION)
    | ^~~~~~~~~~~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:81:27: note: in expansion of macro 'NVS_PARTITION_DEVICE'
    81 | fs.flash_device = NVS_PARTITION_DEVICE;
    | ^~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: note: each undeclared identifier is reported only once for each function it appears in
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
    137 | #define _DO_CONCAT(x, y) x ## y
    | ^
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
    216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
    | ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
    233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
    | ^~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/storage/flash_map.h:348:9: note: in expansion of macro 'DEVICE_DT_GET'
    348 | DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label)))
    | ^~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:52:33: note: in expansion of macro 'FIXED_PARTITION_DEVICE'
    52 | #define NVS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(NVS_PARTITION)
    | ^~~~~~~~~~~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:81:27: note: in expansion of macro 'NVS_PARTITION_DEVICE'
    81 | fs.flash_device = NVS_PARTITION_DEVICE;
    | ^~~~~~~~~~~~~~~~~~~~
    In file included from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/arch/arm/arch.h:20,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/arch/cpu.h:19,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/kernel_includes.h:37:
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:198:36: error: 'DT_N_NODELABEL_second_storage_REG_IDX_0_VAL_ADDRESS' undeclared (first use in this function)
    198 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:4345:33: note: in definition of macro 'DT_CAT4'
    4345 | #define DT_CAT4(a1, a2, a3, a4) a1 ## a2 ## a3 ## a4
    | ^~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:2225:30: note: in expansion of macro 'DT_REG_ADDR_BY_IDX'
    2225 | #define DT_REG_ADDR(node_id) DT_REG_ADDR_BY_IDX(node_id, 0)
    | ^~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/storage/flash_map.h:319:39: note: in expansion of macro 'DT_REG_ADDR'
    319 | #define FIXED_PARTITION_OFFSET(label) DT_REG_ADDR(DT_NODELABEL(label))
    | ^~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:198:29: note: in expansion of macro 'DT_CAT'
    198 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/storage/flash_map.h:319:51: note: in expansion of macro 'DT_NODELABEL'
    319 | #define FIXED_PARTITION_OFFSET(label) DT_REG_ADDR(DT_NODELABEL(label))
    | ^~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:53:33: note: in expansion of macro 'FIXED_PARTITION_OFFSET'
    53 | #define NVS_PARTITION_OFFSET FIXED_PARTITION_OFFSET(NVS_PARTITION)
    | ^~~~~~~~~~~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:86:21: note: in expansion of macro 'NVS_PARTITION_OFFSET'
    86 | fs.offset = NVS_PARTITION_OFFSET;
    | ^~~~~~~~~~~~~~~~~~~~
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/f8037e9b83/bin/cmake --build /Users/nistantritech/Documents/Zigbee/nvs_2/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 [pristine]: nvs_2/build (active)

    Building nvs_2
    west build --build-dir /Users/nistantritech/Documents/Zigbee/nvs_2/build /Users/nistantritech/Documents/Zigbee/nvs_2 --pristine --board nrf21540dk_nrf52840 -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=prj.conf -DDTC_OVERLAY_FILE=nrf21540dk_nrf52840.overlay -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DBOARD_ROOT=/Users/nistantritech/Documents/Zigbee/nvs_2

    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /Users/nistantritech/Documents/Zigbee/nvs_2
    -- CMake version: 3.21.0
    -- Found Python3: /opt/nordic/ncs/toolchains/f8037e9b83/opt/[email protected]/bin/python3.9 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: /Users/nistantritech/Library/Caches/zephyr
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.1/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf21540dk_nrf52840
    -- Found host-tools: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk)
    -- Found Dtc: /opt/nordic/ncs/toolchains/f8037e9b83/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found BOARD.dts: /opt/nordic/ncs/v2.6.1/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840.dts
    -- Found devicetree overlay: nrf21540dk_nrf52840.overlay
    -- Generated zephyr.dts: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v2.6.1/zephyr/Kconfig
    Loaded configuration '/opt/nordic/ncs/v2.6.1/zephyr/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840_defconfig'
    Merged configuration '/Users/nistantritech/Documents/Zigbee/nvs_2/prj.conf'
    Merged configuration '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/.config'
    Kconfig header saved to '/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: /opt/nordic/ncs/toolchains/f8037e9b83/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/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Using ccache: /opt/nordic/ncs/toolchains/f8037e9b83/bin/ccache
    -- Found partition manager static configuration: /Users/nistantritech/Documents/Zigbee/nvs_2/pm_static.yml
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/nistantritech/Documents/Zigbee/nvs_2/build
    -- west build: building application
    [1/164] Preparing syscall dependency handling

    [4/164] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.1/zephyr), build: v3.5.99-ncs1-1
    [156/164] Building C object CMakeFiles/app.dir/src/main.c.obj
    FAILED: CMakeFiles/app.dir/src/main.c.obj
    ccache /opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DNRF52840_XXAA -DPICOLIBC_LONG_LONG_PRINTF_SCANF -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/opt/nordic/ncs/v2.6.1/zephyr/subsys/fs/nvs -I/opt/nordic/ncs/v2.6.1/zephyr/include -I/Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated -I/opt/nordic/ncs/v2.6.1/zephyr/soc/arm/nordic_nrf/nrf52 -I/opt/nordic/ncs/v2.6.1/zephyr/soc/common/nordic_nrf/. -I/opt/nordic/ncs/v2.6.1/zephyr/soc/arm/nordic_nrf/common/. -I/opt/nordic/ncs/v2.6.1/nrf/include -I/opt/nordic/ncs/v2.6.1/nrf/tests/include -I/opt/nordic/ncs/v2.6.1/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v2.6.1/zephyr/modules/cmsis/. -I/opt/nordic/ncs/v2.6.1/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v2.6.1/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v2.6.1/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v2.6.1/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v2.6.1/modules/debug/segger/SEGGER -I/opt/nordic/ncs/v2.6.1/modules/debug/segger/Config -isystem /opt/nordic/ncs/v2.6.1/zephyr/lib/libc/common/include -isystem /opt/nordic/ncs/v2.6.1/nrfxlib/crypto/nrf_cc310_platform/include -fno-strict-aliasing -Og -imacros /Users/nistantritech/Documents/Zigbee/nvs_2/build/zephyr/include/generated/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=/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v2.6.1/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 -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/Users/nistantritech/Documents/Zigbee/nvs_2=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v2.6.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v2.6.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 /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c
    In file included from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/toolchain/gcc.h:98,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/toolchain.h:50,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/kernel_includes.h:23,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/kernel.h:17,
    from /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:41:
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c: In function 'main':
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_DT_N_NODELABEL_second_storage_PARENT_PARENT_ORD' undeclared (first use in this function)
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
    137 | #define _DO_CONCAT(x, y) x ## y
    | ^
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
    216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
    | ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
    233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
    | ^~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/storage/flash_map.h:348:9: note: in expansion of macro 'DEVICE_DT_GET'
    348 | DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label)))
    | ^~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:52:33: note: in expansion of macro 'FIXED_PARTITION_DEVICE'
    52 | #define NVS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(NVS_PARTITION)
    | ^~~~~~~~~~~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:81:27: note: in expansion of macro 'NVS_PARTITION_DEVICE'
    81 | fs.flash_device = NVS_PARTITION_DEVICE;
    | ^~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: note: each undeclared identifier is reported only once for each function it appears in
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
    137 | #define _DO_CONCAT(x, y) x ## y
    | ^
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
    216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
    | ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
    233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
    | ^~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/storage/flash_map.h:348:9: note: in expansion of macro 'DEVICE_DT_GET'
    348 | DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(label)))
    | ^~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:52:33: note: in expansion of macro 'FIXED_PARTITION_DEVICE'
    52 | #define NVS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(NVS_PARTITION)
    | ^~~~~~~~~~~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:81:27: note: in expansion of macro 'NVS_PARTITION_DEVICE'
    81 | fs.flash_device = NVS_PARTITION_DEVICE;
    | ^~~~~~~~~~~~~~~~~~~~
    In file included from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/arch/arm/arch.h:20,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/arch/cpu.h:19,
    from /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/kernel_includes.h:37:
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:198:36: error: 'DT_N_NODELABEL_second_storage_REG_IDX_0_VAL_ADDRESS' undeclared (first use in this function)
    198 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:4345:33: note: in definition of macro 'DT_CAT4'
    4345 | #define DT_CAT4(a1, a2, a3, a4) a1 ## a2 ## a3 ## a4
    | ^~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:2225:30: note: in expansion of macro 'DT_REG_ADDR_BY_IDX'
    2225 | #define DT_REG_ADDR(node_id) DT_REG_ADDR_BY_IDX(node_id, 0)
    | ^~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/storage/flash_map.h:319:39: note: in expansion of macro 'DT_REG_ADDR'
    319 | #define FIXED_PARTITION_OFFSET(label) DT_REG_ADDR(DT_NODELABEL(label))
    | ^~~~~~~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:198:29: note: in expansion of macro 'DT_CAT'
    198 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~
    /opt/nordic/ncs/v2.6.1/zephyr/include/zephyr/storage/flash_map.h:319:51: note: in expansion of macro 'DT_NODELABEL'
    319 | #define FIXED_PARTITION_OFFSET(label) DT_REG_ADDR(DT_NODELABEL(label))
    | ^~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:53:33: note: in expansion of macro 'FIXED_PARTITION_OFFSET'
    53 | #define NVS_PARTITION_OFFSET FIXED_PARTITION_OFFSET(NVS_PARTITION)
    | ^~~~~~~~~~~~~~~~~~~~~~
    /Users/nistantritech/Documents/Zigbee/nvs_2/src/main.c:86:21: note: in expansion of macro 'NVS_PARTITION_OFFSET'
    86 | fs.offset = NVS_PARTITION_OFFSET;
    | ^~~~~~~~~~~~~~~~~~~~
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/f8037e9b83/bin/cmake --build /Users/nistantritech/Documents/Zigbee/nvs_2/build

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

  • Hi,

     

    I am unable to reproduce this behavior. Are you using a stock nvs sample or the network_coordinator example when testing this?

    Dalvadi Anil said:
    '__device_dts_ord_DT_N_NODELABEL_second_storage_PARENT_PARENT_ORD' undeclared (first use in this function)
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)

    This indicates that there's a device-tree issue happening, as the error will be reported differently if the partition name is not found.

     

    Kind regards,

    Håkon

  • Hi  
    I guess something was with cache 
    its working now on mac as well

  • Hi,

     

    Great to hear that it is working now. Hope you have a wonderful weekend!

     

    Kind regards,

    Håkon

Related