diff options
| author | Selene ToyKeeper | 2023-05-30 06:18:12 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2023-05-30 06:18:12 -0600 |
| commit | 803191510e07ebc6567158c47cff8b9893a16465 (patch) | |
| tree | 51c4a56f00e95f7c71e05ef7f7951e304e221f64 /bin/build.sh | |
| parent | synced configs between D4v2 and KR4 (diff) | |
| download | anduril-803191510e07ebc6567158c47cff8b9893a16465.tar.gz anduril-803191510e07ebc6567158c47cff8b9893a16465.tar.bz2 anduril-803191510e07ebc6567158c47cff8b9893a16465.zip | |
with each build, dump a .cpp file with the source after preprocessing
(for easier whole-program debugging)
Diffstat (limited to 'bin/build.sh')
| -rwxr-xr-x | bin/build.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/build.sh b/bin/build.sh index 4cb03b4..a6169d1 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -27,9 +27,11 @@ fi export MCU=attiny$ATTINY 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 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" 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' @@ -45,6 +47,8 @@ function run () { if [ x"$?" != x0 ]; then exit 1 ; fi } +run $CPP $OTHERFLAGS $CPPFLAGS -o foo.cpp $PROGRAM.c +grep --text -E -v '^#|^$' foo.cpp > $PROGRAM.cpp ; rm foo.cpp 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 |
