DFU over Bluetooth - Modify the Peripheral LBS sample error

Hi,

I have a question regarding the DFU example



Board used: nRF7002dk
Toolchain used: v2.6.1
SDK used: v2.6.99-cs2

OS used: Windows 10


I was following the process of 'DFU over Bluetooth - Modify the Peripheral LBS sample' from the link below, and encountered a build error starting from step 2a
(I think I saw a similar example in the intermediate course at the academy.)
https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu#mcetoc_1h90kb1ii2

It is stated that if you use NCS version 2.5.0 or later,

CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

only need to add the above.

Below is the build failure log.

Please share a solution for this.
(It seems like the example adding MCUBOOT configuration is encountering the same error.)


"Failed build log"

-- Found Python3: C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe (found version "3.9.13") found components: Interpreter
Changed board to secure nrf7002dk_nrf5340_cpuapp (NOT NS)

=== child image mcuboot - begin ===
loading initial cache file C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/child_image_preload.cmake
Loading Zephyr default modules (Zephyr base).
-- Application: C:/ncs/v2.6.99-cs2/bootloader/mcuboot/boot/zephyr
-- CMake version: 3.21.0
-- Found Python3: C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.6.99-cs2/zephyr/.cache
-- Zephyr version: 3.6.99 (C:/ncs/v2.6.99-cs2/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: nrf7002dk_nrf5340_cpuapp
-- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/cf2149caf2/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs/v2.6.99-cs2/nrf/boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpuapp.dts
-- Found devicetree overlay: C:/ncs/v2.6.99-cs2/bootloader/mcuboot/boot/zephyr/app.overlay
-- Found devicetree overlay: C:/ncs/v2.6.99-cs2/nrf/modules/mcuboot/usb.overlay
-- Generated zephyr.dts: C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/dts.cmake


Parsing C:/ncs/v2.6.99-cs2/bootloader/mcuboot/boot/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.6.99-cs2/nrf/boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpuapp_defconfig'
Merged configuration 'C:/ncs/v2.6.99-cs2/bootloader/mcuboot/boot/zephyr/prj.conf'
Merged configuration 'C:/ncs/v2.6.99-cs2/nrf/modules/mcuboot/tfm.conf'
Merged configuration 'C:/ncs/v2.6.99-cs2/nrf/modules/mcuboot/fih_low_enable.conf'
Merged configuration 'C:/ncs/v2.6.99-cs2/nrf/subsys/partition_manager/partition_manager_enabled.conf'
Merged configuration 'C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to 'C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/.config'
Kconfig header saved to 'C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../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/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v2.6.99-cs2/zephyr/CMakeLists.txt:864 (message):
No SOURCES given to Zephyr library: drivers__spi

Excluding target from build.

MCUBoot bootloader key file: C:/ncs/v2.6.99-cs2/bootloader/mcuboot/root-rsa-2048.pem
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot
=== child image mcuboot - end ===

CMake Warning at C:/ncs/v2.6.99-cs2/nrf/modules/mcuboot/CMakeLists.txt:382 (message):

---------------------------------------------------------
--- WARNING: Using default MCUBoot key, it should not ---
--- be used for production. ---
---------------------------------------------------------

-- libmetal version: 1.5.0 (C:/Users/user/ncs_examples/peripheral_lbs)
-- Build type:
-- Host: Windows/AMD64
-- Target: Generic/arm
-- Machine: arm
-- Looking for include file stdatomic.h
-- Looking for include file stdatomic.h - found
-- open-amp version: 1.5.0 (C:/ncs/v2.6.99-cs2/modules/lib/open-amp/open-amp)
-- Host: Windows/AMD64
-- Target: Generic/arm
-- Machine: arm
-- C_FLAGS : -Wall -Wextra
-- Looking for include file fcntl.h
-- Looking for include file fcntl.h - found
CMake Warning at C:/ncs/v2.6.99-cs2/zephyr/CMakeLists.txt:1969 (message):
__ASSERT() statements are globally ENABLED

CMake Warning at C:/ncs/v2.6.99-cs2/nrf/cmake/partition_manager.cmake:83 (message):

---------------------------------------------------------------------
--- WARNING: Using a bootloader without pm_static.yml. ---
--- There are cases where a deployed product can consist of ---
--- multiple images, and only a subset of these images can be ---
--- upgraded through a firmware update mechanism. In such cases, ---
--- the upgradable images must have partitions that are static ---
--- and are matching the partition map used by the bootloader ---
--- programmed onto the device. ---
---------------------------------------------------------------------

Call Stack (most recent call first):
C:/ncs/v2.6.99-cs2/zephyr/cmake/modules/kernel.cmake:248 (include)
C:/ncs/v2.6.99-cs2/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
C:/ncs/v2.6.99-cs2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
C:/ncs/v2.6.99-cs2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:8 (find_package)

-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/user/ncs_examples/peripheral_lbs/build
-- west build: building application
[11/378] Generating include/generated/version.h
-- Zephyr version: 3.6.99 (C:/ncs/v2.6.99-cs2/zephyr), build: 7a22da43c1d4
[4/204] Generating include/generated/version.h
-- Zephyr version: 3.6.99 (C:/ncs/v2.6.99-cs2/zephyr), build: 7a22da43c1d4
[201/204] Linking C executable zephyr\zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 174184 B 256 KB 66.45%
RAM: 57456 B 64 KB 87.67%
SRAM1: 0 GB 64 KB 0.00%
IDT_LIST: 0 GB 32 KB 0.00%
Generating files from C:/Users/user/ncs_examples/peripheral_lbs/build/hci_ipc/zephyr/zephyr.elf for board: nrf7002dk_nrf5340_cpunet
[18/378] Generating ../../tfm/CMakeCache.txt
CMake Warning at cmake/version.cmake:22 (message):

Actual TF-M version is not available from Git repository. Settled to

v2.0.0

Call Stack (most recent call first):

CMakeLists.txt:22 (include)

-- Found Git: C:/ncs/toolchains/cf2149caf2/mingw64/bin/git.exe (found version "2.37.3.windows.1")
-- 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/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
-- Found Python3: C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe (found version "3.9.13") found components: Interpreter
CMake Deprecation Warning at C:/ncs/v2.6.99-cs2/zephyr/cmake/modules/FindDeprecated.cmake:94 (message):

'PYTHON_PREFER' variable is deprecated. Please use Python3_EXECUTABLE

instead.

Call Stack (most recent call first):

C:/ncs/v2.6.99-cs2/zephyr/cmake/modules/python.cmake:16 (find_package)

C:/ncs/v2.6.99-cs2/zephyr/cmake/modules/user_cache.cmake:30 (include)

C:/ncs/v2.6.99-cs2/zephyr/cmake/modules/extensions.cmake:5 (include)

C:/ncs/v2.6.99-cs2/nrf/subsys/nrf_security/tfm/CMakeLists.txt:42 (include)


-- Found Python3: C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.6.99-cs2/zephyr/.cache
-- Configuring done
-- Generating done
CMake Warning:

Manually-specified variables were not used by the project:

CRYPTO_RNG_MODULE_ENABLED

MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE

PYTHON_PREFER


-- Build files have been written to: C:/Users/user/ncs_examples/peripheral_lbs/build/tfm
[4/271] Generating include/generated/version.h
-- Zephyr version: 3.6.99 (C:/ncs/v2.6.99-cs2/zephyr), build: 7a22da43c1d4
[265/271] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\cf2149caf2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/arch/arch/arm/core/cortex_m/cmse/libarch__arm__core__cortex_m__cmse.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/soc/soc/arm/nordic_nrf/libsoc__arm__nordic_nrf.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/nrf/drivers/hw_cc3xx/lib..__nrf__drivers__hw_cc3xx.a modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a modules/mbedtls/libmbedTLSBase.a modules/mbedtls/libmbedTLSCrypto.a modules/mbedtls/libmbedTLSX509.a modules/mbedtls/libmodules__mbedtls.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main/nofp" -LC:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr -lgcc zephyr/arch/common/libisr_tables.a modules/mbedtls/libmbedTLSBase.a modules/mbedtls/libmbedTLSCrypto.a modules/mbedtls/libmbedTLSX509.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie C:/ncs/v2.6.99-cs2/nrfxlib/crypto/nrf_cc312_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc312_platform_0.9.19.a && cmd.exe /C "cd /D C:\Users\user\ncs_examples\peripheral_lbs\build\mcuboot\zephyr && C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_143'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[26/378] Completed 'hci_ipc_subimage'
FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf C:/Users/user/ncs_examples/peripheral_lbs/build/modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/zephyr.hex C:/Users/user/ncs_examples/peripheral_lbs/build/mcuboot/zephyr/zephyr.elf
cmd.exe /C "cd /D C:\Users\user\ncs_examples\peripheral_lbs\build\mcuboot && C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.exe --build . --"
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.EXE' --build 'c:\Users\user\ncs_examples\peripheral_lbs\build'


  • Hello,

    Please use English to describe your issue, as we don't support any other language inside this forum. Briefly state your issue by explaining what you are trying to achieve and where exactly you are facing it. Please use the insert tab to attach the logs so that it is easy for us to go through.

    Kind Regards,

    Abhijith

  • Hello, Abhijith.

    I apologize, there seems to have been a mistake in the translation process.
    I intended to provide the build log through the Insert tab as Code.

    but, it didn't work well, so I am providing it in its original form. My goal is to simply add DFU OTA to the BLE_COEX sample code. Therefore, as practice, I followed the DFU over Bluetooth - Modify the Peripheral LBS guide.

    The guide mentioned that for NCS version 2.5.0 or later,
    you should add the following configurations to prj.conf:

    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

    I only added these two lines and configured the 7002dk board in the BLE Peripheral LBS code.
    The build failed, and I am curious about the reason. Is there anything else I need to add?

    Thank you.

  • Hello,

    Could you tell me what your build configuration is or to which board you are building this sample? I recommend you follow the Developer Academy tutorial for doing the OTA BLE DFU.

    Kind Regards,

    Abhijith

  • Hello again.

    The OTA BLE DFU guide provided by the academy follows the same process as the link I mentioned. However, I followed the exact conditions of the Nordic Academy environment once again. I attempted to build the solution project for exercise 3 of lesson 8 in the intermediate course. As a result, the build fails on the nRF7002dk board, which requires OTA, up to this point.

    Visual Code - Nordic Connect for VS Code Extension Pack v2023.11.3 Sample: [Academy Intermediate] inter_less8_exer3_solution

    First attempt (Academy environment) Toolchains: v2.4.2 (python3.8.2) SDKs: v2.5.2 Build config:

    • nrf52840dk_nrf52840
    • nrf7002dk_nrf5340_cpuapp
    • nrf7002dk_nrf5340_cpuapp_ns
    • nrf5340dk_nrf5340_cpuapp_ns

    = Only the nrf5340dk_nrf5340_cpuapp_ns build succeeds, as suggested by the Compatible boards setting.

    Second attempt (latest version environment) Toolchains: v2.6.1 (python3.9.13) SDKs: v2.6.99-cs2 & v2.7.0_rc1 Build config:

    • nrf7002dk_nrf5340_cpuapp
    • nrf7002dk_nrf5340_cpuapp_ns
    • nrf5340dk_nrf5340_cpuapp_ns

    = Similarly, only the nrf5340dk_nrf5340_cpuapp_ns build succeeds, as suggested by the Compatible boards setting.

    I tested this on two Windows 10 computers, and the same error occurs. If all other board environments also failed, it would be considered strange, but the build succeeds on the 5340dk_ns.


    "If the Python path is not set to 'Toolchain_folder\opt\bin\python.exe' for someone else, and it's running as a local Python without installed pip modules, the build for nRF5340dk_nrf5340_cpuapp_ns will also fail.

    Build failure message: from cryptography.hazmat.~ ImportError: DLL load failed while importing _rust"

    The failure reasons on the 7002dk board include "RAM overflowed by 250184 bytes" and a few others.

    This board is the official nRF7002 DK board, not a custom-made one, and the sample is also an official sample. I am wondering if this error is occurring only for me.

    If possible, could you test the BLE OTA process?

    Thank you.

  • Hello,

    That's strange. I will try to test this here and get back to you by Monday.

    Kind regards,
    Abhijith

Related