-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflash.py
More file actions
executable file
·25 lines (19 loc) · 1.23 KB
/
flash.py
File metadata and controls
executable file
·25 lines (19 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os, sys
args = len(sys.argv)
if args != 3:
print("Usage: flash.py <target> <port>")
exit(0)
if sys.argv[1] != "esp32s3" and sys.argv[1] != "esp32c3" and sys.argv[1] != "esp32c3":
print("Supported targets are: esp32s3,esp32s2,esp32c3")
exit(0)
flash = ""
port = ' --port "' + sys.argv[2] + '"'
if sys.argv[1] == "esp32s3":
flash = " --chip esp32s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0000 bin/bootloader32s3.bin 0x8000 bin/partitions32s3.bin 0xe000 bin/boot32s3.bin 0x10000 bin/firmware32s3.bin"
elif sys.argv[1] == "esp32s2":
flash = " --chip esp32s2 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 bin/bootloader32s2.bin 0x8000 bin/partitions32s2.bin 0xe000 bin/boot32s2.bin 0x10000 bin/firmware32s2.bin"
elif sys.argv[1] == "esp32c3":
flash = " --chip esp32c3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0000 bin/bootloader32c3.bin 0x8000 bin/partitions32c3.bin 0xe000 bin/boot32c3.bin 0x10000 bin/firmware32c3.bin"
cmd = "python3 -m esptool" + port + flash
print(cmd)
os.system(cmd)