diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/Kconfig b/boards/risc-v/esp32c3/esp32c3-devkit/Kconfig index 153e528920d..0ab22836c86 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/Kconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/Kconfig @@ -41,6 +41,15 @@ config ESP32C3_DEVKIT_RUN_IRAM bool "Run from IRAM" default n +config ESP32C3_MERGE_BINS + bool "Merge raw binary files into a single file" + default n + ---help--- + Merge the raw binary files into a single file for flashing to the + device. + This is only useful when the path to binary files (e.g. bootloader) + is provided via the ESPTOOL_BINDIR variable. + choice prompt "SPIFLASH File System" default ESP32C3_SPIFLASH_SMARTFS diff --git a/tools/esp32c3/Config.mk b/tools/esp32c3/Config.mk index 9952f702a95..0659b70dabc 100644 --- a/tools/esp32c3/Config.mk +++ b/tools/esp32c3/Config.mk @@ -61,12 +61,39 @@ else endif ifdef ESPTOOL_BINDIR - BL_OFFSET := 0x0 - PT_OFFSET := 0x8000 - BOOTLOADER := $(ESPTOOL_BINDIR)/bootloader-esp32c3.bin + BL_OFFSET := 0x0 + PT_OFFSET := 0x8000 + BOOTLOADER := $(ESPTOOL_BINDIR)/bootloader-esp32c3.bin PARTITION_TABLE := $(ESPTOOL_BINDIR)/partition-table-esp32c3.bin - FLASH_BL := $(BL_OFFSET) $(BOOTLOADER) - FLASH_PT := $(PT_OFFSET) $(PARTITION_TABLE) + FLASH_BL := $(BL_OFFSET) $(BOOTLOADER) + FLASH_PT := $(PT_OFFSET) $(PARTITION_TABLE) + ESPTOOL_BINS := $(FLASH_BL) $(FLASH_PT) +endif + +ESPTOOL_BINS += 0x10000 nuttx.bin + +# MERGEBIN -- Merge raw binary files into a single file + +ifeq ($(CONFIG_ESP32C3_MERGE_BINS),y) +define MERGEBIN + $(Q) if [ -z $(ESPTOOL_BINDIR) ]; then \ + echo "MERGEBIN error: Missing argument for binary files directory."; \ + echo "USAGE: make ESPTOOL_BINDIR=