Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 576 lines (515 sloc) 16.197 kb
6877dd1 @esden Added support for toolchain building on Mac OS X.
esden authored
1 #!/bin/bash
dfcf062 Initial commit
Piotr Esden-Tempski authored
2 # Written by Uwe Hermann <uwe@hermann-uwe.de>, released as public domain.
5e32010 @uwehermann Fix typos.
uwehermann authored
3 # Modified by Piotr Esden-Tempski <piotr@esden.net>, released as public domain.
dfcf062 Initial commit
Piotr Esden-Tempski authored
4
80dca85 @uwehermann Document build dependencies in the script.
uwehermann authored
5 #
6 # Requirements (example is for Debian, replace package names as needed):
7 #
8 # apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev \
9 # libmpc-dev autoconf texinfo build-essential
10 #
b7a46ec @nzmichaelh Shifted some variables about to allow a better override from local.sh
nzmichaelh authored
11 # Or on Ubuntu Maverick give `apt-get build-dep gcc-4.5` a try.
12 #
80dca85 @uwehermann Document build dependencies in the script.
uwehermann authored
13
ccb4e0f @nzmichaelh Use set -e to stop on any error, including downloads.
nzmichaelh authored
14 # Stop if any command fails
15 set -e
16
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
17 ##############################################################################
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
18 # Default settings section
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
19 # You probably want to customize those
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
20 # You can also pass them as parameters to the script
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
21 ##############################################################################
d4f2596 @uwehermann Cosmetics and typo fixes.
uwehermann authored
22 TARGET=arm-none-eabi # Or: TARGET=arm-elf
d6c345c @esden Changed default install directory of Summon-Arm-Toolchain to ~/sat wh…
esden authored
23 PREFIX=${HOME}/sat # Install location of your final toolchain
be918bb @LorenzMeier Enabled building of ARM7 along
LorenzMeier authored
24 DARWIN_OPT_PATH=/usr/local # Path in which MacPorts or Fink is installed
eb973fb @nzmichaelh Added the ability to run a bit quieter
nzmichaelh authored
25 # Set to 'sudo' if you need superuser privileges while installing
26 SUDO=
27 # Set to 1 to be quieter while running
433bb43 @nzmichaelh Added ability to have a local config that overrides the script.
nzmichaelh authored
28 QUIET=0
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
29 # Set to 1 to use linaro gcc instead of the FSF gcc
e739ab8 @esden SAT now builds Linaro GCC and libopenstm32 by default.
esden authored
30 USE_LINARO=1
5789834 @esden Added building of openocd as part of the toolchain.
esden authored
31 # Set to 1 to enable building of OpenOCD
32 OOCD_EN=1
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
33 # Set to 'master' or a git revision number to use instead of stable version
34 OOCD_GIT=
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
35 # Set to 1 to build libstm32 provided by ST
36 LIBSTM32_EN=0
d66240e @esden Renamed libopenstm32 to libopencm3 and updated the git source.
esden authored
37 # Set to 1 to build libopencm3 an open source library for Cortex M3 and simalar
38 # chips
6aca4dd @esden Reenabled to build libopencm3 by default.
esden authored
39 LIBOPENCM3_EN=1
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
40 # Make the gcc default to Cortex-M3
41 DEFAULT_TO_CORTEX_M3=0
9b7cedd @esden Added option to override the automatic CPU amount detection.
esden authored
42 # Override automatic detection of cpus to compile on
43 CPUS=
dfcf062 Initial commit
Piotr Esden-Tempski authored
44
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
45 ##############################################################################
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
46 # Parsing command line parameters
47 ##############################################################################
48
49 while [ $# -gt 0 ]; do
50 case $1 in
51 TARGET=*)
52 TARGET=$(echo $1 | sed 's,^TARGET=,,')
53 ;;
54 PREFIX=*)
55 PREFIX=$(echo $1 | sed 's,^PREFIX=,,')
56 ;;
57 DARWIN_OPT_PATH=*)
58 DARWIN_OPT_PATH=$(echo $1 | sed 's,^DARWIN_OPT_PATH=,,')
59 ;;
60 SUDO=*)
61 SUDO=$(echo $1 | sed 's,^SUDO=,,')
62 ;;
63 QUIET=*)
64 QUIET=$(echo $1 | sed 's,^QUIET=,,')
65 ;;
66 USE_LINARO=*)
67 USE_LINARO=$(echo $1 | sed 's,^USE_LINARO=,,')
68 ;;
69 OOCD_EN=*)
70 OOCD_EN=$(echo $1 | sed 's,^OOCD_EN=,,')
71 ;;
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
72 OOCD_GIT=*)
73 OOCD_GIT=$(echo $1 | sed 's,^OOCD_GIT=,,')
74 ;;
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
75 LIBSTM32_EN=*)
76 LIBSTM32_EN=$(echo $1 | sed 's,^LIBSTM32_EN=,,')
77 ;;
d66240e @esden Renamed libopenstm32 to libopencm3 and updated the git source.
esden authored
78 LIBOPENCM3_EN=*)
79 LIBOPENCM3_EN=$(echo $1 | sed 's,^LIBOPENCM3_EN=,,')
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
80 ;;
81 DEFAULT_TO_CORTEX_M3=*)
82 DEFAULT_TO_CORTEX_M3=$(echo $1 | sed 's,^DEFAULT_TO_CORTEX_M3=,,')
83 ;;
9b7cedd @esden Added option to override the automatic CPU amount detection.
esden authored
84 CPUS=*)
85 CPUS=$(echo $1 | sed 's,^CPUS=,,')
86 ;;
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
87 *)
88 echo "Unknown parameter: $1"
89 exit 1
90 ;;
91 esac
92
93 shift # shifting parameter list to access the next one
94 done
95
96 echo "Settings used for this build are:"
97 echo "TARGET=$TARGET"
98 echo "PREFIX=$PREFIX"
99 echo "DARWIN_OPT_PATH=$DARWIN_OPT_PATH"
100 echo "SUDO=$SUDO"
101 echo "QUIET=$QUIET"
102 echo "USE_LINARO=$USE_LINARO"
103 echo "OOCD_EN=$OOCD_EN"
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
104 echo "OOCD_GIT=$OOCD_GIT"
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
105 echo "LIBSTM32_EN=$LIBSTM32_EN"
d66240e @esden Renamed libopenstm32 to libopencm3 and updated the git source.
esden authored
106 echo "LIBOPENCM3_EN=$LIBOPENCM3_EN"
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
107 echo "DEFAULT_TO_CORTEX_M3=$DEFAULT_TO_CORTEX_M3"
9b7cedd @esden Added option to override the automatic CPU amount detection.
esden authored
108 echo "CPUS=$CPUS"
8a44ea4 @esden Added the option to pass the customization parameters also as command…
esden authored
109
110 ##############################################################################
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
111 # Version and download url settings section
112 ##############################################################################
113 if [ ${USE_LINARO} == 0 ] ; then
114 # For FSF GCC:
78c5171 @esden Updated binutils, gcc, linaro gcc and newlib versions.
esden authored
115 GCCVERSION=4.5.2
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
116 GCC=gcc-${GCCVERSION}
117 GCCURL=http://ftp.gnu.org/gnu/gcc/${GCC}/${GCC}.tar.gz
1196531 Add Cortex-M0 support.
Mike Smith authored
118
119 # For FSF GDB:
120 GDBVERSION=7.3.1
121 GDB=gdb-${GDBVERSION}
122 GDBURL=http://ftp.gnu.org/gnu/gdb/${GDB}.tar.bz2
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
123 else
1196531 Add Cortex-M0 support.
Mike Smith authored
124 # For Linaro GCC:
b5c1604 Update to the most recent Linaro drop.
Mike Smith authored
125 GCCRELEASE=4.6-2011.10
126 GCCVERSION=4.6-2011.10
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
127 GCC=gcc-linaro-${GCCVERSION}
b5c1604 Update to the most recent Linaro drop.
Mike Smith authored
128 GCCURL=http://launchpad.net/gcc-linaro/4.6/${GCCRELEASE}/+download/${GCC}.tar.bz2
1196531 Add Cortex-M0 support.
Mike Smith authored
129
130 # For Linaro GDB:
131 GDBRELEASE=7.3-2011.10
132 GDBVERSION=7.3-2011.10
133 GDB=gdb-linaro-${GDBVERSION}
134 GDBURL=http://launchpad.net/gdb-linaro/7.3/${GDBRELEASE}/+download/${GDB}.tar.bz2
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
135 fi
c9917c6 @nzmichaelh Added support for fetching the Linaro GCC. Add a note on being Corte…
nzmichaelh authored
136
35f35a8 @fnoble binutils version updated to 2.21.1 (from 2.21)
fnoble authored
137 BINUTILS=binutils-2.21.1
78c5171 @esden Updated binutils, gcc, linaro gcc and newlib versions.
esden authored
138 NEWLIB=newlib-1.19.0
d897aaf @fnoble gdb version updated to 7.3.1 (from 7.2)
fnoble authored
139 GDB=gdb-7.3.1
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
140 OOCD=openocd-0.5.0
ff52735 @esden Merge remote-tracking branch 'mikesmith/master'
esden authored
141 OOCD_GIT=9e1a16690e669b895dce7c3951b1fe893bfd6149
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
142 LIBCMSIS=
143 LIBCMSIS_GIT=v1.10-3
144 LIBSTM32=
145 LIBSTM32_GIT=v3.0.0-2
146 LIBSTM32USB=
147 LIBSTM32USB_GIT=v3.0.1-1
148 LIBOPENCM3=
149 LIBOPENCM3_GIT=master
dfcf062 Initial commit
Piotr Esden-Tempski authored
150
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
151 ##############################################################################
152 # Flags section
153 ##############################################################################
154
9b7cedd @esden Added option to override the automatic CPU amount detection.
esden authored
155 if [ "x${CPUS}" == "x" ]; then
156 if which getconf > /dev/null; then
157 CPUS=$(getconf _NPROCESSORS_ONLN)
158 else
159 CPUS=1
160 fi
161
162 PARALLEL=-j$((CPUS + 1))
01f0afa @esden Fixed CygWin build.
esden authored
163 else
9b7cedd @esden Added option to override the automatic CPU amount detection.
esden authored
164 PARALLEL=-j${CPUS}
01f0afa @esden Fixed CygWin build.
esden authored
165 fi
9b7cedd @esden Added option to override the automatic CPU amount detection.
esden authored
166
d1fe694 @esden PARALLEL flag is now being set automatically based on available host …
esden authored
167 echo "${CPUS} cpu's detected running make with '${PARALLEL}' flag"
168
d08135e @uwehermann Use --disable-werror unconditionally everywhere.
uwehermann authored
169 GDBFLAGS=
170 BINUTILFLAGS=
171
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
172 if [ ${DEFAULT_TO_CORTEX_M3} == 0 ] ; then
173 GCCFLAGS=
174 else
175 # To default to the Cortex-M3:
0beded1 @esden Added flags to force software floating point math emulation.
esden authored
176 GCCFLAGS="--with-arch=armv7-m --with-mode=thumb --with-float=soft"
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
177 fi
c9917c6 @nzmichaelh Added support for fetching the Linaro GCC. Add a note on being Corte…
nzmichaelh authored
178
433bb43 @nzmichaelh Added ability to have a local config that overrides the script.
nzmichaelh authored
179 # Pull in the local configuration, if any
180 if [ -f local.sh ]; then
181 . ./local.sh
182 fi
183
184 MAKEFLAGS=${PARALLEL}
185 TARFLAGS=v
186
187 if [ ${QUIET} != 0 ]; then
188 TARFLAGS=
189 MAKEFLAGS="${MAKEFLAGS} -s"
190 fi
191
b7a46ec @nzmichaelh Shifted some variables about to allow a better override from local.sh
nzmichaelh authored
192 export PATH="${PREFIX}/bin:${PATH}"
193
194 SUMMON_DIR=$(pwd)
195 SOURCES=${SUMMON_DIR}/sources
196 STAMPS=${SUMMON_DIR}/stamps
197
b983292 @esden Not using -a option for tar anymore that was cousing too many problems.
esden authored
198
199 ##############################################################################
200 # Tool section
201 ##############################################################################
202 TAR=tar
203
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
204 ##############################################################################
80aef78 @esden Added proper detection of tar utility. We need gnutar on OS X.
esden authored
205 # OS and Tooldetection section
b983292 @esden Not using -a option for tar anymore that was cousing too many problems.
esden authored
206 # Detects which tools and flags to use
80aef78 @esden Added proper detection of tar utility. We need gnutar on OS X.
esden authored
207 ##############################################################################
208
209 case "$(uname)" in
210 Linux)
211 echo "Found Linux OS."
212 ;;
213 Darwin)
214 echo "Found Darwin OS."
215 GCCFLAGS="${GCCFLAGS} \
216 --with-gmp=${DARWIN_OPT_PATH} \
217 --with-mpfr=${DARWIN_OPT_PATH} \
218 --with-mpc=${DARWIN_OPT_PATH} \
8e028a7 @esden Fixed libiconv location parameter. Thanks Bernard Davison!
esden authored
219 --with-libiconv-prefix=${DARWIN_OPT_PATH}"
be918bb @LorenzMeier Enabled building of ARM7 along
LorenzMeier authored
220 OOCD_CFLAGS="-I/opt/mine/include -I${DARWIN_OPT_PATH}/include"
221 OOCD_LDFLAGS="-L/opt/mine/lib -L${DARWIN_OPT_PATH}/lib"
849ef20 @esden We need to use clang instead of llvm-gcc for compiling gcc on Mac OS …
esden authored
222 if gcc --version | grep llvm-gcc > /dev/null ; then
223 echo "Found you are using llvm gcc, switching to clang for gcc compile."
224 GCC_CC=clang
225 fi
80aef78 @esden Added proper detection of tar utility. We need gnutar on OS X.
esden authored
226 ;;
01f0afa @esden Fixed CygWin build.
esden authored
227 CYGWIN*)
228 echo "Found CygWin that means Windows most likely."
229 ;;
80aef78 @esden Added proper detection of tar utility. We need gnutar on OS X.
esden authored
230 *)
231 echo "Found unknown OS. Aborting!"
232 exit 1
233 ;;
234 esac
235
236 ##############################################################################
97d0342 @esden Divided the script into sections. Added more switches.
esden authored
237 # Building section
238 # You probably don't have to touch anything after this
239 ##############################################################################
240
5a82a41 @nzmichaelh Pulled fetching out into a function with stamps to prevent extra down…
nzmichaelh authored
241 # Fetch a versioned file from a URL
242 function fetch {
243 if [ ! -e ${STAMPS}/$1.fetch ]; then
c3332a5 @nzmichaelh Changed echos for logs
nzmichaelh authored
244 log "Downloading $1 sources..."
494a025 @esden Create a download stamp only if wget succeeds.
esden authored
245 wget -c --no-passive-ftp $2 && touch ${STAMPS}/$1.fetch
5a82a41 @nzmichaelh Pulled fetching out into a function with stamps to prevent extra down…
nzmichaelh authored
246 fi
247 }
248
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
249 function clone {
250 local NAME=$1
251 local GIT_REF=$2
252 local GIT_URL=$3
253 local POST_CLONE=$4
254 local GIT_SHA=$(git ls-remote ${GIT_URL} ${GIT_REF} | cut -f 1)
255
256 # It seems that the ref is actually a SHA as it could not be found through ls-remote
257 if [ "x${GIT_SHA}" == "x" ]; then
258 local GIT_SHA=${GIT_REF}
259 fi
260
261 # Setting uppercase NAME variable for future use to the source file name
262 eval $(echo ${NAME} | tr "[:lower:]" "[:upper:]")=${NAME}-${GIT_SHA}
263
264 # Clone the repository and do all necessary operations until we get an archive
265 if [ ! -e ${STAMPS}/${NAME}-${GIT_SHA}.fetch ]; then
266 # Making sure there is nothing in our way
267 if [ -e ${NAME}-${GIT_SHA} ]; then
268 log "The clone directory ${NAME}-${GIT_SHA} already exists, removing..."
269 rm -rf ${NAME}-${GIT_SHA}
270 fi
271 log "Cloning ${NAME}-${GIT_SHA} ..."
272 git clone ${GIT_URL} ${NAME}-${GIT_SHA}
273 cd ${NAME}-${GIT_SHA}
274 log "Checking out the revision ${GIT_REF} with the SHA ${GIT_SHA} ..."
275 git checkout -b sat-branch ${GIT_SHA}
276 if [ "x${POST_CLONE}" != "x" ]; then
277 log "Running post clone code for ${NAME}-${GIT_SHA} ..."
278 ${POST_CLONE}
279 fi
280 log "Removing .git directory from ${NAME}-${GIT_SHA} ..."
281 rm -rf .git
282 cd ..
283 log "Generating source archive for ${NAME}-${GIT_SHA} ..."
284 tar cfj ${SOURCES}/${NAME}-${GIT_SHA}.tar.bz2 ${NAME}-${GIT_SHA}
285 rm -rf ${NAME}-${GIT_SHA}
286 touch ${STAMPS}/${NAME}-${GIT_SHA}.fetch
287 fi
288 }
289
4e03b34 @nzmichaelh Pulled all logging out into a function
nzmichaelh authored
290 # Log a message out to the console
291 function log {
292 echo "******************************************************************"
293 echo "* $*"
294 echo "******************************************************************"
295 }
296
d67af73 @nzmichaelh Pulled unpacking out into a function
nzmichaelh authored
297 # Unpack an archive
298 function unpack {
902b6a0 @nzmichaelh Made more of unpack() common. Use wildcards to pick up different com…
nzmichaelh authored
299 log Unpacking $*
d67af73 @nzmichaelh Pulled unpacking out into a function
nzmichaelh authored
300 # Use 'auto' mode decompression. Replace with a switch if tar doesn't support -a
b983292 @esden Not using -a option for tar anymore that was cousing too many problems.
esden authored
301 ARCHIVE=$(ls ${SOURCES}/$1.tar.*)
302 case ${ARCHIVE} in
303 *.bz2)
304 echo "archive type bz2"
305 TYPE=j
306 ;;
307 *.gz)
308 echo "archive type gz"
309 TYPE=z
310 ;;
311 *)
312 echo "Unknown archive type of $1"
313 echo ${ARCHIVE}
314 exit 1
315 ;;
316 esac
317 ${TAR} xf${TYPE}${TARFLAGS} ${SOURCES}/$1.tar.*
d67af73 @nzmichaelh Pulled unpacking out into a function
nzmichaelh authored
318 }
319
1c3dd9a @nzmichaelh Pulled install out to a function to pull in sudo and parallel everywhere
nzmichaelh authored
320 # Install a build
321 function install {
322 log $1
eb973fb @nzmichaelh Added the ability to run a bit quieter
nzmichaelh authored
323 ${SUDO} make ${MAKEFLAGS} $2 $3 $4 $5 $6 $7 $8
1c3dd9a @nzmichaelh Pulled install out to a function to pull in sudo and parallel everywhere
nzmichaelh authored
324 }
325
6877dd1 @esden Added support for toolchain building on Mac OS X.
esden authored
326
74191d4 @nzmichaelh Changed stamp files to go into a directory for easy toasting
nzmichaelh authored
327 mkdir -p ${STAMPS} ${SOURCES}
dfcf062 Initial commit
Piotr Esden-Tempski authored
328
14b5330 @esden Updated gcc and binutils version, added a variable to allow external …
esden authored
329 cd ${SOURCES}
dfcf062 Initial commit
Piotr Esden-Tempski authored
330
5a82a41 @nzmichaelh Pulled fetching out into a function with stamps to prevent extra down…
nzmichaelh authored
331 fetch ${BINUTILS} http://ftp.gnu.org/gnu/binutils/${BINUTILS}.tar.bz2
c9917c6 @nzmichaelh Added support for fetching the Linaro GCC. Add a note on being Corte…
nzmichaelh authored
332 fetch ${GCC} ${GCCURL}
5a82a41 @nzmichaelh Pulled fetching out into a function with stamps to prevent extra down…
nzmichaelh authored
333 fetch ${NEWLIB} ftp://sources.redhat.com/pub/newlib/${NEWLIB}.tar.gz
1196531 Add Cortex-M0 support.
Mike Smith authored
334 fetch ${GDB} ${GDBURL}
dfcf062 Initial commit
Piotr Esden-Tempski authored
335
5789834 @esden Added building of openocd as part of the toolchain.
esden authored
336 if [ ${OOCD_EN} != 0 ]; then
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
337 if [ "x${OOCD_GIT}" == "x" ]; then
338 fetch ${OOCD} http://sourceforge.net/projects/openocd/files/openocd/0.5.0/${OOCD}.tar.bz2
339 else
340 clone oocd ${OOCD_GIT} git://openocd.git.sourceforge.net/gitroot/openocd/openocd ./bootstrap
341 fi
5789834 @esden Added building of openocd as part of the toolchain.
esden authored
342 fi
343
ed24af0 Added _EN variables to enable/disable libstm32 and libopenstm32 insta…
Piotr Esden-Tempski authored
344 if [ ${LIBSTM32_EN} != 0 ]; then
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
345 if [ "x${LIBCMSIS_GIT}" == "x" ]; then
346 log "There is no libcmsis stable release download server yet!"
347 exit 1
348 #fetch ${LIBCMSIS} http://.../${LIBCMSIS}.tar.bz2
349 else
c90858d @esden Fixed url's for the legacy libstm32. (use libopencm3 instead!)
esden authored
350 clone libcmsis ${LIBCMSIS_GIT} git://github.com/esden/libcmsis.git
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
351 fi
dfcf062 Initial commit
Piotr Esden-Tempski authored
352
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
353 if [ "x${LIBSTM32_GIT}" == "x" ]; then
354 log "There is no libstm32 stable release download server yet!"
355 exit 1
356 #fetch ${LIBSTM32} http://.../${LIBSTM32}.tar.bz2
357 else
c90858d @esden Fixed url's for the legacy libstm32. (use libopencm3 instead!)
esden authored
358 clone libstm32 ${LIBSTM32_GIT} git://github.com/esden/libstm32.git
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
359 fi
dfcf062 Initial commit
Piotr Esden-Tempski authored
360
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
361 if [ "x${LIBSTM32USB_GIT}" == "x" ]; then
362 log "There is no libstm32usb stable release download server yet!"
363 exit 1
364 #fetch ${LIBSTM32USB} http://.../${LIBSTM32USB}.tar.bz2
365 else
c90858d @esden Fixed url's for the legacy libstm32. (use libopencm3 instead!)
esden authored
366 clone libstm32usb ${LIBSTM32USB_GIT} git://github.com/esden/libstm32usb.git
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
367 fi
ed24af0 Added _EN variables to enable/disable libstm32 and libopenstm32 insta…
Piotr Esden-Tempski authored
368 fi
369
d66240e @esden Renamed libopenstm32 to libopencm3 and updated the git source.
esden authored
370 if [ ${LIBOPENCM3_EN} != 0 ]; then
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
371 if [ "x${LIBOPENCM3_GIT}" == "x" ]; then
372 log "There is no libopencm3 stable release download server yet!"
373 exit 1
374 #fetch ${LIBOPENCM3} http://.../${LIBOPENCM3}.tar.bz2
375 else
376 clone libopencm3 ${LIBOPENCM3_GIT} git://libopencm3.git.sourceforge.net/gitroot/libopencm3/libopencm3
377 fi
ed24af0 Added _EN variables to enable/disable libstm32 and libopenstm32 insta…
Piotr Esden-Tempski authored
378 fi
dfcf062 Initial commit
Piotr Esden-Tempski authored
379
14b5330 @esden Updated gcc and binutils version, added a variable to allow external …
esden authored
380 cd ${SUMMON_DIR}
dfcf062 Initial commit
Piotr Esden-Tempski authored
381
382 if [ ! -e build ]; then
383 mkdir build
384 fi
385
74191d4 @nzmichaelh Changed stamp files to go into a directory for easy toasting
nzmichaelh authored
386 if [ ! -e ${STAMPS}/${BINUTILS}.build ]; then
902b6a0 @nzmichaelh Made more of unpack() common. Use wildcards to pick up different com…
nzmichaelh authored
387 unpack ${BINUTILS}
d761877 @pieterg binutils-2.21.1: allow svc instruction on cortex-m3
pieterg authored
388 log "Patching binutils to allow SVC support on cortex-m3"
389 cd ${BINUTILS}
390 patch -p1 -i ../patches/patch-binutils-2.21.1-svc-cortexm3.diff
391 cd ..
dfcf062 Initial commit
Piotr Esden-Tempski authored
392 cd build
4e03b34 @nzmichaelh Pulled all logging out into a function
nzmichaelh authored
393 log "Configuring ${BINUTILS}"
dfcf062 Initial commit
Piotr Esden-Tempski authored
394 ../${BINUTILS}/configure --target=${TARGET} \
849ef20 @esden We need to use clang instead of llvm-gcc for compiling gcc on Mac OS …
esden authored
395 --prefix=${PREFIX} \
396 --enable-multilib \
397 --with-gnu-as \
398 --with-gnu-ld \
399 --disable-nls \
400 --disable-werror \
401 ${BINUTILFLAGS}
4e03b34 @nzmichaelh Pulled all logging out into a function
nzmichaelh authored
402 log "Building ${BINUTILS}"
eb973fb @nzmichaelh Added the ability to run a bit quieter
nzmichaelh authored
403 make ${MAKEFLAGS}
1c3dd9a @nzmichaelh Pulled install out to a function to pull in sudo and parallel everywhere
nzmichaelh authored
404 install ${BINUTILS} install
dfcf062 Initial commit
Piotr Esden-Tempski authored
405 cd ..
4e03b34 @nzmichaelh Pulled all logging out into a function
nzmichaelh authored
406 log "Cleaning up ${BINUTILS}"
74191d4 @nzmichaelh Changed stamp files to go into a directory for easy toasting
nzmichaelh authored
407 touch ${STAMPS}/${BINUTILS}.build
dfcf062 Initial commit
Piotr Esden-Tempski authored
408 rm -rf build/* ${BINUTILS}
409 fi
410
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
411 if [ ! -e ${STAMPS}/${GCC}-${NEWLIB}.build ]; then
412 unpack ${GCC}
413 unpack ${NEWLIB}
111117a @esden Added multilib support to SAT. Now floatingpoint support should work …
esden authored
414
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
415 log "Adding newlib symlink to gcc"
111117a @esden Added multilib support to SAT. Now floatingpoint support should work …
esden authored
416 ln -f -s `pwd`/${NEWLIB}/newlib ${GCC}
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
417 log "Adding libgloss symlink to gcc"
111117a @esden Added multilib support to SAT. Now floatingpoint support should work …
esden authored
418 ln -f -s `pwd`/${NEWLIB}/libgloss ${GCC}
419
420 if [ ${DEFAULT_TO_CORTEX_M3} == 0 ] ; then
421 log "Patching gcc to add multilib support"
422 cd ${GCC}
423 patch -p0 -i ../patches/patch-gcc-config-arm-t-arm-elf.diff
b6485ac Add a patch that disables exception support in libgcc.a.
Mike Smith authored
424 patch -p0 -i ../patches/patch-libgcc-divide-exceptions.diff
111117a @esden Added multilib support to SAT. Now floatingpoint support should work …
esden authored
425 cd ..
426 fi
427
dfcf062 Initial commit
Piotr Esden-Tempski authored
428 cd build
849ef20 @esden We need to use clang instead of llvm-gcc for compiling gcc on Mac OS …
esden authored
429 if [ "X${GCC_CC}" != "X" ] ; then
430 export GLOBAL_CC=${CC}
431 log "Overriding the default compiler with: \"${GCC_CC}\""
432 export CC=${GCC_CC}
433 fi
434
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
435 log "Configuring ${GCC} and ${NEWLIB}"
dfcf062 Initial commit
Piotr Esden-Tempski authored
436 ../${GCC}/configure --target=${TARGET} \
437 --prefix=${PREFIX} \
438 --enable-multilib \
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
439 --enable-languages="c,c++" \
dfcf062 Initial commit
Piotr Esden-Tempski authored
440 --with-newlib \
441 --with-gnu-as \
442 --with-gnu-ld \
6877dd1 @esden Added support for toolchain building on Mac OS X.
esden authored
443 --disable-nls \
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
444 --disable-shared \
445 --disable-threads \
446 --with-headers=newlib/libc/include \
447 --disable-libssp \
448 --disable-libstdcxx-pch \
449 --disable-libmudflap \
450 --disable-libgomp \
e1cdb02 @uwehermann Add missing --disable-werror configure options.
uwehermann authored
451 --disable-werror \
f191ef3 @esden Added --use-system-zlib to fix compilation on debian unstable.
esden authored
452 --with-system-zlib \
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
453 --disable-newlib-supplied-syscalls \
ccb4e0f @nzmichaelh Use set -e to stop on any error, including downloads.
nzmichaelh authored
454 ${GCCFLAGS}
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
455 log "Building ${GCC} and ${NEWLIB}"
eb973fb @nzmichaelh Added the ability to run a bit quieter
nzmichaelh authored
456 make ${MAKEFLAGS}
1c3dd9a @nzmichaelh Pulled install out to a function to pull in sudo and parallel everywhere
nzmichaelh authored
457 install ${GCC} install
dfcf062 Initial commit
Piotr Esden-Tempski authored
458 cd ..
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
459 log "Cleaning up ${GCC} and ${NEWLIB}"
849ef20 @esden We need to use clang instead of llvm-gcc for compiling gcc on Mac OS …
esden authored
460
461 if [ "X${GCC_CC}" != "X" ] ; then
462 unset CC
463 CC=${GLOBAL_CC}
464 unset GLOBAL_CC
465 fi
466
687eb52 @esden Modified the build process to one step build of gcc and newlib. Updat…
esden authored
467 touch ${STAMPS}/${GCC}-${NEWLIB}.build
468 rm -rf build/* ${GCC} ${NEWLIB}
dfcf062 Initial commit
Piotr Esden-Tempski authored
469 fi
470
74191d4 @nzmichaelh Changed stamp files to go into a directory for easy toasting
nzmichaelh authored
471 if [ ! -e ${STAMPS}/${GDB}.build ]; then
902b6a0 @nzmichaelh Made more of unpack() common. Use wildcards to pick up different com…
nzmichaelh authored
472 unpack ${GDB}
dfcf062 Initial commit
Piotr Esden-Tempski authored
473 cd build
4e03b34 @nzmichaelh Pulled all logging out into a function
nzmichaelh authored
474 log "Configuring ${GDB}"
dfcf062 Initial commit
Piotr Esden-Tempski authored
475 ../${GDB}/configure --target=${TARGET} \
476 --prefix=${PREFIX} \
451b5f3 @esden GDB compile yelds warnings but compiles on Mac. Added --without-werro…
esden authored
477 --enable-multilib \
d08135e @uwehermann Use --disable-werror unconditionally everywhere.
uwehermann authored
478 --disable-werror \
ccb4e0f @nzmichaelh Use set -e to stop on any error, including downloads.
nzmichaelh authored
479 ${GDBFLAGS}
4e03b34 @nzmichaelh Pulled all logging out into a function
nzmichaelh authored
480 log "Building ${GDB}"
eb973fb @nzmichaelh Added the ability to run a bit quieter
nzmichaelh authored
481 make ${MAKEFLAGS}
1c3dd9a @nzmichaelh Pulled install out to a function to pull in sudo and parallel everywhere
nzmichaelh authored
482 install ${GDB} install
dfcf062 Initial commit
Piotr Esden-Tempski authored
483 cd ..
4e03b34 @nzmichaelh Pulled all logging out into a function
nzmichaelh authored
484 log "Cleaning up ${GDB}"
74191d4 @nzmichaelh Changed stamp files to go into a directory for easy toasting
nzmichaelh authored
485 touch ${STAMPS}/${GDB}.build
dfcf062 Initial commit
Piotr Esden-Tempski authored
486 rm -rf build/* ${GDB}
487 fi
488
5789834 @esden Added building of openocd as part of the toolchain.
esden authored
489 if [ ${OOCD_EN} != 0 ]; then
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
490 if [ ! -e ${STAMPS}/${OOCD}.build ]; then
491 unpack ${OOCD}
ab51a9e @karlp Fix messages and paths
authored
492 log "Patching openocd to support arm7m registers"
ff52735 @esden Merge remote-tracking branch 'mikesmith/master'
esden authored
493 cd ${OOCD}
ab51a9e @karlp Fix messages and paths
authored
494 patch -p1 -i ../patches/patch-openocd-arm7m-registers.diff
ff52735 @esden Merge remote-tracking branch 'mikesmith/master'
esden authored
495 cd ..
5789834 @esden Added building of openocd as part of the toolchain.
esden authored
496 cd build
497 log "Configuring openocd-${OOCD}"
e489f98 @esden Should fix the problem with hanging CFLAGS and LDFLAGS of OOCD.
esden authored
498 CFLAGS="${CFLAGS} ${OOCD_CFLAGS}" \
499 LDFLAGS="${LDFLAGS} ${OOCD_LDFLAGS}" \
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
500 ../${OOCD}/configure --enable-maintainer-mode \
964c781 Disable option checking, since it looks like there's a fight in
Mike Smith authored
501 --disable-option-checking \
b14785f @uwehermann Pass --disable-werror to openocd.
uwehermann authored
502 --disable-werror \
d0b1a97 @esden Fixed openocd build. Not all of the previously enabled interfaces wer…
esden authored
503 --prefix=${PREFIX} \
504 --enable-dummy \
505 --enable-ft2232_libftdi \
506 --enable-usb_blaster_libftdi \
507 --enable-ep93xx \
508 --enable-at91rm9200 \
509 --enable-presto_libftdi \
510 --enable-usbprog \
511 --enable-jlink \
512 --enable-vsllink \
513 --enable-rlink \
514 --enable-arm-jtag-ew
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
515 log "Building ${OOCD}"
5789834 @esden Added building of openocd as part of the toolchain.
esden authored
516 make ${MAKEFLAGS}
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
517 install ${OOCD} install
5789834 @esden Added building of openocd as part of the toolchain.
esden authored
518 cd ..
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
519 log "Cleaning up ${OOCD}"
520 touch ${STAMPS}/${OOCD}.build
5789834 @esden Added building of openocd as part of the toolchain.
esden authored
521 rm -rf build/* ${OOCD}
522 fi
523 fi
524
ed24af0 Added _EN variables to enable/disable libstm32 and libopenstm32 insta…
Piotr Esden-Tempski authored
525 if [ ${LIBSTM32_EN} != 0 ]; then
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
526 if [ ! -e ${STAMPS}/${LIBCMSIS}.build ]; then
527 unpack ${LIBCMSIS}
528 cd ${LIBCMSIS}
529 log "Building ${LIBCMSIS}"
ccb4e0f @nzmichaelh Use set -e to stop on any error, including downloads.
nzmichaelh authored
530 make arch_prefix=${TARGET} prefix=${PREFIX}
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
531 install ${LIBCMSIS} arch_prefix=${TARGET} prefix=${PREFIX} install
dfcf062 Initial commit
Piotr Esden-Tempski authored
532 cd ..
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
533 log "Cleaning up ${LIBCMSIS}"
534 touch ${STAMPS}/${LIBCMSIS}.build
535 rm -rf ${LIBCMSIS}
dfcf062 Initial commit
Piotr Esden-Tempski authored
536 fi
537
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
538 if [ ! -e ${STAMPS}/${LIBSTM32}.build ]; then
539 unpack ${LIBSTM32}
540 cd ${LIBSTM32}
541 log "Building ${LIBSTM32}"
ccb4e0f @nzmichaelh Use set -e to stop on any error, including downloads.
nzmichaelh authored
542 make arch_prefix=${TARGET} prefix=${PREFIX}
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
543 install ${LIBSTM32} arch_prefix=${TARGET} prefix=${PREFIX} install
dfcf062 Initial commit
Piotr Esden-Tempski authored
544 cd ..
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
545 log "Cleaning up ${LIBSTM32}"
546 touch ${STAMPS}/${LIBSTM32}.build
547 rm -rf ${LIBSTM32}
dfcf062 Initial commit
Piotr Esden-Tempski authored
548 fi
549
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
550 if [ ! -e ${STAMPS}/${LIBSTM32USB}.build ]; then
551 unpack ${LIBSTM32USB}
552 cd ${LIBSTM32USB}
553 log "Building ${LIBSTM32USB}"
ccb4e0f @nzmichaelh Use set -e to stop on any error, including downloads.
nzmichaelh authored
554 make arch_prefix=${TARGET} prefix=${PREFIX}
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
555 install ${LIBSTM32USB} arch_prefix=${TARGET} prefix=${PREFIX} install
dfcf062 Initial commit
Piotr Esden-Tempski authored
556 cd ..
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
557 log "Cleaning up ${LIBSTM32USB}"
558 touch ${STAMPS}/${LIBSTM32USB}.build
559 rm -rf ${LIBSTM32USB}
dfcf062 Initial commit
Piotr Esden-Tempski authored
560 fi
ed24af0 Added _EN variables to enable/disable libstm32 and libopenstm32 insta…
Piotr Esden-Tempski authored
561 fi
562
d66240e @esden Renamed libopenstm32 to libopencm3 and updated the git source.
esden authored
563 if [ $LIBOPENCM3_EN != 0 ]; then
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
564 if [ ! -e ${STAMPS}/${LIBOPENCM3}.build ]; then
565 unpack ${LIBOPENCM3}
566 cd ${LIBOPENCM3}
567 log "Building ${LIBOPENCM3}"
ccb4e0f @nzmichaelh Use set -e to stop on any error, including downloads.
nzmichaelh authored
568 make PREFIX=${TARGET} DESTDIR=${PREFIX}
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
569 install ${LIBOPENCM3} PREFIX=${TARGET} DESTDIR=${PREFIX} install
ed24af0 Added _EN variables to enable/disable libstm32 and libopenstm32 insta…
Piotr Esden-Tempski authored
570 cd ..
3b02e97 @esden Improved handling of sources fetched from git repositories.
esden authored
571 log "Cleaning up ${LIBOPENCM3}"
572 touch ${STAMPS}/${LIBOPENCM3}.build
573 rm -rf ${LIBOPENCM3}
ed24af0 Added _EN variables to enable/disable libstm32 and libopenstm32 insta…
Piotr Esden-Tempski authored
574 fi
7df1edb @esden stm32 libraries now create their stamps in stamp directory. libopenst…
esden authored
575 fi
Something went wrong with that request. Please try again.