aboutsummaryrefslogtreecommitdiff
path: root/bin/flash.sh
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-11-03 16:54:18 -0600
committerSelene ToyKeeper2018-11-03 16:54:18 -0600
commitb4d8f74c5fa32b974d7af8c71927822667a24643 (patch)
tree2ea10ed0a9926b7eecf3080ffccc3b22c1a5a9ef /bin/flash.sh
parentCorrected anduril.txt with the new aux LED button mappings. (diff)
parentAdded a help message to build.sh and flash.sh (diff)
downloadanduril-b4d8f74c5fa32b974d7af8c71927822667a24643.tar.gz
anduril-b4d8f74c5fa32b974d7af8c71927822667a24643.tar.bz2
anduril-b4d8f74c5fa32b974d7af8c71927822667a24643.zip
merged trunk and flash-safer branch (clean up flash/build scripts and make flashing less likely to produce bricks)
Diffstat (limited to 'bin/flash.sh')
-rwxr-xr-xbin/flash.sh22
1 files changed, 19 insertions, 3 deletions
diff --git a/bin/flash.sh b/bin/flash.sh
index 9c2ef82..0423c90 100755
--- a/bin/flash.sh
+++ b/bin/flash.sh
@@ -1,3 +1,19 @@
-#/bin/sh
-FIRMWARE=$1
-avrdude -c usbasp -p t13 -u -Uflash:w:$FIRMWARE -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m
+#!/bin/bash
+
+# Flashes both fuses and firmware.
+
+if [ -z "$1" ]; then
+ echo "Usage: flash.sh MCU myprogram[.hex]"
+ echo "MCU is a number, like '13' for attiny13 or '841' for attiny841"
+ echo "The .hex suffix is optional."
+ exit
+fi
+
+set -e
+
+BASEDIR=$(dirname "$0")
+export ATTINY=$1 ; shift
+export PROGRAM=$1 ; shift
+if [ ! -f "$PROGRAM" ]; then PROGRAM="$PROGRAM".hex ; fi
+$BASEDIR/flash-tiny"$ATTINY"-fuses.sh
+$BASEDIR/flash-tiny"$ATTINY".sh "$PROGRAM"