Skip to content

Commit dc9c044

Browse files
alxelaxrlubos
authored andcommitted
samples: bluetooth: mesh: add ble dfu as file suffix to light sample
Commit changes adding the dfu feature to mesh light sample. DFU is added as FILE_SUFFIX sysbuild configuration. Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
1 parent 5b31b6c commit dc9c044

12 files changed

Lines changed: 200 additions & 97 deletions

samples/bluetooth/mesh/light/README.rst

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The sample also requires a smartphone with Nordic Semiconductor's nRF Mesh mobil
3535
DFU requirements
3636
================
3737

38-
The configuration overlay file :file:`overlay-dfu.conf` and the :ref:`sysbuild <configuration_system_overview_sysbuild>` configuration file :file:`sysbuild-dfu.conf` enable DFU support in the application, and apply to the following platforms:
38+
The configuration file :file:`prj_dfu.conf` and the :ref:`sysbuild <configuration_system_overview_sysbuild>` configuration file :file:`sysbuild_dfu.conf` enable DFU support in the application, and apply to the following platforms:
3939

4040
* nrf52840dk/nrf52840
4141
* nrf21540dk/nrf52840
@@ -134,36 +134,20 @@ This sample is split into the following source files:
134134
DFU configuration
135135
=================
136136

137-
.. tabs::
137+
To enable the DFU feature, use ``FILE_SUFFIX=dfu`` when building the sample.
138+
For example, when building from the command line, use the following command, where *board_target* is the target for the development kit for which you are building:
138139

139-
.. tab:: nRF52840 DK and nRF54L15 DK
140+
.. parsed-literal::
141+
:class: highlight
140142
141-
To enable the DFU feature for the nRF52840 and nRF54L15 development kits, set :makevar:`SB_CONF_FILE` to :file:`sysbuild-dfu.conf` and :makevar:`EXTRA_CONF_FILE` to :file:`overlay-dfu.conf` when building the sample.
142-
For example, when building from the command line, use the following command, where *board_target* is the target for the development kit for which you are building:
143+
west build -b *board_target* -p -- -DFILE_SUFFIX=dfu
143144
144-
.. parsed-literal::
145-
:class: highlight
145+
The configuration file :file:`prj_dfu.conf` and the sysbuild configuration file :file:`sysbuild_dfu.conf` enable the DFU feature.
146+
To review the required configuration alterations, open and inspect the two files.
146147

147-
west build -b *board_target* -p -- -DSB_CONF_FILE="sysbuild-dfu.conf" -DEXTRA_CONF_FILE="overlay-dfu.conf"
148-
149-
The configuration overlay file :file:`overlay-dfu.conf` and the sysbuild configuration file :file:`sysbuild-dfu.conf` enable the DFU feature.
150-
To review the required configuration alterations, open and inspect the two files.
151-
152-
.. tab:: nRF5340 DK
153-
154-
To enable the DFU feature for the nRF5340 development kit, set :makevar:`SB_CONF_FILE` to :file:`sysbuild-dfu.conf` and :makevar:`EXTRA_CONF_FILE` to :file:`overlay-dfu.conf` when building the sample.
155-
Additionally, you need to set the :makevar:`EXTRA_CONF_FILE` for the ipc_radio network image to :file:`overlay-dfu.conf` as well.
156-
This is an additional network image specific configuration overlay file, which allocates the necessary resources to enable the DFU feature.
157-
For example, when building from the command line, use the following command, where *board_target* is the target for the development kit for which you are building:
158-
159-
.. parsed-literal::
160-
:class: highlight
161-
162-
west build -b *board_target* -p -- -DSB_CONF_FILE="sysbuild-dfu.conf" -DEXTRA_CONF_FILE="overlay-dfu.conf" -Dipc_radio_EXTRA_CONF_FILE="overlay-dfu.conf"
163-
164-
.. note::
165-
Currently, the nRF5340 development kit only supports DFU for the application core.
166-
This implies that all application DFU images must be compatible with the network core image running on the device.
148+
.. note::
149+
Currently, the nRF5340 development kit only supports DFU for the application core.
150+
This implies that all application DFU images must be compatible with the network core image running on the device.
167151

168152
For more information about configuration files in the |NCS|, see :ref:`app_build_system`.
169153

@@ -216,7 +200,7 @@ Make sure to complete the configuration on each of the elements on the node to e
216200
Running DFU
217201
===========
218202

219-
After the sample is built with the :file:`overlay-dfu.conf` file and the :file:`sysbuild-dfu.conf` file, and programmed to your development kit, support for FOTA update is enabled.
203+
After the sample is built with ``FILE_SUFFIX=dfu`` and programmed to your development kit, support for FOTA update is enabled.
220204
See :ref:`FOTA over Bluetooth Low Energy<ug_nrf52_developing_ble_fota>` for instructions on how to perform FOTA update and initiate the DFU process.
221205

