2020-09-01 05:06:22 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
2021-07-02 00:27:09 -04:00
|
|
|
if(BOOTLOADER_BUILD)
|
|
|
|
set(srcs "${target}/spi_flash_rom_patch.c")
|
|
|
|
set(cache_srcs "")
|
|
|
|
set(priv_requires bootloader_support soc)
|
2018-01-11 21:49:13 -05:00
|
|
|
else()
|
2021-07-02 00:27:09 -04:00
|
|
|
set(cache_srcs
|
|
|
|
"cache_utils.c"
|
|
|
|
"flash_mmap.c"
|
|
|
|
"flash_ops.c"
|
|
|
|
"${target}/flash_ops_${target}.c"
|
|
|
|
)
|
|
|
|
set(srcs
|
|
|
|
"partition.c"
|
|
|
|
"${target}/spi_flash_rom_patch.c"
|
|
|
|
)
|
2021-04-15 05:13:48 -04:00
|
|
|
|
2021-07-02 00:27:09 -04:00
|
|
|
if(CONFIG_ESPTOOLPY_OCT_FLASH)
|
|
|
|
list(APPEND srcs "${target}/spi_flash_oct_flash_init.c")
|
|
|
|
endif()
|
2021-04-15 05:13:48 -04:00
|
|
|
|
2021-07-02 00:27:09 -04:00
|
|
|
if(CONFIG_IDF_TARGET_ESP32S3)
|
2020-09-18 02:32:37 -04:00
|
|
|
list(APPEND srcs
|
2021-07-02 00:27:09 -04:00
|
|
|
"esp32s3/spi_timing_config.c"
|
|
|
|
"spi_flash_timing_tuning.c")
|
2019-10-21 22:51:49 -04:00
|
|
|
endif()
|
|
|
|
|
2021-07-02 00:27:09 -04:00
|
|
|
# New implementation after IDF v4.0
|
|
|
|
list(APPEND srcs
|
|
|
|
"spi_flash_chip_drivers.c"
|
|
|
|
"spi_flash_chip_generic.c"
|
|
|
|
"spi_flash_chip_issi.c"
|
|
|
|
"spi_flash_chip_mxic.c"
|
|
|
|
"spi_flash_chip_gd.c"
|
|
|
|
"spi_flash_chip_winbond.c"
|
|
|
|
"spi_flash_chip_boya.c"
|
2021-09-01 03:58:15 -04:00
|
|
|
"spi_flash_chip_mxic_opi.c"
|
2021-12-01 02:13:02 -05:00
|
|
|
"spi_flash_chip_th.c"
|
2021-07-02 00:27:09 -04:00
|
|
|
"memspi_host_driver.c")
|
|
|
|
|
|
|
|
list(APPEND cache_srcs
|
|
|
|
"esp_flash_api.c"
|
|
|
|
"esp_flash_spi_init.c"
|
|
|
|
"spi_flash_os_func_app.c"
|
|
|
|
"spi_flash_os_func_noos.c")
|
|
|
|
|
|
|
|
list(APPEND srcs ${cache_srcs})
|
2021-09-16 23:14:32 -04:00
|
|
|
set(priv_requires bootloader_support app_update soc driver)
|
2021-07-02 00:27:09 -04:00
|
|
|
endif()
|
2018-01-11 21:49:13 -05:00
|
|
|
|
2021-07-02 00:27:09 -04:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
|
|
|
REQUIRES hal
|
|
|
|
PRIV_REQUIRES "${priv_requires}"
|
|
|
|
INCLUDE_DIRS include
|
|
|
|
PRIV_INCLUDE_DIRS include/spi_flash
|
|
|
|
LDFRAGMENTS linker.lf)
|
2018-04-17 22:57:45 -04:00
|
|
|
|
2021-07-02 00:27:09 -04:00
|
|
|
# Avoid cache miss by unexpected inlineing when built by -Os
|
2021-09-10 13:23:21 -04:00
|
|
|
set_source_files_properties(${cache_srcs} PROPERTIES COMPILE_FLAGS "-fno-inline-functions")
|
|
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
|
|
|
# These flags are GCC specific
|
|
|
|
set_property(SOURCE ${cache_srcs} APPEND_STRING PROPERTY COMPILE_FLAGS
|
|
|
|
" -fno-inline-small-functions -fno-inline-functions-called-once")
|
|
|
|
endif()
|