From 9b5695ea00fcf33e2bff61b7d59b3ff8eff3f286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Mon, 6 Jan 2025 10:16:42 +0100 Subject: [PATCH] Explain --- esp-hal/src/soc/esp32s3/psram.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esp-hal/src/soc/esp32s3/psram.rs b/esp-hal/src/soc/esp32s3/psram.rs index fb2c2973f..5729a44d5 100644 --- a/esp-hal/src/soc/esp32s3/psram.rs +++ b/esp-hal/src/soc/esp32s3/psram.rs @@ -168,8 +168,10 @@ pub(crate) fn init_psram(config: PsramConfig) { const MMU_INVALID: u32 = 1 << 14; const DR_REG_MMU_TABLE: u32 = 0x600C5000; - // calculate the PSRAM start address to map - honor the fact there might be - // unmapped pages in between + // calculate the PSRAM start address to map + // the linker scripts can produce a gap between mapped IROM and DROM segments + // bigger than a flash page - i.e. we will see an unmapped memory slot + // start from the end and find the last mapped flash page let mmu_table_ptr = DR_REG_MMU_TABLE as *const u32; let mut mapped_pages = 0; for i in (0..FLASH_MMU_TABLE_SIZE).rev() {