Skip to content

Commit 73fcf86

Browse files
ArekBalysNordicLuDuda
authored andcommitted
doc: Add dfu_target_suit to documentation.
Updated all pages related to the dfu_target library by adding information about SUIT-based dfu_target implementation. Updated release notes. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent 73d149a commit 73fcf86

File tree

6 files changed

+141
-34
lines changed

6 files changed

+141
-34
lines changed

doc/nrf/libraries/dfu/dfu_multi_image.rst

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,51 @@ To configure the maximum number of images that the DFU multi-image library is ab
2626
To enable building the DFU multi-image package that contains commonly used update images, such as the application core firmware, the network core firmware, or MCUboot images, set the ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_BUILD`` Kconfig option.
2727
The following options control which images are included:
2828

29-
+-------------------------------------------------------------------+---------------------------------------+
30-
| Kconfig | Description |
31-
+===================================================================+=======================================+
32-
| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_APP`` | Include application update. |
33-
+-------------------------------------------------------------------+---------------------------------------+
34-
| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_NET`` | Include network core image update. |
35-
+-------------------------------------------------------------------+---------------------------------------+
36-
| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_MCUBOOT`` | Include MCUboot update. |
37-
+-------------------------------------------------------------------+---------------------------------------+
38-
| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH`` | Include nRF700x WiFi firmware patches.|
39-
+-------------------------------------------------------------------+---------------------------------------+
29+
+-------------------------------------------------------------------+----------------------------------------+
30+
| Kconfig | Description |
31+
+===================================================================+========================================+
32+
| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_APP`` | Include application update. |
33+
+-------------------------------------------------------------------+----------------------------------------+
34+
| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_NET`` | Include network core image update. |
35+
+-------------------------------------------------------------------+----------------------------------------+
36+
| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_MCUBOOT`` | Include MCUboot update. |
37+
+-------------------------------------------------------------------+----------------------------------------+
38+
| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH`` | Include nRF700x Wi-Fi firmware patches.|
39+
+-------------------------------------------------------------------+----------------------------------------+
40+
| ``SB_CONFIG_SUIT_MULTI_IMAGE_PACKAGE_BUILD`` | Include SUIT envelope and cache images.|
41+
+-------------------------------------------------------------------+----------------------------------------+
42+
43+
.. _lib_dfu_multi_image_suit_multi_image_package:
44+
45+
SUIT multi-image package
46+
========================
47+
48+
The DFU multi-image library supports building a SUIT multi-image package that includes a SUIT envelope and cache images.
49+
The SUIT envelope is always included in the package as image 0, while SUIT cache images are included as subsequent images starting from the image 2.
50+
51+
The SUIT multi-image processing requires the SUIT system to support cache processing.
52+
To enable it, set one of the following Kconfig options to ``y``:
53+
54+
* :kconfig:option:`CONFIG_SUIT_DFU_CANDIDATE_PROCESSING_FULL`
55+
* :kconfig:option:`SUIT_DFU_CANDIDATE_PROCESSING_PUSH_TO_CACHE`
56+
57+
The build system merges all application images into a single :file:`dfu_cache_partition_1.bin` partition file and places its content into the multi-image image 2.
58+
This allows all application images to be stored in a single DFU multi-image, as they will be processed by SUIT.
59+
60+
The :kconfig:option:`SB_CONFIG_SUIT_MULTI_IMAGE_PACKAGE_BUILD` Kconfig option enables building the SUIT multi-image package.
61+
As a result, the multi-image package will contain:
62+
63+
* Image 0:
64+
- SUIT envelope that contains manifests only.
65+
66+
* Image 2:
67+
- Application core image.
68+
- Radio core image, if applicable.
69+
- Additional images, if applicable.
70+
71+
You can add more data to be processed by SUIT to the following images starting from image 3.
72+
This operation will require an additional binary file and the proper :file:`dfu_cache_partition_X` definition in a devicetree configuration file, where ``X`` is the image number minus 1.
73+
So for the image 3, you would need :file:`dfu_cache_partition_2`.
4074

4175
Dependencies
4276
************

doc/nrf/libraries/dfu/dfu_target.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The DFU target library supports the following types of firmware upgrades:
4848
* MCUboot-style upgrades
4949
* Modem delta upgrades
5050
* Full modem firmware upgrades
51+
* SUIT-style upgrades
5152

5253
MCUboot-style upgrades
5354
----------------------
@@ -103,6 +104,69 @@ This DFU target downloads the serialized modem firmware to an external flash mem
103104
Once the modem firmware has been downloaded, the application should use :ref:`lib_fmfu_fdev` to write the firmware to the modem.
104105
The DFU target library does not perform the upgrade and calling the :c:func:`dfu_target_schedule_update` function has no effect.
105106

107+
.. _lib_dfu_target_suit_style_update:
108+
109+
SUIT-style upgrades
110+
-------------------
111+
112+
SUIT-style firmware upgrades can be used for :ref:`ug_nrf54h20_suit_dfu`.
113+
Depending on the image number and the used SUIT system configuration, this type of DFU writes the data provided to the :c:func:`dfu_target_write` function into the following partitions:
114+
115+
* Image 0: ``dfu_partition``
116+
* Image 1: ``dfu_cache_partition_0`` - always located just after the ``dfu_partition`` partition.
117+
* Image 2..n: ``dfu_cache_partition_n`` - located in internal or external memory.
118+
119+
Before calling the :c:func:`dfu_target_init` and :c:func:`dfu_target_write` functions, the application must call the :c:func:`dfu_target_suit_set_buf` function to allocate the buffer used during the firmware update process.
120+
The buffer size must be at least the size of the largest chunk that will be downloaded at a single time.
121+
The buffer will be used for processing all images, so there is no need to allocate a new buffer for each image.
122+
123+
You can upgrade your device in several ways depending on your SUIT system configuration:
124+
125+
.. tabs::
126+
127+
.. tab:: SUIT single image processing
128+
129+
SUIT minimal processing is used for devices that do not have a cache partition.
130+
To enable it, set the :kconfig:option:`CONFIG_SUIT_DFU_CANDIDATE_PROCESSING_MINIMAL` Kconfig option to ``y``.
131+
132+
In this approach, the SUIT envelope contains the manifests and the firmware image.
133+
The SUIT envelope is stored in the ``dfu_partition`` partition.
134+
After that, the ``dfu_cache_partition_0`` partition will be created automatically just after the ``dfu_partition`` partition and will contain the firmware.
135+
136+
.. tab:: SUIT cache processing
137+
138+
The SUIT cache processing requires one of the following SUIT system configurations set to ``y``:
139+
140+
* :kconfig:option:`CONFIG_SUIT_DFU_CANDIDATE_PROCESSING_FULL`
141+
* :kconfig:option:`SUIT_DFU_CANDIDATE_PROCESSING_PUSH_TO_CACHE`
142+
143+
With one of these options set, the DFU target SUIT library can process the SUIT envelope and cache images.
144+
In this approach, the SUIT envelope contains the manifests only, while the firmware is stored in the cache images.
145+
146+
You can disable cache processing by setting the :kconfig:option:`DFU_TARGET_SUIT_CACHE_PROCESSING` Kconfig option to ``n``.
147+
148+
When this approach is used, the SUIT manifests will be stored in the ``dfu_partition`` partition.
149+
The firmware will be stored in the ``dfu_cache_partition_1`` partition.
150+
This approach can be used for devices that have defined the ``dfu_cache_partition_1`` partition in the internal or external flash memory.
151+
The :ref:`lib_dfu_multi_image_suit_multi_image_package` uses this approach for multi-image updates.
152+
153+
To read more about SUIT cache processing, see the :ref:`ug_nrf54h20_suit_external_memory` guide.
154+
155+
Make sure the application calls the :c:func:`dfu_target_init` function for image 0 first and then downloads the SUIT envelope.
156+
When the single image data transfer is completed, the application using the DFU target library must call the :c:func:`dfu_target_done` function for each subsequent image.
157+
After that, the application can call the :c:func:`dfu_target_init` function for another image index.
158+
159+
When all image data transfers are completed, the application using the DFU target library must do the following:
160+
161+
1. Call the :c:func:`dfu_target_schedule_update` function to inform SUIT that the manifests can be processed.
162+
2. Automatically reboot the device by calling :c:func:`dfu_target_suit_reboot` with a defined delay.
163+
You can set the delay before rebooting the device by configuring the :kconfig:option:`CONFIG_DFU_TARGET_SUIT_REBOOT_DELAY` Kconfig option.
164+
Alternatively, you can skip this step and reboot the device manually.
165+
166+
.. note::
167+
The application must schedule the upgrade of all images at once using the :c:func:`dfu_target_schedule_update` function.
168+
During this operation, the manifests stored in the ``dfu_partition`` partition will be processed.
169+
106170
Configuration
107171
*************
108172

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,10 @@ Debug libraries
710710
DFU libraries
711711
-------------
712712

713-
|no_changes_yet_note|
713+
* :ref:`lib_dfu_target` library:
714+
715+
* Updated the DFU Target SUIT implementation to the newest version of the SUIT.
716+
* Added SUIT cache processing to the DFU Target SUIT library, as described in the :ref:`lib_dfu_target_suit_style_update` section.
714717

715718
Gazell libraries
716719
----------------

