This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Non-Volatile Storage (NVS) Sample compile issue on NRF SDK v1.6

When compiling the sample located in samples/subsys/nvs/src/main.c I get the following compile error:

Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
ccache /opt/toolchains/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DBUILD_VERSION=v2.6.0-rc1-ncs1-4-g9a974d0214f4 -DEXT_API_MAGIC=0x281ee6de,0xb845acea,23298 -DFIRMWARE_INFO_MAGIC=0x281ee6de,0x8fcebb4c,23298 -DKERNEL -DNRF9160_XXAA -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -I/opt/zephyrproject/zephyr/subsys/fs/nvs -I/opt/zephyrproject/zephyr/include -Izephyr/include/generated -I/opt/zephyrproject/zephyr/soc/arm/nordic_nrf/nrf91 -I/opt/zephyrproject/nrf/include -I/opt/zephyrproject/modules/hal/cmsis/CMSIS/Core/Include -I/opt/zephyrproject/modules/hal/nordic/nrfx -I/opt/zephyrproject/modules/hal/nordic/nrfx/drivers/include -I/opt/zephyrproject/modules/hal/nordic/nrfx/mdk -I/opt/zephyrproject/zephyr/modules/hal_nordic/nrfx/. -isystem /opt/zephyrproject/zephyr/lib/libc/minimal/include -isystem /opt/toolchains/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/include -isystem /opt/toolchains/zephyr-sdk-0.12.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/include-fixed -Os -imacros /opt/zephyrproject/zephyr/samples/subsys/nvs/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -imacros /opt/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/opt/zephyrproject/zephyr/samples/subsys/nvs=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/zephyrproject=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 /opt/zephyrproject/zephyr/include/toolchain/gcc.h:69,
                 from /opt/zephyrproject/zephyr/include/toolchain.h:43,
                 from /opt/zephyrproject/zephyr/include/kernel_includes.h:19,
                 from /opt/zephyrproject/zephyr/include/kernel.h:17,
                 from /opt/zephyrproject/zephyr/include/zephyr.h:18,
                 from ../src/main.c:41:
../src/main.c: In function 'main':
/opt/zephyrproject/zephyr/include/device.h:80:39: error: '__device_dts_ord_DT_COMPAT_fixed_partitions_LABEL_nvs_storage_PARENT_PARENT_ORD' undeclared (first use in this function)
   80 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
      |                                       ^~~~~~~~~
/opt/zephyrproject/zephyr/include/toolchain/common.h:124:26: note: in definition of macro '_DO_CONCAT'
  124 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/opt/zephyrproject/zephyr/include/device.h:80:31: note: in expansion of macro '_CONCAT'
   80 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
      |                               ^~~~~~~
/opt/zephyrproject/zephyr/include/device.h:257:37: note: in expansion of macro 'DEVICE_NAME_GET'
  257 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_NAME(node_id))
      |                                     ^~~~~~~~~~~~~~~
/opt/zephyrproject/zephyr/include/device.h:271:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  271 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
../src/main.c:81:14: note: in expansion of macro 'DEVICE_DT_GET'
   81 |  flash_dev = DEVICE_DT_GET(FLASH_NODE);
      |              ^~~~~~~~~~~~~
/opt/zephyrproject/zephyr/include/device.h:80:39: note: each undeclared identifier is reported only once for each function it appears in
   80 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
      |                                       ^~~~~~~~~
/opt/zephyrproject/zephyr/include/toolchain/common.h:124:26: note: in definition of macro '_DO_CONCAT'
  124 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/opt/zephyrproject/zephyr/include/device.h:80:31: note: in expansion of macro '_CONCAT'
   80 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
      |                               ^~~~~~~
/opt/zephyrproject/zephyr/include/device.h:257:37: note: in expansion of macro 'DEVICE_NAME_GET'
  257 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_NAME(node_id))
      |                                     ^~~~~~~~~~~~~~~
/opt/zephyrproject/zephyr/include/device.h:271:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  271 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
../src/main.c:81:14: note: in expansion of macro 'DEVICE_DT_GET'
   81 |  flash_dev = DEVICE_DT_GET(FLASH_NODE);
      |              ^~~~~~~~~~~~~
[44/174] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_base_addresses.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /opt/zephyrproject/zephyr/samples/subsys/nvs/build

I tried to revert the last commit and manage to compile and run the sample that way. To me it looks like there is something wrong here. Note that I managed to compile the original sample for the board QEMU_X86.

Best regards,

Michael

Related