MCUboot and flash remapping feature#
The default upgrade mechanism in MCUBoot is the SWAP-USING-MOVE algorithm. Several NXP processors support flash remapping functionality 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 operation. Multiple platforms support this mechanism, primarily those based on their external memory FlexSPI controller (e.g., RT1060, RW612). Platforms like 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 an 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 loads the image with the highest version, as there is no rollback support.
IMPORTANT NOTE: Signed application images directly programmed into flash memory by a programmer require an additional “–pad –confirm” parameter for imgtool. This parameter adds an additional trailer to the initial signed image and 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
Active region overlays inactive region
Inactive region is logically not accessible for read
For flash reads from overlayed region, users must manually use a peripheral driver of the memory device
OTA process has to download the OTA image into primary or secondary slot depending on the active flag location
Flash remap using SWAP
Active region swaps address range with inactive region
Both regions are logically accessible
OTA process always downloads the OTA image into secondary slot due to SWAP mechanism design (even if flash remap is active)
Supported Boards#
Flash remap using overlay
Flash remap using swap