222206
External flash for settings partition

samples/bluetooth/mesh/light/boards/nrf5340dk_nrf5340_cpuapp_ns.overlay

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,31 @@
55
*/
66

77
/* Rebalance secure/non-secure subpartitions to fit larger mesh light NS image.
8-
* Aligned slot0/slot1 addresses and sizes to MCUboot defaults
9-
* (nrf5340_cpuapp_partition.dtsi): each slot is 0x74000 (464 KB).
10-
* Secure: 192 KB, Non-secure: 272 KB.
8+
* MCUboot is removed; slot0 starts at 0x0 and spans 928 KB (0xe8000).
9+
* Secure: 128 KB, Non-secure: 800 KB.
1110
*/
1211

12+
/delete-node/ &boot_partition;
1313
/delete-node/ &slot0_partition;
14-
/delete-node/ &slot1_partition;
1514

1615
&flash0 {
1716
partitions {
18-
slot0_partition: partition@10000 {
17+
slot0_partition: partition@0 {
1918
compatible = "fixed-subpartitions";
2019
label = "image-0";
21-
reg = <0x10000 0x74000>;
22-
ranges = <0x0 0x10000 0x74000>;
20+
reg = <0x00000000 0xe8000>;
21+
ranges = <0x0 0x0 0xe8000>;
2322
#address-cells = <1>;
2423
#size-cells = <1>;
2524

2625
slot0_s_partition: partition@0 {
2726
label = "image-0-secure";
28-
reg = <0x0 0x30000>;
27+
reg = <0x00000000 0x20000>;
2928
};
3029

31-
slot0_ns_partition: partition@30000 {
30+
slot0_ns_partition: partition@20000 {
3231
label = "image-0-nonsecure";
33-
reg = <0x30000 0x44000>;
34-
};
35-
};
36-
37-
slot1_partition: partition@84000 {
38-
compatible = "fixed-subpartitions";
39-
label = "image-1";
40-
reg = <0x84000 0x74000>;
41-
ranges = <0x0 0x84000 0x74000>;
42-
#address-cells = <1>;
43-
#size-cells = <1>;
44-
45-
slot1_s_partition: partition@0 {
46-
label = "image-1-secure";
47-
reg = <0x0 0x30000>;
48-
};
49-
50-
slot1_ns_partition: partition@30000 {
51-
label = "image-1-nonsecure";
52-
reg = <0x30000 0x44000>;
32+
reg = <0x00020000 0xc8000>;
5333
};
5434
};
5535
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (c) 2026 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/* Rebalance secure/non-secure subpartitions to fit larger mesh light NS image.
8+
* Aligned slot0/slot1 addresses and sizes to MCUboot defaults
9+
* (nrf5340_cpuapp_partition.dtsi): each slot is 0x74000 (464 KB).
10+
* Secure: 192 KB, Non-secure: 272 KB.
11+
*/
12+
13+
/delete-node/ &slot0_partition;
14+
/delete-node/ &slot1_partition;
15+
16+
&flash0 {
17+
partitions {
18+
slot0_partition: partition@10000 {
19+
compatible = "fixed-subpartitions";
20+
label = "image-0";
21+
reg = <0x10000 0x74000>;
22+
ranges = <0x0 0x10000 0x74000>;
23+
#address-cells = <1>;
24+
#size-cells = <1>;
25+
26+
slot0_s_partition: partition@0 {
27+
label = "image-0-secure";
28+
reg = <0x0 0x30000>;
29+
};
30+
31+
slot0_ns_partition: partition@30000 {
32+
label = "image-0-nonsecure";
33+
reg = <0x30000 0x44000>;
34+
};
35+
};
36+
37+
slot1_partition: partition@84000 {
38+
compatible = "fixed-subpartitions";
39+
label = "image-1";
40+
reg = <0x84000 0x74000>;
41+
ranges = <0x0 0x84000 0x74000>;
42+
#address-cells = <1>;
43+
#size-cells = <1>;
44+
45+
slot1_s_partition: partition@0 {
46+
label = "image-1-secure";
47+
reg = <0x0 0x30000>;
48+
};
49+
50+
slot1_ns_partition: partition@30000 {
51+
label = "image-1-nonsecure";
52+
reg = <0x30000 0x44000>;
53+
};
54+
};
55+
};
56+
};

samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l10_cpuapp.overlay renamed to samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l10_cpuapp_dfu.overlay

File renamed without changes.

samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l15_cpuapp.overlay renamed to samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l15_cpuapp_dfu.overlay

File renamed without changes.

samples/bluetooth/mesh/light/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay renamed to samples/bluetooth/mesh/light/boards/nrf54lm20dk_nrf54lm20a_cpuapp_dfu.overlay

File renamed without changes.

samples/bluetooth/mesh/light/overlay-dfu.conf

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#
2+
# Copyright (c) 2026 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_NCS_SAMPLES_DEFAULTS=y
7+
8+
# Deferred logging helps improve LPN power consumption
9+
# when friendship is established.
10+
CONFIG_LOG_MODE_DEFERRED=y
11+
12+
# General configuration
13+
CONFIG_NCS_APPLICATION_BOOT_BANNER_STRING="Mesh Light"
14+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=3072
15+
CONFIG_FLASH=y
16+
CONFIG_FLASH_MAP=y
17+
CONFIG_NVS=y
18+
CONFIG_SETTINGS=y
19+
CONFIG_NVS_LOOKUP_CACHE=y
20+
CONFIG_SETTINGS_NVS_NAME_CACHE=y
21+
CONFIG_HWINFO=y
22+
CONFIG_DK_LIBRARY=y
23+
CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE=y
24+
25+
# Bluetooth configuration
26+
CONFIG_BT=y
27+
CONFIG_BT_DEVICE_NAME="Mesh Light"
28+
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
29+
30+
CONFIG_BT_OBSERVER=y
31+
CONFIG_BT_PERIPHERAL=y
32+
CONFIG_BT_SETTINGS=y
33+
# Increase RX stack size to avoid overflow during provisioning
34+
CONFIG_BT_RX_STACK_SIZE=2700
35+
36+
# Disable unused Bluetooth features
37+
CONFIG_BT_CTLR_LE_ENC=n
38+
CONFIG_BT_PHY_UPDATE=n
39+
CONFIG_BT_CTLR_CHAN_SEL_2=n
40+
CONFIG_BT_CTLR_MIN_USED_CHAN=n
41+
CONFIG_BT_CTLR_PRIVACY=n
42+
43+
# Bluetooth Mesh configuration
44+
CONFIG_BT_MESH=y
45+
CONFIG_BT_MESH_RELAY=y
46+
CONFIG_BT_MESH_FRIEND=y
47+
CONFIG_BT_MESH_TX_SEG_MAX=10
48+
CONFIG_BT_MESH_PB_GATT=y
49+
CONFIG_BT_MESH_GATT_PROXY=y
50+
CONFIG_BT_MESH_PROXY_USE_DEVICE_NAME=y
51+
CONFIG_BT_MESH_DK_PROV=y
52+
53+
# Bluetooth Mesh models
54+
CONFIG_BT_MESH_ONOFF_SRV=y
55+
56+
# === BLE DFU configuration ===
57+
# Enable point to point DFU over SMP
58+
CONFIG_BOOTLOADER_MCUBOOT=y
59+
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
60+
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y
61+
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=3072
62+
# Enable Extended Advertiser to advertise BT SMP service
63+
CONFIG_BT_EXT_ADV=y
64+
CONFIG_BT_EXT_ADV_MAX_ADV_SET=6
65+
66+
# One extra connection for mesh GATT/proxy and one for SMP BT.
67+
CONFIG_BT_MAX_CONN=3
68+
69+
# One extra identity for SMP service
70+
CONFIG_BT_ID_MAX=2
71+
72+
# Increase the HCI command buffers to 3 for additional SMP service
73+
CONFIG_BT_BUF_CMD_TX_COUNT=3
74+
75+
# Enable MCUmgr command hooks for doing mesh reset when doing dfu upgrade and storage erase
76+
CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
77+
CONFIG_MCUMGR_SMP_COMMAND_STATUS_HOOKS=y
78+
CONFIG_MCUMGR_GRP_OS_RESET_HOOK=y
79+
80+
# Force disconnect after PB-GATT provisioning for proper Proxy transition after DFU
81+
CONFIG_BT_MESH_DK_PROV_PB_GATT_DISCONNECT=y

samples/bluetooth/mesh/light/sample.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ tests:
4040
- nrf54lm20dk/nrf54lm20a/cpuapp
4141
- nrf5340dk/nrf5340/cpuapp
4242
- nrf5340dk/nrf5340/cpuapp/ns
43-
extra_args:
44-
- EXTRA_CONF_FILE=overlay-dfu.conf
45-
- SB_CONF_FILE=sysbuild-dfu.conf
43+
extra_args: FILE_SUFFIX=dfu
4644
sample.bluetooth.mesh.light.settings_ext_flash:
4745
sysbuild: true
4846
build_only: true

samples/bluetooth/mesh/light/sysbuild/ipc_radio/overlay-dfu.conf

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)