just(flash): add optional extra_features arg for build/flash/flash-probe
Appends comma-separated extra features to the board feature when
building. Enables iteration workflows like:
just flash wio_tracker_l1 debug-checkpoint
without having to drop to raw cargo + rust-objcopy + uf2 cp.
This commit is contained in:
1 file changed
+18
-11
@@ -53,15 +53,19 @@ check-all:
|
|||||||
check board:
|
check board:
|
||||||
@just _cargo {{board}} "clippy --release" "-- -D warnings"
|
@just _cargo {{board}} "clippy --release" "-- -D warnings"
|
||||||
|
|
||||||
# Build release firmware and copy to builds/ with a readable name
|
# Build release firmware and copy to builds/ with a readable name.
|
||||||
build board profile="release":
|
# `extra_features` (comma-separated) is appended to the board feature,
|
||||||
@just _cargo {{board}} "build --{{profile}}"
|
# e.g. `just build wio_tracker_l1 release debug-checkpoint`.
|
||||||
|
build board profile="release" extra_features="":
|
||||||
|
@just _cargo {{board}} "build --{{profile}}" "" "{{extra_features}}"
|
||||||
@just _copy_firmware {{board}} {{profile}}
|
@just _copy_firmware {{board}} {{profile}}
|
||||||
|
|
||||||
# Build and flash a board (espflash for Xtensa, UF2 DFU for ARM)
|
# Build and flash a board (espflash for Xtensa, UF2 DFU for ARM).
|
||||||
flash board:
|
# `extra_features` is passed through to the build, e.g.
|
||||||
|
# `just flash wio_tracker_l1 debug-checkpoint`.
|
||||||
|
flash board extra_features="":
|
||||||
@just _ensure_tools
|
@just _ensure_tools
|
||||||
@just build {{board}} release
|
@just build {{board}} release "{{extra_features}}"
|
||||||
@set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \
|
@set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \
|
||||||
case "$target" in \
|
case "$target" in \
|
||||||
xtensa-*) \
|
xtensa-*) \
|
||||||
@@ -76,10 +80,11 @@ flash board:
|
|||||||
*) just _flash_uf2 {{board}} ;; \
|
*) just _flash_uf2 {{board}} ;; \
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Flash ARM board via debug probe (requires J-Link or similar)
|
# Flash ARM board via debug probe (requires J-Link or similar).
|
||||||
flash-probe board:
|
# `extra_features` is passed through to the build.
|
||||||
|
flash-probe board extra_features="":
|
||||||
@just _ensure_tools
|
@just _ensure_tools
|
||||||
@just build {{board}} release
|
@just build {{board}} release "{{extra_features}}"
|
||||||
@set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \
|
@set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \
|
||||||
probe-rs run --chip $chip "{{builds_dir}}/donglora-{{board}}-v{{version}}.elf"
|
probe-rs run --chip $chip "{{builds_dir}}/donglora-{{board}}-v{{version}}.elf"
|
||||||
|
|
||||||
@@ -102,12 +107,14 @@ outdated:
|
|||||||
_ensure_tools:
|
_ensure_tools:
|
||||||
@mise trust --yes . 2>/dev/null; mise install --quiet
|
@mise trust --yes . 2>/dev/null; mise install --quiet
|
||||||
|
|
||||||
# Run a cargo command for a board.
|
# Run a cargo command for a board, optionally with extra Cargo features
|
||||||
|
# (comma-separated, e.g. "debug-checkpoint").
|
||||||
# Xtensa: esp toolchain (cargo + rustc + rust-src together) + -Zbuild-std=core
|
# Xtensa: esp toolchain (cargo + rustc + rust-src together) + -Zbuild-std=core
|
||||||
[private]
|
[private]
|
||||||
_cargo board cmd extra_args="":
|
_cargo board cmd extra_args="" extra_features="":
|
||||||
@just _ensure_tools
|
@just _ensure_tools
|
||||||
@set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \
|
@set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \
|
||||||
|
[ -n "{{extra_features}}" ] && feat="$feat,{{extra_features}}"; \
|
||||||
extra=""; buildstd=""; \
|
extra=""; buildstd=""; \
|
||||||
case "$target" in xtensa-*) \
|
case "$target" in xtensa-*) \
|
||||||
just _require_esp_toolchain; \
|
just _require_esp_toolchain; \
|
||||||
|
|||||||
Reference in new issue
Block a user