From b64fd872bcaf84276fcc6829f84b5b48cf6654cd Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Fri, 21 Aug 2020 04:28:05 +0300 Subject: [PATCH] Allow esptool's download stub to be disabled by other options and applications Currently USB CDC Download requires the `--no-stub` option of `esptool`. This change inverts the Kconfig option to negative, so that it can be `selected` by other options or enabled in applications through `sdkconfig.defaults`. --- components/bootloader/Kconfig.projbuild | 1 + components/esptool_py/CMakeLists.txt | 6 +++--- components/esptool_py/Kconfig.projbuild | 11 ++++++----- components/esptool_py/project_include.cmake | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/components/bootloader/Kconfig.projbuild b/components/bootloader/Kconfig.projbuild index f402dd78b1..5aa23a5151 100644 --- a/components/bootloader/Kconfig.projbuild +++ b/components/bootloader/Kconfig.projbuild @@ -763,6 +763,7 @@ menu "Security features" config SECURE_ENABLE_SECURE_ROM_DL_MODE bool "Permanently switch to ROM UART Secure Download mode" depends on SECURE_TARGET_HAS_SECURE_ROM_DL_MODE && !SECURE_DISABLE_ROM_DL_MODE + select ESPTOOLPY_NO_STUB help If set, during startup the app will burn an eFuse bit to permanently switch the UART ROM Download Mode into a separate Secure Download mode. This option can only work if diff --git a/components/esptool_py/CMakeLists.txt b/components/esptool_py/CMakeLists.txt index 8060133158..3f03d50627 100644 --- a/components/esptool_py/CMakeLists.txt +++ b/components/esptool_py/CMakeLists.txt @@ -27,10 +27,10 @@ if(NOT BOOTLOADER_BUILD) set(ESPTOOLPY_BEFORE "${CONFIG_ESPTOOLPY_BEFORE}") set(ESPTOOLPY_AFTER "${CONFIG_ESPTOOLPY_AFTER}") set(ESPTOOLPY_CHIP "${target}") - if(CONFIG_ESPTOOLPY_WITH_STUB) - set(ESPTOOLPY_WITH_STUB true) - else() + if(CONFIG_ESPTOOLPY_NO_STUB) set(ESPTOOLPY_WITH_STUB false) + else() + set(ESPTOOLPY_WITH_STUB true) endif() if(CONFIG_SECURE_BOOT OR CONFIG_SECURE_FLASH_ENC_ENABLED) diff --git a/components/esptool_py/Kconfig.projbuild b/components/esptool_py/Kconfig.projbuild index 3069be8a69..74028a45ca 100644 --- a/components/esptool_py/Kconfig.projbuild +++ b/components/esptool_py/Kconfig.projbuild @@ -54,11 +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 + config ESPTOOLPY_NO_STUB + bool "Disable download stub" + default "n" + help + The flasher tool sends a precompiled download stub first by default. That stub allows things + like compressed downloads and more. Usually you should not need to disable that feature choice ESPTOOLPY_FLASHMODE prompt "Flash SPI mode" diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index c421458474..fb366f425d 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -153,7 +153,7 @@ else() list(APPEND esptool_flash_main_args "--after=${CONFIG_ESPTOOLPY_AFTER}") endif() -if(NOT CONFIG_ESPTOOLPY_WITH_STUB) +if(CONFIG_ESPTOOLPY_NO_STUB) list(APPEND esptool_flash_main_args "--no-stub") endif()