2019-08-08 00:00:45 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
2019-08-07 23:44:24 -04:00
|
|
|
|
2021-06-16 19:21:36 -04:00
|
|
|
if(CONFIG_EFUSE_VIRTUAL)
|
|
|
|
message(STATUS "Efuse virtual mode is enabled. If Secure boot or Flash encryption is on"
|
|
|
|
" it does not provide any security. FOR TESTING ONLY!")
|
|
|
|
endif()
|
|
|
|
|
2019-06-18 07:34:05 -04:00
|
|
|
if(EXISTS "${COMPONENT_DIR}/${target}")
|
|
|
|
include(${COMPONENT_DIR}/${target}/sources.cmake)
|
|
|
|
spaces2list(EFUSE_SOC_SRCS)
|
|
|
|
set(include_dirs include ${target}/include)
|
2021-01-25 15:27:03 -05:00
|
|
|
set(private_include private_include ${target}/private_include)
|
2019-06-18 07:34:05 -04:00
|
|
|
add_prefix(srcs "${target}/" ${EFUSE_SOC_SRCS})
|
|
|
|
endif()
|
2019-08-07 23:44:24 -04:00
|
|
|
|
2021-12-02 12:48:47 -05:00
|
|
|
if(CONFIG_SOC_EFUSE_KEY_PURPOSE_FIELD)
|
|
|
|
set(type "with_key_purposes")
|
2021-01-25 15:27:03 -05:00
|
|
|
else()
|
2021-12-02 12:48:47 -05:00
|
|
|
if(CONFIG_SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK)
|
|
|
|
set(type "without_key_purposes/one_key_block")
|
|
|
|
else()
|
|
|
|
set(type "without_key_purposes/three_key_blocks")
|
|
|
|
endif()
|
2021-01-25 15:27:03 -05:00
|
|
|
endif()
|
2018-11-18 22:46:21 -05:00
|
|
|
|
2021-12-02 12:48:47 -05:00
|
|
|
list(APPEND srcs "src/esp_efuse_api.c"
|
|
|
|
"src/esp_efuse_fields.c"
|
|
|
|
"src/esp_efuse_utility.c"
|
|
|
|
"src/efuse_controller/keys/${type}/esp_efuse_api_key.c")
|
|
|
|
|
2019-04-28 03:38:23 -04:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
2019-07-04 03:54:13 -04:00
|
|
|
PRIV_REQUIRES bootloader_support soc spi_flash
|
2019-06-18 07:34:05 -04:00
|
|
|
INCLUDE_DIRS "${include_dirs}"
|
2021-01-25 15:27:03 -05:00
|
|
|
PRIV_INCLUDE_DIRS "${private_include}")
|
2019-06-18 07:34:05 -04:00
|
|
|
|
|
|
|
if(target)
|
|
|
|
set(TOOL_TARGET -t ${target})
|
|
|
|
endif()
|
2018-11-18 22:46:21 -05:00
|
|
|
|
2019-06-18 07:34:05 -04:00
|
|
|
set(GEN_EFUSE_TABLE_ARG ${TOOL_TARGET} --max_blk_len ${CONFIG_EFUSE_MAX_BLK_LEN})
|
2018-11-21 03:09:36 -05:00
|
|
|
|
2019-05-09 22:53:08 -04:00
|
|
|
idf_build_get_property(python PYTHON)
|
|
|
|
|
2018-11-18 22:46:21 -05:00
|
|
|
###################
|
|
|
|
# Make common files esp_efuse_table.c and include/esp_efuse_table.h files.
|
2019-06-18 07:34:05 -04:00
|
|
|
set(EFUSE_COMMON_TABLE_CSV_PATH "${COMPONENT_DIR}/${target}/esp_efuse_table.csv")
|
2018-12-06 04:49:02 -05:00
|
|
|
|
2021-08-11 09:24:17 -04:00
|
|
|
add_custom_target(efuse-common-table COMMAND "${python}"
|
2020-11-10 01:51:08 -05:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py"
|
|
|
|
${EFUSE_COMMON_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG})
|
2021-08-11 09:24:17 -04:00
|
|
|
add_deprecated_target_alias(efuse_common_table efuse-common-table)
|
2018-11-18 22:46:21 -05:00
|
|
|
|
2018-11-21 03:09:36 -05:00
|
|
|
###################
|
|
|
|
# Make custom files project/main/esp_efuse_custom_table.c and project/main/include/esp_efuse_custom_table.h files.
|
|
|
|
# Path to CSV file is relative to project path for custom CSV files.
|
2018-11-18 22:46:21 -05:00
|
|
|
if(${CONFIG_EFUSE_CUSTOM_TABLE})
|
|
|
|
# Custom filename expands any path relative to the project
|
2019-05-09 22:53:08 -04:00
|
|
|
idf_build_get_property(project_dir PROJECT_DIR)
|
2020-11-10 01:51:08 -05:00
|
|
|
get_filename_component(EFUSE_CUSTOM_TABLE_CSV_PATH "${CONFIG_EFUSE_CUSTOM_TABLE_FILENAME}"
|
|
|
|
ABSOLUTE BASE_DIR "${project_dir}")
|
2021-08-11 09:24:17 -04:00
|
|
|
add_custom_target(efuse-custom-table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py"
|
2020-11-10 01:51:08 -05:00
|
|
|
${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG})
|
2021-08-11 09:24:17 -04:00
|
|
|
add_deprecated_target_alias(efuse_custom_table efuse-custom-table)
|
2018-12-06 04:49:02 -05:00
|
|
|
else()
|
2021-08-11 09:24:17 -04:00
|
|
|
add_custom_target(efuse-custom-table COMMAND)
|
|
|
|
add_deprecated_target_alias(efuse_custom_table efuse-custom-table)
|
2018-11-21 03:09:36 -05:00
|
|
|
endif()#if(${CONFIG_EFUSE_CUSTOM_TABLE})
|
2018-11-18 22:46:21 -05:00
|
|
|
|
2021-08-11 09:24:17 -04:00
|
|
|
add_custom_target(show-efuse-table COMMAND "${python}"
|
2020-11-10 01:51:08 -05:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py"
|
|
|
|
${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG} "--info")
|
2021-08-11 09:24:17 -04:00
|
|
|
add_deprecated_target_alias(show_efuse_table show-efuse-table)
|
2018-11-18 22:46:21 -05:00
|
|
|
|
|
|
|
###################
|
|
|
|
# Generates files for unit test. This command is run manually.
|
2019-05-09 22:53:08 -04:00
|
|
|
set(EFUSE_TEST_TABLE_CSV_PATH "${COMPONENT_DIR}/test/esp_efuse_test_table.csv")
|
2020-11-10 01:51:08 -05:00
|
|
|
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})
|
2022-01-31 13:45:31 -05:00
|
|
|
|
|
|
|
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|