xtensa/esp32s3: keep octal-flash init in IRAM for the protected build

The protected kernel linker (kernel-space.ld) placed the octal (OPI)
flash bring-up helpers -- esp_rom_spiflash / esp_rom_opiflash_*,
spi_flash_oct_flash_init, mmu_hal, mspi_timing_*, bootloader_flash*,
efuse_hal/efuse_utility, esp_mmu_map and esp32s3_spi_timing -- in mapped
flash.  During configure_cpu_caches() / spi_flash_init_chip_state() in
__start these run while the flash mapping is being reconfigured, which
faults (illegal instruction) on octal-flash modules such as the
ESP32-S3-WROOM-2.  Quad-flash parts never exercise the OPI path, so the
problem was latent.

Place those functions in .iram0.text (mirroring the flat sections
script) so they are safe to execute during flash reconfiguration.

Assisted-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
This commit is contained in:
Marco Casaroli 2026-07-30 14:16:01 +02:00 • committed by Alan C. Assis
parent 54fcbe888b
commit b7f3c06b09

View file

@ -190,6 +190,7 @@ SECTIONS
*libkarch.a:*uart_hal.*(.text .text.* .literal .literal.*)
*libkarch.a:*mpu_hal.*(.text .text.* .literal .literal.*)
*libkarch.a:*mmu_hal.*(.text .text.* .literal .literal.*)
*libkarch.a:*esp_mmu_map.*(.text .text.* .literal .literal.*)
*libkarch.a:*efuse_hal.*(.text .text.* .literal .literal.*)
*libkarch.a:*uart_periph.*(.text .text.* .literal .literal.*)
*libkarch.a:*esp_rom_uart.*(.text .text.* .literal .literal.*)
@ -217,6 +218,7 @@ SECTIONS
*libkarch.a:*mspi_timing_tuning.*(.text .text.* .literal .literal.*)
*libkarch.a:*mspi_timing_config.*(.text .text.* .literal .literal.*)
*libkarch.a:esp32s3_spi_timing.*(.text .text.* .literal .literal.*)
*libkarch.a:*spi_flash_oct_flash_init.*(.text .text.* .literal .literal.*)
*libkarch.a:*spi_flash_hpm_enable.*(.text .text.* .literal .literal.*)
#endif