Repository navigation
imx_rt: enable the L1 caches while wolfBoot runs - #993
Closed
elyorbek010 wants to merge 1 commit into
Closed
elyorbek010 wants to merge 1 commit into
elyorbek010 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Default cache enablement affects flash-update coherency and application handoff across supported i.MX RT variants, but runtime evidence covers only RT1040 without DCP, leaving other variants and DCP-enabled builds needing maintainer confirmation or hardware validation.
No open issues 🎉
What changed in this PR
This PR addresses #990 by enabling Cortex-M7 L1 caches while wolfBoot runs on i.MX RT, reducing image-verification time while preserving a cache-disabled application handoff.
Changes:
- Enables instruction and data caches during wolfBoot initialization and disables them before application handoff.
- Keeps the data cache off for DCP builds or when
IMX_RT_NO_DCACHEis defined; application-only HAL builds remain unaffected. - Documents cache behavior and the data-cache opt-out.
| File | Description |
|---|---|
hal/imx_rt.c |
Adds guarded cache initialization and shutdown, with DCP and opt-out handling. |
docs/Targets.md |
Documents i.MX RT cache behavior and IMX_RT_NO_DCACHE. |
Review effort: Balanced
The boot ROM leaves the instruction and data caches of the Cortex-M7 off and hal_init() did not enable them, so the image hash and the signature verification ran from memory-mapped flash without caches. Enable both caches in hal_init() and disable them in hal_prepare_boot(), so the application starts with the caches off as before. The flash write and erase functions already invalidate the data cache for the range they touch. The data cache stays off when the DCP is used, because the DCP port of wolfCrypt does not support it, and when IMX_RT_NO_DCACHE is defined.
elyorbek010
force-pushed
the
imx-rt-l1-caches
branch
from
November 18, 2026 09:14
c9ffefd to
4476d98
Compare
Member
|
Okay to test. Contributor agreement in progress. ZD 22861 |
Member
|
Not approved as a contributor. Please consider opening a GitHub Issue to report this issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #990.
hal_init()now enables the instruction cache and the data cache, andhal_prepare_boot()disables both again, so the application still starts with the caches off, the state the boot ROM leaves.PKA=1):dcp_port.cin wolfCrypt refuses to build withDCP_USE_DCACHE=1, so its buffers would not be maintained. The instruction cache is still enabled in that case.IMX_RT_NO_DCACHEkeeps the data cache off in any build. It is described indocs/Targets.md.__WOLFBOOT), not when it is built into an application.Testing
Run on an i.MX RT1040 series board, XIP from QSPI NOR flash, with master (6d94df4) plus this branch,
SIGN=ECC384,HASH=SHA384, no DCP, application image about 2.5 MB. The board needs its own DCD and application entry offset on top, nothing else. Time from reset until the application answers on the network, three runs each, same application:With the caches on I also ran, on master together with the change of #989: two swap updates (boot partition byte-identical to the new image afterwards, state
IMG_STATE_SUCCESS) and a rollback of an image that does not confirm itself (stateIMG_STATE_TESTINGafter the update, previous image back after the next reset).Build only, no warnings:
config/examples/imx-rt1040.configwithPKA=0, withPKA=1and with-DIMX_RT_NO_DCACHE. Not tried on the RT1050, RT1060 and RT1064, which I do not have, and not run with the DCP in use.I have asked support for the contributor agreement and referenced this pull request.