include/dfu/dfu_target_suit.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ extern "C" {
2929
int dfu_target_suit_set_buf(uint8_t *buf, size_t len);
3030

3131
/**
32-
* @brief Initialize dfu target for specific image, perform steps necessary to receive firmware.
32+
* @brief Initialize the DFU target for the specific image and perform the necessary steps to
33+
* receive the firmware.
3334
*
3435
* If you call this function, you must call dfu_target_suit_done() to finalize the firmware upgrade
3536
* before initializing any other images.
@@ -38,7 +39,7 @@ int dfu_target_suit_set_buf(uint8_t *buf, size_t len);
3839
* @param[in] img_num Image index.
3940
* @param[in] cb Callback for signaling events(unused).
4041
*
41-
* @return 0 If successful
42+
* @return 0 If successful.
4243
* @return -ENODEV errno code if the buffer has not been initialized.
4344
* @return -ENXIO errno code if the partition dedicated for provided image is not found.
4445
* @return -ENOMEM errno code if the buffer is not large enough.
@@ -53,7 +54,7 @@ int dfu_target_suit_init(size_t file_size, int img_num, dfu_target_callback_t cb
5354
*
5455
* @param[out] offset Returns the offset of the firmware upgrade.
5556
*
56-
* @retval 0 if success, otherwise negative value if unable to get the offset
57+
* @retval 0 If success. Otherwise, a negative value if unable to get the offset.
5758
*/
5859
int dfu_target_suit_offset_get(size_t *offset);
5960

@@ -63,7 +64,7 @@ int dfu_target_suit_offset_get(size_t *offset);
6364
* @param[in] buf Pointer to data that should be written.
6465
* @param[in] len Length of data to write.
6566
*
66-
* @return 0 on success
67+
* @return 0 If successful.
6768
* @return -EFAULT errno code if the stream flash has not been initialized for any dfu image.
6869
* @return other negative errno code if the initialization failed.
6970
*/
@@ -79,7 +80,7 @@ int dfu_target_suit_write(const void *const buf, size_t len);
7980
int dfu_target_suit_done(bool successful);
8081

8182
/**
82-
* @brief Schedule an update
83+
* @brief Schedule an update.
8384
*
8485
* This call processes SUIT envelope and requests images update.
8586
*
@@ -89,8 +90,9 @@ int dfu_target_suit_done(bool successful);
8990
* @param[in] img_num Given image pair index or -1 for all
9091
* of image pair indexes.
9192
*
92-
* @retval 0 for a successful request or a negative error
93-
* code indicating reason of failure.
93+
* @retval 0 Successful request.
94+
* @retval negative_errno_code Negative error
95+
* code indicating the reason of failure.
9496
**/
9597
int dfu_target_suit_schedule_update(int img_num);
9698

@@ -99,17 +101,19 @@ int dfu_target_suit_schedule_update(int img_num);
99101
*
100102
* Cancels any ongoing updates.
101103
*
102-
* @retval 0 on success, negative errno otherwise.
104+
* @retval negative_errno_code Negative error
105+
* code indicating the reason of failure.
103106
*/
104107
int dfu_target_suit_reset(void);
105108

106109
/**
107-
* @brief Reboot the device, and apply new image.
110+
* @brief Reboot the device and apply the new image.
108111
*
109112
* The reboot can be delayed by setting the
110-
* CONFIG_DFU_TARGET_REBOOT_RESET_DELAY_MS kconfig value.
113+
* CONFIG_DFU_TARGET_REBOOT_RESET_DELAY_MS Kconfig option value to the desired delay value.
111114
*
112-
* @retval 0 on success, negative errno otherwise.
115+
* @retval negative_errno_code Negative error
116+
* code indicating the reason of failure.
113117
*/
114118
int dfu_target_suit_reboot(void);
115119

subsys/dfu/dfu_target/Kconfig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,20 @@ config DFU_TARGET_SUIT_CACHE_PROCESSING
135135
default y
136136
depends on SUIT_CACHE_RW
137137
help
138-
Enable SUIT cache processing to process images ids bigger than 0.
139-
It allows to store the image in the cache cache partitions and
140-
assign them to be processed by the SUIT.
138+
Enable SUIT cache processing to process images IDs higher than 0.
139+
This allows to store the image in the cache partitions and
140+
assign them to be processed by SUIT.
141141

142142
config DFU_TARGET_SUIT_INITIALIZE_SUIT
143-
bool "Initialize SUIT dfu library"
143+
bool "Initialize the SUIT DFU library"
144144
help
145-
Initialize SUIT library during the system startup.
145+
Initialize the SUIT library during the system startup.
146146

147147
config DFU_TARGET_REBOOT_RESET_DELAY_MS
148-
int "Reboot reset delay in milliseconds"
148+
int "Set reboot reset delay in milliseconds"
149149
default 0
150150
help
151-
Set the delay in milliseconds before the device is reset after a reboot
151+
Set the delay in milliseconds for resetting the device after a reboot
152152
function is called.
153153

154154
endif # DFU_TARGET_SUIT

tests/subsys/dfu/dfu_target/suit/src/common.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
void reset_fakes(void);
2525

2626
/**
27-
* @brief Check whether the partition is empty
27+
* @brief Check whether the partition is empty.
2828
*
29-
* @param address partition address to check
30-
* @param size partition size
31-
* @retval true if partition is empty, false otherwise
29+
* @param address Partition address to check.
30+
* @param size Partition size.
31+
*
32+
* @retval true If the partition is empty.
33+
* @retval false If the partition is not empty.
3234
*/
3335
bool is_partition_empty(void *address, size_t size);
3436

0 commit comments

Comments
 (0)