~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to bin/build.sh

  • Committer: Selene ToyKeeper
  • Date: 2023-11-04 15:09:10 UTC
  • mfrom: (483.1.175 anduril2)
  • Revision ID: bzr@toykeeper.net-20231104150910-ddd3afw4nhfvof2l
merged anduril2 branch -> fsm, with *years* of changes
(this also means this code is now Anduril 2 instead of Anduril 1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
export ATTINY=$1 ; shift
13
13
export PROGRAM=$1 ; shift
 
14
 
 
15
# give a more useful error message when AVR DFP is needed but not installed
 
16
# (Atmel ATtiny device family pack, for attiny1616 support)
 
17
# http://packs.download.atmel.com/
 
18
#if [ -z "$ATTINY_DFP" ]; then export ATTINY_DFP=~/avr/attiny_dfp ; fi
 
19
SERIES1=' 416 417 816 817 1616 1617 3216 3217 '
 
20
if [[ $SERIES1 =~ " $ATTINY " ]]; then
 
21
  if [ -z "$ATTINY_DFP" ]; then
 
22
    echo "ATtiny$ATTINY support requires Atmel attiny device family pack."
 
23
    echo "More info is in /README under tiny1616 support."
 
24
    exit 1
 
25
  fi
 
26
fi
 
27
 
14
28
export MCU=attiny$ATTINY
15
29
export CC=avr-gcc
 
30
export CPP=avr-cpp
16
31
export OBJCOPY=avr-objcopy
17
 
export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums"
18
 
export OFLAGS="-Wall -g -Os -mmcu=$MCU"
 
32
export DFPFLAGS="-B $ATTINY_DFP/gcc/dev/$MCU/ -I $ATTINY_DFP/include/"
 
33
export CFLAGS="  -Wall -g -Os -mmcu=$MCU -c -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums $DFPFLAGS"
 
34
export CPPFLAGS="-Wall -g -Os -mmcu=$MCU -C -std=gnu99 -fgnu89-inline -fwhole-program -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums $DFPFLAGS"
 
35
export OFLAGS="-Wall -g -Os -mmcu=$MCU -mrelax $DFPFLAGS"
19
36
export LDFLAGS="-fgnu89-inline"
20
 
export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex'
 
37
export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex --remove-section .fuse'
21
38
export OBJS=$PROGRAM.o
22
39
 
23
40
for arg in "$*" ; do
30
47
  if [ x"$?" != x0 ]; then exit 1 ; fi
31
48
}
32
49
 
 
50
run $CPP $OTHERFLAGS $CPPFLAGS -o foo.cpp $PROGRAM.c
 
51
grep -a -E -v '^#|^$' foo.cpp > $PROGRAM.cpp ; rm foo.cpp
33
52
run $CC $OTHERFLAGS $CFLAGS -o $PROGRAM.o -c $PROGRAM.c
34
53
run $CC $OFLAGS $LDFLAGS -o $PROGRAM.elf $PROGRAM.o
35
54
run $OBJCOPY $OBJCOPYFLAGS $PROGRAM.elf $PROGRAM.hex