Skip to content

Commit

Permalink
fix(esptool): Bump esptool version to 4.9.dev1 on 3.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasssvaz committed Nov 5, 2024
1 parent dc8e81d commit 6059491
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 42 deletions.
70 changes: 35 additions & 35 deletions package/package_esp32_index.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{
"packager": "esp32",
"name": "esptool_py",
"version": "4.6"
"version": "4.9.dev1"
},
{
"packager": "esp32",
Expand Down Expand Up @@ -594,56 +594,56 @@
},
{
"name": "esptool_py",
"version": "4.6",
"version": "4.9.dev1",
"systems": [
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.9/esptool-v4.6-src.tar.gz",
"archiveFileName": "esptool-v4.6-src.tar.gz",
"checksum": "SHA-256:22f9bad0cd1cea14e554ac1f4a6d8f67415ff7029a66ce9130756276e7264e5a",
"size": "99141"
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.1.0-RC2/esptool-v4.9.dev1-linux-amd64.tar.gz",
"archiveFileName": "esptool-v4.9.dev1-linux-amd64.tar.gz",
"checksum": "SHA-256:21f6c2155f0ec9e5b475c8a4bf59803d8cfb4d74f4e488a80f97da3d77542bba",
"size": "64632960"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.9/esptool-v4.6-src.tar.gz",
"archiveFileName": "esptool-v4.6-src.tar.gz",
"checksum": "SHA-256:22f9bad0cd1cea14e554ac1f4a6d8f67415ff7029a66ce9130756276e7264e5a",
"size": "99141"
"host": "arm-linux-gnueabihf",
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.1.0-RC2/esptool-v4.9.dev1-linux-arm32.tar.gz",
"archiveFileName": "esptool-v4.9.dev1-linux-arm32.tar.gz",
"checksum": "SHA-256:818477f10814b2bd82078fc6695663ac84220d3947722ce1880a6c867d5c2997",
"size": "46042432"
},
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.9/esptool-v4.6-src.tar.gz",
"archiveFileName": "esptool-v4.6-src.tar.gz",
"checksum": "SHA-256:22f9bad0cd1cea14e554ac1f4a6d8f67415ff7029a66ce9130756276e7264e5a",
"size": "99141"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.9/esptool-v4.6-src.tar.gz",
"archiveFileName": "esptool-v4.6-src.tar.gz",
"checksum": "SHA-256:22f9bad0cd1cea14e554ac1f4a6d8f67415ff7029a66ce9130756276e7264e5a",
"size": "99141"
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.1.0-RC2/esptool-v4.9.dev1-linux-arm64.tar.gz",
"archiveFileName": "esptool-v4.9.dev1-linux-arm64.tar.gz",
"checksum": "SHA-256:b377a130a4dca58f3a31c66ed0b9858cc057c998741222cccdb6e5a724651a1f",
"size": "54459357"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.9/esptool-v4.6-macos.tar.gz",
"archiveFileName": "esptool-v4.6-macos.tar.gz",
"checksum": "SHA-256:885ec69fcffdcb9e7c6eacd2589f13a45ce6bcb6742bea368ec3a73bcca6dd59",
"size": "5851297"
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.1.0-RC2/esptool-v4.9.dev1-macos-amd64.tar.gz",
"archiveFileName": "esptool-v4.9.dev1-macos-amd64.tar.gz",
"checksum": "SHA-256:25cc246b20230afc287ffdfe95f57b3fab23cec88a6dde3b5092ec05926b5431",
"size": "32386336"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.9/esptool-v4.6-win64.zip",
"archiveFileName": "esptool-v4.6-win64.zip",
"checksum": "SHA-256:c7c68cd1aa520cbfce488ff6a77818ece272272eb012831b9d9ab1280a7c393f",
"size": "6638480"
"host": "arm64-apple-darwin",
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.1.0-RC2/esptool-v4.9.dev1-macos-arm64.tar.gz",
"archiveFileName": "esptool-v4.9.dev1-macos-arm64.tar.gz",
"checksum": "SHA-256:b845d678db1d1559d82894e68366683a7fc3809371a5f5def67c30c9dee15912",
"size": "29841092"
},
{
"host": "i686-mingw32",
"url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.9/esptool-v4.6-win64.zip",
"archiveFileName": "esptool-v4.6-win64.zip",
"checksum": "SHA-256:c7c68cd1aa520cbfce488ff6a77818ece272272eb012831b9d9ab1280a7c393f",
"size": "6638480"
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.1.0-RC2/esptool-v4.9.dev1-win64.zip",
"archiveFileName": "esptool-v4.9.dev1-win64.zip",
"checksum": "SHA-256:f649a212e086b06ca6ee595feffd7a4706696ea43a2cd1a4f49352829e8ac96e",
"size": "35812159"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.1.0-RC2/esptool-v4.9.dev1-win64.zip",
"archiveFileName": "esptool-v4.9.dev1-win64.zip",
"checksum": "SHA-256:f649a212e086b06ca6ee595feffd7a4706696ea43a2cd1a4f49352829e8ac96e",
"size": "35812159"
}
]
},
Expand Down
7 changes: 0 additions & 7 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ tools.riscv32-esp-elf-gdb.path={runtime.platform.path}/tools/riscv32-esp-elf-gdb

