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