From 9513be7f9d3d0b0ec29f6487fa9dc8f1ac24d0de Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 25 Aug 2011 20:43:44 -0700 Subject: altos: Restructure altos build to prepare for multi-arch support Split out sources into separate directories: core: architecture and product independent bits cc1111: cc1111-specific code drivers: architecture independent drivers product: product-specific sources and Makefile fragments util: scripts for building stuff This should have no effect on the built products, but testing is encouraged Signed-off-by: Keith Packard --- src/util/check-stack | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 src/util/check-stack (limited to 'src/util/check-stack') diff --git a/src/util/check-stack b/src/util/check-stack new file mode 100755 index 00000000..1e8044e0 --- /dev/null +++ b/src/util/check-stack @@ -0,0 +1,13 @@ +#!/bin/sh +HEADER=$1 +MEM=$2 + +HEADER_STACK=`awk '/#define AO_STACK_START/ {print strtonum($3)}' $HEADER` +MEM_STACK=`awk '/Stack starts at/ {print strtonum ($4)}' $MEM` + +if [ "$HEADER_STACK" -lt "$MEM_STACK" ]; then + echo $MEM_STACK | awk '{ printf ("Set AO_STACK_START to at least 0x%x\n", $1); }' + exit 1 +else + exit 0 +fi -- cgit v1.2.3 From ef7f86453d686a49882e8c1b88a59228c4c631a9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 12 Nov 2011 18:37:53 -0800 Subject: altos: Check pdata+xdata memory usage during build The sdcc linker doesn't check the sum of pdata+xdata memory usage, it only ensures that xdata itself is small enough. This doesn't keep xdata below the end of usable ram on the cc1111 though (0xfe000). Fix up the check-stack program to also make sure all of xdata fits in available memory. Signed-off-by: Keith Packard --- src/product/Makefile.telebt | 2 +- src/product/Makefile.teledongle | 2 +- src/product/Makefile.telelaunch | 2 +- src/product/Makefile.telemetrum | 2 +- src/product/Makefile.telemini | 2 +- src/product/Makefile.telenano | 2 +- src/teleballoon-v1.1/Makefile | 2 +- src/teleterra-v0.2/Makefile | 5 +---- src/tidongle/Makefile | 2 +- src/util/check-stack | 10 ++++++++-- 10 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src/util/check-stack') diff --git a/src/product/Makefile.telebt b/src/product/Makefile.telebt index 8f7c7429..ea18ff18 100644 --- a/src/product/Makefile.telebt +++ b/src/product/Makefile.telebt @@ -81,7 +81,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/product/Makefile.teledongle b/src/product/Makefile.teledongle index c1b422c0..cf33d1f1 100644 --- a/src/product/Makefile.teledongle +++ b/src/product/Makefile.teledongle @@ -81,7 +81,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/product/Makefile.telelaunch b/src/product/Makefile.telelaunch index b40f61a2..97764517 100644 --- a/src/product/Makefile.telelaunch +++ b/src/product/Makefile.telelaunch @@ -84,7 +84,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/product/Makefile.telemetrum b/src/product/Makefile.telemetrum index 40fc6bc2..52c723ca 100644 --- a/src/product/Makefile.telemetrum +++ b/src/product/Makefile.telemetrum @@ -94,7 +94,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/product/Makefile.telemini b/src/product/Makefile.telemini index 9f90b01f..75beeae4 100644 --- a/src/product/Makefile.telemini +++ b/src/product/Makefile.telemini @@ -83,7 +83,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/product/Makefile.telenano b/src/product/Makefile.telenano index eff3ea97..b30ca789 100644 --- a/src/product/Makefile.telenano +++ b/src/product/Makefile.telenano @@ -82,7 +82,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/teleballoon-v1.1/Makefile b/src/teleballoon-v1.1/Makefile index 89471cf4..fb88787b 100644 --- a/src/teleballoon-v1.1/Makefile +++ b/src/teleballoon-v1.1/Makefile @@ -103,7 +103,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/teleterra-v0.2/Makefile b/src/teleterra-v0.2/Makefile index 583805f6..0747bfbf 100644 --- a/src/teleterra-v0.2/Makefile +++ b/src/teleterra-v0.2/Makefile @@ -25,9 +25,7 @@ CORE_SRC = \ ao_mutex.c \ ao_panic.c \ ao_report.c \ - ao_rssi.c \ ao_sqrt.c \ - ao_state.c \ ao_stdio.c \ ao_storage.c \ ao_task.c @@ -38,7 +36,6 @@ CC1111_SRC = \ ao_button.c \ ao_dbg.c \ ao_dma.c \ - ao_led.c \ ao_packet.c \ ao_packet_master.c \ ao_radio.c \ @@ -90,7 +87,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/tidongle/Makefile b/src/tidongle/Makefile index 58b9d735..698d612c 100644 --- a/src/tidongle/Makefile +++ b/src/tidongle/Makefile @@ -76,7 +76,7 @@ all: ../$(PROG) ../$(PROG): $(REL) Makefile $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. - $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ diff --git a/src/util/check-stack b/src/util/check-stack index 1e8044e0..3b639d70 100755 --- a/src/util/check-stack +++ b/src/util/check-stack @@ -4,10 +4,16 @@ MEM=$2 HEADER_STACK=`awk '/#define AO_STACK_START/ {print strtonum($3)}' $HEADER` MEM_STACK=`awk '/Stack starts at/ {print strtonum ($4)}' $MEM` +XRAM_END=`awk '/EXTERNAL RAM/ { print strtonum ($4)}' $MEM` if [ "$HEADER_STACK" -lt "$MEM_STACK" ]; then echo $MEM_STACK | awk '{ printf ("Set AO_STACK_START to at least 0x%x\n", $1); }' exit 1 -else - exit 0 fi +if [ "$XRAM_END" -ge 65024 ]; then + echo $XRAM_END | awk '{ printf ("Uses too much XRAM, 0x%x >= 0x%x\n", $1, 65024); }' + exit 1 +fi + +exit 0 + -- cgit v1.2.3 From 9804528e249db256e020d4b5340ba6216d3474f0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 9 Apr 2012 22:25:13 -0700 Subject: altos: Check for cc1111 flash overflow The linker is supposed to do this, but it ignores the static initializer data added after the code. Signed-off-by: Keith Packard --- src/util/check-stack | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/util/check-stack') diff --git a/src/util/check-stack b/src/util/check-stack index 3b639d70..7b62e460 100755 --- a/src/util/check-stack +++ b/src/util/check-stack @@ -5,6 +5,8 @@ MEM=$2 HEADER_STACK=`awk '/#define AO_STACK_START/ {print strtonum($3)}' $HEADER` MEM_STACK=`awk '/Stack starts at/ {print strtonum ($4)}' $MEM` XRAM_END=`awk '/EXTERNAL RAM/ { print strtonum ($4)}' $MEM` +FLASH_END=`awk '/ROM\/EPROM\/FLASH/ { print strtonum ($3)}' $MEM` +echo FLASH_END $FLASH_END if [ "$HEADER_STACK" -lt "$MEM_STACK" ]; then echo $MEM_STACK | awk '{ printf ("Set AO_STACK_START to at least 0x%x\n", $1); }' @@ -14,6 +16,10 @@ if [ "$XRAM_END" -ge 65024 ]; then echo $XRAM_END | awk '{ printf ("Uses too much XRAM, 0x%x >= 0x%x\n", $1, 65024); }' exit 1 fi +if [ "$FLASH_END" -ge 32768 ]; then + echo $FLASH_END | awk '{ printf ("Uses too much FLASH, 0x%x >= 0x%x\n", $1, 32768); }' + exit 1 +fi exit 0 -- cgit v1.2.3 From 5c8af6d35ebfc8fd896dfbf9928ec8f9dbfa531f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 14 Apr 2012 12:05:28 -0700 Subject: altos: Remove debug printf from cc1111 check-stack script Signed-off-by: Keith Packard --- src/util/check-stack | 1 - 1 file changed, 1 deletion(-) (limited to 'src/util/check-stack') diff --git a/src/util/check-stack b/src/util/check-stack index 7b62e460..f4cada2b 100755 --- a/src/util/check-stack +++ b/src/util/check-stack @@ -6,7 +6,6 @@ HEADER_STACK=`awk '/#define AO_STACK_START/ {print strtonum($3)}' $HEADER` MEM_STACK=`awk '/Stack starts at/ {print strtonum ($4)}' $MEM` XRAM_END=`awk '/EXTERNAL RAM/ { print strtonum ($4)}' $MEM` FLASH_END=`awk '/ROM\/EPROM\/FLASH/ { print strtonum ($3)}' $MEM` -echo FLASH_END $FLASH_END if [ "$HEADER_STACK" -lt "$MEM_STACK" ]; then echo $MEM_STACK | awk '{ printf ("Set AO_STACK_START to at least 0x%x\n", $1); }' -- cgit v1.2.3