Skip to content

Commit 191f401

Browse files
committed
restore miniesptool_esp32multifile.py
1 parent c3701e8 commit 191f401

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import time
2+
import board
3+
import busio
4+
5+
from digitalio import DigitalInOut, Direction # pylint: disable=unused-import
6+
import adafruit_miniesptool
7+
8+
print("ESP32 mini prog")
9+
10+
# With a Metro or Feather M4
11+
uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=1)
12+
resetpin = DigitalInOut(board.D5)
13+
gpio0pin = DigitalInOut(board.D6)
14+
15+
# With a Particle Argon, we need to also turn off flow control
16+
"""
17+
uart = busio.UART(board.ESP_RX, board.ESP_TX, baudrate=115200, timeout=1)
18+
resetpin = DigitalInOut(board.ESP_WIFI_EN)
19+
gpio0pin = DigitalInOut(board.ESP_BOOT_MODE)
20+
esp_cts = DigitalInOut(board.ESP_CTS)
21+
esp_cts.direction = Direction.OUTPUT
22+
esp_cts.value = False
23+
"""
24+
25+
esptool = adafruit_miniesptool.miniesptool(uart, gpio0pin, resetpin,
26+
flashsize=4*1024*1024)
27+
esptool.debug = False
28+
29+
esptool.sync()
30+
print("Synced")
31+
print("Found:", esptool.chip_name)
32+
if esptool.chip_name != "ESP32":
33+
raise RuntimeError("This example is for ESP32 only")
34+
esptool.baudrate = 912600
35+
print("MAC ADDR: ", [hex(i) for i in esptool.mac_addr])
36+
37+
# 0x10000 ota_data_initial.bin
38+
esptool.flash_file("esp32/ota_data_initial.bin", 0x10000,
39+
'84d04c9d6cc8ef35bf825d51a5277699')
40+
41+
# 0x1000 bootloader/bootloader.bin
42+
esptool.flash_file("esp32/bootloader/bootloader.bin", 0x1000,
43+
'894e5f067a44773ac1ae987a14e85787')
44+
# 0x20000 at_customize.bin
45+
esptool.flash_file("esp32/at_customize.bin", 0x20000,
46+
'9853055e077ba0c90cd70691b9d8c3d5')
47+
48+
# 0x24000 customized_partitions/server_cert.bin
49+
esptool.flash_file("esp32/customized_partitions/server_cert.bin", 0x24000,
50+
'766fa1e87aabb9ab78ff4023f6feb4d3')
51+
52+
# 0x26000 customized_partitions/server_key.bin
53+
esptool.flash_file("esp32/customized_partitions/server_key.bin", 0x26000,
54+
'05da7907776c3d5160f26bf870592459')
55+
56+
# 0x28000 customized_partitions/server_ca.bin
57+
esptool.flash_file("esp32/customized_partitions/server_ca.bin", 0x28000,
58+
'e0169f36f9cb09c6705343792d353c0a')
59+
60+
# 0x2a000 customized_partitions/client_cert.bin
61+
esptool.flash_file("esp32/customized_partitions/client_cert.bin", 0x2a000,
62+
'428ed3bae5d58b721b8254cbeb8004ff')
63+
64+
# 0x2c000 customized_partitions/client_key.bin
65+
esptool.flash_file("esp32/customized_partitions/client_key.bin", 0x2c000,
66+
'136f563811930a5d3bf04c946f430ced')
67+
68+
# 0x2e000 customized_partitions/client_ca.bin
69+
esptool.flash_file("esp32/customized_partitions/client_ca.bin", 0x2e000,
70+
'25ab638695819daae67bcd8a4bfc5626')
71+
72+
# 0xf000 phy_init_data.bin
73+
esptool.flash_file("esp32/phy_init_data.bin", 0xf000,
74+
'bc9854aa3687ca73e25d213d20113b23')
75+
76+
# 0x100000 esp-at.bin
77+
esptool.flash_file("esp32/esp-at.bin", 0x100000,
78+
'7018a1b4c8a5c108377ecda7632b899c')
79+
80+
# 0x8000 partitions_at.bin
81+
esptool.flash_file("esp32/partitions_at.bin", 0x8000,
82+
'd3d1508993d61aedf17280140fc22a6b')
83+
84+
esptool.reset()
85+
time.sleep(0.5)

0 commit comments

Comments
 (0)