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/target.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/target.rs') diff --git a/src/target.rs b/src/target.rs index 95dc7b6..5e298e6 100644 --- a/src/target.rs +++ b/src/target.rs @@ -151,7 +151,10 @@ __pre_init: # debugger, perhaps). cmp r2, #0 beq 1000f + + zero_section64 0x00 , 0x20 zero_section64 __estack , __sstack + zero_section64 __svector_table_pad , __evector_table_pad maybe_zero_section64 __svector_table , __sivector_table , __evector_table maybe_zero_section64 __stext , __sitext , __etext maybe_zero_section64 __srodata , __sirodata , __erodata @@ -160,6 +163,10 @@ __pre_init: zero_section64 __suninit , __euninit zero_section64 __sheap , __eheap + zero_section64 __sitcm_unused , __eitcm_unused + zero_section64 __sdtcm_unused , __edtcm_unused + zero_section64 __socram_unused , __eocram_unused + b 1000f 1180: -- cgit v1.2.3