Milestone #2 increment A: the product's real publish flow, distinct from git_push's fresh-init-per-boot throwaway branch. open-or-clone a persistent /spiflash/repo, append to a tracked notes.md, commit on top of the branch, and fast-forward push over mbedTLS HTTPS+PAT. Reconcile handles up-to-date and fast-forward; a true divergence (merge commit on FATFS) is deferred to increment B. Runs on the dedicated 96 KB git thread; gated behind `git`. Compiles clean; on-device clone/open+fast-forward not yet hardware-verified (clone/checkout is deeper than the proven init path — the flash may need a GIT_STACK bump).
116 lines
4.4 KiB
Makefile
116 lines
4.4 KiB
Makefile
# Typoena firmware — common commands.
|
|
# Recipes source ~/export-esp.sh themselves (LIBCLANG_PATH + Xtensa GCC),
|
|
# so no per-shell setup is needed before calling just.
|
|
|
|
# Load firmware/.env (Wi-Fi creds for the network spikes) into recipe env.
|
|
# Absent .env is fine — the editor build ignores TW_* entirely.
|
|
set dotenv-load := true
|
|
|
|
esp_env := ". ~/export-esp.sh &&"
|
|
elf := "target/xtensa-esp32s3-espidf/release/firmware"
|
|
elf_wifi := "target/xtensa-esp32s3-espidf/release/wifi_tls"
|
|
elf_sd := "target/xtensa-esp32s3-espidf/release/sd_fat"
|
|
elf_git := "target/xtensa-esp32s3-espidf/release/git_smoke"
|
|
elf_git_push := "target/xtensa-esp32s3-espidf/release/git_push"
|
|
elf_git_sync := "target/xtensa-esp32s3-espidf/release/git_sync"
|
|
|
|
# Custom partition table (adds the `storage` FAT partition for the git working
|
|
# copy). Only the git-push flash applies it — the editor flash keeps the default
|
|
# single-app layout, so this change is scoped to Spike 7's finish.
|
|
partition_table := justfile_directory() + "/partitions.csv"
|
|
|
|
# Spike 7 Path 2 — env for the git2/libgit2 build. LIBGIT2_SRC points at the
|
|
# vendored libgit2 submodule (v1.9.4, matches libgit2-sys 0.18.5). pkgconfig/
|
|
# holds fake .pc files so libgit2-sys + libz-sys run in system mode and the
|
|
# symbols come from the esp-idf libgit2 component. Only the git recipes set this,
|
|
# so the editor build never compiles libgit2.
|
|
libgit2_src := justfile_directory() + "/components/libgit2/vendor"
|
|
git_env := "LIBGIT2_SRC=" + libgit2_src + " LIBGIT2_NO_VENDOR=1 PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_LIBDIR=" + justfile_directory() + "/pkgconfig"
|
|
|
|
# list recipes
|
|
default:
|
|
@just --list
|
|
|
|
# compile (release)
|
|
build:
|
|
{{esp_env}} cargo build --release --bin firmware
|
|
|
|
# build + flash + open serial monitor
|
|
flash:
|
|
{{esp_env}} cargo run --release --bin firmware
|
|
|
|
# serial monitor only, with decoded backtraces
|
|
monitor:
|
|
espflash monitor --elf {{elf}}
|
|
|
|
# Spike 6 — build the Wi-Fi + TLS spike (needs TW_WIFI_SSID / TW_WIFI_PASS in .env)
|
|
build-wifi:
|
|
{{esp_env}} cargo build --release --bin wifi_tls
|
|
|
|
# Spike 6 — flash + monitor the Wi-Fi + TLS spike
|
|
flash-wifi:
|
|
{{esp_env}} cargo run --release --bin wifi_tls
|
|
|
|
# serial monitor for the Wi-Fi spike, with decoded backtraces
|
|
monitor-wifi:
|
|
espflash monitor --elf {{elf_wifi}}
|
|
|
|
# Spike 3 — build the SD/FAT spike (no .env needed)
|
|
build-sd:
|
|
{{esp_env}} cargo build --release --bin sd_fat
|
|
|
|
# Spike 3 — flash + monitor the SD/FAT spike
|
|
flash-sd:
|
|
{{esp_env}} cargo run --release --bin sd_fat
|
|
|
|
# serial monitor for the SD spike, with decoded backtraces
|
|
monitor-sd:
|
|
espflash monitor --elf {{elf_sd}}
|
|
|
|
# Spike 7 Path 2 — build the git2/libgit2 smoke (git2 safe API on device)
|
|
build-git:
|
|
{{esp_env}} {{git_env}} cargo build --release --bin git_smoke --features git
|
|
|
|
# Spike 7 Path 2 — flash + monitor the git2/libgit2 smoke
|
|
flash-git:
|
|
{{esp_env}} {{git_env}} cargo run --release --bin git_smoke --features git
|
|
|
|
# serial monitor for the git smoke, with decoded backtraces
|
|
monitor-git:
|
|
espflash monitor --elf {{elf_git}}
|
|
|
|
# Spike 7 finish — build the on-device git push (Wi-Fi + SNTP + flash-FAT + libgit2)
|
|
build-git-push:
|
|
{{esp_env}} {{git_env}} cargo build --release --bin git_push --features git
|
|
|
|
# Spike 7 finish — flash + monitor. espflash applies the custom partition table
|
|
# (so the `storage` FAT partition exists) and sets 16 MB flash. Uses espflash
|
|
# directly, not `cargo run`, so the table is applied only to this binary.
|
|
flash-git-push: build-git-push
|
|
espflash flash --monitor --partition-table {{partition_table}} --flash-size 16mb {{elf_git_push}}
|
|
|
|
# serial monitor for the git push, with decoded backtraces
|
|
monitor-git-push:
|
|
espflash monitor --elf {{elf_git_push}}
|
|
|
|
# Milestone #2A — build the persistent-clone publish cycle (clone + fast-forward push)
|
|
build-git-sync:
|
|
{{esp_env}} {{git_env}} cargo build --release --bin git_sync --features git
|
|
|
|
# Milestone #2A — flash + monitor. Applies the same custom partition table as
|
|
# git-push (the `storage` FAT partition holds the persistent clone).
|
|
flash-git-sync: build-git-sync
|
|
espflash flash --monitor --partition-table {{partition_table}} --flash-size 16mb {{elf_git_sync}}
|
|
|
|
# serial monitor for the git sync, with decoded backtraces
|
|
monitor-git-sync:
|
|
espflash monitor --elf {{elf_git_sync}}
|
|
|
|
# detect board, print chip/MAC/flash size
|
|
info:
|
|
espflash board-info
|
|
|
|
# list USB serial devices
|
|
ports:
|
|
@ls /dev/cu.usb* 2>/dev/null || echo "no USB serial device found"
|