doc/design: Add header for swap using scratch algorithm
Added sub-header for point where swap-using-scratch algorithm
is described.
Added note on the maximum image size allowed for this mode.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
diff --git a/docs/design.md b/docs/design.md
index b86c718..a8cc788 100755
--- a/docs/design.md
+++ b/docs/design.md
@@ -179,8 +179,11 @@
overwrite-based image upgrades, but must be configured at build time to choose
one of these two strategies.
-In addition to the slots of image areas, the bootloader requires a scratch
-area to allow for reliable image swapping. The scratch area must have a size
+### [Swap using scratch](#image-swap-using-scratch)
+
+When swap-using-scratch algorithm is used, in addition to the slots of
+image areas, the bootloader requires a scratch area to allow for reliable
+image swapping. The scratch area must have a size
that is enough to store at least the largest sector that is going to be swapped.
Many devices have small equally sized flash sectors, eg 4K, while others have
variable sized sectors where the largest sectors might be 128K or 256K, so the
@@ -220,6 +223,18 @@
manufacturer's specified number of erase cycles. In general, using a ratio that
allows hundreds to thousands of field upgrades in production is recommended.
+swap-using scratch algorithm assumes that the primary and the secondary image
+slot areas sizes are equal.
+The maximum image size available for the application
+will be:
+```
+maximum-image-size = image-slot-size - image-trailer-size
+```
+
+Where:
+ `image-slot-size` is the size of the image slot.
+ `image-trailer-sectors-size` is the size of the image trailer.
+
### [Swap without using scratch](#image-swap-no-scratch)
This algorithm is an alternative to the swap-using-scratch algorithm.