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

4.104.114.84.95
Last change on this file since da47e4a9 was da47e4a9, checked in by Joel Sherrill <joel.sherrill@…>, on May 26, 1999 at 2:00:48 PM

Initiated updating this to reflect split up.

  • 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-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}/wrap/${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
113# XXX These have been split up
114MANLIST=" \
115${RTEMSOBJ}/clock.o \
116${RTEMSOBJ}/dpmem.o \
117${RTEMSOBJ}/event.o \
118${RTEMSOBJ}/intr.o \
119${RTEMSOBJ}/msg.o \
120${RTEMSOBJ}/part.o \
121${RTEMSOBJ}/ratemon.o \
122${RTEMSOBJ}/region.o \
123${RTEMSOBJ}/sem.o \
124${RTEMSOBJ}/signal.o \
125${RTEMSOBJ}/tasks.o \
126${RTEMSOBJ}/timer.o \
127${SAPIOBJ}/debug.o \
128${SAPIOBJ}/extension.o \
129${SAPIOBJ}/fatal.o \
130${SAPIOBJ}/exinit.o \
131${SAPIOBJ}/io.o \
132${SAPIOBJ}/rtemsapi.o \
133"
134
135if [ -r ${RTEMSOBJ}/mp.o ] ; then
136  MPLIST="\
137  ${RTEMSOBJ}/mp.o ${RTEMSOBJ}/eventmp.o \
138  ${COREOBJ}/mpci.o ${RTEMSOBJ}/msgmp.o ${COREOBJ}/objectmp.o \
139  ${RTEMSOBJ}/partmp.o ${RTEMSOBJ}/regionmp.o ${RTEMSOBJ}/semmp.o \
140  ${RTEMSOBJ}/signalmp.o ${RTEMSOBJ}/taskmp.o ${COREOBJ}/threadmp.o \
141  "
142
143  MPOBJLIST=${OPTOBJ}/no-mp.rel
144fi
145
146OPTMANLIST="\
147${OPTOBJ}/no-dpmem.rel \
148${OPTOBJ}/no-event.rel \
149${MPOBJLIST} \
150${OPTOBJ}/no-msg.rel \
151${OPTOBJ}/no-part.rel \
152${OPTOBJ}/no-region.rel \
153${OPTOBJ}/no-rtmon.rel \
154${OPTOBJ}/no-sem.rel \
155${OPTOBJ}/no-signal.rel \
156${OPTOBJ}/no-timer.rel \
157"
158REQMANLIST="\
159${SAPIOBJ}/exinit.o \
160${RTEMSOBJ}/tasks.o \
161${RTEMSOBJ}/intr.o \
162${SAPIOBJ}/fatal.o \
163"
164# XXX parts of these have been split up
165CORELIST=" \
166${COREOBJ}/apiext.o ${COREOBJ}/chain.o \
167${COREOBJ}/coremsg.o   ${COREOBJ}/coremutex.o ${COREOBJ}/coresem.o \
168${COREOBJ}/heap.o  ${COREOBJ}/interr.o \
169${COREOBJ}/isr.o \
170${COREOBJ}/object.o \
171${SAPIOBJ}/rtemsapi.o \
172${COREOBJ}/thread.o ${COREOBJ}/threadq.o ${COREOBJ}/tod.o \
173${COREOBJ}/userext.o \
174${COREOBJ}/watchdog.o ${COREOBJ}/wkspace.o \
175"
176
177CPULIST="\
178${CPUOBJ}/rtems-cpu.rel \
179"
180
181# check directories
182for i in ${EXECOBJ} ${CPUOBJ} ${OPTOBJ}
183do
184  if [ ! -d ${i} ] ; then
185    echo "${i} does not exist ... is RTEMS compiled and installed?"
186    exit 1
187  fi
188done
189
190for i in ${MANLIST} ${MPLIST} ${OPTMANLIST} ${REQMANLIST} ${CORELIST} ${CPULIST}
191do
192  if [ ! -r ${i} ] ; then
193    echo ${i} does not exist ... is RTEMS compiled and installed?
194    exit 1
195  fi
196done
197
198# "rips" a line of gsize's output and prints size, data, bss
199parse_size()
200{
201  echo $1 $2 $3
202}
203
204# prepares a list of code, data, bss sizes for a directory
205sizedir()
206{
207  ${gnusize} $* | sed -e '1,1d' |
208    while read line
209      do
210        parse_size ${line}
211      done
212}
213
214# adds the numbers passed on the command line
215addit()
216{
217  sumx=0
218  for x in $*
219  do
220    sumx=`expr $sumx + $x`
221  done
222  echo $sumx
223}
224
225# adds a column from the output of sizedir
226addsizes()
227{
228  # dc version is not portable enough -- It can be left out during
229  #  installing linux and may not be available on non-UNIX hosts.
230  #cut -d' ' -f${2} ${1} | sed -e '2,$s/$/ + /' -e '$,$s/$/ p/' | dc
231 
232  #  This may not be as fast but it is probably more portable.
233  addit `cut -d' ' -f${2} ${1}`
234}
235
236# calculates total size of a directory and prints report line
237size_files()
238{
239  trap "rm -f /tmp/size.$$ ; exit 1"  2 3
240
241    for file in $*
242      do
243        parse_size `${gnusize} $file | sed -e '/text/d'`
244      done >/tmp/size.$$
245
246  code=`cat /tmp/size.$$ | addsizes 1`
247  data=`cat /tmp/size.$$ | addsizes 2`
248  bss=` cat /tmp/size.$$ | addsizes 3`
249  echo "${code} ${data} ${bss}"
250  rm /tmp/size.$$
251}
252
253echo
254echo "     RTEMS SIZE REPORT"
255echo
256echo   "          CODE  DATA    BSS"
257echo   "          =================="
258echo ${EARG} "MANAGERS: " ${EOL} ; size_files $MANLIST $MPLIST
259echo ${EARG} "CORE    : " ${EOL} ; size_files $CORELIST $CPULIST
260echo ${EARG} "CPU     : " ${EOL} ; size_files $CPULIST
261echo ${EARG} "OVERALL : " ${EOL} ; size_files $CPULIST $CORELIST $MANLIST \
262                                               $MPLIST
263echo ${EARG} "MINIMUM : " ${EOL} ; size_files $CPULIST $CORELIST \
264                                               $OPTMANLIST $REQMANLIST
265echo
266
267for file in $MANLIST
268do
269  base=`basename ${file}`
270  echo ${EARG}  ""${base}       : " ${EOL} " ; size_files ${file}
271done
272
273echo ${EARG} "MP         : " ${EOL} ; size_files $MPLIST
274
275echo
276for file in $OPTMANLIST
277do
278  base=`basename ${file}`
279  echo ${EARG} "${base} : " ${EOL} ; size_files ${file}
280done
281
282echo
283exit 0
Note: See TracBrowser for help on using the repository browser.