###########################################################################
# Number of can bus to use
-MAX_CAN_BUS_ID=1
+MAX_CAN_BUS_ID=1
# max bytes to transmit by SDO Put 4 if you only support expedited transfert.
-# For a normal transfert, (usually for a string), put the maximum string size to transfer.
-SDO_MAX_LENGTH_TRANSFERT=32
+#For a normal transfert, (usually for a string), put the maximum string size to transfer.
+SDO_MAX_LENGTH_TRANSFERT=32
# Number of SDO from differents nodes that the node can manage concurrently.
-# for a slave node, usually put 1.
+#for a slave node, usually put 1.
SDO_MAX_SIMULTANEOUS_TRANSFERTS=4
# Used for NMTable[bus][nodeId]
# You can put less of 128 if on the netwo
# are connected only smaller nodeId node.
-NMT_MAX_NODE_ID=128
+NMT_MAX_NODE_ID=128
#Timeout in milliseconds for SDO.
# Comment the #define if not used (infinite wait for SDO response message)
TIMEVAL_MAX=
# Default to little-endian
-CANOPEN_LITTLE_ENDIAN=1
CANOPEN_BIG_ENDIAN=
+# Max number of active errors managed in error_data structure.
+EMCY_MAX_ERRORS=8
+
+#Timeout in milliseconds for LSS.
+LSS_TIMEOUT_MS=1000
+#Timeout in milliseconds for LSS FastScan.
+LSS_FS_TIMEOUT_MS=100
+
###########################################################################
# DEFAULT BUILD OPTIONS #
###########################################################################
-# Leave empty for automatic detection
-CC=
-
#default target
SUB_TARGET=
test=conftest
rm -f $test $test.c
-if [ "$XENO_CONFIG" == "" ]; then
+if [ "$XENO_CONFIG" = "" ]; then
XENO_CONFIG=/usr/xenomai/bin/xeno-config
fi
+if [ "$RTAI_CONFIG" = "" ]; then
+ RTAI_CONFIG=/usr/realtime/bin/rtai-config
+fi
+
###########################################################################
# ARGUMENTS PARSING #
###########################################################################
case $1 in
--cc=*) CC=$optarg;;
+ --cxx=*) CXX=$optarg;;
+ --ld=*) LD=$optarg;;
+ --binutils=*) BINUTILS_PREFIX=$optarg;;
--arch=*) SUB_ARCH_NAME=$optarg;;
--os=*) SUB_OS_NAME=$optarg;;
+ --kerneldir=*) SUB_KERNELDIR=$optarg;;
--prefix=*) SUB_PREFIX=$optarg;;
--target=*) SUB_TARGET=$optarg;;
--can=*) SUB_CAN_DRIVER=$optarg;;
--timers=*) SUB_TIMERS_DRIVER=$optarg;;
+ --wx=*) SUB_WX=$optarg;
+ echo "Forced wx detection to $optarg";;
--disable-Ox) DISABLE_OPT=1;
echo "On user request: Won't optimize with \"-Ox\"";;
--disable-dll) DISABLE_DLL=1;
echo "On user request: Won't create and link to dll";;
- --debug) DEBUG=1;
- echo "Debug messages enabled !!";;
- --debugPDO) DEBUG=PDO;
- echo "Debug messages (PDO) enabled !!";;
- --MAX_CAN_BUS_ID=*) MAX_CAN_BUS_ID=$1;;
- --SDO_MAX_LENGTH_TRANSFERT=*) SDO_MAX_LENGTH_TRANSFERT=$1;;
- --SDO_MAX_SIMULTANEOUS_TRANSFERTS=*) SDO_MAX_SIMULTANEOUS_TRANSFERTS=$1;;
- --NMT_MAX_NODE_ID=*) NMT_MAX_NODE_ID=$1;;
- --SDO_TIMEOUT_MS=*) SDO_TIMEOUT_MS=$1;;
- --CANOPEN_BIG_ENDIAN=*) CANOPEN_BIG_ENDIAN=$1;;
- --MAX_NB_TIMER=*) MAX_NB_TIMER=$1;;
- --help) echo "Usage: ./configure [options]"
- echo "Options:"
- echo " --cc=foo Use compiler 'foo' instead of defaults ${CC1} or ${CC2}."
+ --enable-lss) ENABLE_LSS=1;
+ echo "On user request: LSS services enabled";;
+ --enable-lss-fs) ENABLE_LSS_FS=1;
+ echo "On user request: LSS FastScan service enabled";;
+ --debug=*) DEBUG=$optarg;;
+ --MAX_CAN_BUS_ID=*) MAX_CAN_BUS_ID=$optarg;;
+ --SDO_MAX_LENGTH_TRANSFERT=*) SDO_MAX_LENGTH_TRANSFERT=$optarg;;
+ --SDO_MAX_SIMULTANEOUS_TRANSFERTS=*) SDO_MAX_SIMULTANEOUS_TRANSFERTS=$optarg;;
+ --NMT_MAX_NODE_ID=*) NMT_MAX_NODE_ID=$optarg;;
+ --SDO_TIMEOUT_MS=*) SDO_TIMEOUT_MS=$optarg;;
+ --CANOPEN_BIG_ENDIAN=*) CANOPEN_BIG_ENDIAN=$optarg;;
+ --MAX_NB_TIMER=*) MAX_NB_TIMER=$optarg;;
+ --EMCY_MAX_ERRORS=*) EMCY_MAX_ERRORS=$optarg;;
+ --LSS_TIMEOUT_MS=*) LSS_TIMEOUT_MS=$optarg;;
+ --LSS_FS_TIMEOUT_MS=*) LSS_FS_TIMEOUT_MS=$optarg;;
+ --help)
+ echo "Usage: ./configure [options]"
+ echo "Options:"
+ echo " --cc=foo Use C compiler 'foo' instead of defaults ${CC1} or ${CC2}."
+ echo " --cxx=foo Use C++ compiler 'foo' instead of defaults g++."
+ echo " --ld=foo Use linker 'foo' instead of ld."
echo " --arch=foo Use architecture 'foo' instead of trying to autodetect."
echo " --os=foo Use operative system 'foo' instead of trying to autodetect."
+ echo " --kerneldir=foo Use 'foo' as kernel source directory instead of default"
echo " --prefix=foo Use prefix 'foo' instead of default ${SUB_PREFIX}."
echo " --target=foo Use 'foo' as build target."
- echo " \"generic\" for have independant CAN and TIMERS driver"
- echo " \"unix\" for unix-like systems"
- echo " \"win32\" for win32 systems"
+ echo " \"unix\" for unix-like systems (Linux, Cygwin)"
+ echo " \"win32\" for win32 systems (native, mingw or VC++)"
echo " \"hcs12\" for HCS12 micro-controller"
- echo " \"ecos_lpc2138_sja1000\" for eCOS + Philips ARM LPC21381 + Philips SJA1000"
echo " --can=foo Use 'foo' as CAN driver"
+ echo " \"anagate_linux\" use AnaGate CAN(duo) driver for linux"
+ echo " \"anagate_win32\" use AnaGate CAN(duo) driver for win32"
echo " \"peak_linux\" use Linux build host installed Peak driver and library"
- echo " please see http://www.peak-system.com/linux/"
+ echo " see http://www.peak-system.com/linux/"
echo " \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin"
- echo " please see http://www.peak-system.com/themen/download_gb.html"
+ echo " see http://www.peak-system.com/themen/download_gb.html"
echo " \"virtual\" use unix pipe based virtual can driver"
+ echo " \"virtual_kernel\" use kernel module virtual can driver"
echo " \"socket\" use socket-can "
- echo " please see http://developer.berlios.de/projects/socketcan/"
- echo " \"lincan\" for HCS12 micro-controller"
- echo " please see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html"
- echo " --timers=foo Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')"
+ echo " see http://developer.berlios.de/projects/socketcan/"
+ echo " \"lincan\" lincan driver"
+ echo " see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html"
+ echo " \"can4linux\" can4linux driver"
+ echo " see http://www.port.de/engl/canprod/hw_can4linux.html"
+ echo " --timers=foo Use 'foo' as TIMERS driver (can be 'unix', 'xeno', 'rtai' or 'kernel')"
+ echo " --wx=foo Force result of WxWidgets detection (0 or 1)"
+ echo " --binutils=path Override binutils path detection (as regards \$CC content)"
echo " --disable-dll Disable run-time dynamic linking of can, led and nvram drivers"
+ echo " --enable-lss Enable the LSS services"
+ echo " --enable-lss-fs Enable the LSS FastScan service"
echo " --disable-Ox Disable gcc \"-Ox\" optimizations."
- echo " --debug Enable debug messages."
- echo " --debugPDO Enable debug messages, using PDO."
+ echo " --debug=foo,foo,.. Enable debug messages, ERR -> only errors, WAR)."
+ echo " \"PDO\" send errors and warnings through PDO messages"
+ echo " \"ERR\" print errors only, to stdout"
+ echo " \"WAR\" print errors and warnings, to stdout"
+ echo " \"MSG\" print messages content, to stdout"
echo
echo "Stack compilation constants"
echo " --MAX_CAN_BUS_ID [=1] Number of can bus to use"
echo " --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently"
echo " --NMT_MAX_NODE_ID [=128] can be reduced to gain memory on small network"
echo " --SDO_TIMEOUT_MS [=3000] Timeout in milliseconds for SDO (None to disable the feature)"
+ echo " --EMCY_MAX_ERRORS [=8] Max number of active errors managed in error_data structure"
+ echo " --LSS_TIMEOUT_MS [=1000] Timeout in milliseconds for LSS services."
+ echo " LSS must be enabled with \"--enable-lss\""
+ echo " --LSS_FS_TIMEOUT_MS [=100] Timeout in milliseconds for LSS FastScan service."
+ echo " LSS FastScan must be enabled with \"--enable-lss-fs\""
exit 0;;
*) echo "Unknown argument ${1}"; exit -1;;
esac
SUB_OS_NAME="`(uname -s | sed \"s/\//-/\" | sed \"s/_/-/\" \
| sed \"s/-.*//g\") 2>&1`"
fi
-if [ "$SUB_OS_NAME" = "HP" -o "$SUB_OS_NAME" = "HP-UX" ]; then
- SUB_OS_NAME=HPUX
-fi
if [ "$SUB_ARCH_NAME" = "" ]; then
if [ "$CC" = "" ]; then
fi
# x86
-if [ "$A_NAME" = "i386" ]; then
- SUB_ARCH_NAME=x86
-fi
-if [ "$A_NAME" = "i486" ]; then
- SUB_ARCH_NAME=x86
-fi
-if [ "$A_NAME" = "i586" ]; then
- SUB_ARCH_NAME=x86
-fi
-if [ "$A_NAME" = "i686" ]; then
- SUB_ARCH_NAME=x86
-fi
-if [ "$A_NAME" = "x86" ]; then
+if [ "$A_NAME" = "i386" -o "$A_NAME" = "i486" -o "$A_NAME" = "i586" -o "$A_NAME" = "i686" -o "$A_NAME" = "x86" ]; then
SUB_ARCH_NAME=x86
fi
SUB_ARCH_NAME=x86_64
fi
-# ia64
-if [ "$A_NAME" = "ia64" ]; then
- SUB_ARCH_NAME=ia64
-fi
-
-# alpha
-if [ "$A_NAME" = "alpha" ]; then
- SUB_ARCH_NAME=alpha
-fi
-
-# parisc
-if [ "$A_NAME" = "parisc" ]; then
- SUB_ARCH_NAME=parisc
-fi
-if [ "$SUB_OS_NAME" = "HPUX" -a "$A_NAME" != "ia64" ]; then
- # If we're on HP-UX and the architecture is *not* ia64,
- # it's most likely parisc
- SUB_ARCH_NAME=parisc
-fi
-
-# sparc
-if [ "$A_NAME" = "sparc" ]; then
- SUB_ARCH_NAME=sparc
-fi
-if [ "$A_NAME" = "sun4u" ]; then
- SUB_ARCH_NAME=sparc
-fi
-
-# sparc64
-if [ "$A_NAME" = "sparc64" ]; then
- SUB_ARCH_NAME=sparc64
-fi
-
# ppc
if [ "$A_NAME" = "powerpc" ]; then
SUB_ARCH_NAME=ppc
SUB_ARCH_NAME=arm
fi
-# mips3
-if [ "$A_NAME" = "ip32" ]; then # IRIX
- SUB_ARCH_NAME=mips3
-fi
-if [ "$A_NAME" = "ip35" ]; then # IRIX
- SUB_ARCH_NAME=mips3
-fi
-
-# mips32
-if [ "$A_NAME" = "mips32" ]; then
- SUB_ARCH_NAME=mips32
-fi
-if [ "$A_NAME" = "mips" ]; then
- SUB_ARCH_NAME=mips32
-fi
-if [ "$A_NAME" = "MIPS" ]; then
- SUB_ARCH_NAME=mips32
-fi
-if [ "$A_NAME" = "RISC" ]; then # MIPS Ultrix
- SUB_ARCH_NAME=mips32
-fi
-
-# mips64
-if [ "$A_NAME" = "mips64" ]; then
- SUB_ARCH_NAME=mips64
-fi
-if [ "$A_NAME" = "MIPS64" ]; then
- SUB_ARCH_NAME=mips64
-fi
-if [ "$A_NAME" = "IP64" ]; then # IRIX
- SUB_ARCH_NAME=mips64
+# mingw32
+if [ "$A_NAME" = "mingw32" ]; then
+ SUB_ARCH_NAME=mingw32
fi
-# power
-if [ "$A_NAME" = "power" ]; then # Manual
- SUB_ARCH_NAME=power
-fi
-
-echo "Using OS: ${SUB_OS_NAME}"
-echo "Using architecture: ${SUB_ARCH_NAME}"
-
if [ "$SUB_ARCH_NAME" = "" ]; then
echo "Error: could not detect what architecture this system is running!"
echo "Please supply manually instead with \"--arch=foo\""
exit -1
fi
-if [ "$SUB_OS_NAME" = "HPUX" -a "$CC" = "gcc" ]; then
- # Only if we are on HP-UX, ia64 and using gcc
- SUB_PROG_CFLAGS=-mlp64
-fi
-
-if [ "$SUB_OS_NAME" = "SunOS" -a "$SUB_ARCH_NAME" = "sparc" -a "$CC" = "gcc" ]; then
- # Only if we are on SunOS, sparc and using gcc
- # Tells the assembler that we are dealing with a v8plusa arch sparc
- # and -mimpure-text is needed for shared library linking
- SUB_PROG_CFLAGS="-Wa,-xarch=v8plusa -mimpure-text"
-fi
-
-if [ "$SUB_OS_NAME" = "AIX" -a "$SUB_ARCH_NAME" = "power" -a "$CC" = "gcc" ]; then
- # Only if we are on AIX, power and using gcc
- # The assembler may default to generating Power and PowerPC compatible
- # code. We need to override that.
- SUB_PROG_CFLAGS=-Wa,-mpwr
-fi
-
-if [ "$SUB_OS_NAME" = "AIX" -a "$SUB_ARCH_NAME" = "ppc" -a "$CC" = "gcc" ]; then
- # Only if we are on AIX, ppc and using gcc
- # The assembler may default to generating Power and PowerPC compatible
- # code. We need to override that.
- SUB_PROG_CFLAGS=-Wa,-mppc
-fi
+echo "Host OS: ${SUB_OS_NAME}"
+echo "Host arch: ${SUB_ARCH_NAME}"
-if [ "$SUB_ARCH_NAME" = "x86_64" -a "$CC" = "gcc" ]; then
- # Only if we are on x86_64 and using gcc
- # For shared library generation, it needs this
- SUB_PROG_CFLAGS=-fPIC
+if [ "$SUB_ARCH_NAME" = "ppc" -o "$SUB_ARCH_NAME" = "powerpc" ]; then
+ # PowerPC uses big endian format
+ CANOPEN_BIG_ENDIAN=1
fi
###########################################################################
# DEFAULT TARGET/DRIVERS GUESSING #
###########################################################################
-# If target not specified, try to gess one
+# If target not specified, try to guess one
if [ "$SUB_TARGET" = "" ]; then
if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
echo "Choosing unix (cygwin) target"
SUB_TARGET=unix
- else
+ fi
+ if [ "$SUB_OS_NAME" = "Linux" ]; then
echo "Choosing unix target"
SUB_TARGET=unix
fi
+ if [ "$SUB_OS_NAME" = "MINGW32" ]; then
+ echo "Choosing windows target"
+ SUB_TARGET=win32
+ fi
fi
-# Try to gess can
+# Try to guess can
if [ "$SUB_CAN_DRIVER" = "" ]; then
if [ "$SUB_TARGET" = "unix" ]; then
if [ -e /usr/lib/libpcan.so ]; then
elif [ "$SUB_OS_NAME" = "CYGWIN" -a "PCAN_LIB" != "" ]; then
echo "Choosing installed Peak driver as CAN driver."
SUB_CAN_DRIVER=peak_win32
+ elif [ -e /usr/lib/libcanlib.so ]; then
+ echo "Choosing installed Kvaser driver as CAN driver. (unix)"
+ SUB_CAN_DRIVER=kvaser
+ elif [ -e /usr/local/lib/libAnaGateAPIDLL.so ]; then
+ echo "Choosing installed AnaGate driver as CAN driver. (unix)"
+ SUB_CAN_DRIVER=anagate_linux
+ elif [ "$SUB_OS_NAME" = "CYGWIN" -a "$KVASER_DLL_PATH" != "" ]; then
+ echo "Choosing installed Kvaser driver as CAN driver. (cygwin)"
+ SUB_CAN_DRIVER=kvaser
else
echo "Choosing virtual CAN driver."
SUB_CAN_DRIVER=virtual
SUB_TIMERS_DRIVER=unix
fi
+# If target is windows, default timers also
+if [ "$SUB_TARGET" = "win32" -a "$SUB_TIMERS_DRIVER" = "" ]; then
+ echo "Choosing windows timers driver."
+ SUB_TIMERS_DRIVER=win32
+fi
+
# Warn for unstalled peak driver if choosen
if [ "$SUB_CAN_DRIVER" = "peak" ]; then
if [ ! -e /usr/lib/libpcan.so ]; then
fi
fi
-###########################################################################
-# TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS #
-###########################################################################
-if [ "$SUB_TARGET" = "generic" ]; then
- if [ "$US_TO_TIMEVAL_FACTOR" = "" ]; then
- US_TO_TIMEVAL_FACTOR=1
- fi
- if [ "$TIMEVAL" = "" ]; then
- TIMEVAL=UNS64
+# Warn for unstalled peak driver if choosen
+if [ "$SUB_CAN_DRIVER" = "anagate_linux" ]; then
+ if [ ! -e /usr/local/lib/libAnaGateAPIDLL.so ]; then
+ echo "AnaGateCAN driver hasn't been installed !"
+ exit -1
fi
- if [ "$TIMEVAL_MAX" = "" ]; then
- TIMEVAL_MAX=0xffffffffffffffff
+fi
+
+# Warn for unstalled kvaser driver if choosen
+if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then
+ if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
+ if [ ! -e "$KVASER_DLL_PATH/canlib32.dll" ]; then
+ echo "Kvaser driver hasn't been installed (cygwin)"
+ exit -1
+ fi
+ elif [ "$SUB_OS_NAME" = "LINUX" ]; then
+ if [ ! -e /usr/lib/libcanlib.so ]; then
+ echo "Kvaser driver hasn't been installed (unix)"
+ exit -1
+ fi
fi
fi
+###########################################################################
+# TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS #
+###########################################################################
if [ "$SUB_TARGET" = "hcs12" ]; then
- # Only if we want to compile for a µC HCS12
+ # Only if we want to compile for a C HCS12
# it is a big endian architecture.
CANOPEN_BIG_ENDIAN=1
# search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ?
#### CAN_DRIVER ####
+if [ "$SUB_CAN_DRIVER" = "kvaser" ]; then
+ if [ "$SUB_TARGET" = "unix" ]; then
+ if [ "$SUB_OS_NAME" = "LINUX" ]; then
+ SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lcanlib
+ elif [ "$SUB_OS_NAME" = "CYGWIN" ]; then
+ if [ "$KVASER_INCLUDE_PATH" = "" -o "$KVASER_DLL_PATH" = "" ]; then
+ echo "!!! ERROR !!! Please set KVASER_DLL_PATH and KVASER_INCLUDE_PATH to appropriate paths ! "
+ else
+ SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -L$KVASER_DLL_PATH\ -lcanlib32
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -I$KVASER_INCLUDE_PATH
+ fi
+ fi
+ fi
+fi
+
if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then
SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lpcan
fi
+if [ "$SUB_CAN_DRIVER" = "anagate_linux" ]; then
+ SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lAnaGateAPIDLL
+ SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lAnaCommon
+fi
+
+
+if [ "$SUB_CAN_DRIVER" = "vscom" ]; then
+ SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lvs_can_api
+fi
+
+if [ "$SUB_CAN_DRIVER" = "anagate_win32" ]; then
+ SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lAnaGateCan
+fi
+
PW32DIR=drivers/can_peak_win32
if [ "$SUB_CAN_DRIVER" = "peak_win32" ]; then
- if [ "$PCAN_HEADER" = "" -o "PCAN_LIB" = "" ]; then
+ if [ "$PCAN_HEADER" = "" -o "$PCAN_LIB" = "" ]; then
echo "!!! ERROR !!! Please set PCAN_LIB PCAN_HEADER [PCAN_INCLUDE] to appropriate paths ! "
fi
SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -liberty\ \'$PCAN_LIB\'
echo "Converting PcanLib header files for gcc -> $PW32DIR/cancfg.h"
cat $PW32DIR/cancfg.h.head $PCAN_INCLUDE/$PCAN_HEADER > $PW32DIR/cancfg.h
+ echo >> $PW32DIR/cancfg.h
# second port handling
if [ "$PCAN2_HEADER" != "" ]; then
echo "Stripping down second Pcan Light header "
echo " PCANHwType PCANIO_Port PCANInterupt"
echo '#define extra_PCAN_init_params' >> $PW32DIR/cancfg.h
fi
+ if ! grep -q CAN_Init $PW32DIR/cancfg.h ; then
+ echo "Pcan Light header/lib is for second port of device only"
+ echo "CAN_* calls redefined to CAN2_* "
+ echo '#define CAN_Init CAN2_Init' >> $PW32DIR/cancfg.h
+ echo '#define CAN_Read CAN2_Read' >> $PW32DIR/cancfg.h
+ echo '#define CAN_Write CAN2_Write' >> $PW32DIR/cancfg.h
+ echo '#define CAN_Close CAN2_Close' >> $PW32DIR/cancfg.h
+ fi
cat $PW32DIR/cancfg.h.tail >> $PW32DIR/cancfg.h
fi
fi
if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
- SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lnative\ -lrtdm\
-\ -L`$XENO_CONFIG --library-dir`
- SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ `$XENO_CONFIG --xeno-cflags`
- RTCAN_SOCKET=1
+ RT_LIB_DIR=`$XENO_CONFIG --library-dir`\ -Wl,-rpath\ `$XENO_CONFIG --library-dir`
+ SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ `$XENO_CONFIG --xeno-ldflags`\ -L$RT_LIB_DIR\ -lnative\ -lrtdm
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DUSE_XENO\ `$XENO_CONFIG --xeno-cflags`
+ RTCAN_SOCKET=1
+fi
+
+if [ "$SUB_TIMERS_DRIVER" = "rtai" ]; then
+ RT_LIB_DIR=`$RTAI_CONFIG --library-dir`\ -Wl,-rpath\ `$RTAI_CONFIG --library-dir`
+ SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ `$RTAI_CONFIG --lxrt-ldflags`\ -L$RT_LIB_DIR\ -llxrt\ -lrtdm
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DUSE_RTAI\ `$RTAI_CONFIG --lxrt-cflags`
+ RTCAN_SOCKET=1
+fi
+
+if [ "$SUB_TIMERS_DRIVER" = "kernel" ]; then
+ DISABLE_DLL=1
+ if [ "$SUB_KERNELDIR" = "" ]; then
+ # use directory of current kernel
+ SUB_KERNELDIR=/lib/modules/$(uname -r)/build
+ fi
fi
if [ "$SUB_TIMERS_DRIVER" = "none" ]; then
fi
###########################################################################
-# GUESS COMPILER #
+# GUESS TOOLCHAIN #
###########################################################################
# If CC is empty, the user wanted automatic detection
if [ "$CC" = "" ]; then
exit -1
fi
-echo "Using ${CC}"
+echo "Using ${CC} as a C compiler"
-###########################################################################
-# GUESS PREFIX's #
-###########################################################################
+if [ "$SUB_ARCH_NAME" = "x86_64" -a "$CC" = "gcc" ]; then
+ # Only if we are on x86_64 and using gcc
+ # For shared library generation, it needs this
+ SUB_PROG_CFLAGS=-fPIC
+fi
+
+if [ "$BINUTILS_PREFIX" = "" ]; then
+ SUB_BINUTILS_PREFIX=`echo "$CC" | sed 's/gcc$//'`
+else
+ SUB_BINUTILS_PREFIX=$BINUTILS_PREFIX
+fi
+
+if [ "$CXX" = "" ]; then
+ CXX=${SUB_BINUTILS_PREFIX}g++
+fi
+
+echo "Using ${CXX} as a C++ compiler"
+
+if [ "$SUB_TARGET" = "win32" ]; then
+ # on cygwin/mingw, choose g++ as a linker for native target
+ if [ "$LD" = "" ]; then
+ LD=$CXX
+ fi
+ if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
+ SUB_PROG_CFLAGS="-mno-cygwin"
+ fi
+fi
-SUB_BINUTILS_PREFIX=`echo "$CC" | sed 's/gcc$//'`
+if [ "$SUB_TARGET" = "unix" ]; then
+ if [ "$LD" = "" ]; then
+ LD=$CC
+ fi
+fi
+
+echo "Using ${LD} as a linker"
# Guess prefix as regard cross compiling target machine
if [ "$SUB_PREFIX" = "" ]; then
echo "Using prefix: ${SUB_PREFIX}"
+###########################################################################
+# GUESS DEPENDENCIES #
+###########################################################################
+
+if [ "$SUB_WX" = "" ]; then
+ if which wx-config >/dev/null 2>&1; then
+ echo -n "Testing wxWidgets compiles ... "
+ cat > /tmp/wx_test.cpp <<EOF
+#include "wx/wx.h"
+class MyApp : public wxApp
+{
+};
+IMPLEMENT_APP(MyApp)
+EOF
+ if $CXX /tmp/wx_test.cpp `wx-config --cxxflags` `wx-config --libs` -o /tmp/wx_test >/dev/null 2>&1 ; then
+ SUB_WX=1
+ echo "Yes"
+ else
+ SUB_WX=0
+ echo "No"
+ fi
+ rm -f /tmp/wx_test*
+ else
+ SUB_WX=0
+ echo "No wxWidgets available"
+ fi
+fi
###########################################################################
# CANFESTIVAL DEFINES --> config.h #
###########################################################################
# Some CONSTANTS preparation
-if [ "$CANOPEN_BIG_ENDIAN" = "" ]; then
- CANOPEN_LITTLE_ENDIAN=1
-else
- CANOPEN_LITTLE_ENDIAN=
-fi
# Create include/config.h with the relevant contents
rm -f include/config.h
SDO_TIMEOUT_MS\
MAX_NB_TIMER\
CANOPEN_BIG_ENDIAN\
- CANOPEN_LITTLE_ENDIAN\
US_TO_TIMEVAL_FACTOR\
TIMEVAL\
TIMEVAL_MAX\
- RTCAN_SOCKET; do
+ RTCAN_SOCKET\
+ EMCY_MAX_ERRORS\
+ LSS_TIMEOUT_MS\
+ LSS_FS_TIMEOUT_MS; do
if [ "${!i}" = "" ]; then
echo "/* $i is not defined */" >> include/config.h
else
for i in \
SDO_MAX_SIMULTANEOUS_TRANSFERTS\
- NMT_MAX_NODE_ID; do
+ NMT_MAX_NODE_ID\
+ EMCY_MAX_ERRORS; do
echo "#define REPEAT_"$i"_TIMES(repeat)\\">> include/config.h
times=${!i}
result=""
###########################################################################
# DEBUG DEFINES/CFLAGS #
###########################################################################
-if [ "$DEBUG" != "" ]; then
- SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_CAN\ -DDEBUG_WAR_CONSOLE_ON\ -DDEBUG_ERR_CONSOLE_ON\ -g
+
+save_ifs="$IFS"; IFS=','
+
+for DEBUG_METHOD in $DEBUG;
+ do
+ IFS="$save_ifs"
+ case $DEBUG_METHOD in
+ ERR)ERR=1;;
+ WAR)WAR=1;ERR=1;;
+ MSG)MSG=1;;
+ PDO)PDO=1;WAR=1;ERR=1;;
+ *)echo ""
+ echo "$DEBUG_METHOD is not a valid debug's method"
+ echo "Possible Debug's methods are : \"ERR\", \"WAR\", \"MSG\", \"PDO\""
+ exit -1
+ ;;
+ esac
+done
+
+if [ $WAR ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_WAR_CONSOLE_ON;
fi
-if [ "$DEBUG" = "PDO" ]; then
- SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DPDO_ERROR
+if [ $ERR ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_ERR_CONSOLE_ON;
fi
+if [ $MSG ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_MSG_CONSOLE_ON;
+fi
+
+if [ $PDO ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_PDO_CONSOLE_ON;
+fi
+
+if [ $DEBUG ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -g
+fi
+
+IFS="$save_ifs"
+
if [ "$DISABLE_OPT" = "1" ]; then
SUB_OPT_CFLAGS=
else
SUB_ENABLE_DLL_DRIVERS=0
else
SUB_ENABLE_DLL_DRIVERS=1
- SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -ldl
+ if [ "$SUB_TARGET" = "win32" ]; then
+ SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS
+ else
+ SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -ldl
+ fi
+
fi
SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ $SUB_CAN_DLL_CFLAGS
fi
+if [ $ENABLE_LSS ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DCO_ENABLE_LSS;
+ SUB_ENABLE_LSS=1
+ if [ $ENABLE_LSS_FS ]; then
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DCO_ENABLE_LSS_FS;
+ fi
+else
+ SUB_ENABLE_LSS=0
+fi
+
###########################################################################
# CREATE MAKEFILES #
###########################################################################
\ src/Makefile.in\
\ drivers/Makefile.in\
\ objdictgen/Makefile.in\
-\ examples/Makefile.in
+\ examples/Makefile.in\
+\ objdictgen/canfestival_config.py.in
# Drivers dependent Makefiles
if [ "$SUB_TIMERS_DRIVER" != "" ]; then
# Target dependent Makefiles
MAKEFILES=$MAKEFILES\ drivers/$SUB_TARGET/Makefile.in
-if [ "$SUB_TARGET" = "unix" ]; then
+if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "kernel" ]; then
+ MAKEFILES=$MAKEFILES\
+\ examples/kerneltest/Makefile.in
+
+elif [ "$SUB_TARGET" = "unix" ]; then
MAKEFILES=$MAKEFILES\
-\ examples/TestMasterSlave/Makefile.in
+\ examples/TestMasterSlave/Makefile.in\
+\ examples/TestMasterSlaveLSS/Makefile.in\
+\ examples/SillySlave/Makefile.in\
+\ examples/TestMasterMicroMod/Makefile.in
fi
-if [ "$SUB_TARGET" = "unix" ]; then
+if [ "$SUB_TARGET" = "win32" ]; then
MAKEFILES=$MAKEFILES\
+\ examples/TestMasterSlave/Makefile.in\
+\ examples/TestMasterSlaveLSS/Makefile.in\
+\ examples/SillySlave/Makefile.in\
\ examples/TestMasterMicroMod/Makefile.in
fi
+if [ "$SUB_WX" = "1" ]; then
+ MAKEFILES=$MAKEFILES\
+\ examples/DS401_Master/Makefile.in\
+\ examples/DS401_Slave_Gui/Makefile.in
+fi
+
if [ "$SUB_TARGET" = "hcs12" ]; then
MAKEFILES=$MAKEFILES\
\ examples/gene_SYNC_HCS12/Makefile.in
echo "Creating $makefile"
sed < $makefile_in "
s:SUB_CC:${CC}:
+ s:SUB_CXX:${CXX}:
+ s:SUB_LD:${LD}:
s:SUB_PROG_CFLAGS:${SUB_PROG_CFLAGS}:
s:SUB_EXE_CFLAGS:${SUB_EXE_CFLAGS}:
+ s:SUB_KERNELDIR:${SUB_KERNELDIR}:
s:SUB_PREFIX:${SUB_PREFIX}:
s:SUB_OS_NAME:${SUB_OS_NAME}:
s:SUB_ARCH_NAME:${SUB_ARCH_NAME}:
s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}:
s:SUB_CAN_DLL_CFLAGS:${SUB_CAN_DLL_CFLAGS}:
s:SUB_ENABLE_DLL_DRIVERS:${SUB_ENABLE_DLL_DRIVERS}:
+ s:SUB_ENABLE_LSS:${SUB_ENABLE_LSS}:
+ s:SUB_WX:${SUB_WX}:
" > $makefile
done