CMakeLists.txt 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. idf_build_get_property(target IDF_TARGET)
  2. if(${target} STREQUAL "linux")
  3. set(srcs "partition.c"
  4. "partition_linux.c")
  5. idf_component_get_property(hal_dir hal COMPONENT_DIR)
  6. idf_component_get_property(bootloader_support_dir bootloader_support COMPONENT_DIR)
  7. idf_component_register(SRCS "${srcs}"
  8. INCLUDE_DIRS include ${hal_dir}/include ${bootloader_support_dir}/include
  9. PRIV_INCLUDE_DIRS include/spi_flash
  10. PRIV_REQUIRES partition_table)
  11. return()
  12. endif()
  13. if(BOOTLOADER_BUILD)
  14. set(cache_srcs "")
  15. set(priv_requires bootloader_support soc)
  16. else()
  17. set(cache_srcs
  18. "cache_utils.c"
  19. "flash_mmap.c"
  20. "flash_ops.c"
  21. "${target}/flash_ops_${target}.c"
  22. )
  23. set(srcs
  24. "partition.c"
  25. "partition_target.c"
  26. "flash_brownout_hook.c"
  27. )
  28. if(CONFIG_ESPTOOLPY_OCT_FLASH)
  29. list(APPEND srcs "${target}/spi_flash_oct_flash_init.c")
  30. endif()
  31. if(CONFIG_IDF_TARGET_ESP32S3)
  32. list(APPEND srcs
  33. "esp32s3/spi_timing_config.c"
  34. "spi_flash_timing_tuning.c"
  35. "spi_flash_hpm_enable.c")
  36. endif()
  37. # New implementation after IDF v4.0
  38. list(APPEND srcs
  39. "spi_flash_chip_drivers.c"
  40. "spi_flash_chip_generic.c"
  41. "spi_flash_chip_issi.c"
  42. "spi_flash_chip_mxic.c"
  43. "spi_flash_chip_gd.c"
  44. "spi_flash_chip_winbond.c"
  45. "spi_flash_chip_boya.c"
  46. "spi_flash_chip_mxic_opi.c"
  47. "spi_flash_chip_th.c"
  48. "memspi_host_driver.c")
  49. list(APPEND cache_srcs
  50. "esp_flash_api.c"
  51. "esp_flash_spi_init.c"
  52. "spi_flash_os_func_app.c"
  53. "spi_flash_os_func_noos.c")
  54. list(APPEND srcs ${cache_srcs})
  55. set(priv_requires bootloader_support app_update soc driver)
  56. endif()
  57. idf_component_register(SRCS "${srcs}"
  58. REQUIRES hal
  59. PRIV_REQUIRES "${priv_requires}"
  60. INCLUDE_DIRS include
  61. PRIV_INCLUDE_DIRS include/spi_flash
  62. LDFRAGMENTS linker.lf)
  63. # Avoid cache miss by unexpected inlineing when built by -Os
  64. set_source_files_properties(${cache_srcs} PROPERTIES COMPILE_FLAGS "-fno-inline-functions")
  65. if(CMAKE_C_COMPILER_ID MATCHES "GNU")
  66. # These flags are GCC specific
  67. set_property(SOURCE ${cache_srcs} APPEND_STRING PROPERTY COMPILE_FLAGS
  68. " -fno-inline-small-functions -fno-inline-functions-called-once")
  69. endif()
  70. if(NOT BOOTLOADER_BUILD)
  71. if(CONFIG_SPIRAM)
  72. # [refactor-todo]: requires "esp_psram" for few MMU usages in `flash_mmap.c`
  73. # will be replaced with MMU requirements
  74. idf_component_optional_requires(PRIVATE esp_psram)
  75. endif()
  76. target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
  77. endif()