aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-06-24 18:05:38 -0600
committerSelene ToyKeeper2018-06-24 18:05:38 -0600
commitbb419e016d98b611a1ed5303737a966050605f52 (patch)
treec7a496af8dd522578858abcab411e883bb043949
parentMoved pseudo_rand() into its own header, and made it gather entropy from ADC ... (diff)
downloadanduril-bb419e016d98b611a1ed5303737a966050605f52.tar.gz
anduril-bb419e016d98b611a1ed5303737a966050605f52.tar.bz2
anduril-bb419e016d98b611a1ed5303737a966050605f52.zip
Added script to build all supported Anduril targets.
Diffstat (limited to '')
-rwxr-xr-xbin/build-25.sh8
-rwxr-xr-xbin/build-85.sh8
-rwxr-xr-xbin/build.sh8
-rw-r--r--spaghetti-monster/anduril/anduril.c10
-rwxr-xr-xspaghetti-monster/anduril/build-all.sh12
5 files changed, 35 insertions, 11 deletions
diff --git a/bin/build-25.sh b/bin/build-25.sh
index 2c58db5..2be8269 100755
--- a/bin/build-25.sh
+++ b/bin/build-25.sh
@@ -3,7 +3,7 @@
# 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 PROGRAM=$1 ; shift
export ATTINY=25
export MCU=attiny$ATTINY
export CC=avr-gcc
@@ -14,13 +14,17 @@ 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 $CFLAGS -o $PROGRAM.o -c $PROGRAM.c
+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
index 8b2937d..8e3704b 100755
--- a/bin/build-85.sh
+++ b/bin/build-85.sh
@@ -3,7 +3,7 @@
# 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 PROGRAM=$1 ; shift
export ATTINY=85
export MCU=attiny$ATTINY
export CC=avr-gcc
@@ -14,13 +14,17 @@ 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 $CFLAGS -o $PROGRAM.o -c $PROGRAM.c
+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
index 68f981d..86afd1d 100755
--- a/bin/build.sh
+++ b/bin/build.sh
@@ -3,7 +3,7 @@
# 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 PROGRAM=$1 ; shift
export ATTINY=13
export MCU=attiny$ATTINY
export CC=avr-gcc
@@ -14,13 +14,17 @@ 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 $CFLAGS -o $PROGRAM.o -c $PROGRAM.c
+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/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 2ee18e8..3d25c8c 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -19,8 +19,8 @@
*/
/********* User-configurable options *********/
-// Physical driver type
-#define FSM_EMISAR_D4_DRIVER
+// Physical driver type (uncomment one of the following or define it at the gcc command line)
+//#define FSM_EMISAR_D4_DRIVER
//#define FSM_BLF_Q8_DRIVER
//#define FSM_FW3A_DRIVER
//#define FSM_BLF_GT_DRIVER
@@ -1644,7 +1644,7 @@ void loop() {
set_level(bike_flasher_brightness);
if (! nice_delay_ms(65)) return;
}
- if (! nice_delay_ms(720)) return;
+ nice_delay_ms(720); // no return check necessary on final delay
}
// party / tactical strobe
else if (st < 3) {
@@ -1659,7 +1659,7 @@ void loop() {
nice_delay_ms(del >> 1);
}
set_level(0);
- nice_delay_ms(del);
+ nice_delay_ms(del); // no return check necessary on final delay
}
#ifdef USE_LIGHTNING_MODE
// lightning storm
@@ -1704,7 +1704,7 @@ void loop() {
rand_time = 1 << (pseudo_rand() % 13);
rand_time += pseudo_rand() % rand_time;
set_level(0);
- nice_delay_ms(rand_time);
+ nice_delay_ms(rand_time); // no return check necessary on final delay
}
#endif
diff --git a/spaghetti-monster/anduril/build-all.sh b/spaghetti-monster/anduril/build-all.sh
new file mode 100755
index 0000000..4100805
--- /dev/null
+++ b/spaghetti-monster/anduril/build-all.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+for TARGET in \
+ BLF_GT \
+ BLF_Q8 \
+ EMISAR_D4 \
+ FW3A \
+ ; do
+ echo "===== $TARGET ====="
+ ../../../bin/build-85.sh anduril "-DFSM_${TARGET}_DRIVER"
+ mv -f anduril.hex anduril.$TARGET.hex
+done