Skip to content

Commit f0c481b

Browse files
alxelaxanangl
authored andcommitted
samples: bluetooth: mesh: add external flash for dfu distributor
Commit adds ability to use the external flash as the secondary partition to store image and then distribute it as well as update distributor by self. External flash is supported only for nrf52840 DK. Signed-off-by: Aleksandr Khromykh <[email protected]>
1 parent 8f32baa commit f0c481b

File tree

7 files changed

+86
-0
lines changed

7 files changed

+86
-0
lines changed

samples/bluetooth/mesh/dfu/distributor/README.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,25 @@ In this sample, the UART console is occupied by the shell module.
237237
Therefore, it uses SEGGER RTT as a logging backend.
238238
For the convenience, ``printk`` is also duplicated to SEGGER RTT.
239239

240+
External flash support
241+
======================
242+
243+
This sample supports external flash memory as secondary storage partition for saving of the firmware images, both as for self update as well as for distribution.
244+
See :ref:`ug_bootloader_external_flash` for more information on external flash support as a partition in the :ref:`ug_bootloader_mcuboot_nsib`.
245+
The default configuration does not support external flash memory.
246+
To enable external flash support, set :makevar:`FILE_SUFFIX` to ``ext_flash`` when building the sample.
247+
248+
Build the sample using the following command:
249+
250+
.. code-block:: console
251+
252+
west build -p -b *board_name* -- -DFILE_SUFFIX=ext_flash
253+
254+
.. note::
255+
The external flash is not erased during the internal flash erasing procedure.
256+
See `nRF Util`_ for more information on how to erase the external flash.
257+
Currently, only the external flash on the ``nrf52840dk/nrf52840`` board is supported at the moment.
258+
240259
Dependencies
241260
************
242261

samples/bluetooth/mesh/dfu/distributor/sample.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,15 @@ tests:
3232
- bluetooth
3333
- ci_build
3434
- sysbuild
35+
sample.bluetooth.mesh_dfu_distributor.ext_flash:
36+
sysbuild: true
37+
build_only: true
38+
integration_platforms:
39+
- nrf52840dk/nrf52840
40+
platform_allow:
41+
- nrf52840dk/nrf52840
42+
extra_args: FILE_SUFFIX=ext_flash
43+
tags:
44+
- bluetooth
45+
- ci_build
46+
- sysbuild
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Copyright (c) 2025 Nordic Semiconductor ASA
2+
*
3+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
4+
*/
5+
6+
/ {
7+
chosen {
8+
nordic,pm-ext-flash = &mx25r64;
9+
};
10+
};

samples/bluetooth/mesh/dfu/distributor/sysbuild/mcuboot.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
################################################################################
17
# RTT is used for interacting with the distributor over shell. Having it enabled in mcuboot will
28
# require a user to manually provide correct _SEGGER_RTT address otherwise RTT Viewer will pick
39
# wrong buffer and shell will not work.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
################################################################################
7+
# RTT is used for interacting with the distributor over shell.
8+
# Having it enabled in mcuboot will require a user to manually provide correct _SEGGER_RTT address.
9+
# Otherwise RTT Viewer will pick wrong buffer and shell will not work.
10+
CONFIG_USE_SEGGER_RTT=n
11+
12+
CONFIG_NORDIC_QSPI_NOR=y
13+
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
14+
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16
15+
16+
# Maximum number of sectors that image can have
17+
CONFIG_BOOT_MAX_IMG_SECTORS=256
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* Copyright (c) 2025 Nordic Semiconductor ASA
2+
*
3+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
4+
*/
5+
6+
/ {
7+
chosen {
8+
zephyr,code-partition = &boot_partition;
9+
nordic,pm-ext-flash = &mx25r64;
10+
};
11+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
SB_CONFIG_BOOTLOADER_MCUBOOT=y
8+
SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
9+
SB_CONFIG_DFU_ZIP=y
10+
SB_CONFIG_DFU_ZIP_BLUETOOTH_MESH_METADATA=y
11+
SB_CONFIG_DFU_ZIP_BLUETOOTH_MESH_METADATA_FWID_MCUBOOT_VERSION=y

0 commit comments

Comments
 (0)