@@ -10,6 +10,7 @@ function usage() {
10
10
echo " -d, --debug build with debug information, without optimizer"
11
11
echo " -h, --help show usage message"
12
12
echo " -n, --no-cpp do not support C++ standard library"
13
+ echo " -o, --option <name>[=<value>] define system option (optionally with value)"
13
14
echo " --opt-tls build with mbed TLS support"
14
15
echo " -p <string>, --prefix <string> prefix of the toolchain commands (default: arm-none-eabi-)"
15
16
echo " --qemu build for running under QEMU in semihosting mode"
@@ -25,7 +26,7 @@ function usage() {
25
26
cd " ${BASH_SOURCE%/* } " || exit 1
26
27
TOPDIR=" $PWD "
27
28
28
- TEMP=$( getopt -o dhnp: r:s: --long debug,help,no-circle-build,no-cpp,opt-tls,qemu,prefix:,raspberrypi:,script-debug,softfp,stddefpath: \
29
+ TEMP=$( getopt -o dhno:p: r:s: --long debug,help,no-circle-build,no-cpp,option: ,opt-tls,qemu,prefix:,raspberrypi:,script-debug,softfp,stddefpath: \
29
30
-n ' build.bash' -- " $@ " )
30
31
31
32
if [ $? != 0 ] ; then echo usage; exit 1 ; fi
@@ -42,6 +43,7 @@ NEWLIB_BUILD=1
42
43
TOOLPREFIX=arm-none-eabi-
43
44
STDDEF_INCPATH=" "
44
45
STDLIB_SUPPORT=3
46
+ OPTIONS=" "
45
47
FLOAT_ABI=hard
46
48
OPTTLS=0
47
49
SIXTY_FOUR_BIT=0
@@ -55,6 +57,7 @@ while true ; do
55
57
-d|--debug) DEBUG=1 ; shift ;;
56
58
-h|--help) usage ; exit 0;;
57
59
-n|--no-cpp) STDLIB_SUPPORT=2 ; shift ;;
60
+ -o|--option) OPTIONS=" $OPTIONS -D$2 " ; shift 2;;
58
61
--opt-tls) OPTTLS=1 ; shift ;;
59
62
--qemu) CIRCLE_QEMU=1 ; shift ;;
60
63
-p|--prefix) TOOLPREFIX=" $2 " ; shift 2;;
@@ -75,6 +78,7 @@ echo "FLOAT_ABI=$FLOAT_ABI"
75
78
echo " NEWLIB_BUILD=$NEWLIB_BUILD "
76
79
echo " RASPBERRYPI=$RASPBERRYPI "
77
80
echo " STDLIB_SUPPORT=$STDLIB_SUPPORT "
81
+ echo " OPTIONS=$OPTIONS "
78
82
echo " NEWLIB_INSTALL_DIR=$NEWLIB_INSTALL_DIR "
79
83
echo " NEWLIB_BUILD_DIR=$NEWLIB_BUILD_DIR "
80
84
echo " DEBUG=$DEBUG "
160
164
echo " STDLIB_SUPPORT = $STDLIB_SUPPORT "
161
165
echo " STDDEF_INCPATH = \" $STDDEF_INCPATH \" "
162
166
echo " CFLAGS = -Wno-parentheses $CIRCLE_CFLAGS "
167
+ if [ " $OPTIONS " != " " ]
168
+ then
169
+ echo " DEFINE += $OPTIONS "
170
+ fi
163
171
if [ $DEBUG -eq 1 ]
164
172
then
165
173
echo " OPTIMIZE = -O0 -g"
@@ -189,9 +197,9 @@ export \
189
197
190
198
if [ $DEBUG -eq 1 ]
191
199
then
192
- CFLAGS_FOR_TARGET=" $ARCH -O0 -g -Wno-parentheses"
200
+ CFLAGS_FOR_TARGET=" $ARCH -DRASPPI= $RASPBERRYPI $OPTIONS - O0 -g -Wno-parentheses"
193
201
else
194
- CFLAGS_FOR_TARGET=" $ARCH -Wno-parentheses"
202
+ CFLAGS_FOR_TARGET=" $ARCH -DRASPPI= $RASPBERRYPI $OPTIONS - Wno-parentheses"
195
203
fi
196
204
export CFLAGS_FOR_TARGET
197
205
0 commit comments