MCUXpresso SDK Documentation

RW61x - OTA update by using SB3 file#

In this walkthrough, the device lifecycle is not changed where possible (for development purposes), so that the device can be restored to its initial state. In real-world scenarios, transitioning the chip to the appropriate lifecycle depends on the specific requirements.

Common information related to SB3 is available in the documentation ‘OTA update by using SB3 file’.

1. Provision the device#

The device must be provisioned to support SB3 processing. To simplify the workflow, the MCUXpresso Secure Provisioning Tool (SEC tool) is used.

To provision the device perform the following steps:

  1. Erase the device

  2. Build the mcuboot_opensource + ota_mcuboot_basic or the ota_rom_basic project, depending on what you want to evaluate

  3. Get the device into ISP mode

    • On development boards this is typically done by holding the ISP button and pressing the reset button

  4. Open the SEC tool and create a new workspace for the RW61x target device

    • Test the ISP connection in the SEC tool

  5. Switch to PKI management tab

    • Click Generate keys (leave default settings)

Image

RW61x does not properly support shadow registers to process SB3 files for development purposes, so the correct RKTH and CUST_MK_SK have to be provisioned. To provision these keys while keeping the device in the Develop lifecycle, we initially use the Encrypted (IPED) Plain boot type as a workaround. This initial operation provisions the device with RKTH and CUST_MK_SK permanently, but the board remains usable for development purposes, as OTP BOOT_CFG0 (fuseword 15) remains intact.

Note: the user is advised to save the SEC tool workspace (or at least the keys) for future use.

  1. Build Image

    • Boot: Encrypted (IPED) Plain

    • Select ota_rom_basic or mcuboot_opensource output binary or ELF image as Source executable image

    • Lifecycle: Develop, OTP

    • Select an authentication key and generate CUST_MK_SK and OEM SB seed

    • Click Build image

Image

  1. Write image

    • Click Write image

Image

Now the device is provisioned with RKTH and CUST_MK_SK without transitioning the lifecycle.

  1. Enable dual image support

Note: This is needed only for ROM bootloader use case, otherwise skip this step

The correct image offset and size have to be programmed into OTP fuseword 17 (BOOT_CFG2). In this example we use these values:

  • FLEXSPI_IMAGE_SIZE = 0x0 (The size of the boot image is considered to be equal to the offset of the second image)

  • FLEXSPI_IMAGE_OFFSET = 0x10

Fuse the OTP using blhost: blhost -p COM3,115200 -- efuse-program-once 17 00008000

Note: We set a 4MB offset here, but the final value is up to the user as this operation is also permanent. The device will still be usable for development purposes, as ROM evaluates only the valid image header of a signed image and looks for image version presence.

  1. Erase device

This will erase encrypted image from the workaround.

  1. Load MCUboot (only MCUboot use case)

Load the unencrypted, unsigned mcuboot_opensource to the device using a programmer, as usual.

2. Prepare OTA images#

2.1 ROM bootloader only use case#

  1. Build Image tab

    • Boot: Plain Signed

    • Select ota_rom_basic output binary or ELF image as Source executable image

    • Define Image version 1

    • Enable Dual image boot with these parameters:

      • Target dual boot image: Image 0

      • Image 1 offset: 0x00400000

      • Image 1 size: Same as offset

    • Click Build image

Image

  1. Rename the generated SB3 file bootable_images/ota_rom_basic.sb to ota_rom_image0.sb

  2. Repeat step 1 with these changes:

    • Define Image version 2

    • In Dual image boot:

      • Target dual boot image: Image 1

    • Click Build image

  3. Rename the generated SB3 file bootable_images/ota_rom_basic.sb to ota_rom_image1.sb

Note: Do not write the image using the Write image tab! This would also fuse BOOT_CFG0 to enable secure boot. The initial SB3 file will be written separately in the next chapter.