tools.esptool_py.path={runtime.platform.path}/tools/esptool
tools.esptool_py.cmd=esptool
tools.esptool_py.cmd.linux=esptool.py
tools.esptool_py.cmd.windows=esptool.exe

tools.esptool_py.network_cmd=python3 "{runtime.platform.path}/tools/espota.py" -r
Expand Down Expand Up @@ -123,7 +122,6 @@ recipe.hooks.prebuild.3.pattern.windows=cmd /c if not exist "{build.path}\partit
# Check if custom bootloader exist: source > variant > build.boot
recipe.hooks.prebuild.4.pattern_args=--chip {build.mcu} elf2image --flash_mode {build.flash_mode} --flash_freq {build.img_freq} --flash_size {build.flash_size} -o
recipe.hooks.prebuild.4.pattern=/usr/bin/env bash -c "[ -f "{build.source.path}"/bootloader.bin ] && cp -f "{build.source.path}"/bootloader.bin "{build.path}"/{build.project_name}.bootloader.bin || ( [ -f "{build.variant.path}"/{build.custom_bootloader}.bin ] && cp "{build.variant.path}"/{build.custom_bootloader}.bin "{build.path}"/{build.project_name}.bootloader.bin || "{tools.esptool_py.path}"/{tools.esptool_py.cmd} {recipe.hooks.prebuild.4.pattern_args} "{build.path}"/{build.project_name}.bootloader.bin "{compiler.sdk.path}"/bin/bootloader_{build.boot}_{build.boot_freq}.elf )"
recipe.hooks.prebuild.4.pattern.linux=/usr/bin/env bash -c "[ -f "{build.source.path}"/bootloader.bin ] && cp -f "{build.source.path}"/bootloader.bin "{build.path}"/{build.project_name}.bootloader.bin || ( [ -f "{build.variant.path}"/{build.custom_bootloader}.bin ] && cp "{build.variant.path}"/{build.custom_bootloader}.bin "{build.path}"/{build.project_name}.bootloader.bin || python3 "{tools.esptool_py.path}"/{tools.esptool_py.cmd} {recipe.hooks.prebuild.4.pattern_args} "{build.path}"/{build.project_name}.bootloader.bin "{compiler.sdk.path}"/bin/bootloader_{build.boot}_{build.boot_freq}.elf )"
recipe.hooks.prebuild.4.pattern.windows=cmd /c IF EXIST "{build.source.path}\bootloader.bin" ( COPY /y "{build.source.path}\bootloader.bin" "{build.path}\{build.project_name}.bootloader.bin" ) ELSE ( IF EXIST "{build.variant.path}\{build.custom_bootloader}.bin" ( COPY "{build.variant.path}\{build.custom_bootloader}.bin" "{build.path}\{build.project_name}.bootloader.bin" ) ELSE ( "{tools.esptool_py.path}\{tools.esptool_py.cmd}" {recipe.hooks.prebuild.4.pattern_args} "{build.path}\{build.project_name}.bootloader.bin" "{compiler.sdk.path}\bin\bootloader_{build.boot}_{build.boot_freq}.elf" ) )

# Check if custom build options exist in the sketch folder
Expand Down Expand Up @@ -168,7 +166,6 @@ recipe.objcopy.partitions.bin.pattern={tools.gen_esp32part.cmd} -q "{build.path}
## Create bin
recipe.objcopy.bin.pattern_args=--chip {build.mcu} elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.img_freq}" --flash_size "{build.flash_size}" --elf-sha256-offset 0xb0 -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf"
recipe.objcopy.bin.pattern="{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.objcopy.bin.pattern_args}
recipe.objcopy.bin.pattern.linux=python3 "{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.objcopy.bin.pattern_args}

