From e1e5fb03c5a2295b5c4981b545853af5da33e2fa Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Wed, 25 May 2022 15:42:13 +0300 Subject: [PATCH] Do not append digest to the bootloader bin Allows the bootloaders to be flashed with esptool v4 on devices with different size flash --- .gitignore | 1 + tools/copy-bootloader.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b74965aea..fd727b3f5 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ sdkconfig.old version.txt components/arduino_tinyusb/tinyusb/ dependencies.lock +tools/esptool/ diff --git a/tools/copy-bootloader.sh b/tools/copy-bootloader.sh index d3df625f7..53b10b39e 100755 --- a/tools/copy-bootloader.sh +++ b/tools/copy-bootloader.sh @@ -10,4 +10,11 @@ source ./tools/config.sh echo "Copying bootloader: $AR_SDK/bin/bootloader_$BOOTCONF.bin" mkdir -p "$AR_SDK/bin" -cp "build/bootloader/bootloader.bin" "$AR_SDK/bin/bootloader_$BOOTCONF.bin" + +# Workaround for getting the bootloaders to be flashable with esptool v4.x +# It might still be needed for IDF5, but using the included esptool instead +#cp "build/bootloader/bootloader.bin" "$AR_SDK/bin/bootloader_$BOOTCONF.bin" +if [ ! -e "tools/esptool" ]; then + git clone https://github.com/espressif/esptool tools/esptool +fi +./tools/esptool/esptool.py --chip "$IDF_TARGET" elf2image --dont-append-digest "build/bootloader/bootloader.elf" -o "$AR_SDK/bin/bootloader_$BOOTCONF.bin"