forked from rancilio-pid/clevercoffee
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_flash_package.py
More file actions
55 lines (45 loc) · 1.8 KB
/
create_flash_package.py
File metadata and controls
55 lines (45 loc) · 1.8 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# create_flash_package.py
import os
import shutil
from pathlib import Path
def create_flash_package():
"""Create ESP Flash Download Tool package"""
# Build first
print("Building firmware...")
os.system("~/.platformio/penv/bin/pio run -e esp32_usb")
os.system("~/.platformio/penv/bin/pio run --target buildfs -e esp32_usb")
# Paths
build_dir = Path(".pio/build/esp32_usb")
release_dir = Path("CleverCoffee_Flash_Package")
# Create release directory
release_dir.mkdir(exist_ok=True)
# Files with addresses from your partitions_4M.csv
files = {
"bootloader.bin": "0x1000", # Standard ESP32 bootloader location
"partitions.bin": "0x8000", # Standard ESP32 partition table location
"firmware.bin": "0x10000", # app0 partition
"littlefs.bin": "0x350000" # file system image partition
}
# Copy files
for filename, address in files.items():
src = build_dir / filename
if src.exists():
shutil.copy2(src, release_dir / filename)
print(f"Copied {filename} -> {address}")
else:
print(f"Missing: {filename}")
# Create flash addresses file
with open(release_dir / "flash_addresses.txt", "w") as f:
f.write("ESP Flash Download Tool Settings:\n")
f.write("==================================\n\n")
f.write("File Name Address\n")
f.write("------------------------\n")
for filename, address in files.items():
f.write(f"{filename:<18} {address}\n")
f.write("\nFlash Settings:\n")
f.write("- SPI Speed: 40MHz\n")
f.write("- SPI Mode: DIO\n")
f.write("- Flash Size: 4MB\n")
print(f"Flash package ready: {release_dir}")
if __name__ == "__main__":
create_flash_package()