Rev Author Line No. Line
3514 miho 1 #!/bin/sh
2 # Name: checksize
3 # Project: AVR Make system
4 # Author: Christian Starkjohann
5 # Creation Date: 2004-12-29
6 # Tabsize: 4
7 # Copyright: (c) 2005 OBJECTIVE DEVELOPMENT Software GmbH.
8 # Revision: $Id: checksize,v 1.1.1.1 2006/11/09 18:27:00 harbaum Exp $
9  
10 error=0
11 codelimit=2048 # default value
12 datalimit=96 # default value; leave 32 bytes for stack
13  
14 if [ $# -gt 1 ]; then
15 codelimit="$2"
16 fi
17 if [ $# -gt 2 ]; then
18 datalimit="$3"
19 fi
20  
21 set -- `avr-size -d "$1" | awk '/[0-9]/ {print $1 + $2, $2 + $3, $2}'`
22 if [ $1 -gt $codelimit ]; then
23 echo "*** code size $1 exceeds limit of $codelimit"
24 error=1
25 else
26 echo "ROM: $1 bytes (data=$3)"
27 fi
28 if [ $2 -gt $datalimit ]; then
29 echo "*** data size $2 exceeds limit of $datalimit"
30 error=1
31 else
32 echo "RAM: $2 bytes"
33 fi
34  
35 exit $error