URL
https://opencores.org/ocsvn/or1k_old/or1k_old/trunk
Subversion Repositories or1k_old
[/] [or1k_old/] [trunk/] [rtems-20020807/] [tools/] [cpu/] [generic/] [size_rtems.in] - Rev 1782
Compare with Previous | Blame | View Log
#!@KSH@ -p## size_rtems## This script gathers information related to the size of RTEMS# using the GNU "size" command.## This script operates by summing up the sizes of the various# object files which constitute a particular configuration of# RTEMS. This size information is gathered for placement in the# brochure flyers and supplement manuals.## NOTE: The concept of the minimum executive size is buried in this script.## COPYRIGHT (c) 1989-1999.# On-Line Applications Research Corporation (OAR).## The license and distribution terms for this file may be# found in the file LICENSE in this distribution or at# http://www.OARcorp.com/rtems/license.html.## size_rtems.in,v 1.15 2000/06/12 15:00:15 joel Exp#target=@target@program_prefix=@program_prefix@gnusize=${program_prefix}size# check usageif [ $# -ne 2 ] ; thenecho usage ${0}: bsp object_directoryexit 1fibsp=$1board=$1ARCH=$2cpu=`echo $target | sed -e 's/-.*//'`case $target insparc-sun-solaris*)rtems_cpu=unixbsp=solaris2echo Not supported on unix port.exit 0;;i[34567]86-pc-linux-gnu)echo linuxrtems_cpu=unixbsp=linux1echo Not supported on unix port.exit 0;;i[34567]86-unknown-freebsd2.[12]*)echo freebsdrtems_cpu=unixbsp=freebsd2echo Not supported on unix port.exit 0;;*-rtems*)cpu=`echo $target | sed -e 's/-.*//'`rtems_cpu=$cpu;;*)echo unknown target $targetexit 1;;esaccase $ARCH in*debug*) VARIANT=debug ;;*profile*) VARIANT=profile ;;*) VARIANT=optimized;;esacechoecho Size Information for the Following Configuration:echo CPU: ${cpu}echo BSP: ${board}echo VARIANT: ${VARIANT}echo## KLUDGE to figure out at runtime how to echo a line without a# newline.#count=`echo "\\c" | wc -c`if [ ${count} -ne 0 ] ; thenEARG="-n"EOL=""elseEARG=""EOL="\\c"fiif [ ! -d ../${board} ] ; thenecho "${board} does not exist ... is the current directory the build directory?"exit 1fi#DIRLIST -- so greps for DIRLIST will find this fileCPUOBJ=exec/score/cpu/${rtems_cpu}/wrap/${ARCH}COREOBJ=exec/score/src/${ARCH}RTEMSOBJ=exec/rtems/src/${ARCH}SAPIOBJ=exec/sapi/src/${ARCH}OPTOBJ=exec/rtems/optman/${ARCH}# XXX These have been split upMANLIST=" \${RTEMSOBJ}/clockget.o \${RTEMSOBJ}/clockset.o \${RTEMSOBJ}/clocktick.o \${RTEMSOBJ}/dpmem.o \${RTEMSOBJ}/event.o \${RTEMSOBJ}/intr.o \${RTEMSOBJ}/msg.o \${RTEMSOBJ}/part.o \${RTEMSOBJ}/ratemon.o \${RTEMSOBJ}/region.o \${RTEMSOBJ}/sem.o \${RTEMSOBJ}/signal.o \${RTEMSOBJ}/tasks.o \${RTEMSOBJ}/timer.o \${SAPIOBJ}/debug.o \${SAPIOBJ}/extension.o \${SAPIOBJ}/fatal.o \${SAPIOBJ}/exinit.o \${SAPIOBJ}/io.o \${SAPIOBJ}/rtemsapi.o \"if [ -r ${RTEMSOBJ}/mp.o ] ; thenMPLIST="\${RTEMSOBJ}/mp.o ${RTEMSOBJ}/eventmp.o \${COREOBJ}/mpci.o ${RTEMSOBJ}/msgmp.o ${COREOBJ}/objectmp.o \${RTEMSOBJ}/partmp.o ${RTEMSOBJ}/regionmp.o ${RTEMSOBJ}/semmp.o \${RTEMSOBJ}/signalmp.o ${RTEMSOBJ}/taskmp.o ${COREOBJ}/threadmp.o \"MPOBJLIST=${OPTOBJ}/no-mp.relfiOPTMANLIST="\${OPTOBJ}/no-dpmem.rel \${OPTOBJ}/no-event.rel \${MPOBJLIST} \${OPTOBJ}/no-msg.rel \${OPTOBJ}/no-part.rel \${OPTOBJ}/no-region.rel \${OPTOBJ}/no-rtmon.rel \${OPTOBJ}/no-sem.rel \${OPTOBJ}/no-signal.rel \${OPTOBJ}/no-timer.rel \"REQMANLIST="\${SAPIOBJ}/exinit.o \${RTEMSOBJ}/tasks.o \${RTEMSOBJ}/intr.o \${SAPIOBJ}/fatal.o \"# XXX parts of these have been split upCORELIST=" \${COREOBJ}/apiext.o ${COREOBJ}/chain.o \${COREOBJ}/coremsg.o ${COREOBJ}/coremutex.o ${COREOBJ}/coresem.o \${COREOBJ}/heap.o ${COREOBJ}/interr.o \${COREOBJ}/isr.o \${COREOBJ}/object.o \${SAPIOBJ}/rtemsapi.o \${COREOBJ}/thread.o ${COREOBJ}/threadq.o ${COREOBJ}/tod.o \${COREOBJ}/userext.o \${COREOBJ}/watchdog.o ${COREOBJ}/wkspace.o \"CPULIST="\${CPUOBJ}/rtems-cpu.rel \"# check directoriesfor i in ${EXECOBJ} ${CPUOBJ} ${OPTOBJ}doif [ ! -d ${i} ] ; thenecho "${i} does not exist ... is RTEMS compiled and installed?"exit 1fidonefor i in ${MANLIST} ${MPLIST} ${OPTMANLIST} ${REQMANLIST} ${CORELIST} ${CPULIST}doif [ ! -r ${i} ] ; thenecho ${i} does not exist ... is RTEMS compiled and installed?exit 1fidone# "rips" a line of gsize's output and prints size, data, bssparse_size(){echo $1 $2 $3}# prepares a list of code, data, bss sizes for a directorysizedir(){${gnusize} $* | sed -e '1,1d' |while read linedoparse_size ${line}done}# adds the numbers passed on the command lineaddit(){sumx=0for x in $*dosumx=`expr $sumx + $x`doneecho $sumx}# adds a column from the output of sizediraddsizes(){# dc version is not portable enough -- It can be left out during# installing linux and may not be available on non-UNIX hosts.#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.addit `cut -d' ' -f${2} ${1}`}# calculates total size of a directory and prints report linesize_files(){trap "rm -f /tmp/size.$$ ; exit 1" 2 3for file in $*doparse_size `${gnusize} $file | sed -e '/text/d'`done >/tmp/size.$$code=`cat /tmp/size.$$ | addsizes 1`data=`cat /tmp/size.$$ | addsizes 2`bss=` cat /tmp/size.$$ | addsizes 3`echo "${code} ${data} ${bss}"rm /tmp/size.$$}echoecho " RTEMS SIZE REPORT"echoecho " CODE DATA BSS"echo " =================="echo ${EARG} "MANAGERS: " ${EOL} ; size_files $MANLIST $MPLISTecho ${EARG} "CORE : " ${EOL} ; size_files $CORELIST $CPULISTecho ${EARG} "CPU : " ${EOL} ; size_files $CPULISTecho ${EARG} "OVERALL : " ${EOL} ; size_files $CPULIST $CORELIST $MANLIST \$MPLISTecho ${EARG} "MINIMUM : " ${EOL} ; size_files $CPULIST $CORELIST \$OPTMANLIST $REQMANLISTechofor file in $MANLISTdobase=`basename ${file}`echo ${EARG} ""${base} : " ${EOL} " ; size_files ${file}doneecho ${EARG} "MP : " ${EOL} ; size_files $MPLISTechofor file in $OPTMANLISTdobase=`basename ${file}`echo ${EARG} "${base} : " ${EOL} ; size_files ${file}doneechoexit 0
