summaryrefslogtreecommitdiffstats
path: root/rtems/bit_all_bsps
blob: a4d8397eb6cfeb7425dfeb8c75c4a1e11f8e81be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#! /bin/sh
#
#  Test build all the tool configurations
#

#  Checks the status returned by executables and exits if it is non-zero.
check_fatal()
{
  if [ $1 -eq 0 ] ; then
    return
  fi
  shift
  echo "ERROR: $*" >&2
  exit $?
}

# Include user configurable information
test -r ./user.cfg || \
  check_fatal 1 "Cannot find user configuration (user.cfg)"
. ./user.cfg

# Verify that the environment is correct
if [ ! -d log ] ; then
  echo No log directory
  exit 1
fi

usage()
{
  echo "$0: arguments"
  echo "  where arguments are:"
  echo "    -t                     enable test mode (default=no)"
  echo "    -p                     execute builds with GNU parallel"
  echo "                             default is sequential"
  echo "    -j N                   when parallel, number of jobs"
  echo "    -v                     disable verbose mode"
}

toggle()
{
  if [ $1 = "no" ] ; then
    echo "yes"
    return
  fi
  echo "no"
}

#  Set up variables which control the scripts behavior
verbose=yes
testing=no
do_parallel=no
jobs=NOT_SET

while getopts j:ptv OPT
do
  case "$OPT" in
    t) testing=`toggle ${testing}` ;;
    j) jobs="${OPTARG}" ;;
    p) do_parallel=`toggle ${do_parallel}` ;;
    v) verbose=`toggle ${verbose}` ;;
    *) usage ; exit 1 ;;
  esac
done

shiftcount=`expr $OPTIND - 1`
shift $shiftcount

if [ ${do_parallel} = "yes" ] ; then
  parallel --version 2>&1 | grep "GNU Parallel" >/dev/null
  check_fatal $? "GNU parallel is not installed"

  JOBS=
  case ${jobs} in
    NOT_SET)
      JOBS=""
      ;;
    ''|*[!0-9]*)
      check_fatal 1 "Number of jobs (${jobs}) specified is not a number"
      ;;
    *)
      JOBS="-j ${jobs}"
      ;;
  esac
fi

#
#  Now get started
#
start=`date`

