source: rtems/tools/cpu/generic/size_rtems.in @ 2ab1b3a

4.104.114.84.95
Last change on this file since 2ab1b3a was 2ab1b3a, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 22, 1997 at 5:28:32 PM

Now generating this file with autoconf to avoid having to embed so
much target specific information in the script.

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