diff options
| author | Ian McIntyre <me@mciantyre.dev> | 2025-04-03 16:44:15 -0400 |
|---|---|---|
| committer | Ian McIntyre <me@mciantyre.dev> | 2026-03-08 10:59:30 -0400 |
| commit | a0dd354bdc299d7d089bd4ed143f6a213852a905 (patch) | |
| tree | 692aa05e756289d5c12638c558f959763615fbff /src/lib.rs | |
| parent | d3fdd76d504622c2e63a8d38b1306fa1abfc86de (diff) | |
Add section for boot ROM reservations
The boot ROM is allowed to use allocations of OCRAM as scratch space. If
you interact with the boot ROM -- using it to interact with FlexSPI, for
instance -- then you cannot also use these OCRAM regions. See the system
boot chapter in the reference manual for more info.
The boot ROM typically reserves the start of OCRAM. The size varies by
chip. This commit describes a new section, .bootrom_reservation, at the
start of OCRAM. Users are encouraged to place a MaybeUninit buffer
that's sized for your ROM's requirements.
If users don't place anything in this section, then the new directive is
a no-op. On the other hand, the section is defined before other RAM
regions, so that it takes precedence over other sections users might
want to place in OCRAM.
Tested using the runtime's test suite. I'm testing with the Teensy 4
binary, since the test suite can support features in this build. The
updated test suite shows that the linker will place the boot ROM
reservation before placing the stack, suggesting that we're respecting
section priority.
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -176,6 +176,28 @@ //! //! With this in place, your package should be able to use the `#[exception]` macro //! exported by `imxrt-rt`. See the `imxrt-rt` package examples for a demonstration. +//! +//! # Extras +//! +//! The runtime package has extra features to support i.MX RT programs. +//! +//! ## Reserving OCRAM for NXP's boot ROM +//! +//! If you're using NXP's boot ROM, you may need to reserve a region at the start of +//! OCRAM for API calls. You can achieve that by placing a buffer into `.bootrom_reservation`. +//! You're responsible for sizing this buffer depending chip's ROM. +//! +//! Here's an example of how to reserve the first 48KiB of OCRAM for the boot ROM. +//! The example assumes the boot ROM requires at most 48KiB. +//! +//! ``` +//! # use core::mem::MaybeUninit; +//! #[unsafe(link_section = ".bootrom_reservation")] +//! static ROM_RESERVATION: MaybeUninit<[u8; 48 * 1024]> = MaybeUninit::uninit(); +//! ``` +//! +//! Without this reservation, this program is allowed to use the lower addresses of +//! OCRAM without concern for the boot ROM. #![cfg_attr(all(target_arch = "arm", target_os = "none"), no_std)] |
