source: rtems/tools/cpu/generic/size_rtems.in @ 48971e5e

4.104.114.84.95
Last change on this file since 48971e5e was 48971e5e, checked in by Joel Sherrill <joel.sherrill@…>, on 01/23/98 at 17:06:36

Cleaned up a bit.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1#!KSHELL -p
2#
3#  size_rtems
4#
5#  This script gathers information related to the size of RTEMS
6#  using the GNU "size" command.
7#
8#  This script operates by summing up the sizes of the various
9#  object files which constitute a particular configuration of
10#  RTEMS.  This size information is gathered for placement in the
11#  brochure flyers and supplement manuals.
12#
13#  NOTE: The concept of the minimum executive size is buried in this script.
14#
15#  COPYRIGHT (c) 1989-1997.
16#  On-Line Applications Research Corporation (OAR).
17#  Copyright assigned to U.S. Government, 1994.
18#
19#  The license and distribution terms for this file may be
20#  found in the file LICENSE in this distribution or at
21#  http://www.OARcorp.com/rtems/license.html.
22#
23#  $Id$
24#
25
26target=@target@
27program_prefix=@program_prefix@
28
29gnusize=${program_prefix}size
30
31# check usage
32if [ $# -ne 1 ] ; then
33  echo usage ${0}: bsp
34  exit 1
35fi
36
37bsp=$1
38board=$1
39
40cpu=`echo $target | sed -e 's/-.*//'`
41
42echo $target
43case $target in
44  sparc-sun-solaris*)
45      rtems_cpu=unix
46      bsp=solaris2
47      ;;
48  i[3456]86-pc-linux-gnu)
49      echo linux
50      rtems_cpu=unix
51      bsp=linux1
52      ;;
53  *-rtems*)
54    cpu=`echo $target | sed -e 's/-.*//'`
55    case $cpu in
56      hppa1.1) rtems_cpu=hppa1_1 ;;
57      powerpc) rtems_cpu=ppc ;;
58      *)       rtems_cpu=$cpu ;;
59    esac
60    ;;
61  *)
62    echo unknown target $target
63    exit 1
64    ;;
65esac
66
67echo
68echo Generating sizes for CPU ${cpu} on board ${board}
69echo
70
71#
72#  KLUDGE to figure out at runtime how to echo a line without a
73#  newline.
74#
75count=`echo "\\c" | wc -c`
76if [ ${count} -ne 0 ] ; then
77  EARG="-n"
78  EOL=""
79else
80  EARG=""
81  EOL="\\c"
82fi
83
84if [ ! -d ${board} ] ; then
85  echo "${board} does not exist ... is the current directory the build directory?"
86  exit 1
87fi
88
89#DIRLIST -- so greps for DIRLIST will find this file
90CPUOBJ=c/src/exec/score/cpu/${rtems_cpu}/o-${bsp}
91COREOBJ=c/src/exec/score/src/o-${bsp}
92RTEMSOBJ=c/src/exec/rtems/src/o-${bsp}
93SAPIOBJ=c/src/exec/sapi/src/o-${bsp}
94OPTOBJ=${board}/lib
95
96MANLIST=" \
97${RTEMSOBJ}/clock.o \
98${RTEMSOBJ}/dpmem.o \
99${RTEMSOBJ}/event.o \
100${RTEMSOBJ}/intr.o \
101${RTEMSOBJ}/msg.o \
102${RTEMSOBJ}/part.o \
103${RTEMSOBJ}/ratemon.o \
104${RTEMSOBJ}/region.o \
105${RTEMSOBJ}/sem.o \
106${RTEMSOBJ}/signal.o \
107${RTEMSOBJ}/tasks.o \
108${RTEMSOBJ}/timer.o \
109${SAPIOBJ}/debug.o \
110${SAPIOBJ}/extension.o \
111${SAPIOBJ}/fatal.o \
112${SAPIOBJ}/init.o \
113${SAPIOBJ}/io.o \
114${SAPIOBJ}/rtemsapi.o \
115"
116MPLIST="\
117${RTEMSOBJ}/mp.o ${RTEMSOBJ}/eventmp.o \
118${COREOBJ}/mpci.o ${RTEMSOBJ}/msgmp.o ${COREOBJ}/objectmp.o \
119${RTEMSOBJ}/partmp.o ${RTEMSOBJ}/regionmp.o ${RTEMSOBJ}/semmp.o \
120${RTEMSOBJ}/signalmp.o ${RTEMSOBJ}/taskmp.o ${COREOBJ}/threadmp.o \
121"
122
123OPTMANLIST="\
124${OPTOBJ}/no-dpmem.rel \
125${OPTOBJ}/no-event.rel \
126${OPTOBJ}/no-mp.rel \
127${OPTOBJ}/no-msg.rel \
128${OPTOBJ}/no-part.rel \
129${OPTOBJ}/no-region.rel \
130${OPTOBJ}/no-rtmon.rel \
131${OPTOBJ}/no-sem.rel \
132${OPTOBJ}/no-signal.rel \
133${OPTOBJ}/no-timer.rel \
134"
135REQMANLIST="\
136${SAPIOBJ}/init.o \
137${RTEMSOBJ}/tasks.o \
138${RTEMSOBJ}/intr.o \
139${SAPIOBJ}/fatal.o \
140"
141CORELIST=" \
142${COREOBJ}/apiext.o ${COREOBJ}/chain.o \
143${COREOBJ}/coremsg.o   ${COREOBJ}/coremutex.o ${COREOBJ}/coresem.o \
144${COREOBJ}/heap.o  ${COREOBJ}/interr.o \
145${COREOBJ}/isr.o \
146${COREOBJ}/object.o \
147${SAPIOBJ}/rtemsapi.o \
148${COREOBJ}/thread.o ${COREOBJ}/threadq.o ${COREOBJ}/tod.o \
149${COREOBJ}/userext.o \
150${COREOBJ}/watchdog.o ${COREOBJ}/wkspace.o \
151"
152
153CPULIST="\
154${CPUOBJ}/rtems-cpu.rel \
155"
156
157# check directories
158for i in ${EXECOBJ} ${CPUOBJ} ${OPTOBJ}
159do
160  if [ ! -d ${i} ] ; then
161    echo "${i} does not exist ... is RTEMS compiled and installed?"
162    exit 1
163  fi
164done
165
166for i in ${MANLIST} ${MPLIST} ${OPTMANLIST} ${REQMANLIST} ${CORELIST} ${CPULIST}
167do
168  if [ ! -r ${i} ] ; then
169    echo ${i} does not exist ... is RTEMS compiled and installed?
170    exit 1
171  fi
172done
173
174# "rips" a line of gsize's output and prints size, data, bss
175parse_size()
176{
177  echo $1 $2 $3
178}
179
180# prepares a list of code, data, bss sizes for a directory
181sizedir()
182{
183  ${gnusize} $* | sed -e '1,1d' |
184    while read line
185      do
186        parse_size ${line}
187      done
188}
189
190# adds a column from the output of sizedir
191addsizes()
192{
193  cut -d' ' -f${1} | sed -e '2,$s/$/ + /' -e '$,$s/$/ p/' | dc
194}
195
196# calculates total size of a directory and prints report line
197size_files()
198{
199  trap "rm -f /tmp/size.$$ ; exit 1"  2 3
200
201    for file in $*
202      do
203        parse_size `${gnusize} $file | sed -e '/text/d'`
204      done >/tmp/size.$$
205
206  code=`cat /tmp/size.$$ | addsizes 1`
207  data=`cat /tmp/size.$$ | addsizes 2`
208  bss=` cat /tmp/size.$$ | addsizes 3`
209  echo "${code} ${data} ${bss}"
210  rm /tmp/size.$$
211}
212
213echo
214echo "     RTEMS SIZE REPORT"
215echo
216echo   "          CODE  DATA    BSS"
217echo   "          =================="
218echo ${EARG} "MANAGERS: " ${EOL} ; size_files $MANLIST $MPLIST
219echo ${EARG} "CORE    : " ${EOL} ; size_files $CORELIST $CPULIST
220echo ${EARG} "CPU     : " ${EOL} ; size_files $CPULIST
221echo ${EARG} "OVERALL : " ${EOL} ; size_files $CPULIST $CORELIST $MANLIST \
222                                               $MPLIST
223echo ${EARG} "MINIMUM : " ${EOL} ; size_files $CPULIST $CORELIST \
224                                               $OPTMANLIST $REQMANLIST
225echo
226
227for file in $MANLIST
228do
229  base=`basename ${file}`
230  echo ${EARG}  ""${base}       : " ${EOL} " ; size_files ${file}
231done
232
233echo ${EARG} "MP         : " ${EOL} ; size_files $MPLIST
234
235echo
236for file in $OPTMANLIST
237do
238  base=`basename ${file}`
239  echo ${EARG} "${base} : " ${EOL} ; size_files ${file}
240done
241
242echo
243exit 0
Note: See TracBrowser for help on using the repository browser.