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 |
---|
10 | RTEMS_TESTER_DIR=${HOME}/rtems-4.11-work/rtems-tools/ |
---|
11 | RTEMS_TOOLS_DIR=${HOME}/rtems-4.11-work/tools/ |
---|
12 | |
---|
13 | #RTEMS_VERSION=4.11 |
---|
14 | RTEMS_VERSION=4.12 |
---|
15 | |
---|
16 | # More variables to tailor behavior below |
---|
17 | |
---|
18 | if [ $# -ne 2 ] ; then |
---|
19 | echo Usage: $0 CPU BSP |
---|
20 | exit 1 |
---|
21 | fi |
---|
22 | |
---|
23 | CPU=$1 |
---|
24 | BSP=$2 |
---|
25 | |
---|
26 | if [ $? -ne 0 ] ; then |
---|
27 | echo "Assumed location of RTEMS is incorrect" |
---|
28 | exit 1 |
---|
29 | fi |
---|
30 | |
---|
31 | if [ ! -d ${RTEMS_TOOLS_DIR}/bin ] ; then |
---|
32 | echo "${RTEMS_TOOLS_DIR}/bin does not exist" |
---|
33 | exit 1 |
---|
34 | fi |
---|
35 | |
---|
36 | if [ ! -d ${RTEMS_TESTER_DIR}/tester ] ; then |
---|
37 | echo "${RTEMS_TESTER_DIR}/tester does not exist" |
---|
38 | exit 1 |
---|
39 | fi |
---|
40 | |
---|
41 | type ${CPU}-rtems${RTEMS_VERSION}-gcc >/dev/null 2>&1 |
---|
42 | if [ $? -ne 0 ] ; then |
---|
43 | echo "The RTEMS tools for ${CPU}-rtems${RTEMS_VERSION} are not in your PATH" |
---|
44 | exit 1 |
---|
45 | fi |
---|
46 | |
---|
47 | if [ ! -d rtems ] ; then |
---|
48 | echo "rtems directory is not in the same directory as this script" |
---|
49 | exit 1 |
---|
50 | fi |
---|
51 | |
---|
52 | if [ ! -r rtems/configure ] ; then |
---|
53 | echo "rtems is not bootstrapped" |
---|
54 | exit 1 |
---|
55 | fi |
---|
56 | |
---|
57 | |
---|
58 | rm -rf b-${BSP} |
---|
59 | mkdir b-${BSP} |
---|
60 | cd 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" |
---|
66 | do_run="no" |
---|
67 | |
---|
68 | # DEBUG="--enable-rtems-debug" |
---|
69 | DEBUG="" |
---|
70 | |
---|
71 | #TESTS="--enable-tests" |
---|
72 | TESTS="--enable-tests=samples" |
---|
73 | |
---|
74 | SMP="--disable-smp" |
---|
75 | #SMP="--enable-smp" |
---|
76 | |
---|
77 | POSIX="--enable-posix" |
---|
78 | # POSIX="--disable-posix" |
---|
79 | |
---|
80 | #NET="--enable-networking" |
---|
81 | NET="--disable-networking" |
---|
82 | |
---|
83 | CXX="--enable-cxx" |
---|
84 | # CXX="--disable-cxx" |
---|
85 | |
---|
86 | #do_size_report=no |
---|
87 | do_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 && \ |
---|
96 | time make -j${jobs} >b.log 2>&1 |
---|
97 | status=$? |
---|
98 | |
---|
99 | if [ ${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 |
---|
127 | fi |
---|
128 | |
---|
129 | if [ ${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" |
---|
136 | fi |
---|
137 | |
---|
138 | echo $status |
---|
139 | exit $status |
---|
140 | |
---|