Skip to content

Commit b495628

Browse files
rsta2smuehlst
authored andcommitted
New option for configure script
New command line option "--option" for specifying additional defines that will be used for the compilation of Circle and circle-newlib. It is important to have consistent defines in the compilation of Circle and circle-newlib, otherwise things like described in probonopd/MiniDexed#39 happen where inconsistent defines in the compilation of the libraries caused a hang.
1 parent 47d9deb commit b495628

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

configure

+11-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function usage() {
1010
echo " -d, --debug build with debug information, without optimizer"
1111
echo " -h, --help show usage message"
1212
echo " -n, --no-cpp do not support C++ standard library"
13+
echo " -o, --option <name>[=<value>] define system option (optionally with value)"
1314
echo " --opt-tls build with mbed TLS support"
1415
echo " -p <string>, --prefix <string> prefix of the toolchain commands (default: arm-none-eabi-)"
1516
echo " --qemu build for running under QEMU in semihosting mode"
@@ -25,7 +26,7 @@ function usage() {
2526
cd "${BASH_SOURCE%/*}" || exit 1
2627
TOPDIR="$PWD"
2728

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: \
2930
-n 'build.bash' -- "$@")
3031

3132
if [ $? != 0 ] ; then echo usage; exit 1 ; fi
@@ -42,6 +43,7 @@ NEWLIB_BUILD=1
4243
TOOLPREFIX=arm-none-eabi-
4344
STDDEF_INCPATH=""
4445
STDLIB_SUPPORT=3
46+
OPTIONS=""
4547
FLOAT_ABI=hard
4648
OPTTLS=0
4749
SIXTY_FOUR_BIT=0
@@ -55,6 +57,7 @@ while true ; do
5557
-d|--debug) DEBUG=1 ; shift;;
5658
-h|--help) usage ; exit 0;;
5759
-n|--no-cpp) STDLIB_SUPPORT=2 ; shift;;
60+
-o|--option) OPTIONS="$OPTIONS -D$2" ; shift 2;;
5861
--opt-tls) OPTTLS=1 ; shift;;
5962
--qemu) CIRCLE_QEMU=1 ; shift;;
6063
-p|--prefix) TOOLPREFIX="$2" ; shift 2;;
@@ -75,6 +78,7 @@ echo "FLOAT_ABI=$FLOAT_ABI"
7578
echo "NEWLIB_BUILD=$NEWLIB_BUILD"
7679
echo "RASPBERRYPI=$RASPBERRYPI"
7780
echo "STDLIB_SUPPORT=$STDLIB_SUPPORT"
81+
echo "OPTIONS=$OPTIONS"
7882
echo "NEWLIB_INSTALL_DIR=$NEWLIB_INSTALL_DIR"
7983
echo "NEWLIB_BUILD_DIR=$NEWLIB_BUILD_DIR"
8084
echo "DEBUG=$DEBUG"
@@ -160,6 +164,10 @@ fi
160164
echo "STDLIB_SUPPORT = $STDLIB_SUPPORT"
161165
echo "STDDEF_INCPATH = \"$STDDEF_INCPATH\""
162166
echo "CFLAGS = -Wno-parentheses $CIRCLE_CFLAGS"
167+
if [ "$OPTIONS" != "" ]
168+
then
169+
echo "DEFINE += $OPTIONS"
170+
fi
163171
if [ $DEBUG -eq 1 ]
164172
then
165173
echo "OPTIMIZE = -O0 -g"
@@ -189,9 +197,9 @@ export \
189197

190198
if [ $DEBUG -eq 1 ]
191199
then
192-
CFLAGS_FOR_TARGET="$ARCH -O0 -g -Wno-parentheses"
200+
CFLAGS_FOR_TARGET="$ARCH -DRASPPI=$RASPBERRYPI $OPTIONS -O0 -g -Wno-parentheses"
193201
else
194-
CFLAGS_FOR_TARGET="$ARCH -Wno-parentheses"
202+
CFLAGS_FOR_TARGET="$ARCH -DRASPPI=$RASPBERRYPI $OPTIONS -Wno-parentheses"
195203
fi
196204
export CFLAGS_FOR_TARGET
197205

0 commit comments

Comments
 (0)