From 428ea28a9102d966eda5b9c39644ff66c5f59c59 Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Sat, 24 Oct 2026 07:30:47 -0400 Subject: Preload RAM sections, maybe, if ECC RAM is active 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. --- tests/inspect_elf.rs | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'tests/inspect_elf.rs') diff --git a/tests/inspect_elf.rs b/tests/inspect_elf.rs index 177bf50..7f7cc79 100644 --- a/tests/inspect_elf.rs +++ b/tests/inspect_elf.rs @@ -266,12 +266,7 @@ fn imxrt1010evk() { binary.fcb().unwrap() ); assert_eq!(binary.flexram_config().unwrap(), 0b11_10_0101); - assert_eq!(binary.symbol_value("__sitcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__eitcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__sdtcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__edtcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__socram").unwrap(), 0); - assert_eq!(binary.symbol_value("__eocram").unwrap(), 0); + assert_eq!(binary.symbol_value("__ecc_ram_config").unwrap(), 0); let ivt = binary.ivt().unwrap(); assert_eq!(ivt.magic_header, 0x402000D1); @@ -386,12 +381,7 @@ fn imxrt1010evk_ram() { let binary = ImxrtBinary::new(&elf, &contents); - assert_eq!(binary.symbol_value("__sitcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__eitcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__sdtcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__edtcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__socram").unwrap(), 0); - assert_eq!(binary.symbol_value("__eocram").unwrap(), 0); + assert_eq!(binary.symbol_value("__ecc_ram_config").unwrap(), 0); let stack = binary.section(".stack").unwrap(); assert_eq!( @@ -508,12 +498,7 @@ fn baseline_teensy4( binary.flexram_config().unwrap(), 0b11111111_101010101010101010101010 ); - assert_eq!(binary.symbol_value("__sitcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__eitcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__sdtcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__edtcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__socram").unwrap(), 0); - assert_eq!(binary.symbol_value("__eocram").unwrap(), 0); + assert_eq!(binary.symbol_value("__ecc_ram_config").unwrap(), 0); let ivt = binary.ivt().unwrap(); assert_eq!(ivt.magic_header, 0x402000D1); @@ -754,12 +739,7 @@ fn imxrt1170evk_cm7() { binary.fcb().unwrap() ); assert_eq!(binary.flexram_config().unwrap(), 0xFFAAFFAA); - assert_eq!(binary.symbol_value("__sitcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__eitcm").unwrap(), 0x4_0000); - assert_eq!(binary.symbol_value("__sdtcm").unwrap(), 0x2000_0000); - assert_eq!(binary.symbol_value("__edtcm").unwrap(), 0x2004_0000); - assert_eq!(binary.symbol_value("__socram").unwrap(), 0x2024_0000); - assert_eq!(binary.symbol_value("__eocram").unwrap(), 0x2034_0000); + assert_eq!(binary.symbol_value("__ecc_ram_config").unwrap(), 0b111); let ivt = binary.ivt().unwrap(); assert_eq!(ivt.magic_header, 0x402000D1); @@ -881,12 +861,7 @@ fn imxrt1170evk_cm7_nonboot() { assert!(binary.fcb().is_err()); assert_eq!(binary.flexram_config().unwrap(), 0xFFAAFFAA); - assert_eq!(binary.symbol_value("__sitcm").unwrap(), 0); - assert_eq!(binary.symbol_value("__eitcm").unwrap(), 0x4_0000); - assert_eq!(binary.symbol_value("__sdtcm").unwrap(), 0x2000_0000); - assert_eq!(binary.symbol_value("__edtcm").unwrap(), 0x2004_0000); - assert_eq!(binary.symbol_value("__socram").unwrap(), 0x2024_0000); - assert_eq!(binary.symbol_value("__eocram").unwrap(), 0x2034_0000); + assert_eq!(binary.symbol_value("__ecc_ram_config").unwrap(), 0b111); assert!( binary.ivt().is_err(), -- cgit v1.2.3