Fix issue with ESP32 bootloader using wrong version

This commit is contained in:
Otto Winter 2018-11-14 23:04:12 +01:00
parent 7ec35ed907
commit 9f54afd78d
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
3 changed files with 12 additions and 12 deletions

View File

@ -91,15 +91,18 @@ def run_esphomeflasher(argv):
flash_size = detect_flash_size(stub_chip)
print(" - Flash Size: {}".format(flash_size))
mock_args = configure_write_flash_args(info, firmware, flash_size,
args.bootloader, args.partitions,
args.otadata)
print(" - Flash Mode: {}".format(mock_args.flash_mode))
print(" - Flash Frequency: {}Hz".format(mock_args.flash_freq.upper()))
try:
stub_chip.flash_set_parameters(esptool.flash_size_bytes(flash_size))
except esptool.FatalError as err:
raise EsphomeflasherError("Error setting flash parameters: {}".format(err))
mock_args = configure_write_flash_args(info, firmware, flash_size,
args.bootloader, args.partitions,
args.otadata)
if not args.no_erase:
try:
esptool.erase_flash(stub_chip, mock_args)

View File

@ -12,13 +12,13 @@ class EsphomeflasherError(Exception):
class MockEsptoolArgs(object):
def __init__(self, flash_size, addr_filename):
def __init__(self, flash_size, addr_filename, flash_mode, flash_freq):
self.compress = True
self.no_compress = False
self.flash_size = flash_size
self.addr_filename = addr_filename
self.flash_mode = 'keep'
self.flash_freq = 'keep'
self.flash_mode = flash_mode
self.flash_freq = flash_freq
self.no_stub = False
self.verify = False
@ -180,7 +180,7 @@ def configure_write_flash_args(info, firmware_path, flash_size,
addr_filename.append((0x10000, firmware))
else:
addr_filename.append((0x0, firmware))
return MockEsptoolArgs(flash_size, addr_filename)
return MockEsptoolArgs(flash_size, addr_filename, flash_mode, flash_freq)
def detect_chip(port, force_esp8266=False, force_esp32=False):

View File

@ -3,11 +3,8 @@ import re
__version__ = "1.0.0"
ESP32_DEFAULT_OTA_DATA = 'https://raw.githubusercontent.com/espressif/arduino-esp32/1.0.0/tools/partitions/boot_app0.bin'
# The latest bootloader image seems to work with older firmwares, but the "stable" bootloader
# doesn't work with firmwares generated with the latest esp-idf
ESP32_DEFAULT_BOOTLOADER_FORMAT = 'https://raw.githubusercontent.com/espressif/arduino-esp32/' \
'96822d783f3ab6a56a69b227ba4d1a1a36c66268/tools/sdk/' \
'bin/bootloader_$FLASH_MODE$_$FLASH_FREQ$.bin'
'1.0.0/tools/sdk/bin/bootloader_$FLASH_MODE$_$FLASH_FREQ$.bin'
ESP32_DEFAULT_PARTITIONS = 'https://raw.githubusercontent.com/OttoWinter/esphomeflasher/master/partitions.bin'
# https://stackoverflow.com/a/3809435/8924614