From dcc52fdfc95e9b2621b46a18250051234891f563 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 3 Nov 2018 16:00:15 -0600 Subject: Renamed flash/build scripts to better indicate MCU type. --- bin/build-25.sh | 30 ------------------------------ bin/build-85.sh | 30 ------------------------------ bin/build-tiny13.sh | 30 ++++++++++++++++++++++++++++++ bin/build-tiny25.sh | 30 ++++++++++++++++++++++++++++++ bin/build-tiny85.sh | 30 ++++++++++++++++++++++++++++++ bin/build.sh | 30 ------------------------------ bin/flash-25.sh | 4 ---- bin/flash-85.sh | 4 ---- bin/flash-tiny13.bat | 1 + bin/flash-tiny13.sh | 3 +++ bin/flash-tiny25.sh | 4 ++++ bin/flash-tiny85.sh | 4 ++++ bin/flash.sh | 3 --- 13 files changed, 102 insertions(+), 101 deletions(-) delete mode 100755 bin/build-25.sh delete mode 100755 bin/build-85.sh create mode 100755 bin/build-tiny13.sh create mode 100755 bin/build-tiny25.sh create mode 100755 bin/build-tiny85.sh delete mode 100755 bin/build.sh delete mode 100755 bin/flash-25.sh delete mode 100755 bin/flash-85.sh create mode 100755 bin/flash-tiny13.bat create mode 100755 bin/flash-tiny13.sh create mode 100755 bin/flash-tiny25.sh create mode 100755 bin/flash-tiny85.sh delete mode 100755 bin/flash.sh 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..c1f0446 --- /dev/null +++ b/bin/build-tiny13.sh @@ -0,0 +1,30 @@ +#!/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=13 +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-tiny25.sh b/bin/build-tiny25.sh new file mode 100755 index 0000000..a775a0f --- /dev/null +++ b/bin/build-tiny25.sh @@ -0,0 +1,30 @@ +#!/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-tiny85.sh b/bin/build-tiny85.sh new file mode 100755 index 0000000..f0cf1b9 --- /dev/null +++ b/bin/build-tiny85.sh @@ -0,0 +1,30 @@ +#!/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.sh b/bin/build.sh deleted file mode 100755 index c1f0446..0000000 --- a/bin/build.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=13 -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/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.bat b/bin/flash-tiny13.bat new file mode 100755 index 0000000..5324ab6 --- /dev/null +++ b/bin/flash-tiny13.bat @@ -0,0 +1 @@ +avrdude -p t13 -c usbasp -u -Uflash:w:%1.hex:a -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m diff --git a/bin/flash-tiny13.sh b/bin/flash-tiny13.sh new file mode 100755 index 0000000..9c2ef82 --- /dev/null +++ b/bin/flash-tiny13.sh @@ -0,0 +1,3 @@ +#/bin/sh +FIRMWARE=$1 +avrdude -c usbasp -p t13 -u -Uflash:w:$FIRMWARE -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m diff --git a/bin/flash-tiny25.sh b/bin/flash-tiny25.sh new file mode 100755 index 0000000..0b24bb2 --- /dev/null +++ b/bin/flash-tiny25.sh @@ -0,0 +1,4 @@ +#/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-tiny85.sh b/bin/flash-tiny85.sh new file mode 100755 index 0000000..8d1636d --- /dev/null +++ b/bin/flash-tiny85.sh @@ -0,0 +1,4 @@ +#/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.sh b/bin/flash.sh deleted file mode 100755 index 9c2ef82..0000000 --- a/bin/flash.sh +++ /dev/null @@ -1,3 +0,0 @@ -#/bin/sh -FIRMWARE=$1 -avrdude -c usbasp -p t13 -u -Uflash:w:$FIRMWARE -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m -- cgit v1.2.3 From 4df62bd9d7c3b7bbb9a62ab13b78d7f42da99958 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 3 Nov 2018 16:17:50 -0600 Subject: Split flashing scripts into firmware vs fuses, to help prevent accidental bricking. (some people had errors happen during the fuse parts, and ended up with bricks) --- bin/flash-tiny13-fuses.bat | 1 + bin/flash-tiny13-fuses.sh | 8 ++++++++ bin/flash-tiny13.bat | 2 +- bin/flash-tiny13.sh | 2 +- bin/flash-tiny25-fuses.sh | 8 ++++++++ bin/flash-tiny25.sh | 3 +-- bin/flash-tiny85-fuses.sh | 8 ++++++++ bin/flash-tiny85.sh | 3 +-- 8 files changed, 29 insertions(+), 6 deletions(-) create mode 100755 bin/flash-tiny13-fuses.bat create mode 100755 bin/flash-tiny13-fuses.sh create mode 100755 bin/flash-tiny25-fuses.sh create mode 100755 bin/flash-tiny85-fuses.sh 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 index 5324ab6..db75fd8 100755 --- a/bin/flash-tiny13.bat +++ b/bin/flash-tiny13.bat @@ -1 +1 @@ -avrdude -p t13 -c usbasp -u -Uflash:w:%1.hex:a -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m +avrdude -p t13 -c usbasp -u -Uflash:w:%1:a diff --git a/bin/flash-tiny13.sh b/bin/flash-tiny13.sh index 9c2ef82..47b2bfe 100755 --- a/bin/flash-tiny13.sh +++ b/bin/flash-tiny13.sh @@ -1,3 +1,3 @@ #/bin/sh FIRMWARE=$1 -avrdude -c usbasp -p t13 -u -Uflash:w:$FIRMWARE -Ulfuse:w:0x75:m -Uhfuse:w:0xFF:m +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 index 0b24bb2..9975671 100755 --- a/bin/flash-tiny25.sh +++ b/bin/flash-tiny25.sh @@ -1,4 +1,3 @@ #/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 +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 index 8d1636d..0f5a292 100755 --- a/bin/flash-tiny85.sh +++ b/bin/flash-tiny85.sh @@ -1,4 +1,3 @@ #/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 +avrdude -c usbasp -p t85 -u -Uflash:w:$FIRMWARE -- cgit v1.2.3 From a8118a67a1eb5d9a0c400b3055d71be7d9f1ed54 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 3 Nov 2018 16:24:02 -0600 Subject: Reduced duplication across build scripts, replaced per-MCU scripts with a tiny wrapper for the main script. --- bin/build-tiny13.sh | 30 ++---------------------------- bin/build-tiny25.sh | 30 ++---------------------------- bin/build-tiny85.sh | 30 ++---------------------------- bin/build.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 84 deletions(-) create mode 100755 bin/build.sh diff --git a/bin/build-tiny13.sh b/bin/build-tiny13.sh index c1f0446..d4b492f 100755 --- a/bin/build-tiny13.sh +++ b/bin/build-tiny13.sh @@ -1,30 +1,4 @@ #!/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=13 -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 +BASEDIR=$(dirname "$0") +$BASEDIR/build.sh 13 $* diff --git a/bin/build-tiny25.sh b/bin/build-tiny25.sh index a775a0f..779f1ef 100755 --- a/bin/build-tiny25.sh +++ b/bin/build-tiny25.sh @@ -1,30 +1,4 @@ #!/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 +BASEDIR=$(dirname "$0") +$BASEDIR/build.sh 25 $* diff --git a/bin/build-tiny85.sh b/bin/build-tiny85.sh index f0cf1b9..6ee8397 100755 --- a/bin/build-tiny85.sh +++ b/bin/build-tiny85.sh @@ -1,30 +1,4 @@ #!/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 +BASEDIR=$(dirname "$0") +$BASEDIR/build.sh 85 $* diff --git a/bin/build.sh b/bin/build.sh new file mode 100755 index 0000000..6920a3f --- /dev/null +++ b/bin/build.sh @@ -0,0 +1,30 @@ +#!/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 ATTINY=$1 ; shift +export PROGRAM=$1 ; shift +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 -- cgit v1.2.3 From 1756b0beae04f04b6072fcfd2bbe10fb2b4dd116 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 3 Nov 2018 16:41:45 -0600 Subject: added a wrapper to flash fuses and firmware at the same time, like the old scripts did --- bin/flash.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 bin/flash.sh diff --git a/bin/flash.sh b/bin/flash.sh new file mode 100755 index 0000000..019631a --- /dev/null +++ b/bin/flash.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Flashes both fuses and firmware. + +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" -- cgit v1.2.3 From 79155e4f242c10b7ffdf3fb31033576ee8626372 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 3 Nov 2018 16:42:26 -0600 Subject: Applied recent updates to FSM build scripts, and added some really simple Makefiles. --- spaghetti-monster/anduril/Makefile | 7 +++++++ spaghetti-monster/anduril/build-all.sh | 2 +- spaghetti-monster/rampingios/Makefile | 7 +++++++ spaghetti-monster/rampingios/build-all.sh | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 spaghetti-monster/anduril/Makefile create mode 100644 spaghetti-monster/rampingios/Makefile diff --git a/spaghetti-monster/anduril/Makefile b/spaghetti-monster/anduril/Makefile new file mode 100644 index 0000000..25c56fa --- /dev/null +++ b/spaghetti-monster/anduril/Makefile @@ -0,0 +1,7 @@ +all: + ./build-all.sh + +clean: + rm -f *.hex *~ *.elf *.o + +.phony: clean diff --git a/spaghetti-monster/anduril/build-all.sh b/spaghetti-monster/anduril/build-all.sh index 9e2a83c..68d32fb 100755 --- a/spaghetti-monster/anduril/build-all.sh +++ b/spaghetti-monster/anduril/build-all.sh @@ -18,6 +18,6 @@ for TARGET in \ FW3A \ ; do echo "===== $TARGET =====" - ../../../bin/build-85.sh "$UI" "-DFSM_${TARGET}_DRIVER" + ../../../bin/build.sh 85 "$UI" "-DFSM_${TARGET}_DRIVER" mv -f "$UI".hex "$UI".$TARGET.hex done diff --git a/spaghetti-monster/rampingios/Makefile b/spaghetti-monster/rampingios/Makefile new file mode 100644 index 0000000..8db198e --- /dev/null +++ b/spaghetti-monster/rampingios/Makefile @@ -0,0 +1,7 @@ +all: + ./build-all.sh + +clean: + rm -f *.hex cfg-*.h *~ *.elf *.o + +.phony: clean diff --git a/spaghetti-monster/rampingios/build-all.sh b/spaghetti-monster/rampingios/build-all.sh index 22597b7..5b75fe4 100755 --- a/spaghetti-monster/rampingios/build-all.sh +++ b/spaghetti-monster/rampingios/build-all.sh @@ -13,6 +13,6 @@ for TARGET in \ EMISAR_D4S_219C \ ; do echo "===== $TARGET =====" - ../../../bin/build-85.sh "$UI" "-DFSM_${TARGET}_DRIVER" + ../../../bin/build.sh 85 "$UI" "-DFSM_${TARGET}_DRIVER" mv -f "$UI".hex "$UI".$TARGET.hex done -- cgit v1.2.3 From f58d398e0d8889dac90f533b8099a328e7792802 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 3 Nov 2018 16:47:44 -0600 Subject: Added a help message to build.sh and flash.sh --- bin/build.sh | 6 ++++++ bin/flash.sh | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/bin/build.sh b/bin/build.sh index 6920a3f..ddd2a72 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -3,6 +3,12 @@ # 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 MCU=attiny$ATTINY diff --git a/bin/flash.sh b/bin/flash.sh index 019631a..0423c90 100755 --- a/bin/flash.sh +++ b/bin/flash.sh @@ -2,6 +2,13 @@ # 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") -- cgit v1.2.3