aboutsummaryrefslogtreecommitdiff
path: root/bin/build.sh
diff options
context:
space:
mode:
authorSelene ToyKeeper2014-11-05 21:55:29 -0700
committerSelene ToyKeeper2014-11-05 21:55:29 -0700
commit890fe154333a0ca20fae023b8ca3dc2df14db5f9 (patch)
tree0d67fa8231e6635d604e49ecbc230f5a12c2def4 /bin/build.sh
parentverify images after flashing them (oops, requires 6 pins, not 5) (diff)
downloadanduril-890fe154333a0ca20fae023b8ca3dc2df14db5f9.tar.gz
anduril-890fe154333a0ca20fae023b8ca3dc2df14db5f9.tar.bz2
anduril-890fe154333a0ca20fae023b8ca3dc2df14db5f9.zip
Convenience script for compiling attiny13a firmwares.
Diffstat (limited to 'bin/build.sh')
-rwxr-xr-xbin/build.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/build.sh b/bin/build.sh
new file mode 100755
index 0000000..1c27212
--- /dev/null
+++ b/bin/build.sh
@@ -0,0 +1,24 @@
+#!/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
+export MCU=attiny13
+export CC=avr-gcc
+export OBJCOPY=avr-objcopy
+export CFLAGS="-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
+
+function run () {
+ echo $*
+ $*
+ if [ x"$?" != x0 ]; then exit 1 ; fi
+}
+
+run $CC $CFLAGS -o $PROGRAM.o -c $PROGRAM.c
+run $CC $CFLAGS $LDFLAGS -o $PROGRAM.elf $PROGRAM.o
+run $OBJCOPY $OBJCOPYFLAGS $PROGRAM.elf $PROGRAM.hex
+run avr-size $PROGRAM.hex