#!@KSH@ -p
|
#!@KSH@ -p
|
#
|
#
|
# size_rtems
|
# size_rtems
|
#
|
#
|
# This script gathers information related to the size of RTEMS
|
# This script gathers information related to the size of RTEMS
|
# using the GNU "size" command.
|
# using the GNU "size" command.
|
#
|
#
|
# This script operates by summing up the sizes of the various
|
# This script operates by summing up the sizes of the various
|
# object files which constitute a particular configuration of
|
# object files which constitute a particular configuration of
|
# RTEMS. This size information is gathered for placement in the
|
# RTEMS. This size information is gathered for placement in the
|
# brochure flyers and supplement manuals.
|
# brochure flyers and supplement manuals.
|
#
|
#
|
# NOTE: The concept of the minimum executive size is buried in this script.
|
# NOTE: The concept of the minimum executive size is buried in this script.
|
#
|
#
|
# COPYRIGHT (c) 1989-1999.
|
# COPYRIGHT (c) 1989-1999.
|
# On-Line Applications Research Corporation (OAR).
|
# On-Line Applications Research Corporation (OAR).
|
#
|
#
|
# The license and distribution terms for this file may be
|
# The license and distribution terms for this file may be
|
# found in the file LICENSE in this distribution or at
|
# found in the file LICENSE in this distribution or at
|
# http://www.OARcorp.com/rtems/license.html.
|
# http://www.OARcorp.com/rtems/license.html.
|
#
|
#
|
# $Id: size_rtems.in,v 1.2 2001-09-27 12:02:53 chris Exp $
|
# $Id: size_rtems.in,v 1.2 2001-09-27 12:02:53 chris Exp $
|
#
|
#
|
|
|
target=@target@
|
target=@target@
|
program_prefix=@program_prefix@
|
program_prefix=@program_prefix@
|
|
|
gnusize=${program_prefix}size
|
gnusize=${program_prefix}size
|
|
|
# check usage
|
# check usage
|
if [ $# -ne 2 ] ; then
|
if [ $# -ne 2 ] ; then
|
echo usage ${0}: bsp object_directory
|
echo usage ${0}: bsp object_directory
|
exit 1
|
exit 1
|
fi
|
fi
|
|
|
bsp=$1
|
bsp=$1
|
board=$1
|
board=$1
|
ARCH=$2
|
ARCH=$2
|
|
|
cpu=`echo $target | sed -e 's/-.*//'`
|
cpu=`echo $target | sed -e 's/-.*//'`
|
|
|
case $target in
|
case $target in
|
sparc-sun-solaris*)
|
sparc-sun-solaris*)
|
rtems_cpu=unix
|
rtems_cpu=unix
|
bsp=solaris2
|
bsp=solaris2
|
echo Not supported on unix port.
|
echo Not supported on unix port.
|
exit 0
|
exit 0
|
;;
|
;;
|
i[34567]86-pc-linux-gnu)
|
i[34567]86-pc-linux-gnu)
|
echo linux
|
echo linux
|
rtems_cpu=unix
|
rtems_cpu=unix
|
bsp=linux1
|
bsp=linux1
|
echo Not supported on unix port.
|
echo Not supported on unix port.
|
exit 0
|
exit 0
|
;;
|
;;
|
i[34567]86-unknown-freebsd2.[12]*)
|
i[34567]86-unknown-freebsd2.[12]*)
|
echo freebsd
|
echo freebsd
|
rtems_cpu=unix
|
rtems_cpu=unix
|
bsp=freebsd2
|
bsp=freebsd2
|
echo Not supported on unix port.
|
echo Not supported on unix port.
|
exit 0
|
exit 0
|
;;
|
;;
|
*-rtems*)
|
*-rtems*)
|
cpu=`echo $target | sed -e 's/-.*//'`
|
cpu=`echo $target | sed -e 's/-.*//'`
|
rtems_cpu=$cpu
|
rtems_cpu=$cpu
|
;;
|
;;
|
*)
|
*)
|
echo unknown target $target
|
echo unknown target $target
|
exit 1
|
exit 1
|
;;
|
;;
|
esac
|
esac
|
|
|
case $ARCH in
|
case $ARCH in
|
*debug*) VARIANT=debug ;;
|
*debug*) VARIANT=debug ;;
|
*profile*) VARIANT=profile ;;
|
*profile*) VARIANT=profile ;;
|
*) VARIANT=optimized;;
|
*) VARIANT=optimized;;
|
esac
|
esac
|
|
|
echo
|
echo
|
echo Size Information for the Following Configuration:
|
echo Size Information for the Following Configuration:
|
echo CPU: ${cpu}
|
echo CPU: ${cpu}
|
echo BSP: ${board}
|
echo BSP: ${board}
|
echo VARIANT: ${VARIANT}
|
echo VARIANT: ${VARIANT}
|
echo
|
echo
|
|
|
|
|
#
|
#
|
# KLUDGE to figure out at runtime how to echo a line without a
|
# KLUDGE to figure out at runtime how to echo a line without a
|
# newline.
|
# newline.
|
#
|
#
|
count=`echo "\\c" | wc -c`
|
count=`echo "\\c" | wc -c`
|
if [ ${count} -ne 0 ] ; then
|
if [ ${count} -ne 0 ] ; then
|
EARG="-n"
|
EARG="-n"
|
EOL=""
|
EOL=""
|
else
|
else
|
EARG=""
|
EARG=""
|
EOL="\\c"
|
EOL="\\c"
|
fi
|
fi
|
|
|
if [ ! -d ../${board} ] ; then
|
if [ ! -d ../${board} ] ; then
|
echo "${board} does not exist ... is the current directory the build directory?"
|
echo "${board} does not exist ... is the current directory the build directory?"
|
exit 1
|
exit 1
|
fi
|
fi
|
|
|
#DIRLIST -- so greps for DIRLIST will find this file
|
#DIRLIST -- so greps for DIRLIST will find this file
|
CPUOBJ=exec/score/cpu/${rtems_cpu}/wrap/${ARCH}
|
CPUOBJ=exec/score/cpu/${rtems_cpu}/wrap/${ARCH}
|
COREOBJ=exec/score/src/${ARCH}
|
COREOBJ=exec/score/src/${ARCH}
|
RTEMSOBJ=exec/rtems/src/${ARCH}
|
RTEMSOBJ=exec/rtems/src/${ARCH}
|
SAPIOBJ=exec/sapi/src/${ARCH}
|
SAPIOBJ=exec/sapi/src/${ARCH}
|
OPTOBJ=exec/rtems/optman/${ARCH}
|
OPTOBJ=exec/rtems/optman/${ARCH}
|
|
|
# XXX These have been split up
|
# XXX These have been split up
|
MANLIST=" \
|
MANLIST=" \
|
${RTEMSOBJ}/clockget.o \
|
${RTEMSOBJ}/clockget.o \
|
${RTEMSOBJ}/clockset.o \
|
${RTEMSOBJ}/clockset.o \
|
${RTEMSOBJ}/clocktick.o \
|
${RTEMSOBJ}/clocktick.o \
|
${RTEMSOBJ}/dpmem.o \
|
${RTEMSOBJ}/dpmem.o \
|
${RTEMSOBJ}/event.o \
|
${RTEMSOBJ}/event.o \
|
${RTEMSOBJ}/intr.o \
|
${RTEMSOBJ}/intr.o \
|
${RTEMSOBJ}/msg.o \
|
${RTEMSOBJ}/msg.o \
|
${RTEMSOBJ}/part.o \
|
${RTEMSOBJ}/part.o \
|
${RTEMSOBJ}/ratemon.o \
|
${RTEMSOBJ}/ratemon.o \
|
${RTEMSOBJ}/region.o \
|
${RTEMSOBJ}/region.o \
|
${RTEMSOBJ}/sem.o \
|
${RTEMSOBJ}/sem.o \
|
${RTEMSOBJ}/signal.o \
|
${RTEMSOBJ}/signal.o \
|
${RTEMSOBJ}/tasks.o \
|
${RTEMSOBJ}/tasks.o \
|
${RTEMSOBJ}/timer.o \
|
${RTEMSOBJ}/timer.o \
|
${SAPIOBJ}/debug.o \
|
${SAPIOBJ}/debug.o \
|
${SAPIOBJ}/extension.o \
|
${SAPIOBJ}/extension.o \
|
${SAPIOBJ}/fatal.o \
|
${SAPIOBJ}/fatal.o \
|
${SAPIOBJ}/exinit.o \
|
${SAPIOBJ}/exinit.o \
|
${SAPIOBJ}/io.o \
|
${SAPIOBJ}/io.o \
|
${SAPIOBJ}/rtemsapi.o \
|
${SAPIOBJ}/rtemsapi.o \
|
"
|
"
|
|
|
if [ -r ${RTEMSOBJ}/mp.o ] ; then
|
if [ -r ${RTEMSOBJ}/mp.o ] ; then
|
MPLIST="\
|
MPLIST="\
|
${RTEMSOBJ}/mp.o ${RTEMSOBJ}/eventmp.o \
|
${RTEMSOBJ}/mp.o ${RTEMSOBJ}/eventmp.o \
|
${COREOBJ}/mpci.o ${RTEMSOBJ}/msgmp.o ${COREOBJ}/objectmp.o \
|
${COREOBJ}/mpci.o ${RTEMSOBJ}/msgmp.o ${COREOBJ}/objectmp.o \
|
${RTEMSOBJ}/partmp.o ${RTEMSOBJ}/regionmp.o ${RTEMSOBJ}/semmp.o \
|
${RTEMSOBJ}/partmp.o ${RTEMSOBJ}/regionmp.o ${RTEMSOBJ}/semmp.o \
|
${RTEMSOBJ}/signalmp.o ${RTEMSOBJ}/taskmp.o ${COREOBJ}/threadmp.o \
|
${RTEMSOBJ}/signalmp.o ${RTEMSOBJ}/taskmp.o ${COREOBJ}/threadmp.o \
|
"
|
"
|
|
|
MPOBJLIST=${OPTOBJ}/no-mp.rel
|
MPOBJLIST=${OPTOBJ}/no-mp.rel
|
fi
|
fi
|
|
|
OPTMANLIST="\
|
OPTMANLIST="\
|
${OPTOBJ}/no-dpmem.rel \
|
${OPTOBJ}/no-dpmem.rel \
|
${OPTOBJ}/no-event.rel \
|
${OPTOBJ}/no-event.rel \
|
${MPOBJLIST} \
|
${MPOBJLIST} \
|
${OPTOBJ}/no-msg.rel \
|
${OPTOBJ}/no-msg.rel \
|
${OPTOBJ}/no-part.rel \
|
${OPTOBJ}/no-part.rel \
|
${OPTOBJ}/no-region.rel \
|
${OPTOBJ}/no-region.rel \
|
${OPTOBJ}/no-rtmon.rel \
|
${OPTOBJ}/no-rtmon.rel \
|
${OPTOBJ}/no-sem.rel \
|
${OPTOBJ}/no-sem.rel \
|
${OPTOBJ}/no-signal.rel \
|
${OPTOBJ}/no-signal.rel \
|
${OPTOBJ}/no-timer.rel \
|
${OPTOBJ}/no-timer.rel \
|
"
|
"
|
REQMANLIST="\
|
REQMANLIST="\
|
${SAPIOBJ}/exinit.o \
|
${SAPIOBJ}/exinit.o \
|
${RTEMSOBJ}/tasks.o \
|
${RTEMSOBJ}/tasks.o \
|
${RTEMSOBJ}/intr.o \
|
${RTEMSOBJ}/intr.o \
|
${SAPIOBJ}/fatal.o \
|
${SAPIOBJ}/fatal.o \
|
"
|
"
|
# XXX parts of these have been split up
|
# XXX parts of these have been split up
|
CORELIST=" \
|
CORELIST=" \
|
${COREOBJ}/apiext.o ${COREOBJ}/chain.o \
|
${COREOBJ}/apiext.o ${COREOBJ}/chain.o \
|
${COREOBJ}/coremsg.o ${COREOBJ}/coremutex.o ${COREOBJ}/coresem.o \
|
${COREOBJ}/coremsg.o ${COREOBJ}/coremutex.o ${COREOBJ}/coresem.o \
|
${COREOBJ}/heap.o ${COREOBJ}/interr.o \
|
${COREOBJ}/heap.o ${COREOBJ}/interr.o \
|
${COREOBJ}/isr.o \
|
${COREOBJ}/isr.o \
|
${COREOBJ}/object.o \
|
${COREOBJ}/object.o \
|
${SAPIOBJ}/rtemsapi.o \
|
${SAPIOBJ}/rtemsapi.o \
|
${COREOBJ}/thread.o ${COREOBJ}/threadq.o ${COREOBJ}/tod.o \
|
${COREOBJ}/thread.o ${COREOBJ}/threadq.o ${COREOBJ}/tod.o \
|
${COREOBJ}/userext.o \
|
${COREOBJ}/userext.o \
|
${COREOBJ}/watchdog.o ${COREOBJ}/wkspace.o \
|
${COREOBJ}/watchdog.o ${COREOBJ}/wkspace.o \
|
"
|
"
|
|
|
CPULIST="\
|
CPULIST="\
|
${CPUOBJ}/rtems-cpu.rel \
|
${CPUOBJ}/rtems-cpu.rel \
|
"
|
"
|
|
|
# check directories
|
# check directories
|
for i in ${EXECOBJ} ${CPUOBJ} ${OPTOBJ}
|
for i in ${EXECOBJ} ${CPUOBJ} ${OPTOBJ}
|
do
|
do
|
if [ ! -d ${i} ] ; then
|
if [ ! -d ${i} ] ; then
|
echo "${i} does not exist ... is RTEMS compiled and installed?"
|
echo "${i} does not exist ... is RTEMS compiled and installed?"
|
exit 1
|
exit 1
|
fi
|
fi
|
done
|
done
|
|
|
for i in ${MANLIST} ${MPLIST} ${OPTMANLIST} ${REQMANLIST} ${CORELIST} ${CPULIST}
|
for i in ${MANLIST} ${MPLIST} ${OPTMANLIST} ${REQMANLIST} ${CORELIST} ${CPULIST}
|
do
|
do
|
if [ ! -r ${i} ] ; then
|
if [ ! -r ${i} ] ; then
|
echo ${i} does not exist ... is RTEMS compiled and installed?
|
echo ${i} does not exist ... is RTEMS compiled and installed?
|
exit 1
|
exit 1
|
fi
|
fi
|
done
|
done
|
|
|
# "rips" a line of gsize's output and prints size, data, bss
|
# "rips" a line of gsize's output and prints size, data, bss
|
parse_size()
|
parse_size()
|
{
|
{
|
echo $1 $2 $3
|
echo $1 $2 $3
|
}
|
}
|
|
|
# prepares a list of code, data, bss sizes for a directory
|
# prepares a list of code, data, bss sizes for a directory
|
sizedir()
|
sizedir()
|
{
|
{
|
${gnusize} $* | sed -e '1,1d' |
|
${gnusize} $* | sed -e '1,1d' |
|
while read line
|
while read line
|
do
|
do
|
parse_size ${line}
|
parse_size ${line}
|
done
|
done
|
}
|
}
|
|
|
# adds the numbers passed on the command line
|
# adds the numbers passed on the command line
|
addit()
|
addit()
|
{
|
{
|
sumx=0
|
sumx=0
|
for x in $*
|
for x in $*
|
do
|
do
|
sumx=`expr $sumx + $x`
|
sumx=`expr $sumx + $x`
|
done
|
done
|
echo $sumx
|
echo $sumx
|
}
|
}
|
|
|
# adds a column from the output of sizedir
|
# adds a column from the output of sizedir
|
addsizes()
|
addsizes()
|
{
|
{
|
# dc version is not portable enough -- It can be left out during
|
# dc version is not portable enough -- It can be left out during
|
# installing linux and may not be available on non-UNIX hosts.
|
# installing linux and may not be available on non-UNIX hosts.
|
#cut -d' ' -f${2} ${1} | sed -e '2,$s/$/ + /' -e '$,$s/$/ p/' | dc
|
#cut -d' ' -f${2} ${1} | sed -e '2,$s/$/ + /' -e '$,$s/$/ p/' | dc
|
|
|
# This may not be as fast but it is probably more portable.
|
# This may not be as fast but it is probably more portable.
|
addit `cut -d' ' -f${2} ${1}`
|
addit `cut -d' ' -f${2} ${1}`
|
}
|
}
|
|
|
# calculates total size of a directory and prints report line
|
# calculates total size of a directory and prints report line
|
size_files()
|
size_files()
|
{
|
{
|
trap "rm -f /tmp/size.$$ ; exit 1" 2 3
|
trap "rm -f /tmp/size.$$ ; exit 1" 2 3
|
|
|
for file in $*
|
for file in $*
|
do
|
do
|
parse_size `${gnusize} $file | sed -e '/text/d'`
|
parse_size `${gnusize} $file | sed -e '/text/d'`
|
done >/tmp/size.$$
|
done >/tmp/size.$$
|
|
|
code=`cat /tmp/size.$$ | addsizes 1`
|
code=`cat /tmp/size.$$ | addsizes 1`
|
data=`cat /tmp/size.$$ | addsizes 2`
|
data=`cat /tmp/size.$$ | addsizes 2`
|
bss=` cat /tmp/size.$$ | addsizes 3`
|
bss=` cat /tmp/size.$$ | addsizes 3`
|
echo "${code} ${data} ${bss}"
|
echo "${code} ${data} ${bss}"
|
rm /tmp/size.$$
|
rm /tmp/size.$$
|
}
|
}
|
|
|
echo
|
echo
|
echo " RTEMS SIZE REPORT"
|
echo " RTEMS SIZE REPORT"
|
echo
|
echo
|
echo " CODE DATA BSS"
|
echo " CODE DATA BSS"
|
echo " =================="
|
echo " =================="
|
echo ${EARG} "MANAGERS: " ${EOL} ; size_files $MANLIST $MPLIST
|
echo ${EARG} "MANAGERS: " ${EOL} ; size_files $MANLIST $MPLIST
|
echo ${EARG} "CORE : " ${EOL} ; size_files $CORELIST $CPULIST
|
echo ${EARG} "CORE : " ${EOL} ; size_files $CORELIST $CPULIST
|
echo ${EARG} "CPU : " ${EOL} ; size_files $CPULIST
|
echo ${EARG} "CPU : " ${EOL} ; size_files $CPULIST
|
echo ${EARG} "OVERALL : " ${EOL} ; size_files $CPULIST $CORELIST $MANLIST \
|
echo ${EARG} "OVERALL : " ${EOL} ; size_files $CPULIST $CORELIST $MANLIST \
|
$MPLIST
|
$MPLIST
|
echo ${EARG} "MINIMUM : " ${EOL} ; size_files $CPULIST $CORELIST \
|
echo ${EARG} "MINIMUM : " ${EOL} ; size_files $CPULIST $CORELIST \
|
$OPTMANLIST $REQMANLIST
|
$OPTMANLIST $REQMANLIST
|
echo
|
echo
|
|
|
for file in $MANLIST
|
for file in $MANLIST
|
do
|
do
|
base=`basename ${file}`
|
base=`basename ${file}`
|
echo ${EARG} ""${base} : " ${EOL} " ; size_files ${file}
|
echo ${EARG} ""${base} : " ${EOL} " ; size_files ${file}
|
done
|
done
|
|
|
echo ${EARG} "MP : " ${EOL} ; size_files $MPLIST
|
echo ${EARG} "MP : " ${EOL} ; size_files $MPLIST
|
|
|
echo
|
echo
|
for file in $OPTMANLIST
|
for file in $OPTMANLIST
|
do
|
do
|
base=`basename ${file}`
|
base=`basename ${file}`
|
echo ${EARG} "${base} : " ${EOL} ; size_files ${file}
|
echo ${EARG} "${base} : " ${EOL} ; size_files ${file}
|
done
|
done
|
|
|
echo
|
echo
|
exit 0
|
exit 0
|
|
|