Merge branch 'refactor/flash_refactor' into 'master'

spi_flash: split driver and os driver into `spi_flash` and `esp_mspi` components

Closes IDF-15210

See merge request espressif/esp-idf!45409
This commit is contained in:
Armando (Dou Yiwen)
2026-09-10 07:29:01 +00:00
266 changed files with 1558 additions and 1208 deletions
+4 -4
View File
@@ -12,7 +12,7 @@ if(${target} STREQUAL "linux")
"freertos_hooks.c"
"startup.c"
INCLUDE_DIRS "include"
PRIV_REQUIRES spi_flash)
PRIV_REQUIRES esp_mspi)
# Add custom ld file (used to place system init functions).
# Mach-O (Apple) does not support linker scripts; section bounds are resolved
@@ -39,10 +39,10 @@ if(BOOTLOADER_BUILD OR esp_tee_build)
if(esp_tee_build)
list(APPEND include_dirs "port/include/private")
endif()
# "_esp_error_check_failed()" requires spi_flash module
# "_esp_error_check_failed()" requires esp_mspi module
# Bootloader relies on some Kconfig options defined in esp_system.
idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}"
REQUIRES spi_flash)
PRIV_REQUIRES esp_mspi)
else()
list(APPEND srcs "crosscore_int.c"
"esp_ipc.c"
@@ -96,7 +96,7 @@ else()
list(APPEND srcs "debug_assist.c")
endif()
set(priv_requires spi_flash esp_timer esp_mm
set(priv_requires esp_mspi esp_timer esp_mm
esp_hal_clock esp_hal_mspi esp_hal_wdt esp_hal_debug_assist
esp_hal_uart esp_hal_dma esp_hal_security
# [refactor-todo] requirements due to init code,
+3 -4
View File
@@ -121,7 +121,6 @@
#include "esp_rom_spiflash.h"
#include "bootloader_init.h"
#include "esp_private/bootloader_flash_internal.h"
#include "spi_flash_mmap.h"
#endif // CONFIG_APP_BUILD_TYPE_RAM
//This dependency will be removed in the future
@@ -569,7 +568,7 @@ FORCE_INLINE_ATTR IRAM_ATTR void ext_mem_init(void)
uint32_t cache_mmu_irom_size = 0;
#if !CONFIG_APP_BUILD_TYPE_ELF_RAM
uint32_t _instruction_size = (uint32_t)&_instruction_reserved_end - (uint32_t)&_instruction_reserved_start;
cache_mmu_irom_size = ((_instruction_size + SPI_FLASH_MMU_PAGE_SIZE - 1) / SPI_FLASH_MMU_PAGE_SIZE) * sizeof(uint32_t);
cache_mmu_irom_size = ((_instruction_size + CONFIG_MMU_PAGE_SIZE - 1) / CONFIG_MMU_PAGE_SIZE) * sizeof(uint32_t);
#endif // !CONFIG_APP_BUILD_TYPE_ELF_RAM
/* Configure the Cache MMU size for instruction and rodata in flash. */
Cache_Set_IDROM_MMU_Size(cache_mmu_irom_size, CACHE_DROM_MMU_MAX_END - cache_mmu_irom_size);
@@ -780,10 +779,10 @@ NOINLINE_ATTR static void system_early_init(const soc_reset_reason_t *rst_reas)
uint32_t cache_mmu_drom_size = 0;
#if !CONFIG_APP_BUILD_TYPE_ELF_RAM
uint32_t _instruction_size = (uint32_t)&_instruction_reserved_end - (uint32_t)&_instruction_reserved_start;
cache_mmu_irom_size = ((_instruction_size + SPI_FLASH_MMU_PAGE_SIZE - 1) / SPI_FLASH_MMU_PAGE_SIZE) * sizeof(uint32_t);
cache_mmu_irom_size = ((_instruction_size + CONFIG_MMU_PAGE_SIZE - 1) / CONFIG_MMU_PAGE_SIZE) * sizeof(uint32_t);
uint32_t _rodata_size = (uint32_t)&_rodata_reserved_end - (uint32_t)&_rodata_reserved_start;
cache_mmu_drom_size = ((_rodata_size + SPI_FLASH_MMU_PAGE_SIZE - 1) / SPI_FLASH_MMU_PAGE_SIZE) * sizeof(uint32_t);
cache_mmu_drom_size = ((_rodata_size + CONFIG_MMU_PAGE_SIZE - 1) / CONFIG_MMU_PAGE_SIZE) * sizeof(uint32_t);
#endif // !CONFIG_APP_BUILD_TYPE_ELF_RAM
int s_instr_flash2spiram_off = 0;
+7 -1
View File
@@ -69,7 +69,13 @@ CORE: 118: init_vfs_nullfs in components/vfs/nullfs.c on BIT(0)
CORE: 119: init_vfs_console in components/esp_stdio/stdio_vfs.c on BIT(0)
CORE: 120: init_libc_stdio in components/esp_libc/src/init.c on BIT(0)
CORE: 125: init_flash_dpd in components/esp_mspi/flash_ops.c on BIT(0)
CORE: 130: init_flash in components/spi_flash/esp_flash_spi_init.c on BIT(0)
# Register partition-based flash write protection callback into spi_flash, right after init_flash.
CORE: 131: esp_partition_flash_region_protection_init in components/esp_partition/partition_target.c on BIT(0)
CORE: 140: init_efuse in components/efuse/src/esp_efuse_startup.c on BIT(0)
CORE: 170: init_xt_wdt in components/esp_system/startup_funcs.c on BIT(0)
@@ -142,7 +148,7 @@ SECONDARY: 230: usb_serial_jtag_conn_status_init in components/esp_driver_usb_se
# psram adjust timing point need a separate task which should be created at startup.
# Valid only `CONFIG_SPIRAM_TIMING_TUNING_POINT_VIA_TEMPERATURE_SENSOR` is enabled.
SECONDARY: 240: psram_adjust_timing_point_via_temperature in components/esp_hw_support/mspi/mspi_timing_tuning/port/esp32s3/mspi_timing_by_mspi_delay.c on BIT(0)
SECONDARY: 240: psram_adjust_timing_point_via_temperature in components/esp_mspi/mspi_timing_tuning/port/esp32s3/mspi_timing_by_mspi_delay.c on BIT(0)
# Has to be the last step!
# Now that the application is about to start, disable boot watchdog
@@ -2,5 +2,5 @@ set(srcs "test_cache_disabled.c"
"test_app_main.c")
idf_component_register(SRCS ${srcs}
PRIV_REQUIRES unity spi_flash
PRIV_REQUIRES unity esp_mspi
WHOLE_ARCHIVE)