Skip to content

i.MX RT: wolfBoot runs with the L1 caches off, image verification is about 20 s slower than it needs to be #990

Open

Description

@elyorbek010

Summary

The i.MX RT HAL (hal/imx_rt.c) does not enable the Cortex-M7 instruction and data caches. The boot ROM leaves both off, so wolfBoot hashes and verifies the image from memory-mapped flash without caches. With software SHA-384 and ECC-384 on a 2.5 MB image this dominates the boot time.

What we measured

Board with an i.MX RT1040 family part, XIP from a QSPI NOR flash, wolfBoot v2.8.0 built with TARGET=imx_rt, SIGN=ECC384, HASH=SHA384, the DCP not used for these algorithms, application image about 2.5 MB. Time from reset until the application answers on the network, three runs each on the same board and application:

wolfBoot build reset to application answering
as in v2.8.0 27.9 s, 33.4 s, 35.7 s
caches enabled in wolfBoot 10.8 s, 16.5 s, 11.1 s

That is about 20 s less per boot. The application part of the boot is the same in both rows, the difference is the time spent in wolfBoot.

I read hal/imx_rt.c on master (254cfa5): hal_init() still does not enable the caches and hal_prepare_boot() is empty, so I expect the same on master, but I have only run v2.8.0.

What we changed locally

In hal_init(), after the clock setup, we enable the instruction cache and the data cache. In hal_prepare_boot() we disable both again, which also cleans the data cache and drops the instruction cache contents, so the application starts in the state the boot ROM would have left. The flash write and erase functions of the HAL already invalidate the data cache for the range they touch, and we did not have to change them.

With this change we have run swap updates, a rollback of an image that does not confirm itself, and normal boots on our board. We have not tried it with the DCP in use, with encrypted partitions, or on other i.MX RT parts. The example configurations pass DCP_USE_DCACHE=0, and I do not know whether that needs attention when the data cache is on.

Request

Could the i.MX RT HAL enable the L1 caches while wolfBoot runs and hand over to the application with them off, either always or behind a build option?

Activity

  1. self-assigned this
    on Nov 16, 2026
  2. dgarske commented on Nov 16, 2026

    @dgarske
    Member

    Hi @elyorbek010 , thank you for your reports. I'll look into these later this week on actual hardware. Can you tell me more about your project and use of wolfSSL libraries? If you'd like to reach out directly email support at wolfssl dot com.
    Thanks, David Garske, wolfSSL

  3. elyorbek010 commented on Nov 17, 2026

    @elyorbek010
    Author

    Hi @elyorbek010 , thank you for your reports. I'll look into these later this week on actual hardware. Can you tell me more about your project and use of wolfSSL libraries? If you'd like to reach out directly email support at wolfssl dot com. Thanks, David Garske, wolfSSL

    Thanks, David.

    I am reporting these as an individual and would like to keep it here on the tracker. I can't share details about the device itself, but I am glad to give any technical detail that helps you reproduce: it is an i.MX RT1040 series board with QSPI NOR flash, wolfBoot as the bootloader and a Zephyr application, and I found both while measuring where the time of a firmware update goes. The numbers in the two issues are from that board. If a log, a config or a test on my hardware would help, tell me what you need.

  4. elyorbek010 commented on Nov 17, 2026

    @elyorbek010
    Author

    If you are open to it, I can send pull requests for both, the changes run on my board. Tell me if you would rather do them yourselves

  5. dgarske commented on Nov 18, 2026

    @dgarske
    Member

    If you are open to it, I can send pull requests for both, the changes run on my board. Tell me if you would rather do them yourselves

    Hi @elyorbek010 , yes you are welcome to submit PR's for this as you have it working. We do need a signed contributor agreement. If you are willing to do that please email support at wolfssl dot com and reference your pull requests and we will get that process started.
    Thanks, David Garske, wolfSSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions