#!/bin/bash set -e BUILDDIR="$(dirname "$0")/build" echo "Building..." make -C "$BUILDDIR" DEV=$(ls /dev/cu.usbmodem* 2>/dev/null | head -1) if [ -n "$DEV" ]; then echo "Sending 'b' to $DEV to enter BOOTSEL mode..." printf 'b' > "$DEV" sleep 2 fi echo "Loading firmware..." picotool load -f "$BUILDDIR/picomap.uf2" echo "Rebooting..." picotool reboot || true echo "Done."