Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/esp32c5-build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ on:
push:
branches: [main]
paths:
- 'ESP32C5/main/main.c'
- 'ESP32C5/**'
- 'FLIPPER/**'
- '.github/scripts/**'
- '.github/workflows/esp32c5-build-master.yml'
release:
types: [published, edited]

Expand Down Expand Up @@ -403,7 +405,7 @@ jobs:
BUILD_TAG: ${{ steps.meta.outputs.tag }}
run: |
set -euo pipefail
python -c "import os, json; from pathlib import Path; version=os.getenv('FW_VERSION') or os.getenv('BUILD_TAG'); build=os.getenv('BUILD_TAG','manual'); manifest={'name':'projectZero ESP32-C5','version':version,'build':build,'chipFamily':'ESP32-C5','parts':[{'path':'firmware/bootloader.bin','offset':8192},{'path':'firmware/partition-table.bin','offset':32768},{'path':'firmware/projectZero.bin','offset':131072}]}; Path('docs/manifest.json').write_text(json.dumps(manifest, indent=2))"
python -c "import os, json; from pathlib import Path; version=os.getenv('FW_VERSION') or os.getenv('BUILD_TAG'); build=os.getenv('BUILD_TAG','manual'); manifest={'name':'projectZero ESP32-C5','version':version,'build':build,'chipFamily':'ESP32-C5','parts':[{'path':'firmware/bootloader.bin','offset':8192},{'path':'firmware/partition-table.bin','offset':32768},{'path':'firmware/projectZero.bin','offset':131072},{'path':'firmware/projectZero.bin','offset':4259840}]}; Path('docs/manifest.json').write_text(json.dumps(manifest, indent=2))"
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages-webflasher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
TAG: ${{ steps.meta.outputs.tag }}
run: |
set -euo pipefail
python -c "import os, json; from pathlib import Path; tag=os.getenv('TAG','manual'); manifest={'name':'projectZero ESP32-C5','version':tag,'build':tag,'chipFamily':'ESP32-C5','parts':[{'path':'firmware/bootloader.bin','offset':8192},{'path':'firmware/partition-table.bin','offset':32768},{'path':'firmware/projectZero.bin','offset':131072}]}; Path('docs/manifest.json').write_text(json.dumps(manifest, indent=2) + '\\n')"
python -c "import os, json; from pathlib import Path; tag=os.getenv('TAG','manual'); manifest={'name':'projectZero ESP32-C5','version':tag,'build':tag,'chipFamily':'ESP32-C5','parts':[{'path':'firmware/bootloader.bin','offset':8192},{'path':'firmware/partition-table.bin','offset':32768},{'path':'firmware/projectZero.bin','offset':131072},{'path':'firmware/projectZero.bin','offset':4259840}]}; Path('docs/manifest.json').write_text(json.dumps(manifest, indent=2) + '\\n')"

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
Expand Down
2 changes: 2 additions & 0 deletions ESP32C5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Important notes:
- The bootloader and partition table must be flashed once via UART after enabling OTA/rollback. OTA only updates the app image.
- Rollback happens if the new image crashes before it is marked valid.
- Auto-OTA on IP is disabled; use the CLI commands below.
- On ESP32-C5 N8R8 (8 MB flash), each OTA slot is `0x3F0000` bytes (~3.94 MiB). Two full `4 MiB` slots do not fit because boot metadata and data partitions occupy the space before `0x20000`.
- A UART/web flash that writes only `ota_0` leaves `ota_1` empty until the first OTA update. The bundled `binaries-esp32c5/flash_board.py` now seeds `ota_1` by default by also writing the app at `0x410000`.

