aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-02 18:51:38 -0600
committerSelene ToyKeeper2023-11-02 18:51:38 -0600
commit2dcd56ce3d00fc7414652e6f866bf8eefd42dba9 (patch)
treee2d5e5159ad5ce379479f49011131880d7e49b7e /bin
parentreorganized project files (part 1) (diff)
downloadanduril-2dcd56ce3d00fc7414652e6f866bf8eefd42dba9.tar.gz
anduril-2dcd56ce3d00fc7414652e6f866bf8eefd42dba9.tar.bz2
anduril-2dcd56ce3d00fc7414652e6f866bf8eefd42dba9.zip
got things to compile again, renamed #includes
(also modified the build scripts to work with the new file structure)
Diffstat (limited to '')
-rwxr-xr-xbin/build-all.sh19
-rwxr-xr-xbin/build.sh24
2 files changed, 28 insertions, 15 deletions
diff --git a/bin/build-all.sh b/bin/build-all.sh
index b3fc5d3..c5bc19a 100755
--- a/bin/build-all.sh
+++ b/bin/build-all.sh
@@ -7,16 +7,19 @@ if [ ! -z "$1" ]; then
SEARCH="$1"
fi
+# TODO: detect UI from $0
UI=anduril
-date '+#define VERSION_NUMBER "%Y-%m-%d"' > version.h
+mkdir -p hex
+
+date '+#define VERSION_NUMBER "%Y-%m-%d"' > ui/$UI/version.h
PASS=0
FAIL=0
PASSED=''
FAILED=''
-for TARGET in cfg-*.h ; do
+for TARGET in hw/*/*/cfg.h ; do
# maybe limit builds to a specific pattern
if [ ! -z "$SEARCH" ]; then
@@ -25,20 +28,20 @@ for TARGET in cfg-*.h ; do
fi
# friendly name for this build
- NAME=$(echo "$TARGET" | perl -ne '/cfg-(.*).h/ && print "$1\n";')
+ NAME=$(echo "$TARGET" | perl -ne 's|/|-|g; /hw-(.*)-cfg.h/ && print "$1\n";')
echo "===== $NAME ====="
# figure out MCU type
- ATTINY=$(grep 'ATTINY:' $TARGET | awk '{ print $3 }')
- if [ -z "$ATTINY" ]; then ATTINY=85 ; fi
+ #ATTINY=$(grep 'ATTINY:' $TARGET | awk '{ print $3 }')
+ #if [ -z "$ATTINY" ]; then ATTINY=85 ; fi
# try to compile
- echo ../../../bin/build.sh $ATTINY "$UI" "-DCFG_H=${TARGET}"
- ../../../bin/build.sh $ATTINY "$UI" "-DCFG_H=${TARGET}"
+ #echo bin/build.sh "$UI" "$TARGET"
+ bin/build.sh "$UI" "$TARGET"
# track result, and rename compiled files
if [ 0 = $? ] ; then
- mv -f "$UI".hex "$UI".$NAME.hex
+ mv -f "ui/$UI/$UI".hex hex/"$UI".$NAME.hex
PASS=$(($PASS + 1))
PASSED="$PASSED $NAME"
else
diff --git a/bin/build.sh b/bin/build.sh
index 499b5bd..0c4fc17 100755
--- a/bin/build.sh
+++ b/bin/build.sh
@@ -4,13 +4,19 @@
# 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"
+ echo "Usage: build.sh UI CFG USER"
+ echo "Example: build.sh ui/anduril hw/hank/emisar-d4 users/myuser"
+ echo "(but USER isn't implemented yet)"
exit
fi
-export ATTINY=$1 ; shift
-export PROGRAM=$1 ; shift
+UI=$1 ; shift
+CFG=$1 ; shift
+
+ATTINY=$(grep 'ATTINY:' $CFG | awk '{ print $3 }')
+if [ -z "$ATTINY" ]; then ATTINY=85 ; fi
+
+PROGRAM="ui/$UI/$UI"
# give a more useful error message when AVR DFP is needed but not installed
# (Atmel ATtiny device family pack, for attiny1616 support)
@@ -30,19 +36,23 @@ export CC=avr-gcc
export CPP=avr-cpp
export OBJCOPY=avr-objcopy
export DFPFLAGS="-B $ATTINY_DFP/gcc/dev/$MCU/ -I $ATTINY_DFP/include/"
-export CFLAGS=" -Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums $DFPFLAGS"
-export CPPFLAGS="-Wall -g -Os -mmcu=$MCU -C -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums $DFPFLAGS"
+# TODO: include $user/ first so it can override other stuff
+INCLUDES="-I ui -I hw -I. -I.. -I../.. -I../../.."
+export CFLAGS=" -Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY $INCLUDES -fshort-enums $DFPFLAGS"
+export CPPFLAGS="-Wall -g -Os -mmcu=$MCU -C -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY $INCLUDES -fshort-enums $DFPFLAGS"
export OFLAGS="-Wall -g -Os -mmcu=$MCU -mrelax $DFPFLAGS"
export LDFLAGS="-fgnu89-inline"
export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex --remove-section .fuse'
export OBJS=$PROGRAM.o
+OTHERFLAGS="-DCFG_H=$CFG"
for arg in "$*" ; do
OTHERFLAGS="$OTHERFLAGS $arg"
done
function run () {
- echo $*
+ #echo $1 ; shift
+ #echo $*
$*
if [ x"$?" != x0 ]; then exit 1 ; fi
}