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