build: declare ESP toolchain in mise.toml; drop ~/export-esp.sh dependence

mise.toml now owns the ESP cross-toolchain end to end:

- [env] pins PATH (xtensa-esp-elf-gcc bin) and LIBCLANG_PATH so any
  `mise exec` (which the justfile already uses for `set shell`)
  resolves the linker without sourcing espup's stray ~/export-esp.sh.
- [tasks.esp-install] installs the matching crosstool version via
  espup (espup hardcodes ~/.rustup/toolchains/esp/ -- there is no
  --prefix flag -- so the binaries necessarily live there, but the
  project now declaratively owns the version + path knowledge).
- cargo:espup pinned to 0.17.1 to match the [env] paths.

Triggered by a real failure: ~/export-esp.sh was moved to Trash and
the ESP build broke with `linker xtensa-esp32s3-elf-gcc not found`.
The previous setup silently no-op'd `[ -f $HOME/export-esp.sh ] && .
$HOME/export-esp.sh` in justfile, leaving the build with no PATH for
the cross-toolchain. Encoding the paths in mise.toml removes the
stray-file dependency.

justfile changes:
- _cargo: drop the `[ -f $HOME/export-esp.sh ] && . ...` source.
- setup / _require_esp_toolchain: install via `mise run esp-install`
  instead of bare `espup install`, so the version pin and the [env]
  paths stay in sync from a single source.

Bumping ESP versions remains a two-touch change: edit the version
dirs in BOTH [tasks.esp-install] and [env], then re-run the task.
This commit is contained in:
swaits committed 2026-04-29 22:26:16 -06:00
1 parent 1c98786ce6
commit eb8202058f
2 files changed
+34 -10

No files matched your search

+10 -8
View File
@@ -19,10 +19,11 @@ boards := "heltec_v3 heltec_v3_uart heltec_v4 elecrow_thinknode_m2 lilygo_tbeam
setup:
mise trust --yes
mise install
@# ESP Xtensa toolchain (not a rustup component — installed out-of-band by espup)
@# ESP Xtensa toolchain — installed via the `esp-install` mise task
@# (which pins versions to match mise.toml's [env] paths).
@if ! rustup toolchain list | grep -q "^esp"; then \
echo "ESP toolchain not found, installing via espup (this may take a while)..."; \
espup install || { echo "error: espup install failed" >&2; exit 1; }; \
echo "ESP toolchain not found, installing via mise task (this may take a while)..."; \
mise run esp-install || { echo "error: esp-install task failed" >&2; exit 1; }; \
fi
# Build release firmware for all boards, installing toolchains as needed
@@ -154,7 +155,6 @@ _cargo board cmd extra_args="" extra_features="":
extra=""; buildstd=""; \
case "$target" in xtensa-*) \
just _require_esp_toolchain; \
[ -f "$HOME/export-esp.sh" ] && . "$HOME/export-esp.sh"; \
extra="+esp"; buildstd="-Zbuild-std=core,alloc";; \
esac; \
cargo $extra {{cmd}} --target "$target" --features "$feat" $buildstd {{extra_args}}
@@ -168,15 +168,17 @@ _can_build board:
*) rustup target list --installed | grep -q "^$target$" || rustup target add "$target" ;; \
esac
# Ensure the ESP Xtensa toolchain is installed (espup installed via mise).
# The esp toolchain ships with its own cargo, rustc, and rust-src — no extra
# Ensure the ESP Xtensa toolchain is installed. The actual install is
# delegated to the `esp-install` mise task so the version pin lives in
# mise.toml alongside the matching [env] PATH/LIBCLANG_PATH entries.
# The esp toolchain ships its own cargo, rustc, and rust-src — no extra
# components are needed on top.
[private]
_require_esp_toolchain:
@just _ensure_tools
@if ! rustup toolchain list | grep -q "^esp"; then \
echo "ESP toolchain not found, installing via espup (this may take a while)..." >&2; \
espup install || { echo "error: espup install failed" >&2; exit 1; }; \
echo "ESP toolchain not found, installing via mise task (this may take a while)..." >&2; \
mise run esp-install || { echo "error: esp-install task failed" >&2; exit 1; }; \
fi
# Find a serial port matching any of the given VID:PID pairs (checked in order)