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 <keithp@keithp.com>
--- /dev/null
+#!/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); }'
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)