From 2b1ec5fa2a4075ef7ae9bb4a18936af669c15cf9 Mon Sep 17 00:00:00 2001 From: s-ol Date: Sat, 12 Oct 2024 19:33:39 +0200 Subject: scripts: support specifying drive, other configs --- .scripts/config.dev.py | 15 +++++++++++++++ .scripts/flash | 29 ++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 .scripts/config.dev.py diff --git a/.scripts/config.dev.py b/.scripts/config.dev.py new file mode 100644 index 0000000..b5b332d --- /dev/null +++ b/.scripts/config.dev.py @@ -0,0 +1,15 @@ +from hex33board.boards.r4_5e4bf5c import * + + +''' boot in dev_mode by default + +When active, the firmware drive will be writable on boot. +''' +dev_mode = True + +''' forward Key events via USB MIDI + +This can be useful to control a simulator instance running on a computer +using the physical buttons on a hardware unit. +''' +sysex_key_sync = False diff --git a/.scripts/flash b/.scripts/flash index ead035f..1c5f99e 100755 --- a/.scripts/flash +++ b/.scripts/flash @@ -6,6 +6,9 @@ CPY= CONFIG= TTY= +UF2_DISK= +CPY_DISK= + set -e while test $# -gt 0 @@ -14,14 +17,22 @@ do --cpy) CPY=1 ;; - --config=testing) - CONFIG=config.testing.py + --config=*) + CONFIG="${1#*=}" + ;; + --uf2-disk=*) + UF2_DISK="${1#*=}" + ;; + --cpy-disk=*) + CPY_DISK="${1#*=}" ;; --help) echo "USAGE:" - echo " --cpy (also) flash circuitpython" - echo " --config=testing copy testing config" - echo " --tty open tty in tio" + echo " --cpy (also) flash circuitpython" + echo " --uf2-disk=/dev/sda1 path to UF2 bootloader disk for flashing CPy" + echo " --cpy-disk=/dev/sda1 path to CircuitPython code disk for flashing firmware" + echo " --config=config.testing.py copy a different config" + echo " --tty open tty in tio" exit ;; esac @@ -44,16 +55,16 @@ wait_disk() { } 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) + [ -z "$UF2_DISK"] && UF2_DISK=$(wait_disk /dev/disk/by-label/RPI-RP2) + sudo mount "$UF2_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) +[ -z "$CPY_DISK" ] && CPY_DISK=$(wait_disk /dev/disk/by-label/{CIRCUITPY,HEX33BOARD}) +sudo mount "$CPY_DISK" $MOUNT -o sync,rw,uid=$(id -u),gid=$(id -g) echo -n "copying Code..." rsync -r $REPO/* $MOUNT/ echo " done" -- cgit v1.2.3