source: rtems/c/src/exec/score/tools/generic/size_rtems.in @ 10122b7

4.104.114.84.95
Last change on this file since 10122b7 was 97e2729d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 17:38:09

Added --disable-multiprocessing flag and modified a lot of files to make
it work.

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