Added support for DFU over Bluetooth LE SMP#112
Conversation
Created a new Kconfig module that provides support for DFU over BLuetooth LE for Zigbee-only solution. Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
Documentation PreviewThe documentation has been built successfully. You can view the preview here: preview Generated at: Expand to view changed pages
|
There was a problem hiding this comment.
Pull request overview
Adds a new Zigbee library module to enable DFU over Bluetooth LE using MCUmgr/SMP for Zigbee-only builds, and wires it into the Light Switch sample (including CI build-only test variants).
Changes:
- Introduces
ZIGBEE_BT_DFUKconfig + library implementation that enables MCUmgr-over-BLE SMP and starts connectable advertising. - Integrates BT DFU initialization into the Light Switch Zigbee app flow, including “confirm image” handling for MCUboot.
- Updates the Light Switch sample’s Matter-related file split and adds CI build-only configurations for BT DFU variants.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| subsys/lib/zigbee_bt_dfu/zigbee_bt_dfu.c | Implements BLE enable + advertising and registers MCUmgr callbacks for SMP DFU flow. |
| subsys/lib/zigbee_bt_dfu/Kconfig | Adds ZIGBEE_BT_DFU feature flag and selects/configures required Bluetooth + MCUmgr options. |
| subsys/lib/zigbee_bt_dfu/CMakeLists.txt | Builds the new library and links MCUboot bootutil. |
| subsys/lib/Kconfig | Exposes the new library Kconfig from the Zigbee libraries menu. |
| subsys/lib/CMakeLists.txt | Builds the new library directory when CONFIG_ZIGBEE_BT_DFU is enabled. |
| include/zigbee/zigbee_bt_dfu.h | Public API header for initializing Zigbee BLE DFU support. |
| samples/light_switch/src/app_task_zigbee.c | Initializes Zigbee BT DFU and reuses MCUboot image confirmation when FOTA/BT DFU is enabled. |
| samples/light_switch/src/main.cpp | Switches Matter-coexistence include to the Matter-specific task header. |
| samples/light_switch/src/app_task_matter.cpp | Aligns include to app_task_matter.h (Matter extension build). |
| samples/light_switch/include/app_task_matter.h | Updates copyright year (no functional change shown in diff). |
| samples/light_switch/CMakeLists.txt | Builds Matter variant with app_task_matter.cpp instead of the prior file. |
| samples/light_switch/Kconfig | Adds a default BT device name when Zigbee BT DFU is enabled. |
| samples/light_switch/sample.yaml | Adds build-only CI test variants for Matter BT DFU and Zigbee FOTA + BT DFU. |
| samples/light_switch/README.rst | Updates source-file structure documentation for the sample split. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if CONFIG_ZIGBEE_BT_DFU | ||
|
|
||
| config BT_DEVICE_NAME | ||
| default "Zigbee_Switch" | ||
|
|
||
| endif # CONFIG_ZIGBEE_BT_DFU |
| #include <zephyr/bluetooth/bluetooth.h> | ||
| #include <zephyr/bluetooth/conn.h> | ||
| #include <zephyr/dfu/mcuboot.h> | ||
| #include <zephyr/logging/log.h> | ||
| #include <zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h> | ||
| #include <zephyr/mgmt/mcumgr/mgmt/callbacks.h> | ||
| #include <zephyr/mgmt/mcumgr/mgmt/mgmt_defines.h> |
| config ZIGBEE_BT_DFU | ||
| bool "Enable DFU over Bluetooth LE SMP feature set" | ||
| depends on !CHIP | ||
| imply BOOTLOADER_MCUBOOT |
| static void advertise(struct k_work *work) { | ||
| struct bt_le_adv_param params = BT_LE_ADV_PARAM_INIT( | ||
| BT_LE_ADV_OPT_CONN, BT_ADV_INT_MIN, BT_ADV_INT_MAX, NULL); | ||
| params.id = 0; | ||
|
|
| #include <zephyr/sys/reboot.h> | ||
| #endif /* CONFIG_ZIGBEE_FOTA */ | ||
|
|
||
| #if IS_ENABLED(CONFIG_ZIGBEE_FOTA) || IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) |
There was a problem hiding this comment.
NIT, AFAIR we've not used IS_ENABLED anywhere.
| #if IS_ENABLED(CONFIG_ZIGBEE_FOTA) || IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) | |
| #if defined(CONFIG_ZIGBEE_FOTA) || defined(CONFIG_ZIGBEE_BT_DFU) |
| #define OTA_ACTIVITY_LED DK_LED2 | ||
| #endif /* CONFIG_ZIGBEE_FOTA */ | ||
|
|
||
| #if IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) |
There was a problem hiding this comment.
| #if IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) | |
| #ifdef CONFIG_ZIGBEE_BT_DFU |
| } | ||
|
|
||
| #ifdef CONFIG_ZIGBEE_FOTA | ||
| #if IS_ENABLED(CONFIG_ZIGBEE_FOTA) || IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) |
There was a problem hiding this comment.
| #if IS_ENABLED(CONFIG_ZIGBEE_FOTA) || IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) | |
| #if defined(CONFIG_ZIGBEE_FOTA) || defined(CONFIG_ZIGBEE_BT_DFU) |
| power_down_unused_ram(); | ||
| } | ||
|
|
||
| #if IS_ENABLED(CONFIG_ZIGBEE_FOTA) || IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) |
There was a problem hiding this comment.
| #if IS_ENABLED(CONFIG_ZIGBEE_FOTA) || IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) | |
| #if defined(CONFIG_ZIGBEE_FOTA) || defined(CONFIG_ZIGBEE_BT_DFU) |
| ZB_ZCL_REGISTER_DEVICE_CB(zcl_device_cb); | ||
| #endif /* CONFIG_ZIGBEE_FOTA */ | ||
|
|
||
| #if IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) |
There was a problem hiding this comment.
| #if IS_ENABLED(CONFIG_ZIGBEE_BT_DFU) | |
| #if defined(CONFIG_ZIGBEE_BT_DFU) |
|
|
||
| if CONFIG_ZIGBEE_BT_DFU | ||
|
|
||
| config BT_DEVICE_NAME |
There was a problem hiding this comment.
Maybe we should start using configdefault to not remove dependencies from the original kconfigs, but I will not push you to do it :)
| @@ -0,0 +1,88 @@ | |||
| # | |||
| # Copyright (c) 2026 Nordic Semiconductor ASA | |||
There was a problem hiding this comment.
Similar suggestion for configdefaults as above.
Created a new Kconfig module that provides support for DFU over BLuetooth LE for Zigbee-only solution.
What is still missing and have to be added: