tools/esp32: Create option for merging all binaries into a single file
This is only useful when the path to binary files (e.g. bootloader) is provided via the ESPTOOL_BINDIR variable. Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
parent
26b4bb3075
commit
c0344d2273
@ -2,6 +2,15 @@
|
|||||||
# For a description of the syntax of this configuration file,
|
# For a description of the syntax of this configuration file,
|
||||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
#
|
#
|
||||||
|
config ESP32_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.
|
||||||
|
|
||||||
config ESP32_QEMU_IMAGE
|
config ESP32_QEMU_IMAGE
|
||||||
bool "ESP32 binary image for QEMU"
|
bool "ESP32 binary image for QEMU"
|
||||||
default n
|
default n
|
||||||
|
@ -104,6 +104,30 @@ else
|
|||||||
MK_QEMU_IMG=
|
MK_QEMU_IMG=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# MERGEBIN -- Merge raw binary files into a single file
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ESP32_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=<dir>"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
$(Q) if [ -z $(FLASH_SIZE) ]; then \
|
||||||
|
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)
|
||||||
|
$(Q) echo nuttx.merged.bin >> nuttx.manifest
|
||||||
|
$(Q) echo "Generated: nuttx.merged.bin"
|
||||||
|
endef
|
||||||
|
else
|
||||||
|
define MERGEBIN
|
||||||
|
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
# POSTBUILD -- Perform post build operations
|
# POSTBUILD -- Perform post build operations
|
||||||
|
|
||||||
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
|
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
|
||||||
@ -121,6 +145,7 @@ define POSTBUILD
|
|||||||
-S $(CONFIG_ESP32_OTA_SLOT_SIZE) \
|
-S $(CONFIG_ESP32_OTA_SLOT_SIZE) \
|
||||||
nuttx.bin nuttx.signed.bin
|
nuttx.bin nuttx.signed.bin
|
||||||
$(Q) echo "Generated: nuttx.signed.bin (MCUboot compatible)"
|
$(Q) echo "Generated: nuttx.signed.bin (MCUboot compatible)"
|
||||||
|
$(call MERGEBIN)
|
||||||
endef
|
endef
|
||||||
else
|
else
|
||||||
define POSTBUILD
|
define POSTBUILD
|
||||||
@ -139,6 +164,7 @@ define POSTBUILD
|
|||||||
$(eval ESPTOOL_ELF2IMG_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ))
|
$(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_ELF2IMG_OPTS) -o nuttx.bin nuttx
|
||||||
$(Q) echo "Generated: nuttx.bin (ESP32 compatible)"
|
$(Q) echo "Generated: nuttx.bin (ESP32 compatible)"
|
||||||
|
$(call MERGEBIN)
|
||||||
$(Q) $(MK_QEMU_IMG)
|
$(Q) $(MK_QEMU_IMG)
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user