From 1087e9bb7cd31e6fd88532ead08a927168e36de7 Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Mon, 26 Oct 2026 10:52:57 -0400 Subject: Zero unallocated memory, too 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. --- src/host/imxrt-link.x | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/host/imxrt-link.x') diff --git a/src/host/imxrt-link.x b/src/host/imxrt-link.x index c04e3d4..48a792b 100644 --- a/src/host/imxrt-link.x +++ b/src/host/imxrt-link.x @@ -51,6 +51,13 @@ SECTIONS _stack_start = __sstack; } > REGION_STACK + .vector_table_pad (NOLOAD) : ALIGN(8) + { + __svector_table_pad = .; + . = ALIGN(1024); + __evector_table_pad = .; + } > REGION_VTABLE + .vector_table : ALIGN(1024) { FILL(0xff); @@ -170,6 +177,9 @@ SECTIONS ASSERT(__sstack % 8 == 0 && __estack % 8 == 0, " BUG(imxrt-rt): .stack is not 8-byte aligned"); +ASSERT(__svector_table_pad % 8 == 0 && __evector_table_pad % 8 == 0, " +BUG(imxrt-rt): .vector_table_pad is not 8-byte aligned"); + ASSERT(__stext % 8 == 0 && __etext % 8 == 0, " BUG(imxrt-rt): .text is not 8-byte aligned"); @@ -199,7 +209,9 @@ BUG(imxrt-rt): .heap is not 8-byte aligned"); /* # Position checks */ -/* ## .vector_table */ +ASSERT(__evector_table_pad == ADDR(.vector_table), " +BUG(imxrt-rt): .vector_table_pad does not end at the vector table"); + ASSERT(__reset_vector == ADDR(.vector_table) + 0x8, " BUG(imxrt-rt): the reset vector is missing"); -- cgit v1.2.3