Hello,
I'm trying to use the zephyr settings module to save bluetooth settings on the nRF9160 DK. I'm using the NCS downstream version of Zephyr. Unfortunately in the most recent version I cannot compile my code anymore and get the error "PM_MCUBOOT_STORAGE_ID" undefined.
To reproduce, simply add the following settings to the latest "ble_lte_gateway" sample:
CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_FCB=y CONFIG_SETTINGS=y CONFIG_SETTINGS_FCB=y
Compiling it then leads to the following error:
[abc@8adab83ea02f lte_ble_gateway]$ rm -rf build/ && west build -b nrf9160_pca10090ns source directory: /home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway build directory: /home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/build (created) BOARD: nrf9160_pca10090ns (origin: command line) -- Using application from '/home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway' Zephyr version: 1.14.99 -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.8", minimum required is "3.4") -- Selected BOARD nrf9160_pca10090ns -- Found west: /usr/local/bin/west (found suitable version "0.5.8", minimum required is "0.5.6") -- Cache files will be written to: /home/abc/.cache/zephyr -- Loading /home/abc/nrf-zephyr/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns.dts as base -- Overlaying /home/abc/nrf-zephyr/zephyr/dts/common/common.dts -- Overlaying /home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/nrf9160_pca10090ns.overlay nrf9160_pca10090ns.dts.pre.tmp:125.18-131.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/uart@a000: duplicate unit-address (also used in node /soc/peripheral@40000000/i2c@a000) also defined at nrf9160_pca10090ns.dts.pre.tmp:518.8-525.3 nrf9160_pca10090ns.dts.pre.tmp:269.19-275.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@40000000/power@5000) Parsing Kconfig tree in /home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/Kconfig Loaded configuration '/home/abc/nrf-zephyr/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns_defconfig' Merged configuration '/home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/prj.conf' Configuration saved to '/home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/build/zephyr/.config' -- The C compiler identification is GNU 7.3.1 -- The CXX compiler identification is GNU 7.3.1 -- The ASM compiler identification is GNU -- Found assembler: /home/abc/gcc_arm/bin/arm-none-eabi-gcc -- Performing Test toolchain_is_ok -- Performing Test toolchain_is_ok - Success Including module: nrf in path: /home/abc/nrf-zephyr/nrf -- Using application from '/home/abc/nrf-zephyr/nrf/samples/nrf9160/spm' Zephyr version: 1.14.99 Changed board to secure nrf9160_pca10090 (NOT NS) -- Loading /home/abc/nrf-zephyr/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090.dts as base -- Overlaying /home/abc/nrf-zephyr/zephyr/dts/common/common.dts -- Overlaying /home/abc/nrf-zephyr/nrf/samples/nrf9160/spm/nrf9160_pca10090.overlay nrf9160_pca10090.dts.pre.tmp:127.18-133.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/uart@a000: duplicate unit-address (also used in node /soc/peripheral@50000000/i2c@a000) also defined at nrf9160_pca10090.dts.pre.tmp:526.8-528.3 nrf9160_pca10090.dts.pre.tmp:271.19-277.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@50000000/power@5000) Parsing Kconfig tree in /home/abc/nrf-zephyr/zephyr/Kconfig Loaded configuration '/home/abc/nrf-zephyr/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090_defconfig' Merged configuration 'prj.conf' Merged configuration '/home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/child_secure_partition_manager.conf' Configuration saved to '/home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/build/spm/zephyr/.config' Including module: nrf in path: /home/abc/nrf-zephyr/nrf Including module: nffs in path: /home/abc/nrf-zephyr/modules/fs/nffs Including module: segger in path: /home/abc/nrf-zephyr/modules/debug/segger Including module: mbedtls in path: /home/abc/nrf-zephyr/modules/crypto/mbedtls Including module: mcuboot in path: /home/abc/nrf-zephyr/mcuboot/zephyr Including module: mcumgr in path: /home/abc/nrf-zephyr/modules/lib/mcumgr Including module: tinycbor in path: /home/abc/nrf-zephyr/modules/lib/tinycbor Including module: nrfxlib in path: /home/abc/nrf-zephyr/nrfxlib Including module: nffs in path: /home/abc/nrf-zephyr/modules/fs/nffs Including module: segger in path: /home/abc/nrf-zephyr/modules/debug/segger Including module: mbedtls in path: /home/abc/nrf-zephyr/modules/crypto/mbedtls Including module: mcuboot in path: /home/abc/nrf-zephyr/mcuboot/zephyr Including module: mcumgr in path: /home/abc/nrf-zephyr/modules/lib/mcumgr Including module: tinycbor in path: /home/abc/nrf-zephyr/modules/lib/tinycbor Including module: nrfxlib in path: /home/abc/nrf-zephyr/nrfxlib CMake Warning at /home/abc/nrf-zephyr/zephyr/CMakeLists.txt:1407 (message): ------------------------------------------------------------ --- WARNING: __ASSERT() statements are globally ENABLED --- --- The kernel will run more slowly and use more memory --- ------------------------------------------------------------ Running Partition Manager... -- Configuring done -- Generating done -- Build files have been written to: /home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/build [1/367] Preparing syscall dependency handling [4/367] Preparing syscall dependency handling [177/367] Linking C executable spm/zephyr/spm_zephyr_prebuilt.elf Memory region Used Size Region Size %age Used FLASH: 32 KB 48 KB 66.67% SRAM: 10000 B 64 KB 15.26% IDT_LIST: 40 B 2 KB 1.95% [257/367] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_fcb.c.obj FAILED: zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_fcb.c.obj ccache /home/abc/gcc_arm/bin/arm-none-eabi-gcc -DBUILD_VERSION=v1.14.99-ncs2-495-ga8933a2ead01 -DKERNEL -DNRF9160_XXAA -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__ZEPHYR__=1 -I/home/abc/nrf-zephyr/zephyr/kernel/include -I/home/abc/nrf-zephyr/zephyr/arch/arm/include -I/home/abc/nrf-zephyr/zephyr/include -I/home/abc/nrf-zephyr/zephyr/include/drivers -Izephyr/include/generated -I/home/abc/nrf-zephyr/zephyr/soc/arm/nordic_nrf/nrf91 -I/home/abc/nrf-zephyr/zephyr/soc/arm/nordic_nrf/include -I/home/abc/nrf-zephyr/zephyr/ext/lib/crypto/tinycrypt/include -I/home/abc/nrf-zephyr/zephyr/ext/hal/cmsis/Include -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/nrfx -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/nrfx/drivers/include -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/nrfx/hal -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/nrfx/mdk -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/. -I/home/abc/nrf-zephyr/zephyr/subsys/net/lib/sockets/. -I/home/abc/nrf-zephyr/zephyr/subsys/settings/include -I/home/abc/nrf-zephyr/zephyr/subsys/bluetooth -I/home/abc/nrf-zephyr/nrf/include -I/home/abc/nrf-zephyr/nrf/ext/cjson/. -I/home/abc/nrf-zephyr/nrf/subsys/net/lib/nrf_cloud/./include -I/home/abc/nrf-zephyr/nrfxlib/bsdlib/include -I/home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/src -isystem /home/abc/gcc_arm/arm-none-eabi/include -Os -imacros /home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -mthumb -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -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 -ffunction-sections -fdata-sections -mabi=aapcs -march=armv8-m.main+dsp -std=c99 -MD -MT zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_fcb.c.obj -MF zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_fcb.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_fcb.c.obj -c /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_fcb.c /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_fcb.c: In function 'settings_fcb_src': /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_fcb.c:19:37: error: 'PM_MCUBOOT_STORAGE_ID' undeclared (first use in this function); did you mean 'FLASH_AREA_STORAGE_ID'? #define FLASH_AREA_STORAGE_ID PM_MCUBOOT_STORAGE_ID ^ /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_fcb.c:55:17: note: in expansion of macro 'FLASH_AREA_STORAGE_ID' rc = fcb_init(FLASH_AREA_STORAGE_ID, &cf->cf_fcb); ^~~~~~~~~~~~~~~~~~~~~ /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_fcb.c:19:37: note: each undeclared identifier is reported only once for each function it appears in #define FLASH_AREA_STORAGE_ID PM_MCUBOOT_STORAGE_ID ^ /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_fcb.c:55:17: note: in expansion of macro 'FLASH_AREA_STORAGE_ID' rc = fcb_init(FLASH_AREA_STORAGE_ID, &cf->cf_fcb); ^~~~~~~~~~~~~~~~~~~~~ [259/367] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_init.c.obj FAILED: zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_init.c.obj ccache /home/abc/gcc_arm/bin/arm-none-eabi-gcc -DBUILD_VERSION=v1.14.99-ncs2-495-ga8933a2ead01 -DKERNEL -DNRF9160_XXAA -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__ZEPHYR__=1 -I/home/abc/nrf-zephyr/zephyr/kernel/include -I/home/abc/nrf-zephyr/zephyr/arch/arm/include -I/home/abc/nrf-zephyr/zephyr/include -I/home/abc/nrf-zephyr/zephyr/include/drivers -Izephyr/include/generated -I/home/abc/nrf-zephyr/zephyr/soc/arm/nordic_nrf/nrf91 -I/home/abc/nrf-zephyr/zephyr/soc/arm/nordic_nrf/include -I/home/abc/nrf-zephyr/zephyr/ext/lib/crypto/tinycrypt/include -I/home/abc/nrf-zephyr/zephyr/ext/hal/cmsis/Include -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/nrfx -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/nrfx/drivers/include -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/nrfx/hal -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/nrfx/mdk -I/home/abc/nrf-zephyr/zephyr/ext/hal/nordic/. -I/home/abc/nrf-zephyr/zephyr/subsys/net/lib/sockets/. -I/home/abc/nrf-zephyr/zephyr/subsys/settings/include -I/home/abc/nrf-zephyr/zephyr/subsys/bluetooth -I/home/abc/nrf-zephyr/nrf/include -I/home/abc/nrf-zephyr/nrf/ext/cjson/. -I/home/abc/nrf-zephyr/nrf/subsys/net/lib/nrf_cloud/./include -I/home/abc/nrf-zephyr/nrfxlib/bsdlib/include -I/home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/src -isystem /home/abc/gcc_arm/arm-none-eabi/include -Os -imacros /home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -mthumb -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -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 -ffunction-sections -fdata-sections -mabi=aapcs -march=armv8-m.main+dsp -std=c99 -MD -MT zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_init.c.obj -MF zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_init.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_init.c.obj -c /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_init.c /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_init.c: In function 'settings_backend_init': /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_init.c:21:37: error: 'PM_MCUBOOT_STORAGE_ID' undeclared (first use in this function); did you mean 'FLASH_AREA_STORAGE_ID'? #define FLASH_AREA_STORAGE_ID PM_MCUBOOT_STORAGE_ID ^ /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_init.c:92:30: note: in expansion of macro 'FLASH_AREA_STORAGE_ID' rc = flash_area_get_sectors(FLASH_AREA_STORAGE_ID, &cnt, ^~~~~~~~~~~~~~~~~~~~~ /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_init.c:21:37: note: each undeclared identifier is reported only once for each function it appears in #define FLASH_AREA_STORAGE_ID PM_MCUBOOT_STORAGE_ID ^ /home/abc/nrf-zephyr/zephyr/subsys/settings/src/settings_init.c:92:30: note: in expansion of macro 'FLASH_AREA_STORAGE_ID' rc = flash_area_get_sectors(FLASH_AREA_STORAGE_ID, &cnt, ^~~~~~~~~~~~~~~~~~~~~ [262/367] Building C object zephyr/arch/arm/core/CMakeFiles/arch__arm__core.dir/thread_abort.c.obj ninja: build stopped: subcommand failed. ERROR: command exited with status 1: /usr/local/bin/cmake --build /home/abc/nrf-zephyr/nrf/samples/nrf9160/lte_ble_gateway/build run as "west -v build -b nrf9160_pca10090ns" for a stack trace
This is the same problem that I have in my code base. This is not surprising to me since, searching through the source tree, I am unable to find where "PM_MCUBOOT_STORAGE_ID" should be defined.
Please tell me what I am missing or how to fix this.
I am working with the following versions:
zephyr a8933a2ead01db56a3d3828d81887535be8b5bda nrf f88b4bd4ed84b52ea69f9c231f705af993486a4b nrfxlib 9e46730fdfbcdb59ce116b460a48ddcc1acac6b3 mcuboot 951bb3644c85c7e30c3a93fc4408c69a06978711 gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)