refactor(esptool_py): Removed global scope variables from esptool_py project_include.cmake

This commit global variables such as ESPTOOLPY, ESPSECUREPY, ESPEFUSEPY,
ESPMONITOR and ESPTOOLPY_CHIP from the project_include.cmake file of
esptool_py component. All other components which use these variables
have been updated to fetch the same from esptool_py component's
properties.
This commit is contained in:
Sudeep Mohanty
2025-07-02 14:55:03 +02:00
parent 8582294caf
commit b6ea668e6e
7 changed files with 30 additions and 27 deletions

View File

@@ -2,6 +2,18 @@ cmake_minimum_required(VERSION 3.16)
# Executes a espefuse.py command and returns a cleaned log
function(espefuse_cmd cmd output_log)
# espefuse_cmd can be called from a project's CMakeLists.txt file, which
# can invoke this function in CMake scripting mode (-P). If that is the case,
# we do not have access to convenience functions like idf_component_get_property.
# In scripting mode, the path to espefuse.py must be passed in via the
# 'ESPEFUSEPY' variable using the -D flag.
#
# When called during the normal build configuration phase, 'ESPEFUSEPY' is not
# defined as a variable, and we must fetch it from the esptool_py component's
# properties.
if(NOT DEFINED ESPEFUSEPY)
idf_component_get_property(ESPEFUSEPY esptool_py ESPEFUSEPY_CMD)
endif()
set(SERIAL_TOOL ${ESPEFUSEPY})
if(${ESPEFUSEPY_OFFLINE})
set(VIRT_OPTION "--virt")

View File

@@ -1,20 +1,5 @@
# esptool_py component project_include.cmake
# Many of these are read when generating flash_app_args & flash_project_args
idf_build_get_property(target IDF_TARGET)
idf_build_get_property(python PYTHON)
idf_build_get_property(idf_path IDF_PATH)
idf_build_get_property(non_os_build NON_OS_BUILD)
set(chip_model ${target})
set(ESPTOOLPY ${python} "$ENV{ESPTOOL_WRAPPER}" "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip ${chip_model})
set(ESPSECUREPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espsecure.py")
set(ESPEFUSEPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espefuse.py")
set(ESPMONITOR ${python} -m esp_idf_monitor)
set(ESPTOOLPY_CHIP "${chip_model}")
# esptool_py_partition_needs_encryption
#
# @brief Determine if a partition needs to be encrypted when flash encryption is enabled.