From 6380bcbf6ab479fc8e84ebd9d1a6688a87d20892 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 24 Apr 2026 01:07:02 -0600 Subject: [PATCH] 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. --- justfile | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/justfile b/justfile index d0a9e78..f0b5005 100644 --- a/justfile +++ b/justfile @@ -53,15 +53,19 @@ check-all: check board: @just _cargo {{board}} "clippy --release" "-- -D warnings" -# Build release firmware and copy to builds/ with a readable name -build board profile="release": - @just _cargo {{board}} "build --{{profile}}" +# Build release firmware and copy to builds/ with a readable name. +# `extra_features` (comma-separated) is appended to the board feature, +# 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}} -# Build and flash a board (espflash for Xtensa, UF2 DFU for ARM) -flash board: +# Build and flash a board (espflash for Xtensa, UF2 DFU for ARM). +# `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 build {{board}} release + @just build {{board}} release "{{extra_features}}" @set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \ case "$target" in \ xtensa-*) \ @@ -76,10 +80,11 @@ flash board: *) just _flash_uf2 {{board}} ;; \ esac -# Flash ARM board via debug probe (requires J-Link or similar) -flash-probe board: +# Flash ARM board via debug probe (requires J-Link or similar). +# `extra_features` is passed through to the build. +flash-probe board extra_features="": @just _ensure_tools - @just build {{board}} release + @just build {{board}} release "{{extra_features}}" @set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \ probe-rs run --chip $chip "{{builds_dir}}/donglora-{{board}}-v{{version}}.elf" @@ -102,12 +107,14 @@ outdated: _ensure_tools: @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 [private] -_cargo board cmd extra_args="": +_cargo board cmd extra_args="" extra_features="": @just _ensure_tools @set -- $(just _info {{board}}); feat=$1; target=$2; chip=$3; \ + [ -n "{{extra_features}}" ] && feat="$feat,{{extra_features}}"; \ extra=""; buildstd=""; \ case "$target" in xtensa-*) \ just _require_esp_toolchain; \