CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. idf_build_get_property(target IDF_TARGET)
  2. if(BOOTLOADER_BUILD)
  3. set(srcs "${target}/spi_flash_rom_patch.c")
  4. set(cache_srcs "")
  5. set(priv_requires bootloader_support soc)
  6. else()
  7. set(cache_srcs
  8. "cache_utils.c"
  9. "flash_mmap.c"
  10. "flash_ops.c"
  11. "${target}/flash_ops_${target}.c"
  12. )
  13. set(srcs
  14. "partition.c"
  15. "${target}/spi_flash_rom_patch.c"
  16. )
  17. if(CONFIG_ESPTOOLPY_OCT_FLASH)
  18. list(APPEND srcs "${target}/spi_flash_oct_flash_init.c")
  19. endif()
  20. if(CONFIG_IDF_TARGET_ESP32S3)
  21. list(APPEND srcs
  22. "esp32s3/spi_timing_config.c"
  23. "spi_flash_timing_tuning.c")
  24. endif()
  25. # New implementation after IDF v4.0
  26. list(APPEND srcs
  27. "spi_flash_chip_drivers.c"
  28. "spi_flash_chip_generic.c"
  29. "spi_flash_chip_issi.c"
  30. "spi_flash_chip_mxic.c"
  31. "spi_flash_chip_gd.c"
  32. "spi_flash_chip_winbond.c"
  33. "spi_flash_chip_boya.c"
  34. "spi_flash_chip_mxic_opi.c"
  35. "memspi_host_driver.c")
  36. list(APPEND cache_srcs
  37. "esp_flash_api.c"
  38. "esp_flash_spi_init.c"
  39. "spi_flash_os_func_app.c"
  40. "spi_flash_os_func_noos.c")
  41. list(APPEND srcs ${cache_srcs})
  42. set(priv_requires bootloader_support app_update soc esp_ipc driver)
  43. endif()
  44. idf_component_register(SRCS "${srcs}"
  45. REQUIRES hal
  46. PRIV_REQUIRES "${priv_requires}"
  47. INCLUDE_DIRS include
  48. PRIV_INCLUDE_DIRS include/spi_flash
  49. LDFRAGMENTS linker.lf)
  50. # Avoid cache miss by unexpected inlineing when built by -Os
  51. set_source_files_properties(${cache_srcs} PROPERTIES COMPILE_FLAGS "-fno-inline-functions")
  52. if(CMAKE_C_COMPILER_ID MATCHES "GNU")
  53. # These flags are GCC specific
  54. set_property(SOURCE ${cache_srcs} APPEND_STRING PROPERTY COMPILE_FLAGS
  55. " -fno-inline-small-functions -fno-inline-functions-called-once")
  56. endif()