aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-11-03 16:50:19 -0600
committerSelene ToyKeeper2018-11-03 16:50:19 -0600
commitba04f5bd8cc8ac59a0ba83b528ada538b93a1773 (patch)
treefca80af5f1956c9edfe530415e5f0de7a68b2d52
parentapplied thermal target bugfix from Anduril (diff)
parentAdded a help message to build.sh and flash.sh (diff)
downloadanduril-ba04f5bd8cc8ac59a0ba83b528ada538b93a1773.tar.gz
anduril-ba04f5bd8cc8ac59a0ba83b528ada538b93a1773.tar.bz2
anduril-ba04f5bd8cc8ac59a0ba83b528ada538b93a1773.zip
merged flash-safer branch (clean up flash/build scripts and make flashing less likely to produce bricks)
-rwxr-xr-xbin/build-25.sh30
-rwxr-xr-xbin/build-85.sh30
-rwxr-xr-xbin/build-tiny13.sh4
-rwxr-xr-xbin/build-tiny25.sh4
-rwxr-xr-xbin/build-tiny85.sh4
-rwxr-xr-xbin/build.sh8
-rwxr-xr-xbin/flash-25.sh4
-rwxr-xr-xbin/flash-85.sh4
-rwxr-xr-xbin/flash-tiny13-fuses.bat1
-rwxr-xr-xbin/flash-tiny13-fuses.sh8
-rwxr-xr-xbin/flash-tiny13.bat1
-rwxr-xr-xbin/flash-tiny13.sh3
-rwxr-xr-xbin/flash-tiny25-fuses.sh8
-rwxr-xr-xbin/flash-tiny25.sh3
-rwxr-xr-xbin/flash-tiny85-fuses.sh8
-rwxr-xr-xbin/flash-tiny85.sh3
-rwxr-xr-xbin/flash.sh22
-rw-r--r--spaghetti-monster/anduril/Makefile7
-rwxr-xr-xspaghetti-monster/anduril/build-all.sh2
-rw-r--r--spaghetti-monster/rampingios/Makefile7
-rwxr-xr-xspaghetti-monster/rampingios/build-all.sh2
21 files changed, 89 insertions, 74 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"
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
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.