From cca3fa36ce9ec85ff5cbf8d96f0157362ec00b7c Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Wed, 8 Sep 2021 11:28:41 +0200 Subject: [PATCH] tools/espXX/Config.mk: Refactor the flash options. Signed-off-by: Abdelatif Guettouche --- tools/esp32/Config.mk | 8 ++++---- tools/esp32c3/Config.mk | 8 ++++---- tools/esp32s2/Config.mk | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/esp32/Config.mk b/tools/esp32/Config.mk index 71a033b1ec8..760577835be 100644 --- a/tools/esp32/Config.mk +++ b/tools/esp32/Config.mk @@ -58,6 +58,8 @@ else ESPTOOL_WRITEFLASH_OPTS := -fs $(FLASH_SIZE) -fm dio -ff $(FLASH_FREQ) endif +ESPTOOL_FLASH_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ) + # Configure the variables according to build environment ifdef ESPTOOL_BINDIR @@ -117,8 +119,7 @@ define MERGEBIN echo "Missing Flash memory size configuration for the ESP32 chip."; \ exit 1; \ fi - $(eval ESPTOOL_MERGEBIN_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)) - esptool.py -c esp32 merge_bin --output nuttx.merged.bin $(ESPTOOL_MERGEBIN_OPTS) $(ESPTOOL_BINS) + esptool.py -c esp32 merge_bin --output nuttx.merged.bin $(ESPTOOL_FLASH_OPTS) $(ESPTOOL_BINS) $(Q) echo nuttx.merged.bin >> nuttx.manifest $(Q) echo "Generated: nuttx.merged.bin" endef @@ -165,8 +166,7 @@ define ELF2IMAGE echo "Missing Flash memory size configuration for the ESP32 chip."; \ exit 1; \ fi - $(eval ESPTOOL_ELF2IMG_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)) - esptool.py -c esp32 elf2image $(ESPTOOL_ELF2IMG_OPTS) -o nuttx.bin nuttx + esptool.py -c esp32 elf2image $(ESPTOOL_FLASH_OPTS) -o nuttx.bin nuttx $(Q) echo "Generated: nuttx.bin (ESP32 compatible)" endef endif diff --git a/tools/esp32c3/Config.mk b/tools/esp32c3/Config.mk index 8030121ea63..440becbd5d5 100644 --- a/tools/esp32c3/Config.mk +++ b/tools/esp32c3/Config.mk @@ -58,6 +58,8 @@ else ESPTOOL_WRITEFLASH_OPTS := -fs $(FLASH_SIZE) -fm dio -ff $(FLASH_FREQ) endif +ESPTOOL_FLASH_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ) + ifdef ESPTOOL_BINDIR BL_OFFSET := 0x0 PT_OFFSET := 0x8000 @@ -85,8 +87,7 @@ define ELF2IMAGE echo "Missing Flash memory size configuration for the ESP32-C3 chip."; \ exit 1; \ fi - $(eval ESPTOOL_ELF2IMG_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)) - esptool.py -c esp32c3 elf2image $(ESPTOOL_ELF2IMG_OPTS) -o nuttx.bin nuttx + esptool.py -c esp32c3 elf2image $(ESPTOOL_FLASH_OPTS) -o nuttx.bin nuttx $(Q) echo "Generated: nuttx.bin (ESP32-C3 compatible)" endef @@ -103,8 +104,7 @@ define MERGEBIN echo "Missing Flash memory size configuration for the ESP32-C3 chip."; \ exit 1; \ fi - $(eval ESPTOOL_MERGEBIN_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)) - esptool.py -c esp32c3 merge_bin --output nuttx.merged.bin $(ESPTOOL_MERGEBIN_OPTS) $(ESPTOOL_BINS) + esptool.py -c esp32c3 merge_bin --output nuttx.merged.bin $(ESPTOOL_FLASH_OPTS) $(ESPTOOL_BINS) $(Q) echo nuttx.merged.bin >> nuttx.manifest $(Q) echo "Generated: nuttx.merged.bin" endef diff --git a/tools/esp32s2/Config.mk b/tools/esp32s2/Config.mk index f53f19e0955..51d38f256d9 100644 --- a/tools/esp32s2/Config.mk +++ b/tools/esp32s2/Config.mk @@ -58,6 +58,8 @@ else ESPTOOL_WRITEFLASH_OPTS := -fs $(FLASH_SIZE) -fm dio -ff $(FLASH_FREQ) endif +ESPTOOL_FLASH_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ) + ifdef ESPTOOL_BINDIR BL_OFFSET := 0x1000 PT_OFFSET := 0x8000 @@ -85,8 +87,7 @@ define ELF2IMAGE echo "Missing Flash memory size configuration for the ESP32-S2 chip."; \ exit 1; \ fi - $(eval ESPTOOL_ELF2IMG_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)) - esptool.py -c esp32s2 elf2image $(ESPTOOL_ELF2IMG_OPTS) -o nuttx.bin nuttx + esptool.py -c esp32s2 elf2image $(ESPTOOL_FLASH_OPTS) -o nuttx.bin nuttx $(Q) echo "Generated: nuttx.bin (ESP32-S2 compatible)" endef @@ -103,8 +104,7 @@ define MERGEBIN echo "Missing Flash memory size configuration for the ESP32-S2 chip."; \ exit 1; \ fi - $(eval ESPTOOL_MERGEBIN_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)) - esptool.py -c esp32s2 merge_bin --output nuttx.merged.bin $(ESPTOOL_MERGEBIN_OPTS) $(ESPTOOL_BINS) + esptool.py -c esp32s2 merge_bin --output nuttx.merged.bin $(ESPTOOL_FLASH_OPTS) $(ESPTOOL_BINS) $(Q) echo nuttx.merged.bin >> nuttx.manifest $(Q) echo "Generated: nuttx.merged.bin" endef