From be1764043dc78abc20c8ff889ef7e87188e2226c Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 1 Aug 2022 15:08:41 +0200 Subject: [PATCH 1/6] makefile/tools/esptool: use dio instead of qout or qio flash mode If Quad SPI modes qout or qio are set by variable FLASH_MODE, esptool.py has to be called with parameter `--flash_mode dio` so that the first stage bootloader is always using Dual SPI mode. --- makefiles/tools/esptool.inc.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/makefiles/tools/esptool.inc.mk b/makefiles/tools/esptool.inc.mk index 022b731f50f2..ef632d35db5c 100644 --- a/makefiles/tools/esptool.inc.mk +++ b/makefiles/tools/esptool.inc.mk @@ -8,6 +8,12 @@ ifeq ($(CPU),esp8266) # Full path to the bootloader binary. In the ESP32 case this is set by the # esp_bootloader module. BOOTLOADER_BIN ?= $(RIOTCPU)/$(CPU)/bin/bootloader$(BOOTLOADER_COLOR)$(BOOTLOADER_INFO).bin +else + # ESP-IDF uses dio as flash mode for esptool.py when qout or qio mode are + # configured to always boot in dual SPI mode + ifneq (,$(filter qout qio,$(FLASH_MODE))) + FLASH_MODE = dio + endif endif ESPTOOL ?= $(RIOTTOOLS)/esptools/esptool.py From cd3c053d3209ae08769358a34baf209687623575 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 1 Aug 2022 15:11:11 +0200 Subject: [PATCH 2/6] cpu/esp32: qout mode is no longer required for SPI RAM --- cpu/esp_common/Makefile.include | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cpu/esp_common/Makefile.include b/cpu/esp_common/Makefile.include index ba6455ef4cc8..4b23cb255bd8 100644 --- a/cpu/esp_common/Makefile.include +++ b/cpu/esp_common/Makefile.include @@ -78,14 +78,6 @@ ifneq (,$(filter lwip,$(USEMODULE))) CFLAGS += -DTCPIP_THREAD_PRIO=5 endif -# if SPI RAM is enabled, the qout flash mode has to be used -_FLASH_MODE_PREV := $(FLASH_MODE) -ifneq (,$(filter esp_spi_ram,$(USEMODULE))) - FLASH_MODE = qout -else - FLASH_MODE = $(_FLASH_MODE_PREV) -endif - # set CFLAG for the correspondant FLASH_MODE CFLAGS += $(if $(findstring qout,$(FLASH_MODE)),-DFLASH_MODE_QOUT=1) CFLAGS += $(if $(findstring qio,$(FLASH_MODE)),-DFLASH_MODE_QIO=1) From b4fafef6e7e6b99f13e7b2163bd3e19fae7a52b8 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 1 Aug 2022 15:17:33 +0200 Subject: [PATCH 3/6] cpu/esp_common: replace FLASH_MODE_* by CONFIG_*FLASHMODE_* defines The former FLASH_MODE_{DOUT,DIO,QOUT,QIO} defines are replaced by the corresponding CONFIG_FLASHMODE_{DOUT,DIO,QOUT,QIO} and CONFIG_ESPTOOLPY_FLASHMODE_{DOUT,DIO,QOUT,QIO} as used by the ESP-IDF. This is also needed for the migration of defining flash mode in Kconfig. --- cpu/esp32/bootloader/Makefile | 2 ++ cpu/esp32/bootloader/sdkconfig.h | 22 ++++++++-------------- cpu/esp32/include/sdkconfig_esp32.h | 22 ++++++---------------- cpu/esp32/periph/gpio_arch_esp32.c | 2 +- cpu/esp8266/periph/gpio.c | 2 +- cpu/esp_common/Makefile.include | 21 ++++++++++++++++----- 6 files changed, 34 insertions(+), 37 deletions(-) diff --git a/cpu/esp32/bootloader/Makefile b/cpu/esp32/bootloader/Makefile index e1607b5be34c..bee981bcfba1 100644 --- a/cpu/esp32/bootloader/Makefile +++ b/cpu/esp32/bootloader/Makefile @@ -155,6 +155,8 @@ INCLUDES = \ -I$(ESP32_SDK_DIR)/components/spi_flash/include/spi_flash \ # +# include CFLAGS from cpu/esp_common/Makefile.include including the defines of +# CONFIG_ESPTOOLPY_FLASHFREQ_* and CONFIG_FLASHMODE_* CFLAGS = -include '$(RIOTBUILD_CONFIG_HEADER_C)' \ ifneq (,$(filter riscv32%,$(TARGET_ARCH))) diff --git a/cpu/esp32/bootloader/sdkconfig.h b/cpu/esp32/bootloader/sdkconfig.h index 27fead5ab1ea..a627e97f1e66 100644 --- a/cpu/esp32/bootloader/sdkconfig.h +++ b/cpu/esp32/bootloader/sdkconfig.h @@ -63,20 +63,14 @@ extern "C" { #endif #endif -#if FLASH_MODE_QIO -#define CONFIG_FLASHMODE_QIO 1 -#define CONFIG_ESPTOOLPY_FLASHMODE_QIO 1 -#elif FLASH_MODE_QOUT -#define CONFIG_FLASHMODE_QOUT 1 -#define CONFIG_ESPTOOLPY_FLASHMODE_QOUT 1 -#elif FLASH_MODE_DIO -#define CONFIG_FLASHMODE_DIO 1 -#define CONFIG_ESPTOOLPY_FLASHMODE_DIO 1 -#elif FLASH_MODE_DOUT -#define CONFIG_FLASHMODE_DOUT 1 -#define CONFIG_ESPTOOLPY_FLASHMODE_DOUT 1 -#else -#error "Unknown flash mode selected." +/** + * Serial flasher config (defined by CFLAGS, only sanity check here) + */ +#if !defined(CONFIG_FLASHMODE_DOUT) && \ + !defined(CONFIG_FLASHMODE_DIO) && \ + !defined(CONFIG_FLASHMODE_QOUT) && \ + !defined(CONFIG_FLASHMODE_QIO) +#error "Flash mode not configured" #endif /* diff --git a/cpu/esp32/include/sdkconfig_esp32.h b/cpu/esp32/include/sdkconfig_esp32.h index 838e754af40c..628b1fffe662 100644 --- a/cpu/esp32/include/sdkconfig_esp32.h +++ b/cpu/esp32/include/sdkconfig_esp32.h @@ -183,23 +183,13 @@ extern "C" { #define CONFIG_ETH_DMA_TX_BUFFER_NUM 10 /** - * Serial flasher config (DO NOT CHANGE) + * Serial flasher config (defined by CFLAGS, only sanity check here) */ -#define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 -#if defined(FLASH_MODE_QIO) -#define CONFIG_FLASHMODE_QIO 1 -#define CONFIG_ESPTOOLPY_FLASHMODE_QIO 1 -#elif defined(FLASH_MODE_QOUT) -#define CONFIG_FLASHMODE_QOUT 1 -#define CONFIG_ESPTOOLPY_FLASHMODE_QOUT 1 -#elif defined(FLASH_MODE_DIO) -#define CONFIG_FLASHMODE_DIO 1 -#define CONFIG_ESPTOOLPY_FLASHMODE_DIO 1 -#elif defined(FLASH_MODE_DOUT) -#define CONFIG_FLASHMODE_DOUT 1 -#define CONFIG_ESPTOOLPY_FLASHMODE_DOUT 1 -#else -#error "Unknown flash mode selected." +#if !defined(CONFIG_FLASHMODE_DOUT) && \ + !defined(CONFIG_FLASHMODE_DIO) && \ + !defined(CONFIG_FLASHMODE_QOUT) && \ + !defined(CONFIG_FLASHMODE_QIO) +#error "Flash mode not configured" #endif /** diff --git a/cpu/esp32/periph/gpio_arch_esp32.c b/cpu/esp32/periph/gpio_arch_esp32.c index 034af6164554..ba7a2c06adcd 100644 --- a/cpu/esp32/periph/gpio_arch_esp32.c +++ b/cpu/esp32/periph/gpio_arch_esp32.c @@ -83,7 +83,7 @@ gpio_pin_usage_t _gpio_pin_usage [GPIO_PIN_NUMOF] = { _SPIF, /* GPIO6 is used as direct I/O SPI SCK for Flash */ _SPIF, /* GPIO7 is used as direct I/O SPI MISO for Flash */ _SPIF, /* GPIO8 is used as direct I/O SPI MOSI for Flash */ - #if defined(FLASH_MODE_QIO) || defined(FLASH_MODE_QOUT) + #if defined(CONFIG_FLASHMODE_QIO) || defined(CONFIG_FLASHMODE_QOUT) /* in qio and qout mode these pins are used in Flash */ _SPIF, /* GPIO9 is used as direct I/O SPI HD for Flash */ _SPIF, /* GPIO10 is used as direct I/O SPI WP for Flash */ diff --git a/cpu/esp8266/periph/gpio.c b/cpu/esp8266/periph/gpio.c index 0bedcfd360d5..1644670965eb 100644 --- a/cpu/esp8266/periph/gpio.c +++ b/cpu/esp8266/periph/gpio.c @@ -62,7 +62,7 @@ gpio_pin_usage_t _gpio_pin_usage [GPIO_PIN_NUMOF] = _SPIF, /* gpio6 SPI flash CLK */ _SPIF, /* gpio7 SPI flash MISO */ _SPIF, /* gpio8 SPI flash MOSI */ - #if defined(FLASH_MODE_QIO) || defined(FLASH_MODE_QOUT) + #if defined(CONFIG_FLASHMODE_QIO) || defined(CONFIG_FLASHMODE_QOUT) _SPIF, /* gpio9 SPI flash HD (qio/qout flash mode) */ _SPIF, /* gpio10 SPI flash WP (qio/qout flash mode) */ #else diff --git a/cpu/esp_common/Makefile.include b/cpu/esp_common/Makefile.include index 4b23cb255bd8..15538f9a6916 100644 --- a/cpu/esp_common/Makefile.include +++ b/cpu/esp_common/Makefile.include @@ -78,11 +78,22 @@ ifneq (,$(filter lwip,$(USEMODULE))) CFLAGS += -DTCPIP_THREAD_PRIO=5 endif -# set CFLAG for the correspondant FLASH_MODE -CFLAGS += $(if $(findstring qout,$(FLASH_MODE)),-DFLASH_MODE_QOUT=1) -CFLAGS += $(if $(findstring qio,$(FLASH_MODE)),-DFLASH_MODE_QIO=1) -CFLAGS += $(if $(findstring dio,$(FLASH_MODE)),-DFLASH_MODE_DIO=1) -CFLAGS += $(if $(findstring dout,$(FLASH_MODE)),-DFLASH_MODE_DOUT=1) +# extend CFLAGS by the corresponding CONFIG_FLASHMODE_* defines +ifeq (dout,$(FLASH_MODE)) + CFLAGS += -DCONFIG_FLASHMODE_DOUT + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHMODE_DOUT +else ifeq (dio,$(FLASH_MODE)) + CFLAGS += -DCONFIG_FLASHMODE_DIO + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHMODE_DIO +else ifeq (qout,$(FLASH_MODE)) + CFLAGS += -DCONFIG_FLASHMODE_QOUT + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHMODE_QUOT +else ifeq (qio,$(FLASH_MODE)) + CFLAGS += -DCONFIG_FLASHMODE_QIO + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHMODE_QIO +else + $(error Undefined FLASH_MODE, possible values are: dout, dio, qout and qio) +endif ARCHIVES += -lg -lc From ae16753f6f2e9a1e7e6b01ac924adde386c84e8e Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Tue, 2 Aug 2022 07:22:23 +0200 Subject: [PATCH 4/6] boards/esp*: replace FLASH_MODE_* by CONFIG_*FLASHMODE_* defines The former FLASH_MODE_{DOUT,DIO,QOUT,QIO} defines are replaced by the corresponding CONFIG_FLASHMODE_{DOUT,DIO,QOUT,QIO} and CONFIG_ESPTOOLPY_FLASHMODE_{DOUT,DIO,QOUT,QIO} as used by the ESP-IDF. This is also needed for the migration of defining flash mode in Kconfig. --- boards/esp32-heltec-lora32-v2/include/periph_conf.h | 2 +- boards/esp32-mh-et-live-minikit/include/periph_conf.h | 2 +- boards/esp32-olimex-evb/include/periph_conf.h | 2 +- boards/esp32-wroom-32/include/periph_conf.h | 2 +- boards/esp8266-esp-12x/include/arduino_board.h | 2 +- boards/esp8266-olimex-mod/include/arduino_board.h | 2 +- boards/esp8266-sparkfun-thing/include/arduino_board.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/esp32-heltec-lora32-v2/include/periph_conf.h b/boards/esp32-heltec-lora32-v2/include/periph_conf.h index 3655b5eb8411..5ec6a49088ba 100644 --- a/boards/esp32-heltec-lora32-v2/include/periph_conf.h +++ b/boards/esp32-heltec-lora32-v2/include/periph_conf.h @@ -152,7 +152,7 @@ #define UART0_TXD GPIO1 /**< direct I/O pin for UART_DEV(0) TxD, can't be changed */ #define UART0_RXD GPIO3 /**< direct I/O pin for UART_DEV(0) RxD, can't be changed */ -#if FLASH_MODE_DOUT || FLASH_MODE_DIO || DOXYGEN +#if CONFIG_FLASHMODE_DOUT || CONFIG_FLASHMODE_DIO || DOXYGEN #ifndef UART1_TXD #define UART1_TXD GPIO10 /**< direct I/O pin for UART_DEV(1) TxD */ #endif diff --git a/boards/esp32-mh-et-live-minikit/include/periph_conf.h b/boards/esp32-mh-et-live-minikit/include/periph_conf.h index 15fe2760aec1..ab19f89237e0 100644 --- a/boards/esp32-mh-et-live-minikit/include/periph_conf.h +++ b/boards/esp32-mh-et-live-minikit/include/periph_conf.h @@ -145,7 +145,7 @@ #define UART0_TXD GPIO1 /**< direct I/O pin for UART_DEV(0) TxD, can't be changed */ #define UART0_RXD GPIO3 /**< direct I/O pin for UART_DEV(0) RxD, can't be changed */ -#if FLASH_MODE_DOUT || FLASH_MODE_DIO || DOXYGEN +#if CONFIG_FLASHMODE_DOUT || CONFIG_FLASHMODE_DIO || DOXYGEN #ifndef UART1_TXD #define UART1_TXD GPIO10 /**< direct I/O pin for UART_DEV(1) TxD */ #endif diff --git a/boards/esp32-olimex-evb/include/periph_conf.h b/boards/esp32-olimex-evb/include/periph_conf.h index 3f3cfe610d65..6d921cf739ea 100644 --- a/boards/esp32-olimex-evb/include/periph_conf.h +++ b/boards/esp32-olimex-evb/include/periph_conf.h @@ -129,7 +129,7 @@ extern "C" { * as PWM channels with `PWM_DEV(0)`. */ #ifndef PWM0_GPIOS -#if FLASH_MODE_DOUT || FLASH_MODE_DIO || DOXYGEN +#if CONFIG_FLASHMODE_DOUT || CONFIG_FLASHMODE_DIO || DOXYGEN #define PWM0_GPIOS { GPIO9, GPIO10 } #else #error Configuration problem: Flash mode qio or qout is used, \ diff --git a/boards/esp32-wroom-32/include/periph_conf.h b/boards/esp32-wroom-32/include/periph_conf.h index 98b3ab80e3b9..8a245a7e4b47 100644 --- a/boards/esp32-wroom-32/include/periph_conf.h +++ b/boards/esp32-wroom-32/include/periph_conf.h @@ -182,7 +182,7 @@ extern "C" { #define UART0_TXD GPIO1 /**< direct I/O pin for UART_DEV(0) TxD, can't be changed */ #define UART0_RXD GPIO3 /**< direct I/O pin for UART_DEV(0) RxD, can't be changed */ -#if FLASH_MODE_DOUT || FLASH_MODE_DIO || DOXYGEN +#if CONFIG_FLASHMODE_DOUT || CONFIG_FLASHMODE_DIO || DOXYGEN #ifndef UART1_TXD #define UART1_TXD GPIO10 /**< direct I/O pin for UART_DEV(1) TxD */ #endif diff --git a/boards/esp8266-esp-12x/include/arduino_board.h b/boards/esp8266-esp-12x/include/arduino_board.h index 07465013ec9d..c8e2e62dfb83 100644 --- a/boards/esp8266-esp-12x/include/arduino_board.h +++ b/boards/esp8266-esp-12x/include/arduino_board.h @@ -39,7 +39,7 @@ static const gpio_t arduino_pinmap[] = { GPIO3, /* ARDUINO_PIN_1 (TxD) */ GPIO0, /* ARDUINO_PIN_2 */ GPIO2, /* ARDUINO_PIN_3 */ - #if defined(FLASH_MODE_QIO) || defined(FLASH_MODE_QOUT) + #if defined(CONFIG_FLASHMODE_QIO) || defined(CONFIG_FLASHMODE_QOUT) GPIO9, /* ARDUINO_PIN_4 */ GPIO10, /* ARDUINO_PIN_5 */ #else diff --git a/boards/esp8266-olimex-mod/include/arduino_board.h b/boards/esp8266-olimex-mod/include/arduino_board.h index 7da0540f29b2..188618a3f356 100644 --- a/boards/esp8266-olimex-mod/include/arduino_board.h +++ b/boards/esp8266-olimex-mod/include/arduino_board.h @@ -37,7 +37,7 @@ static const gpio_t arduino_pinmap[] = { GPIO3, /* ARDUINO_PIN_1 (TxD) */ GPIO0, /* ARDUINO_PIN_2 */ GPIO4, /* ARDUINO_PIN_3 */ - #if defined(FLASH_MODE_QIO) || defined(FLASH_MODE_QOUT) + #if defined(CONFIG_FLASHMODE_QIO) || defined(CONFIG_FLASHMODE_QOUT) GPIO9, /* ARDUINO_PIN_4 */ GPIO10, /* ARDUINO_PIN_5 */ #else diff --git a/boards/esp8266-sparkfun-thing/include/arduino_board.h b/boards/esp8266-sparkfun-thing/include/arduino_board.h index c7949427be13..7a65bf89d6e5 100644 --- a/boards/esp8266-sparkfun-thing/include/arduino_board.h +++ b/boards/esp8266-sparkfun-thing/include/arduino_board.h @@ -37,7 +37,7 @@ static const gpio_t arduino_pinmap[] = { GPIO3, /* ARDUINO_PIN_1 (TxD) */ GPIO0, /* ARDUINO_PIN_2 */ GPIO4, /* ARDUINO_PIN_3 */ - #if defined(FLASH_MODE_QIO) || defined(FLASH_MODE_QOUT) + #if defined(CONFIG_FLASHMODE_QIO) || defined(CONFIG_FLASHMODE_QOUT) GPIO9, /* ARDUINO_PIN_4 */ GPIO10, /* ARDUINO_PIN_5 */ #else From c8de46ddee49328afd5f9b123e8f3ac5d829dac5 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 1 Aug 2022 15:22:16 +0200 Subject: [PATCH 5/6] cpu/{esp_common,esp8266,esp32}: fix default FLASH_* configuration This commit includes the following changes: - the default flash mode in bootloader should be dio and not dout - the default flash configuration for ESP32 has to be exported to be also visible in cpu/esp32/bootloader/Makefile - the comments in cpu/esp8266/Makefile.include have to be removed so that the flash configuration do not contain trailing white spaces --- cpu/esp32/Makefile.include | 15 +++++++++------ cpu/esp32/bootloader/Makefile | 6 +++--- cpu/esp8266/Makefile.include | 5 +++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index 4670311f957b..d4204453bd7d 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -1,14 +1,17 @@ # ESP32x specific flashing options FLASH_CHIP = $(CPU_FAM) + +# Serial flasher config as used by the ESP-IDF, be careful when overriding them. +# They have to be exported to use same values in subsequent makefiles. ifeq (esp32,$(CPU_FAM)) - FLASH_MODE ?= dout - FLASH_FREQ = 40m # DO NOT CHANGE - FLASH_SIZE ?= 4 + export FLASH_MODE ?= dout + export FLASH_FREQ ?= 40m + export FLASH_SIZE ?= 2 BOOTLOADER_POS = 0x1000 else ifeq (esp32c3,$(CPU_FAM)) - FLASH_MODE ?= dio - FLASH_FREQ = 80m # DO NOT CHANGE - FLASH_SIZE ?= 4 + export FLASH_MODE ?= dio + export FLASH_FREQ ?= 80m + export FLASH_SIZE ?= 2 BOOTLOADER_POS = 0x0000 else $(error Unkwnown ESP32x SoC variant (family)) diff --git a/cpu/esp32/bootloader/Makefile b/cpu/esp32/bootloader/Makefile index bee981bcfba1..e45c87c4398e 100644 --- a/cpu/esp32/bootloader/Makefile +++ b/cpu/esp32/bootloader/Makefile @@ -315,9 +315,9 @@ FLASH_CHIP = $(CPU_FAM) ESPTOOL ?= $(RIOTTOOLS)/esptools/esptool_v3.2.py # TODO: These should be exported/configurable from the app side. That would # require to export these values. -FLASH_MODE ?= dout -FLASH_FREQ ?= 40m -FLASH_SIZE ?= 4 +FLASH_MODE ?= dio # ESP-IDF uses dio as default flash mode for the bootloader +FLASH_FREQ ?= 40m # lowest frequency all ESP32x SoC support +FLASH_SIZE ?= 2 # smallesrt size all ESP32x SoC support # We use esptool to extract a version 1 app from the bootloader.elf. This is # like the regular objdump binary file but it contains a 16 byte header which diff --git a/cpu/esp8266/Makefile.include b/cpu/esp8266/Makefile.include index 72afb252e75c..daa32a61cd6d 100644 --- a/cpu/esp8266/Makefile.include +++ b/cpu/esp8266/Makefile.include @@ -4,10 +4,11 @@ CFLAGS_OPT ?= -O2 # ESP8266 specific flashing options +# DO NOT CHANGE, ESP8266/ESP8285 modules only work with dout and 26m FLASH_CHIP = esp8266 FLASH_OPTS = --version 3 -FLASH_MODE = dout # DO NOT CHANGE, ESP8266/ESP8285 modules only work with dout -FLASH_FREQ = 26m # DO NOT CHANGE +FLASH_MODE = dout +FLASH_FREQ = 26m FLASH_SIZE ?= 1 BOOTLOADER_POS = 0x0000 From da39354ae559bf3d71286bab5be7f2dcab88054c Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 1 Aug 2022 15:23:47 +0200 Subject: [PATCH 6/6] cpu/esp32: set CONFIG_ESPTOOL_FLASH_FREQ from FLASH_FREQ CONFIG_ESPTOOL_FLASH_FREQ_* defines are used in ESP-IDF to select the right SPI clock speed for flash. --- cpu/esp32/Makefile.include | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index d4204453bd7d..367bec13879c 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -115,6 +115,19 @@ CFLAGS += -DCONFIG_IDF_TARGET_$(call uppercase_and_underscore,$(CPU_FAM)) CFLAGS += -DESP_PLATFORM CFLAGS += -DLOG_TAG_IN_BRACKETS +# extend CFLAGS by the corresponding FLASH_FREQ +ifeq (20m,$(FLASH_FREQ)) + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHFREQ_20M +else ifeq (26m,$(FLASH_FREQ)) + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHFREQ_26M +else ifeq (40m,$(FLASH_FREQ)) + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHFREQ_40M +else ifeq (80m,$(FLASH_FREQ)) + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHFREQ_80M +else ifeq (120m,$(FLASH_FREQ)) + CFLAGS += -DCONFIG_ESPTOOLPY_FLASHFREQ_120M +endif + # shortcuts used by ESP-IDF CFLAGS += -Dasm=__asm CFLAGS += -Dtypeof=__typeof__