diff options
| author | Ian McIntyre <me@mciantyre.dev> | 2026-10-26 10:52:57 -0400 |
|---|---|---|
| committer | Ian McIntyre <me@mciantyre.dev> | 2026-11-07 10:20:33 -0500 |
| commit | 1087e9bb7cd31e6fd88532ead08a927168e36de7 (patch) | |
| tree | ea487e5dc1758f959e0ef9859e89b8196678e8ac /src/target.rs | |
| parent | f0ef2b86cee6b44e801eb80ba301888a608fdd76 (diff) | |
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.
Diffstat (limited to 'src/target.rs')
| -rw-r--r-- | src/target.rs | 7 |
1 files changed, 7 insertions, 0 deletions
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: |
