aboutsummaryrefslogtreecommitdiff
path: root/src/target.rs
AgeCommit message (Collapse)Author
6 hoursPrototype secondary core supportHEADmainIan McIntyre
Haven't tested the included examples on hardware. It's just here so I can define an inspect_elf test. Out of tree, there's a basic example on an 1170EVK.
2026-11-07Zero unallocated memory, tooIan McIntyre
If the CPU speculates into the RAM we haven't initialized, we can fault when the ECC controller reports bad data. Didn't have that problem when blasting all of RAM... We can use the linker to help us figure out the range of these unused regions. If we don't need to zero anything, the host emits 0 for the start and end, skipping the zeroing. I'm also zeroing the 32 byte reservation at the start of ITCM, along with any padding introduced before the vector table. With this in place, the rip_through_ram firmware does not report any exceptions.
2026-10-27Preload RAM sections, maybe, if ECC RAM is activeIan McIntyre
Blasting all of RAM with zeros would wipe ourselves away if we were executing from RAM. It also wipes out the HAB event log, which seems to reside in the boot ROM reservation. We now zero individual memory regions. Similar to the copy loops, we'll skip the loop if the VMA and LMA are equal. It looks silly to zero things like bss when we know cortex-m's reset handler will do it; but, the usual loop doesn't use the 64 bit writes we'd need to preload ciphers in ITCM and OCRAM. Tested RAM loading with probe-rs, using an 1170EVK w/ ECC RAM active.
2026-10-27Align all sections to 8 bytes minimumIan McIntyre
8 byte alignment means we can perform per-section ECC RAM preloading, usually requiring 64-bit accesses.
2026-03-08Preload RAM for ECC ciphersIan McIntyre
Testing shows that we must blow fuses in order to activate either ECC engine. Once the fuse is blown, NXP's boot ROM will enable the ECC engine. So by the time the reset handler is running, ECC may already be enabled. The 32-bit copy loops won't work for initializing ITCM and OCRAM. Since these bus widths are 64-bit and the ECC is computed over 64 bits, these 32 bit accesses result in a read-modify-write (RMW) on the underlying interface. If these RAM regions aren't already initialized, we'll fail an ECC check; the read in RMW compares bogus RAM contents against a bogus ECC. This seems to dramatically slow down initialization, or stall it (I've seen the CPU spinning in the boot ROM). If we listen to NXP and use 64-bit writes to preload ECC-protected RAM regions, the 32-bit copy loops will work as expected. Note that we can still issue 64-bit accesses towards DTCM; they're scattered across the two 32-bit interfaces. There's an NXP whitepaper [1] describing that. Once TCM ECC is enabled, we need to tell the TCM interfaces to RMW smaller accesses. Otherwise, we won't generate correct ciphers. We also might need to retry operations if there was a correction by the RAM controller. We can perform these with predicated instructions. Tested on an 1010EVK, where I used the debugger to show the control registers weren't touched; and tested on the 1170EVK, with the same approach showing the expected set bits. [1]: https://www.nxp.com/docs/en/white-paper/CORTEXM7WP.pdf [2]: https://www.nxp.com/docs/en/application-note/AN13204.pdf
2025-09-16Use a macro for assembly copy loopsIan McIntyre
Make it easier to write loops for other sections. Since the macro expands to the same instructions that we previously had, we can show that a binary is equivalent before and after this change. Let's use the binaries generated in this test suite. Before this change, run the bash script below. Re-run this script with this change, and show that the hashes for the binaries are the same. cargo clean cargo test inspect_elf -- --include-ignored --exact imxrt1010evk imxrt1170evk_cm7 imxrt1170evk_cm7_nonboot teensy4 teensy4_fake_dcd 2> /dev/null 1>/dev/null for test_binary in imxrt1010evk imxrt1170evk-cm7 imxrt1170evk-cm7-nonboot teensy4 __dcd; do cat target/${test_binary}/thumbv7em-none-eabihf/debug/examples/blink-rtic | sha256sum -; done
2025-09-16Hexify the family IDIan McIntyre
Makes it a little easier for me to manually inspect binaries and figure out their targets.
2025-09-16Remove __pre_init inner jump labelsIan McIntyre
Local numbered labels won't appear in the ELF file. This makes debugging a little easier.
2025-09-16Catch target-host version mismatchIan McIntyre
Attach the version information in a symbol that's generated by the host. Then, expect the same symbol exists in the embedded target. If the linker can't resolve this, then the host and target should be incompatible. I'm overloading the __imxrt_family symbol for this.
2025-09-16Adopt Rust 2024 editionIan McIntyre
I'm considering this a breaking change. I'll try to introduce new sections that rely on the user's `unsafe` keyword for linker placement. Rust 2024 has different opinions on format, and clippy has new thoughts. Let's adopt them.
2025-02-08Add imxrt1160 target supportIan McIntyre
Implemented by following the reference manual, and tested on an MIMXRT1160EVK. The target adopts all of the same limitations as the 1170 target.
2024-10-18Address warnings introduced in 1.82Ian McIntyre
2024-10-17Support RT1180 familyNils Fitinghoff
The 1180 family uses a different boot header than previous families. The header is generated to support the default configuration where hash and signature errors are ignored. The XIP `__pre_init` strategy is still used, more for ease of getting something running than because of any known problems with the boot ROM's implementation of loading images to different memories. The boot ROM for the 1180 does not appear to allow the entry point to lie outside the (loaded or execute-in-place) image, so a new `.xip` section is added after the vector table to put the address inside the image while keeping VMA=LMA. This could cause problems for tools that manipulate binaries based on section names.
2022-12-01Update to cmrt 0.7.2, and use new featuresIan McIntyre
No need for us to set VTOR and the stack pointer anymore.
2022-12-01First commitIan McIntyre