You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/dfu/ab/README.rst
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,67 @@ The sample supports the following MCUmgr transports by default:
42
42
* Bluetooth
43
43
* Serial (UART)
44
44
45
+
A/B functionality
46
+
=================
47
+
48
+
When the A/B functionality is used, the device has two slots for the application: slot A and slot B.
49
+
The slots are equivalent, and the device can boot from either of them.
50
+
In case of MCUBoot this is achieved by using the Direct XIP feature.
51
+
Thus, note that the terms slot 0/primary slot/slot A and slot 1/secondary slot/slot B are used interchangeably in the documentation.
52
+
This configuration allows for performing a background update of the non-active slot while the application runs from the active slot.
53
+
After the update is complete, the device can quickly switch to the updated slot on the next reboot.
54
+
55
+
The following conditions decide which slot will be booted (active) on the next reboot:
56
+
57
+
1. If one of the slots is not valid the other slot is selected as active.
58
+
2. If both slots are valid, the slot marked as "preferred" is selected as active.
59
+
3. If both slots are valid and none is marked as "preferred", the slot with the higher version number is selected as active.
60
+
4. If none of the above conditions is met, slot A is selected as active.
61
+
62
+
Setting the preffered slot can be done using the ``boot_request_set_preferred_slot`` function.
63
+
Currently, this only allows for setting the boot preference for a single reboot.
64
+
65
+
Getting the currently running slot
66
+
----------------------------------
67
+
68
+
If the project uses the Partition Manager, the currently running slot can be identified by checking if ``CONFIG_NCS_IS_VARIANT_IMAGE`` is defined.
69
+
If it is, the application is running from slot B.
70
+
Otherwise, it is running from slot A.
71
+
72
+
If the project does not use the Partition Manager (configuration currently only supported on nRF54H20), the currently running slot can be identified by comparing the address pointed `zephyr,code-partition` to specific node addresses defined in the device tree.
73
+
The following node partitions are used by default:
74
+
75
+
* ``slot0_partition`` - application core slot A
76
+
* ``slot1_partition`` - application core slot B
77
+
* ``cpurad_slot0_partition`` - radio core slot A
78
+
* ``cpurad_slot1_partition`` - radio core slot B
79
+
80
+
For example, verifying that the application is running from slot A can be done by using the following macro:
If building with nRF54H20, the merge slot feature is used when Direct XIP is enabled.
94
+
This means that for both slot A and slot B the application image and the radio image are merged and treated as a single image by MCUboot.
95
+
In this case the following files should be sent to the device when performing an update:
96
+
97
+
* :file:`build/zephyr/zephyr_secondary_app.merged.bin` contains slot B image, should be uploaded to the secondary slot when running from slot A.
98
+
* :file:`build/zephyr/zephyr.merged.bin` contains slot A image, should be uploaded to the primary slot when running from slot B.
99
+
100
+
If building on other supported platforms, where there is no separate radio core, only the application core is updated.
101
+
In this case the mcuboot files for the application image are used:
102
+
103
+
* :file:`build/mcuboot_secondary_app/zephyr/zephyr.signed.bin` contains slot B image, should be uploaded to the secondary slot when running from slot A.
104
+
* :file:`build/ab/zephyr/zephyr.signed.bin` contains slot A image, should be uploaded to the primary slot when running from slot B.
105
+
45
106
User interface
46
107
**************
47
108
@@ -106,6 +167,9 @@ To perform DFU using the `nRF Connect Device Manager`_ mobile app, complete the
0 commit comments