2.2 MCUboot bootloader use case#

  1. Build ota_mcuboot_basic and sign the image with imgtool as usual, following the steps in the example_board_readme.md for your board. Copy the signed binary to your $sec_tool_workspace/source_images.

  2. Look into the ota_examples/_common/sb3_templates directory and copy the SB3 configuration templates for your device to your $sec_tool_workspace/configs.

    • rw612_sb3_cfg_primary_slot.yaml for the primary slot

    • rw612_sb3_cfg_secondary_slot.yaml for the secondary slot

  3. In the SEC tool, open Tools/SB Editor and click Import to import sb3_config_rw612_secondary_slot.yaml.

    • Check and, if necessary, fix the paths to the keys and the image binary.

    • Click Generate.

Image Image

  1. Repeat step 3 for sb3_config_rw612_primary_slot.yaml.

Note: Optionally, an initial SB3 file containing the initial (first) ota_mcuboot_basic application for the primary or secondary slot can be created to simulate the manufacturing process. This image has to be generated with the additional --pad --confirm imgtool arguments. The initial signed image can also be loaded directly using ISP (via blhost and the receive-sb-file command) or another preferred method, as usual.

Note 2: Do not write the image using the Write image tab! This would also fuse BOOT_CFG0 to enable secure boot. The initial SB3 file will be written separately in the next chapter.

3. Firmware update#

For demonstration purposes we use the ExtraPutty tool, as this fork of the classic PuTTY has XMODEM support. Alternatively, TeraTerm can be used.

3.1 ROM bootloader only use case#

  1. Load and run the initial ota_rom_basic application in one of these ways:

    • load signed image via blhost commands:

      • blhost -p COM3,115200 -- fill-memory 0x20001000 0x4 0xC0000004

      • blhost -p COM3,115200 -- configure-memory 0x9 0x20001000

      • blhost -p COM3,115200 -t 20000 receive-sb-file ota_rom_basic_image_0_v1

    or

    • load the unsigned application via a debug session - in this case the image command returns invalid information, as there is no valid image header to parse

  2. Check the image state and the active flag location with the image command

    • Use the active flag location to determine the inactive image slot

  3. Send the OTA image

    • Run the xmodem_sb3 command

    • Send ota_rom_image1.sb, targeting the inactive slot, via Files Transfer/Xmodem (1k)

  4. Reboot the device with reboot command

  5. Check image update with image command

Here is an example of serial output:


*************************************
* Basic ROM application example     *
*************************************

$ image
Flash REMAP_OVERLAY disabled
IMAGE 0:
    <IMG_VERSION 0x1 LENGTH 34884 EXEC_ADDR 0x8001000>
    *ACTIVE*
IMAGE 1: Invalid image header
$ xmodem_sb3
IAP API version=1.0.0
Started xmodem processing SB3
Initiated XMODEM-CRC transfer. Receiving... (Press 'x' to cancel)
CCCCCCC
Received 41984 bytes
SB3 has been processed
$
$ reboot
System reset!

*************************************
* Basic ROM application example     *
*************************************

$ image
Flash REMAP_OVERLAY active
IMAGE 0:
    <IMG_VERSION 0x1 LENGTH 34884 EXEC_ADDR 0x8001000>
IMAGE 1:
    <IMG_VERSION 0x2 LENGTH 34884 EXEC_ADDR 0x8001000>
    *ACTIVE*
$

3.2 MCUboot bootloader use case#

  1. Load mcuboot_opensource and run the initial ota_mcuboot_basic application in one of these ways:

    • load signed image via blhost commands:

      • blhost -p COM3,115200 -- fill-memory 0x20001000 0x4 0xC0000004

      • blhost -p COM3,115200 -- configure-memory 0x9 0x20001000

      • blhost -p COM3,115200 -t 20000 receive-sb-file signed_padded_ota_mcuboot_basic_primary_slot.sb

    or

    • load the unsigned application via a debug session - in this case the image command returns invalid information, as there is no valid image header to parse

  2. Check the image state and the active flag location with the image command

    • Use the active flag location to determine the inactive image slot

  3. Erase the inactive slot with the image erase command

    • Note: not needed if the SB file contains the erase command

  4. Send the OTA image

    • Run the xmodem_sb3 command

    • Send ota_mcuboot_secondary_slot.sb, targeting the inactive slot, via Files Transfer/Xmodem (1k)

  5. Mark the installed image ready for test

    • Run the image test command

  6. Reboot the device with the reboot command

  7. Check the image update with the image command

  8. Mark the updated slot with the confirm flag using image accept, and check the state again with the image command

