diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index 838461c14a..07e72667a1 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -12,7 +12,7 @@ if(target STREQUAL "esp32s3") endif() endif() -set(ESPTOOLPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip ${chip_model}) +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} "${idf_path}/tools/idf_monitor.py") diff --git a/tools/idf_py_actions/serial_ext.py b/tools/idf_py_actions/serial_ext.py index d2c4c51689..57ba358e03 100644 --- a/tools/idf_py_actions/serial_ext.py +++ b/tools/idf_py_actions/serial_ext.py @@ -37,9 +37,13 @@ def action_extensions(base_actions, project_path): def _get_esptool_args(args): esptool_path = os.path.join(os.environ['IDF_PATH'], 'components/esptool_py/esptool/esptool.py') + esptool_wrapper_path = os.environ.get('ESPTOOL_WRAPPER', '') if args.port is None: args.port = _get_default_serial_port(args) - result = [PYTHON, esptool_path] + result = [PYTHON] + if os.path.exists(esptool_wrapper_path): + result += [esptool_wrapper_path] + result += [esptool_path] result += ['-p', args.port] result += ['-b', str(args.baud)]