memlnaut-nisps/scripts/flash-useq-main.sh

37 lines
1.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# Build + flash the uSEQ-CV **main** module firmware (firmware/useq-celium/main).
# Target: uSEQ USEQHARDWARE_1_0 (RP2040). Any extra args are passed to pio
# (e.g. --upload-port /dev/ttyACM0).
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BOARD_DIR="$SCRIPT_DIR/../firmware/useq-celium/main"
ENV="main"
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
echo "Usage: scripts/flash-useq-main.sh [extra pio args]"
echo " Builds firmware/useq-celium/main and uploads it to the uSEQ MAIN board."
exit 0
fi
# Resolve PlatformIO (nix-friendly: fall back to an ephemeral nix-shell).
run_pio() {
if command -v pio >/dev/null 2>&1; then
pio "$@"
elif command -v platformio >/dev/null 2>&1; then
platformio "$@"
elif command -v nix-shell >/dev/null 2>&1; then
nix-shell -p platformio --run "pio $*"
else
echo "error: PlatformIO not found. Install it, e.g.:" >&2
echo " nix-shell -p platformio # or: pipx install platformio" >&2
exit 1
fi
}
echo "==> Build + flash uSEQ MAIN module (env: $ENV)"
echo " If the upload can't auto-reset the board, hold BOOTSEL while plugging in USB."
cd "$BOARD_DIR"
run_pio run -e "$ENV" -t upload "$@"
echo "==> Done. The main board's LEDs sweep on Identify from the Manifold CV panel."