Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
Fix issue with ESP32 bootloader using wrong version
Browse files Browse the repository at this point in the history
  • Loading branch information
OttoWinter committed Nov 14, 2018
1 parent 7ec35ed commit 9f54afd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
11 changes: 7 additions & 4 deletions esphomeflasher/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions esphomeflasher/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down
5 changes: 1 addition & 4 deletions esphomeflasher/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
__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
Expand Down

0 comments on commit 9f54afd

Please sign in to comment.