CMakeLists.txt 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. idf_build_get_property(target IDF_TARGET)
  2. if(EXISTS "${COMPONENT_DIR}/${target}")
  3. include(${COMPONENT_DIR}/${target}/sources.cmake)
  4. spaces2list(EFUSE_SOC_SRCS)
  5. set(include_dirs include ${target}/include)
  6. add_prefix(srcs "${target}/" ${EFUSE_SOC_SRCS})
  7. list(APPEND srcs "src/${target}/esp_efuse_api.c"
  8. "src/${target}/esp_efuse_fields.c"
  9. "src/${target}/esp_efuse_utility.c")
  10. if("esp32s2" STREQUAL "${target}")
  11. list(APPEND srcs "src/${target}/esp_efuse_rtc_table.c")
  12. endif()
  13. if("esp32c3" STREQUAL "${target}")
  14. list(APPEND srcs "src/${target}/esp_efuse_rtc_calib.c")
  15. endif()
  16. endif()
  17. list(APPEND srcs "src/esp_efuse_api.c"
  18. "src/esp_efuse_fields.c"
  19. "src/esp_efuse_utility.c")
  20. idf_component_register(SRCS "${srcs}"
  21. PRIV_REQUIRES bootloader_support soc spi_flash
  22. INCLUDE_DIRS "${include_dirs}"
  23. PRIV_INCLUDE_DIRS private_include)
  24. if(target)
  25. set(TOOL_TARGET -t ${target})
  26. endif()
  27. set(GEN_EFUSE_TABLE_ARG ${TOOL_TARGET} --max_blk_len ${CONFIG_EFUSE_MAX_BLK_LEN})
  28. idf_build_get_property(python PYTHON)
  29. ###################
  30. # Make common files esp_efuse_table.c and include/esp_efuse_table.h files.
  31. set(EFUSE_COMMON_TABLE_CSV_PATH "${COMPONENT_DIR}/${target}/esp_efuse_table.csv")
  32. add_custom_target(efuse_common_table COMMAND "${python}"
  33. "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py"
  34. ${EFUSE_COMMON_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG})
  35. ###################
  36. # Make custom files project/main/esp_efuse_custom_table.c and project/main/include/esp_efuse_custom_table.h files.
  37. # Path to CSV file is relative to project path for custom CSV files.
  38. if(${CONFIG_EFUSE_CUSTOM_TABLE})
  39. # Custom filename expands any path relative to the project
  40. idf_build_get_property(project_dir PROJECT_DIR)
  41. get_filename_component(EFUSE_CUSTOM_TABLE_CSV_PATH "${CONFIG_EFUSE_CUSTOM_TABLE_FILENAME}"
  42. ABSOLUTE BASE_DIR "${project_dir}")
  43. add_custom_target(efuse_custom_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py"
  44. ${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG})
  45. else()
  46. add_custom_target(efuse_custom_table COMMAND)
  47. endif()#if(${CONFIG_EFUSE_CUSTOM_TABLE})
  48. add_custom_target(show_efuse_table COMMAND "${python}"
  49. "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py"
  50. ${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG} "--info")
  51. ###################
  52. # Generates files for unit test. This command is run manually.
  53. set(EFUSE_TEST_TABLE_CSV_PATH "${COMPONENT_DIR}/test/esp_efuse_test_table.csv")
  54. add_custom_target(efuse_test_table COMMAND "${python}"
  55. "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py"
  56. ${EFUSE_TEST_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG})