<feed xmlns='http://www.w3.org/2005/Atom'>
<title>imxrt-rt/src/target.rs, branch main</title>
<subtitle>Runtime support for i.MX RT MCUs
</subtitle>
<id>https://git.mciantyre.dev/imxrt-rs/imxrt-rt/atom?h=main</id>
<link rel='self' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/'/>
<updated>2026-11-22T15:47:30Z</updated>
<entry>
<title>Prototype secondary core support</title>
<updated>2026-11-22T15:47:30Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2026-11-21T18:39:55Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=ea60b60f3ff579cd175abecde49d2d9397420dc0'/>
<id>urn:sha1:ea60b60f3ff579cd175abecde49d2d9397420dc0</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Zero unallocated memory, too</title>
<updated>2026-11-07T15:20:33Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2026-10-26T14:52:57Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=1087e9bb7cd31e6fd88532ead08a927168e36de7'/>
<id>urn:sha1:1087e9bb7cd31e6fd88532ead08a927168e36de7</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Preload RAM sections, maybe, if ECC RAM is active</title>
<updated>2026-10-27T15:35:22Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2026-10-24T11:30:47Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=428ea28a9102d966eda5b9c39644ff66c5f59c59'/>
<id>urn:sha1:428ea28a9102d966eda5b9c39644ff66c5f59c59</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Align all sections to 8 bytes minimum</title>
<updated>2026-10-27T15:18:02Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2026-10-24T10:38:12Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=5ad4b42b4bd810eecf47d3a13853658ffb263a16'/>
<id>urn:sha1:5ad4b42b4bd810eecf47d3a13853658ffb263a16</id>
<content type='text'>
8 byte alignment means we can perform per-section ECC RAM preloading,
usually requiring 64-bit accesses.
</content>
</entry>
<entry>
<title>Preload RAM for ECC ciphers</title>
<updated>2026-03-08T18:14:31Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2026-02-11T21:29:27Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=a9bb416c822d20c1b94fb7b2bfab282d25e11125'/>
<id>urn:sha1:a9bb416c822d20c1b94fb7b2bfab282d25e11125</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>Use a macro for assembly copy loops</title>
<updated>2025-09-16T11:48:07Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2025-06-14T15:23:18Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=aed7296b291c6430e24e6bd4c787cd724830d956'/>
<id>urn:sha1:aed7296b291c6430e24e6bd4c787cd724830d956</id>
<content type='text'>
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&gt; /dev/null 1&gt;/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
</content>
</entry>
<entry>
<title>Hexify the family ID</title>
<updated>2025-09-16T11:48:07Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2025-06-14T14:46:32Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=b91a6a6f11e014f96c91e5a67bef805349de7b43'/>
<id>urn:sha1:b91a6a6f11e014f96c91e5a67bef805349de7b43</id>
<content type='text'>
Makes it a little easier for me to manually inspect binaries and figure
out their targets.
</content>
</entry>
<entry>
<title>Remove __pre_init inner jump labels</title>
<updated>2025-09-16T11:48:07Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2025-06-14T14:36:26Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=ed806ce952cda7400405dbc2a0b83baa7e7824fd'/>
<id>urn:sha1:ed806ce952cda7400405dbc2a0b83baa7e7824fd</id>
<content type='text'>
Local numbered labels won't appear in the ELF file. This makes debugging
a little easier.
</content>
</entry>
<entry>
<title>Catch target-host version mismatch</title>
<updated>2025-09-16T11:48:07Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2025-06-14T14:27:32Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=e244012738c0d431ff6c791325f2d3f9a3dfdeb0'/>
<id>urn:sha1:e244012738c0d431ff6c791325f2d3f9a3dfdeb0</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Adopt Rust 2024 edition</title>
<updated>2025-09-16T11:47:23Z</updated>
<author>
<name>Ian McIntyre</name>
<email>me@mciantyre.dev</email>
</author>
<published>2025-06-14T14:16:12Z</published>
<link rel='alternate' type='text/html' href='https://git.mciantyre.dev/imxrt-rs/imxrt-rt/commit/?id=9728ac5305cfe259115858f0bc49985a0ad7cec4'/>
<id>urn:sha1:9728ac5305cfe259115858f0bc49985a0ad7cec4</id>
<content type='text'>
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.
</content>
</entry>
</feed>
