CMakeLists.txt
1 if(BOOTLOADER_BUILD) 2 if (CONFIG_IDF_TARGET_ESP32) 3 # ESP32 Bootloader needs SPIUnlock from this file, but doesn't 4 # need other parts of this component 5 set(srcs "esp32/spi_flash_rom_patch.c") 6 else() 7 # but on other platforms no source files are needed for bootloader 8 set(srcs) 9 endif() 10 set(cache_srcs "") 11 set(priv_requires bootloader_support soc) 12 else() 13 set(cache_srcs 14 "cache_utils.c" 15 "flash_mmap.c" 16 "flash_ops.c" 17 "${IDF_TARGET}/flash_ops_${IDF_TARGET}.c" 18 ) 19 set(srcs 20 "partition.c") 21 22 if (CONFIG_IDF_TARGET_ESP32) 23 list(APPEND srcs 24 "esp32/spi_flash_rom_patch.c") 25 endif() 26 27 # New implementation after IDF v4.0 28 list(APPEND srcs 29 "spi_flash_chip_drivers.c" 30 "spi_flash_chip_generic.c" 31 "spi_flash_chip_issi.c" 32 "spi_flash_chip_mxic.c" 33 "spi_flash_chip_gd.c" 34 "spi_flash_chip_winbond.c" 35 "memspi_host_driver.c") 36 37 list(APPEND cache_srcs 38 "esp_flash_api.c" 39 "esp_flash_spi_init.c" 40 "spi_flash_os_func_app.c" 41 "spi_flash_os_func_noos.c") 42 43 list(APPEND srcs ${cache_srcs}) 44 set(priv_requires bootloader_support app_update soc esp_ipc) 45 endif() 46 47 idf_component_register(SRCS "${srcs}" 48 REQUIRES hal 49 PRIV_REQUIRES "${priv_requires}" 50 INCLUDE_DIRS include 51 PRIV_INCLUDE_DIRS private_include 52 LDFRAGMENTS linker.lf) 53 54 # Avoid cache miss by unexpected inlineing when built by -Os 55 set_source_files_properties(${cache_srcs} PROPERTIES COMPILE_FLAGS 56 "-fno-inline-functions -fno-inline-small-functions -fno-inline-functions-called-once")