DFU over Bluetooth for nRF52832

Hello,

I am attempting to add DFU support for the nRF52832 over Bluetooth, so I am able to update API and firmware in future renditions of code. I was following the tutorial Add DFU support to your application, but I seem to be getting a host of errors and would love some help getting this issue resolved.

I am using nRF connect for VSCode and the 2.4.1 SDK.

I was following the first tutorial and was getting this error (ant help would be gratefully appreciated):

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

Building ble_dfu_peripheral_lbs
C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir c:/ncs/test_app/ble_dfu_peripheral_lbs/build c:/ncs/test_app/ble_dfu_peripheral_lbs"

[0/1] Re-running CMake...
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: C:/ncs/test_app/ble_dfu_peripheral_lbs
-- CMake version: 3.20.5
-- Cache files will be written to: C:/ncs/v2.4.0/zephyr/.cache
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: nrf52dk_nrf52832
-- Found host-tools: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found BOARD.dts: C:/ncs/v2.4.0/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts
-- Generated zephyr.dts: C:/ncs/test_app/ble_dfu_peripheral_lbs/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/ncs/test_app/ble_dfu_peripheral_lbs/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/ncs/test_app/ble_dfu_peripheral_lbs/build/zephyr/dts.cmake

warning: MCUMGR (defined at subsys/mgmt/mcumgr/Kconfig:5) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: ZCBOR (=n). See
docs.zephyrproject.org/.../kconfig.html and/or look up MCUMGR in the
menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


C:/ncs/test_app/ble_dfu_peripheral_lbs/prj.conf:21: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_CMD_IMG_MGMT

C:/ncs/test_app/ble_dfu_peripheral_lbs/prj.conf:22: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_CMD_OS_MGMT

C:/ncs/test_app/ble_dfu_peripheral_lbs/prj.conf:32: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_SMP_BT

C:/ncs/test_app/ble_dfu_peripheral_lbs/prj.conf:33: warning: attempt to assign the value 'n' to the undefined symbol MCUMGR_SMP_BT_AUTHEN

error: Aborting due to Kconfig warnings
Parsing C:/ncs/test_app/ble_dfu_peripheral_lbs/Kconfig
Loaded configuration 'C:/ncs/v2.4.0/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig'
Merged configuration 'C:/ncs/test_app/ble_dfu_peripheral_lbs/prj.conf'
Merged configuration 'C:/ncs/test_app/ble_dfu_peripheral_lbs/build/zephyr/misc/generated/extra_kconfig_options.conf'

CMake Error at C:/ncs/v2.4.0/zephyr/cmake/modules/kconfig.cmake:339 (message):
command failed with return code: 1
Call Stack (most recent call first):
C:/ncs/v2.4.0/nrf/cmake/modules/kconfig.cmake:29 (include)
C:/ncs/v2.4.0/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
C:/ncs/v2.4.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
C:/ncs/v2.4.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
CMakeLists.txt:8 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/ncs/test_app/ble_dfu_peripheral_lbs/build/CMakeFiles/CMakeOutput.log".
See also "C:/ncs/test_app/ble_dfu_peripheral_lbs/build/CMakeFiles/CMakeError.log".
FAILED: build.ninja
C:\ncs\toolchains\31f4403e35\opt\bin\cmake.exe --regenerate-during-build -SC:\ncs\test_app\ble_dfu_peripheral_lbs -BC:\ncs\test_app\ble_dfu_peripheral_lbs\build
ninja: error: rebuilding 'build.ninja': subcommand failed
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\31f4403e35\opt\bin\cmake.EXE' --build 'c:\ncs\test_app\ble_dfu_peripheral_lbs\build'

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

I added this to main.c

#include <zephyr/mgmt/mcumgr/smp_bt.h>

Here is my prj.conf:

#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_LBS"
# Enable the LBS service
CONFIG_BT_LBS=y
CONFIG_BT_LBS_POLL_BUTTON=y
CONFIG_DK_LIBRARY=y

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Enable mcumgr.
CONFIG_MCUMGR=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y

# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=256

# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
Related