This commit is contained in:
2025-06-27 16:41:18 +02:00
parent 1188995b80
commit ed701e8580
29 changed files with 3329 additions and 376 deletions

View File

@@ -1,28 +1,41 @@
#!/bin/bash
set -e
COM_PORT=/dev/cu.usbmodem1101
# Find the COM port dynamically
COM_PORT=$(ls /dev/cu.usbmodem* 2>/dev/null | head -n 1)
echo -e "bootloader" > $COM_PORT
# Check if a COM port was found
if [ -z "$COM_PORT" ]; then
echo "Error: No /dev/cu.usbmodem device found."
exit 1
else
echo "Using COM Port: $COM_PORT"
# Your script logic goes here, using $COM_PORT
# For example:
# minicom -D $COM_PORT
# screen $COM_PORT 9600
# echo -e "bootloader" > $COM_PORT
sleep 1s
# sleep 1s
while getopts 'abc:h' opt; do
case "$opt" in
?|h)
echo "Usage: $(basename $0) crate_name"
exit 1
;;
esac
done
shift "$(($OPTIND -1))"
CRATE=$1
while getopts 'abc:h' opt; do
case "$opt" in
?|h)
echo "Usage: $(basename $0) crate_name"
exit 1
;;
esac
done
shift "$(($OPTIND -1))"
CRATE=$1
cargo build -p $CRATE --release
arm-none-eabi-objcopy -O ihex target/thumbv7em-none-eabihf/release/$CRATE target/$CRATE.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0x0123 --application target/$CRATE.hex target/$CRATE.zip
# Use our custom reboot system to boot the controller into serial-only DFU mode.
# echo -e "bootloader" > $COM_PORT
# Wait for the reboot.
# sleep 1s
adafruit-nrfutil --verbose dfu serial -pkg target/$CRATE.zip -p $COM_PORT -b 115200 --singlebank
fi
cargo build -p $CRATE --release
arm-none-eabi-objcopy -O ihex target/thumbv7em-none-eabihf/release/$CRATE target/$CRATE.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0x0123 --application target/$CRATE.hex target/$CRATE.zip
# Use our custom reboot system to boot the controller into serial-only DFU mode.
# echo -e "bootloader" > $COM_PORT
# Wait for the reboot.
# sleep 1s
adafruit-nrfutil --verbose dfu serial -pkg target/$CRATE.zip -p $COM_PORT -b 115200 --singlebank