mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/efuse_summary' into 'master'
system-hardware/efuse: fixed efuse summary description containing ; breaking efuse-summary See merge request espressif/esp-idf!23975
This commit is contained in:
commit
1f06806271
@ -12,22 +12,22 @@ function(espefuse_cmd cmd output_log)
|
||||
set(log ${SERIAL_TOOL_OUTPUT_LOG})
|
||||
|
||||
set(prefix_str " command ===")
|
||||
string(FIND ${log} ${prefix_str} pos)
|
||||
string(FIND "${log}" ${prefix_str} pos)
|
||||
if(${pos} GREATER -1)
|
||||
string(LENGTH ${prefix_str} len_of_prefix_str)
|
||||
math(EXPR pos "${pos} + ${len_of_prefix_str}")
|
||||
string(SUBSTRING ${log} ${pos} -1 final_log)
|
||||
string(SUBSTRING "${log}" ${pos} -1 final_log)
|
||||
else()
|
||||
set(final_log ${log})
|
||||
set(final_log "${log}")
|
||||
endif()
|
||||
|
||||
set(${output_log} ${final_log} PARENT_SCOPE)
|
||||
set(${output_log} "${final_log}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Reads efuses "espefuse.py summary" and returns JSON string
|
||||
function(espefuse_get_json_summary json_str)
|
||||
espefuse_cmd("summary;--format;json" output_log)
|
||||
set(${json_str} ${output_log} PARENT_SCOPE)
|
||||
set(${json_str} "${output_log}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# See the esp-idf/docs/en/api-reference/system/efuse.rst "Get eFuses During Build".
|
||||
@ -35,13 +35,13 @@ endfunction()
|
||||
# It takes the efuse json string and returns a value of property for a given efuse name
|
||||
function(espefuse_get_efuse result efuse_json efuse_name efuse_property)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.19.0")
|
||||
string(REGEX MATCH "\"${efuse_name}\":[ \t\n\r]*\{[^\}]*\}" cur_efuse ${efuse_json})
|
||||
string(REGEX MATCH "\"${efuse_property}\":[ \t\n\r]*\"?([^,\"]*)\"?," ret_value ${cur_efuse})
|
||||
string(REGEX MATCH "\"${efuse_name}\":[ \t\n\r]*\{[^\}]*\}" cur_efuse "${efuse_json}")
|
||||
string(REGEX MATCH "\"${efuse_property}\":[ \t\n\r]*\"?([^,\"]*)\"?," ret_value "${cur_efuse}")
|
||||
set(${result} ${CMAKE_MATCH_1} PARENT_SCOPE)
|
||||
else()
|
||||
# The JSON feature has been supported by Cmake since 3.19.0
|
||||
string(JSON cur_efuse GET ${efuse_json} ${efuse_name})
|
||||
string(JSON ret_value GET ${cur_efuse} ${efuse_property})
|
||||
string(JSON cur_efuse GET "${efuse_json}" ${efuse_name})
|
||||
string(JSON ret_value GET "${cur_efuse}" ${efuse_property})
|
||||
set(${result} ${ret_value} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -3,6 +3,6 @@ cmake_minimum_required(VERSION 3.16)
|
||||
include(${esptool_py_dir}/espefuse.cmake)
|
||||
espefuse_get_json_summary(efuse_json)
|
||||
foreach(name ${efuse_names})
|
||||
espefuse_get_efuse(ret_data ${efuse_json} ${name} "value")
|
||||
espefuse_get_efuse(ret_data "${efuse_json}" ${name} "value")
|
||||
message(STATUS "FROM_CMAKE: ${name}: ${ret_data}")
|
||||
endforeach()
|
||||
|
Loading…
Reference in New Issue
Block a user