# Determine the list of CPUs to build
if [ $# -ne 0 ] ; then
  CPUS=$*
else
  # leave out nios2 tic4x
  CPUs=
  for c in arm avr bfin h8300 i386 lm32 m32c m32r m68k mips moxie \
           nios2 or1k powerpc sh sparc sparc64 v850
  do
    if [ -r ${RTEMS}/cpukit/score/cpu/${c} ] ; then
      CPUS="${CPUS} ${c}"
    else
      rm -f log/${CPU}-*.log
    fi
  done
fi

# we collect the ticker executables for users to try out
rm -rf ticker-executables
mkdir ticker-executables

#
#  Calculate the set of BSPs which could be built
#
#  Pick up the minimum set and then see if we are doing everything.
#
get_bsps()
{
  if [ -d ${RTEMS}/c/src/lib/libbsp/i386/pc386/make/custom ] ; then
    ALL_BSPS=`ls -1 ${RTEMS}/c/src/lib/libbsp/${CPU}/*/make/custom/*.cfg | \
      while read f; do \
        basename $f; done | sed -e 's/.cfg$//' `
      
  else
    # RTEMS before 4.10
    case $CPU in   
      avr)     all_bsps="avrtest" ;;
      bfin)    all_bsps="eZKit533 bf537Stamp" ;;
      arm)     all_bsps="csb336 csb337 csb637 edb7312 gba gp32 nds"
               all_bsps="${all_bsps} rtl22xx rtl22xx_t smdk2410"
               all_bsps="${all_bsps} lpc2478 gumstix" ;;
      h8300)   all_bsps="h8sim" ;;
      i386)    all_bsps="i386ex pc386 pc386dx pc486 pc586 pc686"
               all_bsps="${all_bsps} ts_386ex" ;;
      lm32)    all_bsps="lm32_evr" ;;
      m32c)    all_bsps="m32csim" ;;
      m32r)    all_bsps="m32rsim" ;;
      m68k)    all_bsps="gen68360 gen68360_040 mvme136 mvme147 mvme147s"
               all_bsps="${all_bsps} mvme162 mvme162lx mvme167 ods68302"
               all_bsps="${all_bsps} mcf5206elite "
               all_bsps="${all_bsps} uC5282 mcf52235 mcf5329"
               all_bsps="${all_bsps} gen68302 csb360 simcpu32 mrm332 av5282"
               all_bsps="${all_bsps} gen68340 mcf5235 idp pgh360" 
               all_bsps="${all_bsps} m5484FireEngine" ;;
      mips)    all_bsps="jmr3904 genmongoosev csb350 hurricane"
               all_bsps="${all_bsps} rbtx4925 rbtx4938" ;;
      nios2)   all_bsps="nios2_iss" ;;
      powerpc) all_bsps="psim score603e mcp750 mvme2100 mvme2307 mvme3100"
               all_bsps="${all_bsps} mpc8260ads ss555 mvme5500 ep1a"
               all_bsps="${all_bsps} pm520_cr825 pm520_ze30"
               all_bsps="${all_bsps} mbx821_001 mbx821_002 mbx821_002b"
               all_bsps="${all_bsps} mbx860_1b mbx860_001b mbx860_002"
               all_bsps="${all_bsps} mbx860_005b mtx603e brs5l icecube"
               all_bsps="${all_bsps} virtex mpc8349eamds hsc_cm01 haleakala"
               all_bsps="${all_bsps} mpc8313erdb mpc5566evb"
               all_bsps="${all_bsps} pghplus tqm8xx_stk8xx" ;;
      sh)      all_bsps="gensh1 gensh2 gensh4"
               all_bsps="${all_bsps} simsh1 simsh2 simsh4" ;;
      sparc)   all_bsps="sis erc32 leon2 leon3" ;;
      sparc64) all_bsps="usiii niagara" ;;
      tic4x)   all_bsps="c3xsim c4xsim" ;;
      unix)    all_bsps="posix"

        supported=no
        # check to see if this host has a simulator port
        case `${RTEMS}/config.guess` in
          i[3456]86-pc-linux*)  supported=yes ;;
          sparc-sun-solaris*)   supported=yes ;;
          i[3456]86-*freebsd2*) supported=yes ;;
          *hpux*)
             echo "You are on a platform which needs to be tested".
             echo "HPUX has not been tested with the autoconf configuration."
             exit 0
             ;;
        esac
        ;;
      *)
        echo "UNKNOWN CPU ${CPU} -- add to bit_all"
        ;;
    esac

    ALL_BSPS=
    for b in ${all_bsps}
    do
      if [ -r ${RTEMS}/make/custom/${b}.cfg ] ; then
        ALL_BSPS="${ALL_BSPS} ${b}"
      else
        rm -f log/${CPU}-${b}.log
      fi
    done
  fi
}

if [ ${do_parallel} = "yes" ] ; then
  cp /dev/null parallel_bsps.tmp
fi

# Now cycle through all the CPUs selected
for CPU in ${CPUS} 
do
  #
  #  Decide to cycle over all the BSPs
  #
  get_bsps

  for BSP_TO_TEST in ${ALL_BSPS}
  do
    logfile=log/${CPU}-${BSP_TO_TEST}.log
    CMD="./bit_rtems $CPU $BSP_TO_TEST"

    # build the BSPs serially
    if [ ${do_parallel} = no ] ; then
      if [ ${verbose} = yes ] ; then
        echo "Building RTEMS targetting ${CPU} for the ${BSP_TO_TEST} board"
      fi

      # echo the command which will be used to build the BSP
      if [ ${testing} = yes ] ; then
        echo "${CMD} >${logfile} 2>&1"
        continue
      fi

      ${CMD} >${logfile} 2>&1
      continue
    fi

    # generate parallel script
    echo "cd `pwd` ; PATH=${PATH} ${CMD} >${logfile} 2>&1" >>parallel_bsps.tmp

  done
done

if [ ${do_parallel} = yes ] ; then
  if [ ${verbose} = yes ] ; then
    echo "Initiating parallel build of `wc -l parallel_bsps.tmp` RTEMS BSPs"
    echo "  parallel_bsps.tmp is the script being executed"
  fi
  if [ ${testing} = no ] ; then
    cat parallel_bsps.tmp | parallel ${JOBS} ${PARALLEL_ARGS} --verbose
  fi
    
fi

# Now we are done

stop=`date`

echo
echo "Started:  " $start
echo "Finished: " $stop
exit 0