aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2024-06-06 17:39:57 +0000
committers-ol <s+removethis@s-ol.nu>2024-06-06 17:39:57 +0000
commit1ecf808fe479f135a098f4dd2becd3cb47c8e4b7 (patch)
treee443d2826e3ffcd00b64ca0e960df79e1863ac6c
parentupdate for CircuitPy 9 (diff)
downloadfirmware-1ecf808fe479f135a098f4dd2becd3cb47c8e4b7.tar.gz
firmware-1ecf808fe479f135a098f4dd2becd3cb47c8e4b7.zip
scripts: more options for flashing
-rwxr-xr-x.scripts/flash61
1 files changed, 41 insertions, 20 deletions
diff --git a/.scripts/flash b/.scripts/flash
index eaeb068..ead035f 100755
--- a/.scripts/flash
+++ b/.scripts/flash
@@ -2,18 +2,31 @@
MOUNT=/mnt/sd
REPO=$(realpath ..)
+CPY=
CONFIG=
TTY=
-if [ $# -gt 0 ]; then
- if [ "$1" == "testing" ]; then
- echo "flashing with test config"
- CONFIG=config.testing.py
- else
- echo "invalid flashing mode $1"
- exit 1
- fi
-fi
+set -e
+
+while test $# -gt 0
+do
+ case "$1" in
+ --cpy)
+ CPY=1
+ ;;
+ --config=testing)
+ CONFIG=config.testing.py
+ ;;
+ --help)
+ echo "USAGE:"
+ echo " --cpy (also) flash circuitpython"
+ echo " --config=testing copy testing config"
+ echo " --tty open tty in tio"
+ exit
+ ;;
+ esac
+ shift
+done
wait_disk() {
echo "Waiting for disk(s) $@..." >&2
@@ -30,27 +43,35 @@ wait_disk() {
done
}
-disk=$(wait_disk /dev/disk/by-label/RPI-RP2)
-sudo mount $disk $MOUNT -o sync,rw,uid=$(id -u),gid=$(id -g)
-echo -n "flashing CircuitPython..."
-cp adafruit-circuitpython-solderparty_rp2040_stamp-en_US-*.uf2 $MOUNT/
-echo " done"
-echo
+if [ -n "$CPY" ]; then
+ disk=$(wait_disk /dev/disk/by-label/RPI-RP2)
+ sudo mount $disk $MOUNT -o sync,rw,uid=$(id -u),gid=$(id -g)
+ echo -n "flashing CircuitPython..."
+ cp adafruit-circuitpython-solderparty_rp2040_stamp-en_US-*.uf2 $MOUNT/
+ echo " done"
+ echo
+fi
disk=$(wait_disk /dev/disk/by-label/{CIRCUITPY,HEX33BOARD})
sudo mount $disk $MOUNT -o sync,rw,uid=$(id -u),gid=$(id -g)
echo -n "copying Code..."
rsync -r $REPO/* $MOUNT/
-if [ -z $CONFIG ]; then
- cp $CONFIG $MOUNT/config.py
-fi
echo " done"
echo
+if [ -n "$CONFIG" ]; then
+ echo "copying config $CONFIG..."
+ cp $CONFIG $MOUNT/config.py
+ echo " done"
+ echo
+fi
+
echo -n "installing libs..."
circup --path $MOUNT install -r $MOUNT/requirements.txt
echo " done"
echo
-echo "opening" /dev/ttyACM*
-exec tio /dev/ttyACM*
+if [ -n "$TTY" ]; then
+ echo "opening" /dev/ttyACM*
+ exec tio /dev/ttyACM*
+fi