### OTA Commands
- `wifi_connect <SSID> <Password> [ota] [<IP> <Netmask> <GW> [DNS1] [DNS2]]`: Connect to Wi-Fi as STA. Add `ota` to trigger OTA right after DHCP, or pass static IP settings (optionally with DNS).
Expand Down
Binary file not shown.
Binary file modified ESP32C5/binaries-esp32c5/bootloader.bin
Binary file not shown.
18 changes: 14 additions & 4 deletions ESP32C5/binaries-esp32c5/flash_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ def ensure_packages():
# Colors
RED = "\033[91m"; GREEN = "\033[92m"; YELLOW = "\033[93m"; CYAN = "\033[96m"; RESET = "\033[0m"

VERSION = "v02"
VERSION = "v04"
DEFAULT_BAUD = 460800 # Original default; can be overridden via CLI
REQUIRED_FILES = ["bootloader.bin", "partition-table.bin", "projectZero.bin"]

# >>> DO NOT CHANGE: keep your original offsets <<<
# Keep these offsets in sync with partitions.csv.
OFFSETS = {
"bootloader.bin": "0x2000", # as requested
"partition-table.bin": "0x8000",
# partitions.csv defines ota_0 at 0x20000, so app must be flashed there
"projectZero.bin": "0x20000",
# Optional: seed ota_1 so both OTA slots are bootable after a UART flash
"projectZero_ota1.bin": "0x410000",
}

def check_files():
Expand Down Expand Up @@ -76,7 +78,7 @@ def erase_all(port, baud=DEFAULT_BAUD):
print(f"{RED}Erase failed with code {res.returncode}.{RESET}")
sys.exit(res.returncode)

def do_flash(port, baud=DEFAULT_BAUD, flash_mode="dio", flash_freq="80m"):
def do_flash(port, baud=DEFAULT_BAUD, flash_mode="dio", flash_freq="80m", seed_ota1=True):
cmd = [
sys.executable, "-m", "esptool",
"-p", port,
Expand All @@ -92,6 +94,8 @@ def do_flash(port, baud=DEFAULT_BAUD, flash_mode="dio", flash_freq="80m"):
OFFSETS["partition-table.bin"], "partition-table.bin",
OFFSETS["projectZero.bin"], "projectZero.bin",
]
if seed_ota1:
cmd.extend([OFFSETS["projectZero_ota1.bin"], "projectZero.bin"])
print(f"{CYAN}Flashing command:{RESET} {' '.join(cmd)}")
res = subprocess.run(cmd)
if res.returncode != 0:
Expand Down Expand Up @@ -154,6 +158,8 @@ def main():
help=f"Optional baud rate (default: {DEFAULT_BAUD})")
parser.add_argument("--monitor", action="store_true", help="Open serial monitor after flashing")
parser.add_argument("--erase", action="store_true", help="Full erase before flashing (fixes stale NVS/partitions)")
parser.add_argument("--no-seed-ota1", action="store_true",
help="Do not flash projectZero.bin into ota_1 at 0x410000")
parser.add_argument("--flash-mode", default="dio", choices=["dio", "qio", "dout", "qout"],
help="Flash mode (default: dio)")
parser.add_argument("--flash-freq", default="80m", choices=["80m", "60m", "40m", "26m", "20m"],
Expand All @@ -173,11 +179,15 @@ def main():

print(f"{GREEN}Detected serial port: {port}{RESET}")
print(f"{YELLOW}Tip: release the BOOT button before programming finishes.{RESET}")
seed_ota1 = not args.no_seed_ota1
if seed_ota1:
print(f"{YELLOW}Seeding both OTA slots: ota_0 @ {OFFSETS['projectZero.bin']} and ota_1 @ {OFFSETS['projectZero_ota1.bin']}{RESET}")

if args.erase:
erase_all(port, args.baud)

do_flash(port, baud=args.baud, flash_mode=args.flash_mode, flash_freq=args.flash_freq)
do_flash(port, baud=args.baud, flash_mode=args.flash_mode, flash_freq=args.flash_freq,
seed_ota1=seed_ota1)

reset_to_app(port)

Expand Down
Binary file modified ESP32C5/binaries-esp32c5/partition-table.bin
Binary file not shown.
Binary file modified ESP32C5/binaries-esp32c5/projectZero.bin
Binary file not shown.
Loading