~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to bin/build-tiny85.sh

  • Committer: Selene Scriven
  • Date: 2018-11-03 22:54:18 UTC
  • mfrom: (188.1.36 flash-safer)
  • Revision ID: bzr@toykeeper.net-20181103225418-1vsjrc40xh838ggw
merged trunk and flash-safer branch (clean up flash/build scripts and make flashing less likely to produce bricks)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
2
 
3
 
# Instead of using a Makefile, since most of the firmwares here build in the
4
 
# same exact way, here's a script to do the same thing
5
 
 
6
 
export PROGRAM=$1 ; shift
7
 
export ATTINY=85
8
 
export MCU=attiny$ATTINY
9
 
export CC=avr-gcc
10
 
export OBJCOPY=avr-objcopy
11
 
export CFLAGS="-Wall -g -Os -mmcu=$MCU -c -std=gnu99 -DATTINY=$ATTINY -I.. -I../.. -I../../.. -fshort-enums"
12
 
export OFLAGS="-Wall -g -Os -mmcu=$MCU"
13
 
export LDFLAGS=
14
 
export OBJCOPYFLAGS='--set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex'
15
 
export OBJS=$PROGRAM.o
16
 
 
17
 
for arg in "$*" ; do
18
 
  OTHERFLAGS="$OTHERFLAGS $arg"
19
 
done
20
 
 
21
 
function run () {
22
 
  echo $*
23
 
  $*
24
 
  if [ x"$?" != x0 ]; then exit 1 ; fi
25
 
}
26
 
 
27
 
run $CC $OTHERFLAGS $CFLAGS -o $PROGRAM.o -c $PROGRAM.c
28
 
run $CC $OFLAGS $LDFLAGS -o $PROGRAM.elf $PROGRAM.o
29
 
run $OBJCOPY $OBJCOPYFLAGS $PROGRAM.elf $PROGRAM.hex
30
 
run avr-size -C --mcu=$MCU $PROGRAM.elf | grep Full
 
3
BASEDIR=$(dirname "$0")
 
4
$BASEDIR/build.sh 85 $*