Project

General

Profile

Revision 1465

Added RAM size check to makefile for unit tests

View differences:

trunk/code/projects/test/Makefile
14 14
USE_WIRELESS = 1
15 15

  
16 16
# com1 = serial port. Use lpt1 to connect to parallel port.
17
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
17
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM7:'; else echo '/dev/ttyUSB0'; fi)
18 18
#
19 19
#
20 20
###################################
......
119 119
CINCS = -I$(COLONYROOT)/code/lib/include/libdragonfly
120 120
CINCS += -L$(COLONYROOT)/code/lib/bin
121 121
ifdef USE_WIRELESS
122
	CINCS += -I$(COLONYROOT)/code/lib/include/libwireless
122
  CINCS += -I$(COLONYROOT)/code/lib/include/libwireless
123 123
endif
124 124

  
125 125
#---------------- Compiler Options ----------------
......
328 328

  
329 329

  
330 330
# Default target.
331
all: begin gccversion sizebefore build sizeafter end
331
all: begin gccversion sizebefore build sizeafter checksize end
332 332

  
333 333
build: elf hex eep lss sym
334 334

  
......
357 357
ELFSIZE = $(SIZE) -A $(TARGET).elf
358 358
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
359 359

  
360
# check RAM size (make sure under 4 kB)
361
DATASIZE = avr-size -A main.elf | grep 'data' | cut -d" " -f15 > 1.tmp
362
BSSSIZE = avr-size -A main.elf | grep 'bss' | cut -d" " -f16 > 2.tmp
363
ADD = expr `cat 1.tmp` + `cat 2.tmp` > 3.tmp
364
CLEANSIZE = rm 1.tmp 2.tmp 3.tmp
365
checksize:
366
	@$(DATASIZE)
367
	@$(BSSSIZE)
368
	@$(ADD)
369
	@if test `cat 3.tmp` -gt 4096; \
370
	then echo "RAM size exceeded.  Make .data or .bss smaller.";echo;exit 1; \
371
	else echo ".data and .bss size fine";echo; fi
372
	@$(CLEANSIZE)
373

  
360 374
sizebefore:
361 375
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
362 376
	$(AVRMEM) 2>/dev/null; echo; fi

Also available in: Unified diff