From d45eabe676820d41fdb347b98ab9db2c2d53dde7 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Sat, 25 Apr 2020 16:44:27 +1000 Subject: [PATCH] esptool: Add support for ESP32-S2 Secure Download Mode * Pass --no-stub from build system if configured to enable ESP32-S2 Secure Download Mode * Update esptool submodule --- components/esptool_py/CMakeLists.txt | 6 +++++- components/esptool_py/Kconfig.projbuild | 6 ++++++ components/esptool_py/esptool | 2 +- components/esptool_py/flasher_args.json.in | 2 +- components/esptool_py/project_include.cmake | 3 +++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/components/esptool_py/CMakeLists.txt b/components/esptool_py/CMakeLists.txt index f4ce6e0a93..8060133158 100644 --- a/components/esptool_py/CMakeLists.txt +++ b/components/esptool_py/CMakeLists.txt @@ -27,7 +27,11 @@ if(NOT BOOTLOADER_BUILD) set(ESPTOOLPY_BEFORE "${CONFIG_ESPTOOLPY_BEFORE}") set(ESPTOOLPY_AFTER "${CONFIG_ESPTOOLPY_AFTER}") set(ESPTOOLPY_CHIP "${target}") - set(ESPTOOLPY_WITH_STUB TRUE) + if(CONFIG_ESPTOOLPY_WITH_STUB) + set(ESPTOOLPY_WITH_STUB true) + else() + set(ESPTOOLPY_WITH_STUB false) + endif() if(CONFIG_SECURE_BOOT OR CONFIG_SECURE_FLASH_ENC_ENABLED) # If security enabled then override post flash option diff --git a/components/esptool_py/Kconfig.projbuild b/components/esptool_py/Kconfig.projbuild index a01ea47345..7fcba13701 100644 --- a/components/esptool_py/Kconfig.projbuild +++ b/components/esptool_py/Kconfig.projbuild @@ -54,6 +54,12 @@ menu "Serial flasher config" decompress it on the fly before flashing it. For most payloads, this should result in a speed increase. + config ESPTOOLPY_WITH_STUB + # Only real reason to disable this is when ESP32-S2 Secure Download Mode is set + bool + default "y" + depends on !SECURE_ENABLE_SECURE_ROM_DL_MODE + choice ESPTOOLPY_FLASHMODE prompt "Flash SPI mode" default ESPTOOLPY_FLASHMODE_DIO diff --git a/components/esptool_py/esptool b/components/esptool_py/esptool index 988b9a2441..5eada56341 160000 --- a/components/esptool_py/esptool +++ b/components/esptool_py/esptool @@ -1 +1 @@ -Subproject commit 988b9a24414bba694ae9994728865148ee95848a +Subproject commit 5eada56341f3a74c3e09eef3b1266f1072145059 diff --git a/components/esptool_py/flasher_args.json.in b/components/esptool_py/flasher_args.json.in index 2152d68776..1efa47b9db 100644 --- a/components/esptool_py/flasher_args.json.in +++ b/components/esptool_py/flasher_args.json.in @@ -16,7 +16,7 @@ "extra_esptool_args" : { "after" : "${ESPTOOLPY_AFTER}", "before" : "${ESPTOOLPY_BEFORE}", - "stub" : "${ESPTOOLPY_WITH_STUB}", + "stub" : ${ESPTOOLPY_WITH_STUB}, "chip" : "${ESPTOOLPY_CHIP}" } } diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index 3a7eb55bd0..c421458474 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -153,6 +153,9 @@ else() list(APPEND esptool_flash_main_args "--after=${CONFIG_ESPTOOLPY_AFTER}") endif() +if(NOT CONFIG_ESPTOOLPY_WITH_STUB) + list(APPEND esptool_flash_main_args "--no-stub") +endif() idf_component_set_property(esptool_py FLASH_ARGS "${esptool_flash_main_args}") idf_component_set_property(esptool_py FLASH_SUB_ARGS "${ESPTOOLPY_FLASH_OPTIONS}")