From: Keith Packard Date: Sun, 22 May 2011 04:06:29 +0000 (-0700) Subject: src-avr: Check RAM usage for telescience X-Git-Tag: 0.9.3~6 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=6c87e4f77e6072ae7e8587d327b2ff80af2c3e6a;p=fw%2Faltos src-avr: Check RAM usage for telescience ATmega32u4 has only 2.5kB of ram, so check the output of the compiler to make sure it will work. Signed-off-by: Keith Packard --- diff --git a/src-avr/check-avr-mem b/src-avr/check-avr-mem new file mode 100644 index 00000000..c73edbd1 --- /dev/null +++ b/src-avr/check-avr-mem @@ -0,0 +1,9 @@ +#!/bin/sh +nm "$@" | +grep ' N _end' | +awk '{ iram = strtonum("0x" $1) % 0x10000; +if ( iram > 0xaff) { + printf ("%d bytes of ram more than %d available\n", iram, 0xaff); + exit(1); +} else + exit(0); }' diff --git a/src-avr/telescience/Makefile b/src-avr/telescience/Makefile index b964e1e6..2618ee06 100644 --- a/src-avr/telescience/Makefile +++ b/src-avr/telescience/Makefile @@ -77,8 +77,11 @@ quiet ?= $($1) all: $(PROG) +CHECK=sh ../check-avr-mem + $(PROG): Makefile $(OBJ) $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) + $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1) $(PROG).hex: $(PROG) avr-size $(PROG)