## Create Insights Firmware Package
recipe.hooks.objcopy.postobjcopy.1.pattern_args={build.path} {build.project_name} "{build.source.path}"
Expand All @@ -182,7 +179,6 @@ recipe.hooks.objcopy.postobjcopy.2.pattern.windows=cmd /c if exist "{build.path}
# Create merged binary
recipe.hooks.objcopy.postobjcopy.3.pattern_args=--chip {build.mcu} merge_bin -o "{build.path}/{build.project_name}.merged.bin" --fill-flash-size {build.flash_size} --flash_mode keep --flash_freq keep --flash_size keep {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x10000 "{build.path}/{build.project_name}.bin"
recipe.hooks.objcopy.postobjcopy.3.pattern="{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.hooks.objcopy.postobjcopy.3.pattern_args}
recipe.hooks.objcopy.postobjcopy.3.pattern.linux=python3 "{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.hooks.objcopy.postobjcopy.3.pattern_args}

## Save bin
recipe.output.tmp_file={build.project_name}.bin
Expand Down Expand Up @@ -292,15 +288,13 @@ tools.esptool_py.upload.params.verbose=
tools.esptool_py.upload.params.quiet=
tools.esptool_py.upload.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash {upload.erase_cmd} -z --flash_mode keep --flash_freq keep --flash_size keep {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x10000 "{build.path}/{build.project_name}.bin" {upload.extra_flags}
tools.esptool_py.upload.pattern="{path}/{cmd}" {upload.pattern_args}
tools.esptool_py.upload.pattern.linux=python3 "{path}/{cmd}" {upload.pattern_args}

## Program Application
## -------------------
tools.esptool_py.program.params.verbose=
tools.esptool_py.program.params.quiet=
tools.esptool_py.program.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash -z --flash_mode keep --flash_freq keep --flash_size keep 0x10000 "{build.path}/{build.project_name}.bin"
tools.esptool_py.program.pattern="{path}/{cmd}" {program.pattern_args}
tools.esptool_py.program.pattern.linux=python3 "{path}/{cmd}" {program.pattern_args}

## Erase Chip (before burning the bootloader)
## ------------------------------------------
Expand All @@ -309,7 +303,6 @@ tools.esptool_py.erase.params.verbose=
tools.esptool_py.erase.params.quiet=
tools.esptool_py.erase.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset erase_flash
tools.esptool_py.erase.pattern="{path}/{cmd}" {erase.pattern_args}
tools.esptool_py.erase.pattern.linux=python3 "{path}/{cmd}" {erase.pattern_args}

## Burn Bootloader
## ---------------
Expand Down
8 changes: 8 additions & 0 deletions tools/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def is_latest_version(destination, dirname, rename_to, cfile, checksum):


def unpack(filename, destination, force_extract, checksum): # noqa: C901
sys_name = platform.system()
dirname = ""
cfile = None # Compressed file
file_is_corrupted = False
Expand Down Expand Up @@ -223,6 +224,8 @@ def unpack(filename, destination, force_extract, checksum): # noqa: C901
rename_to = re.match(r"^([a-z][^\-]*\-*)+", dirname).group(0).strip("-")
if rename_to == dirname and dirname.startswith("esp32-arduino-libs-"):
rename_to = "esp32-arduino-libs"
elif rename_to == dirname and dirname.startswith("esptool-"):
rename_to = "esptool"

if not force_extract:
if is_latest_version(destination, dirname, rename_to, cfile, checksum):
Expand Down Expand Up @@ -256,6 +259,11 @@ def unpack(filename, destination, force_extract, checksum): # noqa: C901
print("Renaming {0} to {1} ...".format(dirname, rename_to))
shutil.move(dirname, rename_to)

# Add execute permission to esptool on non-Windows platforms
if rename_to.startswith("esptool") and "CYGWIN_NT" not in sys_name and "Windows" not in sys_name:
st = os.stat(os.path.join(destination, rename_to, "esptool"))
os.chmod(os.path.join(destination, rename_to, "esptool"), st.st_mode | 0o111)

with open(os.path.join(destination, rename_to, ".package_checksum"), "w") as f:
f.write(checksum)

Expand Down

0 comments on commit 6059491

Please sign in to comment.