hello sbl.
Bootloader Version 2.2.0
Primary   slot: version=1.0.0+1000
Image 0 Secondary slot: Image not found
Image 0 loaded from the primary slot
Bootloader chainload address offset: 0x40000
Reset_Handler address offset: 0x40400
Jumping to the image


Booting the primary slot - flash remapping is disabled

*************************************
* Basic MCUBoot application example *
*************************************

Built Oct  3 2025 20:33:10
Toolchain IAR ANSI C/C++ Compiler V9.70.1.475/W64 for ARM

$ image
Image 0; name APP; state None:

  Slot 0 APP_PRIMARY; offset 0x40000; size 0x200000 (2097152):
    <IMAGE: size 42421; version 1.0.0+1000>
    SHA256 of image payload: E069B6127A708EE88B39...
    log_addr 0x28040000
    *ACTIVE*

  Slot 1 APP_SECONDARY; offset 0x240000; size 0x200000 (2097152):
    <No Image Found>

$ image erase
Erasing inactive slot...done
$ xmodem_sb3
Started xmodem processing SB3
Make sure this device is provisioned to accept secure binary and its load address is 0x240000
Initiated XMODEM-CRC transfer. Receiving... (Press 'x' to cancel)
CCCCC
Received 51200 bytes
SB3 has been processed
$
$ image test
write magic number offset = 0x43ff00
$ reboot
System reset!
hello sbl.
Bootloader Version 2.2.0
Primary   slot: version=1.0.0+1000
Secondary slot: version=1.2.0+1000
writing copy_done; fa_id=1 off=0x1fffe0 (0x43ffe0)
Image 0 loaded from the secondary slot
Bootloader chainload address offset: 0x240000
Reset_Handler address offset: 0x240400
Jumping to the image


Booting the secondary slot - flash remapping is enabled

*************************************
* Basic MCUBoot application example *
*************************************

Built Oct  3 2025 20:33:10
Toolchain IAR ANSI C/C++ Compiler V9.70.1.475/W64 for ARM

$ image
Flash REMAP_OVERLAY active.

Image 0; name APP; state Testing:

  Slot 0 APP_PRIMARY; offset 0x40000; size 0x200000 (2097152):
    <IMAGE: size 42421; version 1.0.0+1000>
    SHA256 of image payload: E069B6127A708EE88B39...
    log_addr 0x28040000 remaps to 0x28240000

  Slot 1 APP_SECONDARY; offset 0x240000; size 0x200000 (2097152):
    <IMAGE: size 42421; version 1.2.0+1000>
    SHA256 of image payload: E069B6127A708EE88B39...
    log_addr 0x28240000 remaps to 0x28240000
    *ACTIVE*

$ image accept
$ image
Flash REMAP_OVERLAY active.

Image 0; name APP; state Permanent:

  Slot 0 APP_PRIMARY; offset 0x40000; size 0x200000 (2097152):
    <IMAGE: size 42421; version 1.0.0+1000>
    SHA256 of image payload: E069B6127A708EE88B39...
    log_addr 0x28040000 remaps to 0x28240000

  Slot 1 APP_SECONDARY; offset 0x240000; size 0x200000 (2097152):
    <IMAGE: size 42421; version 1.2.0+1000>
    SHA256 of image payload: E069B6127A708EE88B39...
    log_addr 0x28240000 remaps to 0x28240000
    *ACTIVE*

$

Supported Boards#