82 lines
2.8 KiB
Makefile
82 lines
2.8 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"
|
|
|
|
# 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}}
|
|
|
|
# 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"
|