aboutsummaryrefslogtreecommitdiff
path: root/bin/flash.sh
blob: 93fbdbc8f13f0a67de28efc6f5648364f80024b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env 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"