source: rtems/tools/cpu/generic/size_rtems.in @ 9e633f5

4.104.114.84.95
Last change on this file since 9e633f5 was df49c60, checked in by Joel Sherrill <joel.sherrill@…>, on 06/12/00 at 15:00:15

Merged from 4.5.0-beta3a

  • Property mode set to 100644
File size: 6.2 KB
Line 
1#!@KSH@ -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-1999.
16#  On-Line Applications Research Corporation (OAR).
17#
18#  The license and distribution terms for this file may be
19#  found in the file LICENSE in this distribution or at
20#  http://www.OARcorp.com/rtems/license.html.
21#
22#  $Id$
23#
24
25target=@target@
26program_prefix=@program_prefix@
27
28gnusize=${program_prefix}size
29
30# check usage
31if [ $# -ne 2 ] ; then
32  echo usage ${0}: bsp object_directory
33  exit 1
34fi
35
36bsp=$1
37board=$1
38ARCH=$2
39
40cpu=`echo $target | sed -e 's/-.*//'`
41
42case $target in
43  sparc-sun-solaris*)
44      rtems_cpu=unix
45      bsp=solaris2
46      echo Not supported on unix port.
47      exit 0
48      ;;
49  i[34567]86-pc-linux-gnu)
50      echo linux
51      rtems_cpu=unix
52      bsp=linux1
53      echo Not supported on unix port.
54      exit 0
55      ;;
56  i[34567]86-unknown-freebsd2.[12]*)
57      echo freebsd
58      rtems_cpu=unix
59      bsp=freebsd2
60      echo Not supported on unix port.
61      exit 0
62      ;;
63  *-rtems*)
64    cpu=`echo $target | sed -e 's/-.*//'`
65    rtems_cpu=$cpu
66    ;;
67  *)
68    echo unknown target $target
69    exit 1
70    ;;
71esac
72
73case $ARCH in
74  *debug*)   VARIANT=debug ;;
75  *profile*) VARIANT=profile ;;
76  *)         VARIANT=optimized;;
77esac
78
79echo
80echo Size Information for the Following Configuration:
81echo CPU: ${cpu}
82echo BSP: ${board}
83echo VARIANT: ${VARIANT}
84echo
85
86
87#
88#  KLUDGE to figure out at runtime how to echo a line without a
89#  newline.
90#
91count=`echo "\\c" | wc -c`
92if [ ${count} -ne 0 ] ; then
93  EARG="-n"
94  EOL=""
95else
96  EARG=""
97  EOL="\\c"
98fi
99
100if [ ! -d ../${board} ] ; then
101  echo "${board} does not exist ... is the current directory the build directory?"
102  exit 1
103fi
104
105#DIRLIST -- so greps for DIRLIST will find this file
106CPUOBJ=exec/score/cpu/${rtems_cpu}/wrap/${ARCH}
107COREOBJ=exec/score/src/${ARCH}
108RTEMSOBJ=exec/rtems/src/${ARCH}
109SAPIOBJ=exec/sapi/src/${ARCH}
110OPTOBJ=exec/rtems/optman/${ARCH}
111
112# XXX These have been split up
113MANLIST=" \
114${RTEMSOBJ}/clockget.o \
115${RTEMSOBJ}/clockset.o \
116${RTEMSOBJ}/clocktick.o \
117${RTEMSOBJ}/dpmem.o \
118${RTEMSOBJ}/event.o \
119${RTEMSOBJ}/intr.o \
120${RTEMSOBJ}/msg.o \
121${RTEMSOBJ}/part.o \
122${RTEMSOBJ}/ratemon.o \
123${RTEMSOBJ}/region.o \
124${RTEMSOBJ}/sem.o \
125${RTEMSOBJ}/signal.o \
126${RTEMSOBJ}/tasks.o \
127${RTEMSOBJ}/timer.o \
128${SAPIOBJ}/debug.o \
129${SAPIOBJ}/extension.o \
130${SAPIOBJ}/fatal.o \
131${SAPIOBJ}/exinit.o \
132${SAPIOBJ}/io.o \
133${SAPIOBJ}/rtemsapi.o \
134"
135
136if [ -r ${RTEMSOBJ}/mp.o ] ; then
137  MPLIST="\
138  ${RTEMSOBJ}/mp.o ${RTEMSOBJ}/eventmp.o \
139  ${COREOBJ}/mpci.o ${RTEMSOBJ}/msgmp.o ${COREOBJ}/objectmp.o \
140  ${RTEMSOBJ}/partmp.o ${RTEMSOBJ}/regionmp.o ${RTEMSOBJ}/semmp.o \
141  ${RTEMSOBJ}/signalmp.o ${RTEMSOBJ}/taskmp.o ${COREOBJ}/threadmp.o \
142  "
143
144  MPOBJLIST=${OPTOBJ}/no-mp.rel
145fi
146
147OPTMANLIST="\
148${OPTOBJ}/no-dpmem.rel \
149${OPTOBJ}/no-event.rel \
150${MPOBJLIST} \
151${OPTOBJ}/no-msg.rel \
152${OPTOBJ}/no-part.rel \
153${OPTOBJ}/no-region.rel \
154${OPTOBJ}/no-rtmon.rel \
155${OPTOBJ}/no-sem.rel \
156${OPTOBJ}/no-signal.rel \
157${OPTOBJ}/no-timer.rel \
158"
159REQMANLIST="\
160${SAPIOBJ}/exinit.o \
161${RTEMSOBJ}/tasks.o \
162${RTEMSOBJ}/intr.o \
163${SAPIOBJ}/fatal.o \
164"
165# XXX parts of these have been split up
166CORELIST=" \
167${COREOBJ}/apiext.o ${COREOBJ}/chain.o \
168${COREOBJ}/coremsg.o   ${COREOBJ}/coremutex.o ${COREOBJ}/coresem.o \
169${COREOBJ}/heap.o  ${COREOBJ}/interr.o \
170${COREOBJ}/isr.o \
171${COREOBJ}/object.o \
172${SAPIOBJ}/rtemsapi.o \
173${COREOBJ}/thread.o ${COREOBJ}/threadq.o ${COREOBJ}/tod.o \
174${COREOBJ}/userext.o \
175${COREOBJ}/watchdog.o ${COREOBJ}/wkspace.o \
176"
177
178CPULIST="\
179${CPUOBJ}/rtems-cpu.rel \
180"
181
182# check directories
183for i in ${EXECOBJ} ${CPUOBJ} ${OPTOBJ}
184do
185  if [ ! -d ${i} ] ; then
186    echo "${i} does not exist ... is RTEMS compiled and installed?"
187    exit 1
188  fi
189done
190
191for i in ${MANLIST} ${MPLIST} ${OPTMANLIST} ${REQMANLIST} ${CORELIST} ${CPULIST}
192do
193  if [ ! -r ${i} ] ; then
194    echo ${i} does not exist ... is RTEMS compiled and installed?
195    exit 1
196  fi
197done
198
199# "rips" a line of gsize's output and prints size, data, bss
200parse_size()
201{
202  echo $1 $2 $3
203}
204
205# prepares a list of code, data, bss sizes for a directory
206sizedir()
207{
208  ${gnusize} $* | sed -e '1,1d' |
209    while read line
210      do
211        parse_size ${line}
212      done
213}
214
215# adds the numbers passed on the command line
216addit()
217{
218  sumx=0
219  for x in $*
220  do
221    sumx=`expr $sumx + $x`
222  done
223  echo $sumx
224}
225
226# adds a column from the output of sizedir
227addsizes()
228{
229  # dc version is not portable enough -- It can be left out during
230  #  installing linux and may not be available on non-UNIX hosts.
231  #cut -d' ' -f${2} ${1} | sed -e '2,$s/$/ + /' -e '$,$s/$/ p/' | dc
232 
233  #  This may not be as fast but it is probably more portable.
234  addit `cut -d' ' -f${2} ${1}`
235}
236
237# calculates total size of a directory and prints report line
238size_files()
239{
240  trap "rm -f /tmp/size.$$ ; exit 1"  2 3
241
242    for file in $*
243      do
244        parse_size `${gnusize} $file | sed -e '/text/d'`
245      done >/tmp/size.$$
246
247  code=`cat /tmp/size.$$ | addsizes 1`
248  data=`cat /tmp/size.$$ | addsizes 2`
249  bss=` cat /tmp/size.$$ | addsizes 3`
250  echo "${code} ${data} ${bss}"
251  rm /tmp/size.$$
252}
253
254echo
255echo "     RTEMS SIZE REPORT"
256echo
257echo   "          CODE  DATA    BSS"
258echo   "          =================="
259echo ${EARG} "MANAGERS: " ${EOL} ; size_files $MANLIST $MPLIST
260echo ${EARG} "CORE    : " ${EOL} ; size_files $CORELIST $CPULIST
261echo ${EARG} "CPU     : " ${EOL} ; size_files $CPULIST
262echo ${EARG} "OVERALL : " ${EOL} ; size_files $CPULIST $CORELIST $MANLIST \
263                                               $MPLIST
264echo ${EARG} "MINIMUM : " ${EOL} ; size_files $CPULIST $CORELIST \
265                                               $OPTMANLIST $REQMANLIST
266echo
267
268for file in $MANLIST
269do
270  base=`basename ${file}`
271  echo ${EARG}  ""${base}       : " ${EOL} " ; size_files ${file}
272done
273
274echo ${EARG} "MP         : " ${EOL} ; size_files $MPLIST
275
276echo
277for file in $OPTMANLIST
278do
279  base=`basename ${file}`
280  echo ${EARG} "${base} : " ${EOL} ; size_files ${file}
281done
282
283echo
284exit 0
Note: See TracBrowser for help on using the repository browser.