CMakeLists.txt 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. idf_build_get_property(target IDF_TARGET)
  2. if(CONFIG_IDF_ENV_FPGA)
  3. list(APPEND srcs "src/fpga_overrides.c")
  4. endif()
  5. if(BOOTLOADER_BUILD)
  6. # For bootloader, all we need from esp_common is headers
  7. idf_component_register(SRCS ${srcs}
  8. INCLUDE_DIRS include
  9. PRIV_REQUIRES soc)
  10. set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--gc-sections")
  11. else()
  12. # Regular app build
  13. list(APPEND srcs "src/brownout.c"
  14. "src/esp_err.c"
  15. "src/esp_err_to_name.c"
  16. "src/freertos_hooks.c"
  17. "src/mac_addr.c"
  18. "src/stack_check.c"
  19. "src/task_wdt.c"
  20. "src/int_wdt.c")
  21. if(NOT CONFIG_IDF_TARGET_ESP32C3)
  22. list(APPEND srcs "src/dbg_stubs.c")
  23. endif()
  24. # Note: esp_ipc, esp_pm added as a public requirement to keep compatibility as to be located here.
  25. idf_component_register(SRCS "${srcs}"
  26. INCLUDE_DIRS include
  27. REQUIRES ${target} espcoredump esp_timer esp_ipc esp_pm esp_hw_support
  28. PRIV_REQUIRES soc
  29. LDFRAGMENTS "linker.lf")
  30. set_source_files_properties(
  31. "src/stack_check.c"
  32. PROPERTIES COMPILE_FLAGS
  33. -fno-stack-protector)
  34. set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_LIBRARIES "-Wl,--gc-sections")
  35. set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--gc-sections")
  36. set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 4)
  37. # List of components needed for the error codes list
  38. set(optional_reqs ulp
  39. efuse
  40. esp_http_client
  41. esp_http_server
  42. bootloader_support
  43. nvs_flash
  44. esp_wifi
  45. app_update
  46. lwip
  47. spi_flash
  48. wpa_supplicant
  49. tcpip_adapter
  50. esp_serial_slave_link
  51. esp_netif
  52. soc
  53. esp-tls
  54. esp_https_ota)
  55. idf_build_get_property(build_components BUILD_COMPONENTS)
  56. foreach(req ${optional_reqs})
  57. if(req IN_LIST build_components)
  58. idf_component_get_property(req_lib ${req} COMPONENT_LIB)
  59. target_link_libraries(${COMPONENT_LIB} PRIVATE ${req_lib})
  60. endif()
  61. endforeach()
  62. endif()
  63. if(CONFIG_IDF_ENV_FPGA)
  64. # Forces the linker to include fpga stubs from this component
  65. target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_common_include_fpga_overrides")
  66. endif()