OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [tools/] [cpu/] [generic/] [size_rtems.in] - Blame information for rev 173

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.