firmware: debug/test build profiles with real behavioural differences

This commit is contained in:
Lars Nolden
2026-09-01 11:23:28 +02:00
parent 31c7aa7d02
commit c835c62172
9 changed files with 133 additions and 13 deletions
+15 -4
View File
@@ -1,11 +1,22 @@
#!/usr/bin/env bash
# Build + flash the firmware to the discovered DUT. Refuses ambiguous devices.
# Build + flash a firmware profile to the discovered DUT.
# ./tools/flash.sh [test|debug]
# Refuses ambiguous serial devices (see tools/discover_devices.sh).
set -euo pipefail
cd "$(dirname "$0")/.."
PROFILE=${1:-test}
eval "$(./tools/discover_devices.sh)"
echo "Flashing DUT: $DUT_PORT" >&2
echo "Flashing profile '$PROFILE' to: $DUT_PORT" >&2
./tools/build.sh "$PROFILE"
cd firmware
idf.py build
idf.py -p "$DUT_PORT" flash
if ! idf.py -B "build-$PROFILE" -p "$DUT_PORT" flash; then
# entering download mode re-enumerates the USB device; rediscover once
sleep 2
cd ..
eval "$(./tools/discover_devices.sh)"
cd firmware
idf.py -B "build-$PROFILE" -p "$DUT_PORT" flash
fi