esptool: add chip and stub option

This commit is contained in:
morris
2019-11-28 21:09:45 +08:00
parent 2237cc11a3
commit 5efb1140ac
4 changed files with 13 additions and 3 deletions

View File

@@ -15,6 +15,8 @@
>, >,
"extra_esptool_args" : { "extra_esptool_args" : {
"after" : "${ESPTOOLPY_AFTER}", "after" : "${ESPTOOLPY_AFTER}",
"before" : "${ESPTOOLPY_BEFORE}" "before" : "${ESPTOOLPY_BEFORE}",
"stub" : "${ESPTOOLPY_WITH_STUB}",
"chip" : "${ESPTOOLPY_CHIP}"
} }
} }

View File

@@ -1,8 +1,9 @@
# Set some global esptool.py variables # Set some global esptool.py variables
# #
# Many of these are read when generating flash_app_args & flash_project_args # 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(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(ESPSECUREPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espsecure.py")
set(ESPEFUSEPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espefuse.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_BEFORE "${CONFIG_ESPTOOLPY_BEFORE}")
set(ESPTOOLPY_AFTER "${CONFIG_ESPTOOLPY_AFTER}") 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(CONFIG_SECURE_BOOT_ENABLED OR CONFIG_SECURE_FLASH_ENC_ENABLED)
# If security enabled then override post flash option # If security enabled then override post flash option

View File

@@ -483,13 +483,15 @@ def init_cli(verbose_output=None):
cmd += o + " " + flasher_path(f) + " " cmd += o + " " + flasher_path(f) + " "
print( 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, PYTHON,
_safe_relpath("%s/components/esptool_py/esptool/esptool.py" % os.environ["IDF_PATH"]), _safe_relpath("%s/components/esptool_py/esptool/esptool.py" % os.environ["IDF_PATH"]),
args.port or "(PORT)", args.port or "(PORT)",
args.baud, args.baud,
flasher_args["extra_esptool_args"]["before"], flasher_args["extra_esptool_args"]["before"],
flasher_args["extra_esptool_args"]["after"], 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(), cmd.strip(),
)) ))
print( print(

View File

@@ -42,6 +42,9 @@ def action_extensions(base_actions, project_path):
extra_esptool_args = flasher_args["extra_esptool_args"] extra_esptool_args = flasher_args["extra_esptool_args"]
result += ["--before", extra_esptool_args["before"]] result += ["--before", extra_esptool_args["before"]]
result += ["--after", extra_esptool_args["after"]] result += ["--after", extra_esptool_args["after"]]
result += ["--chip", extra_esptool_args["chip"]]
if not extra_esptool_args["stub"]:
result += ["--no-stub"]
return result return result
def _get_commandline_options(ctx): def _get_commandline_options(ctx):