Skip to content

Commit bd96f7f

Browse files
committed
Update IDF Libs
1 parent ca7ed86 commit bd96f7f

File tree

259 files changed

+1675
-840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+1675
-840
lines changed

platform.txt

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

tools/esptool.py

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ def __init__(self, port=DEFAULT_PORT, baud=ESP_ROM_BAUD, trace_enabled=False):
257257
with ones which throw NotImplementedInROMError().
258258
259259
"""
260+
self.secure_download_mode = False # flag is set to True if esptool detects the ROM is in Secure Download Mode
261+
260262
if isinstance(port, basestring):
261263
self._port = serial.serial_for_url(port)
262264
else:
@@ -309,6 +311,9 @@ def detect_chip(port=DEFAULT_PORT, baud=ESP_ROM_BAUD, connect_mode='default_rese
309311
inst = cls(detect_port._port, baud, trace_enabled=trace_enabled)
310312
print(' %s' % inst.CHIP_NAME, end='')
311313
return inst
314+
except UnsupportedCommandError:
315+
raise FatalError("Unsupported Command Error received. Probably this means Secure Download Mode is enabled, " +
316+
"autodetection will not work. Need to manually specify the chip.")
312317
finally:
313318
print('') # end line
314319
raise FatalError("Unexpected UART datecode value 0x%08x. Failed to autodetect chip type." % (date_reg))
@@ -381,7 +386,8 @@ def command(self, op=None, data=b"", chk=0, wait_response=True, timeout=DEFAULT_
381386
if op is None or op_ret == op:
382387
return val, data
383388
if byte(data, 0) != 0 and byte(data, 1) == self.ROM_INVALID_RECV_MSG:
384-
raise UnsupportedCommandError()
389+
self.flush_input() # Unsupported read_reg can result in more than one error response for some reason
390+
raise UnsupportedCommandError(self)
385391

386392
finally:
387393
if new_timeout != saved_timeout:
@@ -515,20 +521,23 @@ def connect(self, mode='default_reset', attempts=DEFAULT_CONNECT_ATTEMPTS, detec
515521
raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
516522

517523
if not detecting:
518-
# check the date code registers match what we expect to see
519-
date_reg = self.read_reg(self.UART_DATE_REG_ADDR)
520-
date_reg2 = self.read_reg(self.UART_DATE_REG2_ADDR)
521-
if date_reg != self.DATE_REG_VALUE or (self.DATE_REG2_VALUE is not None and date_reg2 != self.DATE_REG2_VALUE):
522-
actually = None
523-
for cls in [ESP8266ROM, ESP32ROM, ESP32S2ROM]:
524-
if date_reg == cls.DATE_REG_VALUE and (cls.DATE_REG2_VALUE is None or date_reg2 == cls.DATE_REG2_VALUE):
525-
actually = cls
526-
break
527-
if actually is None:
528-
print(("WARNING: This chip doesn't appear to be a %s (date codes 0x%08x:0x%08x). " +
529-
"Probably it is unsupported by this version of esptool.") % (self.CHIP_NAME, date_reg, date_reg2))
530-
else:
531-
raise FatalError("This chip is %s not %s. Wrong --chip argument?" % (actually.CHIP_NAME, self.CHIP_NAME))
524+
try:
525+
# check the date code registers match what we expect to see
526+
date_reg = self.read_reg(self.UART_DATE_REG_ADDR)
527+
date_reg2 = self.read_reg(self.UART_DATE_REG2_ADDR)
528+
if date_reg != self.DATE_REG_VALUE or (self.DATE_REG2_VALUE is not None and date_reg2 != self.DATE_REG2_VALUE):
529+
actually = None
530+
for cls in [ESP8266ROM, ESP32ROM, ESP32S2ROM]:
531+
if date_reg == cls.DATE_REG_VALUE and (cls.DATE_REG2_VALUE is None or date_reg2 == cls.DATE_REG2_VALUE):
532+
actually = cls
533+
break
534+
if actually is None:
535+
print(("WARNING: This chip doesn't appear to be a %s (date codes 0x%08x:0x%08x). " +
536+
"Probably it is unsupported by this version of esptool.") % (self.CHIP_NAME, date_reg, date_reg2))
537+
else:
538+
raise FatalError("This chip is %s not %s. Wrong --chip argument?" % (actually.CHIP_NAME, self.CHIP_NAME))
539+
except UnsupportedCommandError:
540+
self.secure_download_mode = True
532541

533542
def read_reg(self, addr):
534543
""" Read memory address in target """
@@ -1497,7 +1506,12 @@ def get_chip_description(self):
14971506
return "ESP32-S2"
14981507

14991508
def get_chip_features(self):
1500-
return ["WiFi"]
1509+
result = ["WiFi"]
1510+
1511+
if self.secure_download_mode:
1512+
result.append("Secure Download Mode Enabled")
1513+
1514+
return result
15011515

15021516
def get_crystal_freq(self):
15031517
# ESP32-S2 XTAL is fixed to 40MHz
@@ -1549,6 +1563,7 @@ class ESP32StubLoader(ESP32ROM):
15491563
IS_STUB = True
15501564

15511565
def __init__(self, rom_loader):
1566+
self.secure_download_mode = rom_loader.secure_download_mode
15521567
self._port = rom_loader._port
15531568
self._trace_enabled = rom_loader._trace_enabled
15541569
self.flush_input() # resets _slip_reader
@@ -1568,6 +1583,7 @@ class ESP32S2StubLoader(ESP32S2ROM):
15681583
IS_STUB = True
15691584

15701585
def __init__(self, rom_loader):
1586+
self.secure_download_mode = rom_loader.secure_download_mode
15711587
self._port = rom_loader._port
15721588
self._trace_enabled = rom_loader._trace_enabled
15731589
self.flush_input() # resets _slip_reader
@@ -2433,10 +2449,14 @@ class UnsupportedCommandError(FatalError):
24332449
"""
24342450
Wrapper class for when ROM loader returns an invalid command response.
24352451
2436-
Usually this indicates the loader is running in a reduced mode.
2452+
Usually this indicates the loader is running in Secure Download Mode.
24372453
"""
2438-
def __init__(self):
2439-
FatalError.__init__(self, "Invalid (unsupported) command")
2454+
def __init__(self, esp):
2455+
if esp.secure_download_mode:
2456+
msg = "This command is not supported in Secure Download Mode"
2457+
else:
2458+
msg = "Invalid (unsupported) command"
2459+
FatalError.__init__(self, msg)
24402460

24412461

24422462
def load_ram(esp, args):
@@ -2484,6 +2504,8 @@ def dump_mem(esp, args):
24842504

24852505
def detect_flash_size(esp, args):
24862506
if args.flash_size == 'detect':
2507+
if esp.secure_download_mode:
2508+
raise FatalError("Detecting flash size is not supported in secure download mode. Need to manually specify flash size.")
24872509
flash_id = esp.flash_id()
24882510
size_id = flash_id >> 16
24892511
args.flash_size = DETECTED_FLASH_SIZES.get(size_id)
@@ -2644,7 +2666,7 @@ def write_flash(esp, args):
26442666
speed_msg = " (%.1f kbit/s)" % (written / t * 8 / 1000)
26452667
print_overwrite('Wrote %d bytes at 0x%08x in %.1f seconds%s...' % (written, address, t, speed_msg), last_line=True)
26462668

2647-
if not args.encrypt:
2669+
if not args.encrypt and not esp.secure_download_mode:
26482670
try:
26492671
res = esp.flash_md5sum(address, uncsize)
26502672
if res != calcmd5:
@@ -3186,10 +3208,17 @@ def add_spi_flash_subparsers(parent, is_elf2image):
31863208

31873209
print("Crystal is %dMHz" % esp.get_crystal_freq())
31883210

3189-
read_mac(esp, args)
3211+
try:
3212+
read_mac(esp, args)
3213+
except UnsupportedCommandError:
3214+
pass # can't get this data in Secure Download Mode
31903215

31913216
if not args.no_stub:
3192-
esp = esp.run_stub()
3217+
if esp.secure_download_mode:
3218+
print("WARNING: Stub loader is not supported in Secure Download Mode, setting --no-stub")
3219+
args.no_stub = True
3220+
else:
3221+
esp = esp.run_stub()
31933222

31943223
if args.override_vddsdio:
31953224
esp.override_vddsdio(args.override_vddsdio)

tools/platformio-build-esp32.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "efuse", "esp32", "include"),
132132
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "espcoredump", "include"),
133133
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_timer", "include"),
134+
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_ipc", "include"),
134135
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "soc", "soc", "esp32"),
135136
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "soc", "soc", "esp32", "include"),
136137
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "soc", "soc", "include"),
@@ -214,7 +215,7 @@
214215
],
215216

216217
LIBS=[
217-
"-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lasio", "-lbt", "-lcbor", "-lcoap", "-lconsole", "-lnghttp", "-lesp-tls", "-lesp_adc_cal", "-lesp_gdbstub", "-lesp_hid", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lprotobuf-c", "-lprotocomm", "-lmdns", "-lesp_local_ctrl", "-lsdmmc", "-lesp_serial_slave_link", "-lesp_websocket_client", "-lexpat", "-lwear_levelling", "-lfatfs", "-lfreemodbus", "-ljsmn", "-ljson", "-llibsodium", "-lmqtt", "-lopenssl", "-lspiffs", "-lulp", "-lunity", "-lwifi_provisioning", "-lfb_gfx", "-lasio", "-lcbor", "-lcoap", "-lesp_gdbstub", "-lesp_hid", "-lesp_https_ota", "-lesp_local_ctrl", "-lesp_serial_slave_link", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lmqtt", "-lunity", "-lwifi_provisioning", "-lprotocomm", "-lprotobuf-c", "-ljson", "-lfb_gfx", "-lbt", "-lbtdm_app", "-lesp_adc_cal", "-lmdns", "-lconsole", "-lfatfs", "-lsdmmc", "-lwear_levelling", "-lopenssl", "-lspiffs", "-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lulp", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lsoc_esp32", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lulp", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lsoc_esp32", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lulp", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lsoc_esp32", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lulp", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lsoc_esp32", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lrtc", "-lsmartconfig", "-lphy", "-lhal", "-lm", "-lnewlib", "-lgcc", "-lstdc++", "-lpthread", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc"
218+
"-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lasio", "-lbt", "-lcbor", "-lcoap", "-lconsole", "-lnghttp", "-lesp-tls", "-lesp_adc_cal", "-lesp_gdbstub", "-lesp_hid", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lprotobuf-c", "-lprotocomm", "-lmdns", "-lesp_local_ctrl", "-lsdmmc", "-lesp_serial_slave_link", "-lesp_websocket_client", "-lexpat", "-lwear_levelling", "-lfatfs", "-lfreemodbus", "-ljsmn", "-ljson", "-llibsodium", "-lmqtt", "-lopenssl", "-lspiffs", "-lulp", "-lunity", "-lwifi_provisioning", "-lfb_gfx", "-lasio", "-lcbor", "-lcoap", "-lesp_gdbstub", "-lesp_hid", "-lesp_https_ota", "-lesp_local_ctrl", "-lesp_serial_slave_link", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lmqtt", "-lunity", "-lwifi_provisioning", "-lprotocomm", "-lprotobuf-c", "-ljson", "-lfb_gfx", "-lbt", "-lbtdm_app", "-lesp_adc_cal", "-lmdns", "-lconsole", "-lfatfs", "-lsdmmc", "-lwear_levelling", "-lopenssl", "-lspiffs", "-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lulp", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lsoc_esp32", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lulp", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lsoc_esp32", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lulp", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lsoc_esp32", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lesp_system", "-lsoc", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lnvs_flash", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lesp_ringbuf", "-ldriver", "-lpthread", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lulp", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lsoc_esp32", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lrtc", "-lsmartconfig", "-lphy", "-lhal", "-lm", "-lnewlib", "-lgcc", "-lstdc++", "-lpthread", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc"
218219
],
219220

220221
CPPDEFINES=[
@@ -223,7 +224,7 @@
223224
"UNITY_INCLUDE_CONFIG_H",
224225
"WITH_POSIX",
225226
"_GNU_SOURCE",
226-
("IDF_VER", '\\"v4.2-dev-1660-g7d7521367\\"'),
227+
("IDF_VER", '\\"v4.2-dev-1905-g625bd5eb1-dirty\\"'),
227228
"ESP_PLATFORM",
228229
"ARDUINO_ARCH_ESP32",
229230
"ESP32",

0 commit comments

Comments
 (0)