#!/usr/bin/env bash # Build + flash a firmware profile to the discovered DUT; no SDR required. # ./tools/flash.sh [test|debug] # Refuses ambiguous serial devices (see tools/discover_devices.sh). set -euo pipefail cd "$(dirname "$0")/.." PROFILE=${1:-test} devices=$(./tools/discover_devices.sh --dut-only) eval "$devices" echo "Flashing profile '$PROFILE' to: $DUT_PORT" >&2 ./tools/build.sh "$PROFILE" cd firmware if ! idf.py -B "build-$PROFILE" -p "$DUT_PORT" flash; then # entering download mode re-enumerates the USB device; rediscover once sleep 2 cd .. devices=$(./tools/discover_devices.sh --dut-only) eval "$devices" cd firmware idf.py -B "build-$PROFILE" -p "$DUT_PORT" flash fi