Upgrade to esptool 2.0.1

This commit is contained in:
Marcel Stör 2017-07-15 22:35:50 +02:00
parent b26b0b20c6
commit 55d3169279
1 changed files with 13 additions and 6 deletions

View File

@ -1,4 +1,4 @@
#!/usr/local/opt/python/bin/python2.7
#!/usr/bin/env python
#
# ESP8266 & ESP32 ROM Bootloader Utility
# Copyright (C) 2014-2016 Fredrik Ahlberg, Angus Gratton, Espressif Systems (Shanghai) PTE LTD, other contributors as noted.
@ -30,7 +30,7 @@ import base64
import zlib
import shlex
__version__ = "2.0"
__version__ = "2.0.1"
MAX_UINT32 = 0xffffffff
MAX_UINT24 = 0xffffff
@ -1265,6 +1265,13 @@ class ESP32FirmwareImage(BaseFirmwareImage):
ROM_LOADER = ESP32ROM
# 16 byte extended header contains WP pin number (byte), then 6 half-byte drive stength
# config fields, then 12 reserved bytes. None of this is exposed in esptool.py right now,
# but we need to set WP to 0xEE (disabled) to avoid problems when remapping SPI flash
# pins via efuse (for example on ESP32-D2WD).
EXTENDED_HEADER = [0xEE] + ([0] * 15)
EXTENDED_HEADER_STRUCT_FMT = "B" * 16
def __init__(self, load_file=None):
super(ESP32FirmwareImage, self).__init__()
self.flash_mode = 0
@ -1273,11 +1280,11 @@ class ESP32FirmwareImage(BaseFirmwareImage):
if load_file is not None:
segments = self.load_common_header(load_file, ESPLoader.ESP_IMAGE_MAGIC)
additional_header = list(struct.unpack("B" * 16, load_file.read(16)))
additional_header = list(struct.unpack(self.EXTENDED_HEADER_STRUCT_FMT, load_file.read(16)))
# check these bytes are unused
if additional_header != [0] * 16:
print("WARNING: ESP32 image header contains unknown flags. Possibly this image is from a newer version of esptool.py")
if additional_header != self.EXTENDED_HEADER:
print("WARNING: ESP32 image header contains unknown flags. Possibly this image is from a different version of esptool.py")
for _ in range(segments):
self.load_segment(load_file)
@ -1301,7 +1308,7 @@ class ESP32FirmwareImage(BaseFirmwareImage):
# first 4 bytes of header are read by ROM bootloader for SPI
# config, but currently unused
f.write(b'\x00' * 16)
f.write(struct.pack(self.EXTENDED_HEADER_STRUCT_FMT, *self.EXTENDED_HEADER))
checksum = ESPLoader.ESP_CHECKSUM_MAGIC
last_addr = None