From 5efb1140ac76133bde657f627a1c8e982f1db47b Mon Sep 17 00:00:00 2001 From: morris Date: Thu, 28 Nov 2019 21:09:45 +0800 Subject: [PATCH] esptool: add chip and stub option --- components/esptool_py/flasher_args.json.in | 4 +++- components/esptool_py/project_include.cmake | 5 ++++- tools/idf.py | 4 +++- tools/idf_py_actions/serial_ext.py | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/components/esptool_py/flasher_args.json.in b/components/esptool_py/flasher_args.json.in index ca8693cc75..53a63d1bd2 100644 --- a/components/esptool_py/flasher_args.json.in +++ b/components/esptool_py/flasher_args.json.in @@ -15,6 +15,8 @@ >, "extra_esptool_args" : { "after" : "${ESPTOOLPY_AFTER}", - "before" : "${ESPTOOLPY_BEFORE}" + "before" : "${ESPTOOLPY_BEFORE}", + "stub" : "${ESPTOOLPY_WITH_STUB}", + "chip" : "${ESPTOOLPY_CHIP}" } } diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index b1297f1a1a..a57a2f6b3b 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -1,8 +1,9 @@ # Set some global esptool.py variables # # 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) -set(ESPTOOLPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip ${IDF_TARGET}) +set(ESPTOOLPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip ${target}) set(ESPSECUREPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espsecure.py") set(ESPEFUSEPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espefuse.py") @@ -12,6 +13,8 @@ set(ESPFLASHSIZE ${CONFIG_ESPTOOLPY_FLASHSIZE}) set(ESPTOOLPY_BEFORE "${CONFIG_ESPTOOLPY_BEFORE}") set(ESPTOOLPY_AFTER "${CONFIG_ESPTOOLPY_AFTER}") +set(ESPTOOLPY_CHIP "${target}") +set(ESPTOOLPY_WITH_STUB TRUE) if(CONFIG_SECURE_BOOT_ENABLED OR CONFIG_SECURE_FLASH_ENC_ENABLED) # If security enabled then override post flash option diff --git a/tools/idf.py b/tools/idf.py index e6573f149d..651453326e 100755 --- a/tools/idf.py +++ b/tools/idf.py @@ -483,13 +483,15 @@ def init_cli(verbose_output=None): cmd += o + " " + flasher_path(f) + " " print( - "%s %s -p %s -b %s --before %s --after %s write_flash %s" % ( + "%s %s -p %s -b %s --before %s --after %s --chip %s %s write_flash %s" % ( PYTHON, _safe_relpath("%s/components/esptool_py/esptool/esptool.py" % os.environ["IDF_PATH"]), args.port or "(PORT)", args.baud, flasher_args["extra_esptool_args"]["before"], flasher_args["extra_esptool_args"]["after"], + flasher_args["extra_esptool_args"]["chip"], + "--no-stub" if not flasher_args["extra_esptool_args"]["stub"] else "", cmd.strip(), )) print( diff --git a/tools/idf_py_actions/serial_ext.py b/tools/idf_py_actions/serial_ext.py index f30a667a1c..4ea0e4a023 100644 --- a/tools/idf_py_actions/serial_ext.py +++ b/tools/idf_py_actions/serial_ext.py @@ -42,6 +42,9 @@ def action_extensions(base_actions, project_path): extra_esptool_args = flasher_args["extra_esptool_args"] result += ["--before", extra_esptool_args["before"]] result += ["--after", extra_esptool_args["after"]] + result += ["--chip", extra_esptool_args["chip"]] + if not extra_esptool_args["stub"]: + result += ["--no-stub"] return result def _get_commandline_options(ctx):