GCI/Coding/AddPerSectionSupportToBSPs: build_bsp

File build_bsp, 3.2 KB (added by Joel Sherrill, on Jan 7, 2016 at 12:45:19 AM)

Script to assist in building and obtaining size information

Line 
1#! /bin/sh
2#
3# Simple script to build CPU/BSP
4#
5# Assumes ${HOME}/rtems-4.11-work
6#
7# Must be edited to change configure settings
8
9# Tailor these for your local installation
10RTEMS_TESTER_DIR=${HOME}/rtems-4.11-work/rtems-tools/
11RTEMS_TOOLS_DIR=${HOME}/rtems-4.11-work/tools/
12
13#RTEMS_VERSION=4.11
14RTEMS_VERSION=4.12
15
16# More variables to tailor behavior below
17
18if [ $# -ne 2 ] ; then
19  echo Usage: $0 CPU BSP
20  exit 1
21fi
22
23CPU=$1
24BSP=$2
25
26if [ $? -ne 0 ] ; then
27  echo "Assumed location of RTEMS is incorrect"
28  exit 1
29fi
30
31if [ ! -d ${RTEMS_TOOLS_DIR}/bin ] ; then
32  echo "${RTEMS_TOOLS_DIR}/bin does not exist"
33  exit 1
34fi
35
36if [ ! -d ${RTEMS_TESTER_DIR}/tester ] ; then
37  echo "${RTEMS_TESTER_DIR}/tester does not exist"
38  exit 1
39fi
40
41type ${CPU}-rtems${RTEMS_VERSION}-gcc >/dev/null 2>&1
42if [ $? -ne 0 ] ; then
43  echo "The RTEMS tools for ${CPU}-rtems${RTEMS_VERSION} are not in your PATH"
44  exit 1
45fi
46
47if [ ! -d rtems ] ; then
48  echo "rtems directory is not in the same directory as this script"
49  exit 1
50fi
51
52if [ ! -r rtems/configure ] ; then
53  echo "rtems is not bootstrapped"
54  exit 1
55fi
56
57
58rm -rf b-${BSP}
59mkdir b-${BSP}
60cd b-${BSP}
61
62# Behavioral variables to set
63# Comment out the one in each set you do not want
64
65#do_run="yes"
66do_run="no"
67
68# DEBUG="--enable-rtems-debug"
69DEBUG=""
70
71#TESTS="--enable-tests"
72TESTS="--enable-tests=samples"
73
74SMP="--disable-smp"
75#SMP="--enable-smp"
76
77POSIX="--enable-posix"
78# POSIX="--disable-posix"
79
80#NET="--enable-networking"
81 NET="--disable-networking"
82
83CXX="--enable-cxx"
84# CXX="--disable-cxx"
85
86#do_size_report=no
87do_size_report=yes
88
89# Now invoke configure and make using the arguments selected
90../rtems/configure --target=${CPU}-rtems${RTEMS_VERSION} \
91   --enable-rtemsbsp=${BSP} \
92  --prefix=${HOME}/rtems-4.11-work/bsp-install \
93  ${NET} ${POSIX} ${SMP} ${DEBUG} ${TESTS} ${CXX} \
94  --enable-maintainer-mode \
95 >c.log 2>&1 && \
96time make -j${jobs} >b.log 2>&1
97status=$?
98
99if [ ${do_run} = "yes" -a ${status} -eq 0 ] ; then
100
101  runner=${BSP}
102  case ${BSP} in
103    arm1136jfs|arm1136js|arm7tdmi|arm920|armcortexa9) able=yes ;;
104    xilinx_zynq_a9_qemu)   able=yes ;;
105    realview_pbx_a9_qemu)  able=yes ;;
106    bf537Stamp)            able=yes ;;
107    h8sim|h8sxsim)         able=yes ;;
108    pc386)                 able=yes ;;
109    jmr3904)               able=yes ;;
110    psim)                  able=yes ;;
111    lm32_evr*)             able=yes ;;
112    m32c*)                 able=yes ;;
113    m32r*)                 able=yes ;;
114    generic_or1k)          able=yes runner=or1ksim;;
115    simsh*)                able=yes ;;
116    sis|erc32|leon2|leon3) able=yes ;;
117    v850*)                 able=yes ;;
118    *)                     able=no ;;
119  esac
120
121  if [ "${able}" = "yes" ] ; then
122    #time ${runner} `find . -name *.exe`
123    time ${RTEMS_TESTER_DIR}/tester/rtems-test \
124      --rtems-tools=${RTEMS_TOOLS_DIR} --rtems-bsp=${BSP}  `find . -name *.exe`
125    status=$?
126  fi
127fi
128
129if [ ${status} -eq 0 -a ${do_size_report} = "yes" ] ; then
130  # print the header followed by all the test sizes
131  ${CPU}-rtems${RTEMS_VERSION}-size `find . -name "hello.exe"` | head -1
132  find . -name "*.exe"  | while read f
133  do
134    (cd `dirname ${f} `; ${CPU}-rtems${RTEMS_VERSION}-size `basename ${f}`)
135  done | grep "\.exe"
136fi
137
138echo $status
139exit $status
140