CMakeLists.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. endif()
  11. list(APPEND srcs "src/esp_efuse_api.c"
  12. "src/esp_efuse_fields.c"
  13. "src/esp_efuse_utility.c")
  14. idf_component_register(SRCS "${srcs}"
  15. PRIV_REQUIRES bootloader_support soc spi_flash
  16. INCLUDE_DIRS "${include_dirs}"
  17. PRIV_INCLUDE_DIRS private_include)
  18. if(target)
  19. set(TOOL_TARGET -t ${target})
  20. endif()
  21. set(GEN_EFUSE_TABLE_ARG ${TOOL_TARGET} --max_blk_len ${CONFIG_EFUSE_MAX_BLK_LEN})
  22. idf_build_get_property(python PYTHON)
  23. ###################
  24. # Make common files esp_efuse_table.c and include/esp_efuse_table.h files.
  25. set(EFUSE_COMMON_TABLE_CSV_PATH "${COMPONENT_DIR}/${target}/esp_efuse_table.csv")
  26. add_custom_target(efuse_common_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py" ${EFUSE_COMMON_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG})
  27. ###################
  28. # Make custom files project/main/esp_efuse_custom_table.c and project/main/include/esp_efuse_custom_table.h files.
  29. # Path to CSV file is relative to project path for custom CSV files.
  30. if(${CONFIG_EFUSE_CUSTOM_TABLE})
  31. # Custom filename expands any path relative to the project
  32. idf_build_get_property(project_dir PROJECT_DIR)
  33. get_filename_component(EFUSE_CUSTOM_TABLE_CSV_PATH "${CONFIG_EFUSE_CUSTOM_TABLE_FILENAME}" ABSOLUTE BASE_DIR "${project_dir}")
  34. add_custom_target(efuse_custom_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py" ${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG})
  35. else()
  36. add_custom_target(efuse_custom_table COMMAND)
  37. endif()#if(${CONFIG_EFUSE_CUSTOM_TABLE})
  38. add_custom_target(show_efuse_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py" ${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG} "--info")
  39. ###################
  40. # Generates files for unit test. This command is run manually.
  41. set(EFUSE_TEST_TABLE_CSV_PATH "${COMPONENT_DIR}/test/esp_efuse_test_table.csv")
  42. add_custom_target(efuse_test_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py" ${EFUSE_TEST_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG})