diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/build-25.sh | 30 | ||||
| -rwxr-xr-x | bin/build-85.sh | 30 | ||||
| -rwxr-xr-x | bin/build-tiny13.sh | 4 | ||||
| -rwxr-xr-x | bin/build-tiny25.sh | 4 | ||||
| -rwxr-xr-x | bin/build-tiny85.sh | 4 | ||||
| -rwxr-xr-x | bin/build.sh | 8 | ||||
| -rwxr-xr-x | bin/flash-25.sh | 4 | ||||
| -rwxr-xr-x | bin/flash-85.sh | 4 | ||||
| -rwxr-xr-x | bin/flash-tiny13-fuses.bat | 1 | ||||
| -rwxr-xr-x | bin/flash-tiny13-fuses.sh | 8 | ||||
| -rwxr-xr-x | bin/flash-tiny13.bat | 1 | ||||
| -rwxr-xr-x | bin/flash-tiny13.sh | 3 | ||||
| -rwxr-xr-x | bin/flash-tiny25-fuses.sh | 8 | ||||
| -rwxr-xr-x | bin/flash-tiny25.sh | 3 | ||||
| -rwxr-xr-x | bin/flash-tiny85-fuses.sh | 8 | ||||
| -rwxr-xr-x | bin/flash-tiny85.sh | 3 | ||||
| -rwxr-xr-x | bin/flash.sh | 22 |
17 files changed, 73 insertions, 72 deletions
diff --git a/bin/build-25.sh b/bin/build-25.sh deleted file mode 100755 index a775a0f..0000000 --- a/bin/build-25.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Instead of using a Makefile, since most of the firmwares here build in the -# same exact way, here's a script to do the same thing - -export PROGRAM=$1 ; shift -export ATTINY=25 -export MCU=attiny$ATTINY -export CC=avr-gcc -export OBJCOPY=avr-objcopy -export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums" -export OFLAGS="-Wall -g -Os -mmcu=$MCU" -export LDFLAGS= -export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex' -export OBJS=$PROGRAM.o - -for arg in "$*" ; do - OTHERFLAGS="$OTHERFLAGS $arg" -done - -function run () { - echo $* - $* - if [ x"$?" != x0 ]; then exit 1 ; fi -} - -run $CC $OTHERFLAGS $CFLAGS -o $PROGRAM.o -c $PROGRAM.c -run $CC $OFLAGS $LDFLAGS -o $PROGRAM.elf $PROGRAM.o -run $OBJCOPY $OBJCOPYFLAGS $PROGRAM.elf $PROGRAM.hex -run avr-size -C --mcu=$MCU $PROGRAM.elf | grep Full diff --git a/bin/build-85.sh b/bin/build-85.sh deleted file mode 100755 index f0cf1b9..0000000 --- a/bin/build-85.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Instead of using a Makefile, since most of the firmwares here build in the -# same exact way, here's a script to do the same thing - -export PROGRAM=$1 ; shift -export ATTINY=85 -export MCU=attiny$ATTINY -export CC=avr-gcc -export OBJCOPY=avr-objcopy -export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums" -export OFLAGS="-Wall -g -Os -mmcu=$MCU" -export LDFLAGS= -export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex' -export OBJS=$PROGRAM.o - -for arg in "$*" ; do - OTHERFLAGS="$OTHERFLAGS $arg" -done - -function run () { - echo $* - $* - if [ x"$?" != x0 ]; then exit 1 ; fi -} - -run $CC $OTHERFLAGS $CFLAGS -o $PROGRAM.o -c $PROGRAM.c -run $CC $OFLAGS $LDFLAGS -o $PROGRAM.elf $PROGRAM.o -run $OBJCOPY $OBJCOPYFLAGS $PROGRAM.elf $PROGRAM.hex -run avr-size -C --mcu=$MCU $PROGRAM.elf | grep Full diff --git a/bin/build-tiny13.sh b/bin/build-tiny13.sh new file mode 100755 index 0000000..d4b492f --- /dev/null +++ b/bin/build-tiny13.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +BASEDIR=$(dirname "$0") +$BASEDIR/build.sh 13 $* diff --git a/bin/build-tiny25.sh b/bin/build-tiny25.sh new file mode 100755 index 0000000..779f1ef --- /dev/null +++ b/bin/build-tiny25.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +BASEDIR=$(dirname "$0") +$BASEDIR/build.sh 25 $* diff --git a/bin/build-tiny85.sh b/bin/build-tiny85.sh new file mode 100755 index 0000000..6ee8397 --- /dev/null +++ b/bin/build-tiny85.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +BASEDIR=$(dirname "$0") +$BASEDIR/build.sh 85 $* diff --git a/bin/build.sh b/bin/build.sh index c1f0446..ddd2a72 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -3,8 +3,14 @@ # Instead of using a Makefile, since most of the firmwares here build in the # same exact way, here's a script to do the same thing +if [ -z "$1" ]; then + echo "Usage: build.sh MCU myprogram" + echo "MCU is a number, like '13' for attiny13 or '841' for attiny841" + exit +fi + +export ATTINY=$1 ; shift export PROGRAM=$1 ; shift -export ATTINY=13 export MCU=attiny$ATTINY export CC=avr-gcc export OBJCOPY=avr-objcopy diff --git a/bin/flash-25.sh b/bin/flash-25.sh deleted file mode 100755 index 0b24bb2..0000000 --- a/bin/flash-25.sh +++ /dev/null @@ -1,4 +0,0 @@ -#/bin/sh -FIRMWARE=$1 -avrdude -c usbasp -p t25 -u -U lfuse:w:0xd2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m -Uflash:w:$FIRMWARE -# http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=ATtiny25&P=ATtiny25&M_LOW_0x3F=0x22&M_HIGH_0x07=0x07&M_HIGH_0x20=0x00&B_SUT1=P&B_SPIEN=P&B_CKSEL3=P&B_CKSEL2=P&B_CKSEL0=P&V_LOW=D2&V_HIGH=DF&V_EXTENDED=FF diff --git a/bin/flash-85.sh b/bin/flash-85.sh deleted file mode 100755 index 8d1636d..0000000 --- a/bin/flash-85.sh +++ /dev/null @@ -1,4 +0,0 @@ -#/bin/sh -FIRMWARE=$1 -avrdude -c usbasp -p t85 -u -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m -Uflash:w:$FIRMWARE -# http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=ATtiny85&P=ATtiny85&M_LOW_0x3F=0x22&M_HIGH_0x07=0x06&M_HIGH_0x20=0x00&B_SPIEN=P&B_SUT0=P&B_CKSEL3=P&B_CKSEL2=P&B_CKSEL0=P&B_BODLEVEL0=P&V_LOW=E2&V_HIGH=DE&V_EXTENDED=FF diff --git a/bin/flash-tiny13-fuses.bat b/bin/flash-tiny13-fuses.bat new file mode 100755 index 0000000..cec982e --- /dev/null +++ b/bin/flash-tiny13-fuses.bat @@ -0,0 +1 @@ +avrdude -c usbasp -p t13 -u -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m diff --git a/bin/flash-tiny13-fuses.sh b/bin/flash-tiny13-fuses.sh new file mode 100755 index 0000000..fe479a8 --- /dev/null +++ b/bin/flash-tiny13-fuses.sh @@ -0,0 +1,8 @@ +#/bin/sh +# 4.8 MHz (~4.0 MHz actual), 4ms boot delay, enable flashing +# (everything else disabled) +# Use low fuse 0x75 for 4ms startup delay, +# or 0x79 for 64ms (useful on a twisty light) +avrdude -c usbasp -p t13 -u -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m + +# http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=ATtiny13A&P=ATtiny13A&M_LOW_0x0F=0x05&M_LOW_0x80=0x00&M_HIGH_0x06=0x06&B_SPIEN=P&B_SUT1=P&B_CKSEL1=P&V_LOW=75&V_HIGH=FF&O_HEX=Apply+values diff --git a/bin/flash-tiny13.bat b/bin/flash-tiny13.bat new file mode 100755 index 0000000..db75fd8 --- /dev/null +++ b/bin/flash-tiny13.bat @@ -0,0 +1 @@ +avrdude -p t13 -c usbasp -u -Uflash:w:%1:a diff --git a/bin/flash-tiny13.sh b/bin/flash-tiny13.sh new file mode 100755 index 0000000..47b2bfe --- /dev/null +++ b/bin/flash-tiny13.sh @@ -0,0 +1,3 @@ +#/bin/sh +FIRMWARE=$1 +avrdude -c usbasp -p t13 -u -Uflash:w:$FIRMWARE diff --git a/bin/flash-tiny25-fuses.sh b/bin/flash-tiny25-fuses.sh new file mode 100755 index 0000000..65d5b1d --- /dev/null +++ b/bin/flash-tiny25-fuses.sh @@ -0,0 +1,8 @@ +#/bin/sh +# 8 MHz, 4ms boot delay, enable flashing +# (everything else disabled) +# Use low fuse 0xD2 for 4ms startup delay, +# or 0xE2 for 64ms (useful on a twisty light) +avrdude -c usbasp -p t25 -u -U lfuse:w:0xd2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m + +# http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=ATtiny25&P=ATtiny25&M_LOW_0x3F=0x22&M_HIGH_0x07=0x07&M_HIGH_0x20=0x00&B_SPIEN=P&B_SUT0=P&B_CKSEL3=P&B_CKSEL2=P&B_CKSEL0=P&V_LOW=E2&V_HIGH=DF&V_EXTENDED=FF&O_HEX=Apply+values diff --git a/bin/flash-tiny25.sh b/bin/flash-tiny25.sh new file mode 100755 index 0000000..9975671 --- /dev/null +++ b/bin/flash-tiny25.sh @@ -0,0 +1,3 @@ +#/bin/sh +FIRMWARE=$1 +avrdude -c usbasp -p t25 -u -Uflash:w:$FIRMWARE diff --git a/bin/flash-tiny85-fuses.sh b/bin/flash-tiny85-fuses.sh new file mode 100755 index 0000000..e517b2d --- /dev/null +++ b/bin/flash-tiny85-fuses.sh @@ -0,0 +1,8 @@ +#/bin/sh +# 8 MHz, 64ms boot delay, enable flashing +# (everything else disabled) +# Use low fuse 0xD2 for 4ms startup delay, +# or 0xE2 for 64ms (useful on a twisty light) +avrdude -c usbasp -p t85 -u -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m + +# http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=ATtiny85&P=ATtiny85&M_LOW_0x3F=0x22&M_HIGH_0x07=0x07&M_HIGH_0x20=0x00&B_SPIEN=P&B_SUT0=P&B_CKSEL3=P&B_CKSEL2=P&B_CKSEL0=P&V_LOW=E2&V_HIGH=DF&V_EXTENDED=FF&O_HEX=Apply+values diff --git a/bin/flash-tiny85.sh b/bin/flash-tiny85.sh new file mode 100755 index 0000000..0f5a292 --- /dev/null +++ b/bin/flash-tiny85.sh @@ -0,0 +1,3 @@ +#/bin/sh +FIRMWARE=$1 +avrdude -c usbasp -p t85 -u -Uflash:w:$FIRMWARE 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" |
