MCUboot and flash remapping feature#
The default upgrade mechanism in MCUboot is the SWAP-USING-MOVE algorithm. Several NXP processors support a flash remapping feature that can be used to speed up the OTA update process and minimize flash wear. This flash remapping feature enables zero-copy image swapping without requiring any data-moving operations, resulting in the fastest possible update. Multiple platforms support this mechanism, primarily those based on the external-memory FlexSPI controller (e.g. RT1060, RW612). Platforms such as MCX N9 also implement this mechanism for their internal flash memory.
Development boards with these processors include example projects configured to use this feature. This is achieved by using MCUboot’s DIRECT-XIP mechanism and by activating flash remapping when the active flag is located in the secondary slot - the image is still built to run from the primary slot. Keep in mind that DIRECT-XIP mode boots the image with the highest version, as there is no rollback support.
IMPORTANT NOTE:
A signed application image programmed directly into flash memory by a programmer requires the additional --pad --confirm parameters for imgtool. These parameters add an extra trailer to the initial signed image, which is required by the bootloader’s DIRECT-XIP process. Signed images used in the OTA process do not require the --pad parameter.
Flash remap mechanisms in NXP devices#
There are currently two flash remapping mechanisms:
Flash remap using OVERLAY
The active region overlays the inactive region.
The inactive region is logically not accessible for reading.
To read flash from the overlaid region, the user must access it manually through a peripheral driver of the memory device.
The OTA process has to download the OTA image into the primary or the secondary slot, depending on the active flag location.
Flash remap using SWAP
The active region swaps its address range with the inactive region.
Both regions are logically accessible.
Due to the design of the SWAP mechanism, the OTA process always downloads the OTA image into the secondary slot (even when flash remap is active).
Supported Boards#
Flash remap using overlay
Flash remap using swap