OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [doc/] [posix_users/] [gen_size_report] - Rev 1775

Go to most recent revision | Compare with Previous | Blame | View Log

#
#  Hack of a script to generate a very long list which contains
#  the size information for every service listed in this manual
#
#  This script must be modified by the user to tailor it for their
#  environment.  This is VERY ugly and could be replaced by something
#  nicer in the future if this report style is useful.
#
#  gen_size_report,v 1.5 2002/01/17 21:47:45 joel Exp
# 

#cpu=sparc
#bsp=erc32

#cpu=powerpc
#bsp=mcp750

cpu=v850
bsp=bare
symprefix=_

#objdir=/usr1/rtems/build/build-${cpu}-rtems/${cpu}-rtems/c/${bsp}/
#libc=/opt/rtems/${cpu}-rtems/lib/libc.a
#libm=/opt/rtems/${cpu}-rtems/lib/libm.a
objdir=/usr1/rtems/work/tools-v850/b-rtems/${cpu}-rtems/c/${bsp}/
libc=/usr2/test-v850/${cpu}-rtems/lib/libc.a
libm=/usr2/test-v850/${cpu}-rtems/lib/libm.a
srcdir=$r/src
docdir=$d
nm=${cpu}-rtems-nm
size=${cpu}-rtems-size
ar=${cpu}-rtems-ar

#
#  All customization should be above this point
#

check_objs()
{
  for i in *.o
  do
    ${nm} $i | grep "T ${symprefix}${1}$" >/dev/null
    if [ $? -eq  0 ] ; then
      echo $i
      return 0
    fi
  done
  return 1
}
per_manager()
{
  docfile=$1
  shift
  subdirs=$*
  grep ^@item ${docfile} | grep "@code.* - " | \
    grep -v "@item E" | \
    grep -v "@code{CONFIGURE" | \
    grep -v "@value{RPREFIX" | \
    sed -e 's/@value{DIRPREFIX}/rtems_/' | \
    cut -d'{' -f2 | sed -e 's/}//' | cut -d'-' -f1 >/tmp/XXX.size

  if [ `wc -c </tmp/XXX.size` -eq 1 ]  ; then
    return
  fi
  echo "====> `grep ^@chapter ${docfile} | sed -e 's/@chapter //'`"
  cat /tmp/XXX.size | while read line
  do
    # echo $line
    found=no
    for subd in ${subdirs}
    do
      if [ ${found} = "no" ] ; then
        cd ${objdir}/${subd}/o-optimize/
        objfile=`check_objs $line`
        if [ $? -eq 0 ] ; then
           found=yes
           #echo ${objfile}
           objcode=`${size} ${objfile} | tail -1 | cut -f1`
           objdata=`${size} ${objfile} | tail -1 | cut -f2`
           objbss=`${size} ${objfile} | tail -1 | cut -f3`
           objcode=`echo ${objcode}`
           objdata=`echo ${objdata}`
           objbss=`echo ${objbss}`
           echo "${line} - ${objcode}, ${objdata}, ${objbss}"
        fi
      fi
    done
    if [ ${found} = "no" ] ; then
      echo "$line - macro or not implemented"
    fi
   
  done
}


# extract libc
if [ ! -d ${objdir}/newlib_extract/o-optimize ] ; then
  mkdir -p ${objdir}/newlib_extract/o-optimize
  cd ${objdir}/newlib_extract/o-optimize
  list=`${ar} t ${libc}`
  for i in $list
  do
    ${ar} x ${libc} ${i}
  done
fi

# extract libm
if [ ! -d ${objdir}/libm_extract/o-optimize ] ; then
  mkdir -p ${objdir}/libm_extract/o-optimize
  cd ${objdir}/libm_extract/o-optimize
  list=`${ar} t ${libm}`
  for i in $list
  do
    ${ar} x ${libm} ${i}
  done
fi

# grab the size of the Classic API
#
#  NOTE: This API is always configured.
#
cd ${docdir}/user
echo
echo "=============================================================="
echo "=============================================================="
echo "====                                                      ===="
echo "====            CLASSIC API SIZE INFORMATION              ===="
echo "====                                                      ===="
echo "=============================================================="
echo "=============================================================="
echo
if [ -r ${objdir}/../../../${bsp}/lib/librtems.a ] ; then
  for i in *.t
  do
    per_manager $i exec/rtems/src exec/sapi/src lib/libc
  done
else
  echo "RTEMS Classic API not configured."
fi

# Grab the size of the POSIX API
cd ${docdir}/posix_users
echo
echo "=============================================================="
echo "=============================================================="
echo "====                                                      ===="
echo "====         POSIX 1003.1b API SIZE INFORMATION           ===="
echo "====                                                      ===="
echo "=============================================================="
echo "=============================================================="
echo
if [ -r ${objdir}/../../../${bsp}/lib/libposix.a ] ; then
  for i in `ls -1 *.t | grep -v libc.t | grep -v libm.t`
  do
    per_manager $i exec/posix/src lib/libc newlib_extract
  done
else
  echo "POSIX API not configured."
fi

# Grab the size of the POSIX routines provided by the C Library
cd ${docdir}/posix_users
echo
echo "=============================================================="
echo "=============================================================="
echo "====                                                      ===="
echo "====             LIBC API SIZE INFORMATION                ===="
echo "====                                                      ===="
echo "=============================================================="
echo "=============================================================="
echo
for i in libc.t
do
  per_manager $i exec/posix/src lib/libc newlib_extract
done

# Grab the size of the libm routines
cd ${docdir}/posix_users
echo
echo "=============================================================="
echo "=============================================================="
echo "====                                                      ===="
echo "====             LIBM API SIZE INFORMATION                ===="
echo "====                                                      ===="
echo "=============================================================="
echo "=============================================================="
echo
for i in libm.t
do
  per_manager $i exec/posix/src lib/libc libm_extract
done

# Grab the size of the ITRON API
cd ${docdir}/itron3.0
echo
echo "=============================================================="
echo "=============================================================="
echo "====                                                      ===="
echo "====           ITRON 3.0 API SIZE INFORMATION             ===="
echo "====                                                      ===="
echo "=============================================================="
echo "=============================================================="
echo
if [ -r ${objdir}/../../../${bsp}/lib/libitron.a ] ; then
  for i in *.t
  do
    per_manager $i exec/itron/src
  done
else
  echo "ITRON API not configured."
fi


Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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