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

4.104.114.84.95
Last change on this file since 42dc81e was 42dc81e, checked in by Joel Sherrill <joel.sherrill@…>, on 03/23/98 at 23:08:10

Renamed hppa1_1 to hppa1.1

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