aboutsummaryrefslogtreecommitdiff
path: root/bin/flash.sh
diff options
context:
space:
mode:
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"