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

4.104.114.84.95
Last change on this file since 0799dec was 60b791ad, checked in by Joel Sherrill <joel.sherrill@…>, on 02/17/98 at 23:46:28

updated copyright to 1998

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