configure
changeset 24 a9543d2ccd56
parent 15 e930a0e817de
child 27 c16a00df5621
equal deleted inserted replaced
23:6a5cdca4de01 24:a9543d2ccd56
    45 #    Comment the #define if not used (infinite wait for SDO response message)
    45 #    Comment the #define if not used (infinite wait for SDO response message)
    46 SDO_TIMEOUT_MS=3000
    46 SDO_TIMEOUT_MS=3000
    47 
    47 
    48 MAX_NB_TIMER=32
    48 MAX_NB_TIMER=32
    49 
    49 
       
    50 # Generic timers declaration defaults
       
    51 US_TO_TIMEVAL_FACTOR=
       
    52 TIMEVAL=
       
    53 TIMEVAL_MAX=
       
    54 
    50 # Default to little-endian
    55 # Default to little-endian
    51 CANOPEN_LITTLE_ENDIAN=1
    56 CANOPEN_LITTLE_ENDIAN=1
    52 CANOPEN_BIG_ENDIAN=
    57 CANOPEN_BIG_ENDIAN=
    53 
    58 
    54 ###########################################################################
    59 ###########################################################################
    73 
    78 
    74 # Used for C compiler test/detection 
    79 # Used for C compiler test/detection 
    75 CFLAGS=
    80 CFLAGS=
    76 test=conftest
    81 test=conftest
    77 rm -f $test $test.c
    82 rm -f $test $test.c
    78 
       
    79 # Jaxe install is now disbaled by default
       
    80 DISABLE_JAXE=1
       
    81 
    83 
    82 XENO_CONFIG=/usr/xenomai/bin/xeno-config
    84 XENO_CONFIG=/usr/xenomai/bin/xeno-config
    83 
    85 
    84 ###########################################################################
    86 ###########################################################################
    85 #                          ARGUMENTS PARSING                              #
    87 #                          ARGUMENTS PARSING                              #
   121     		echo 	" --cc=foo	Use compiler 'foo' instead of defaults ${CC1} or ${CC2}."
   123     		echo 	" --cc=foo	Use compiler 'foo' instead of defaults ${CC1} or ${CC2}."
   122 		echo 	" --arch=foo	Use architecture 'foo' instead of trying to autodetect."
   124 		echo 	" --arch=foo	Use architecture 'foo' instead of trying to autodetect."
   123 		echo 	" --os=foo	Use operative system 'foo' instead of trying to autodetect."
   125 		echo 	" --os=foo	Use operative system 'foo' instead of trying to autodetect."
   124 		echo 	" --prefix=foo	Use prefix 'foo' instead of default ${SUB_PREFIX}."
   126 		echo 	" --prefix=foo	Use prefix 'foo' instead of default ${SUB_PREFIX}."
   125 		echo 	" --target=foo	Use 'foo' as build target."
   127 		echo 	" --target=foo	Use 'foo' as build target."
   126 		echo	"		Where 'foo' can be \"generic\" to have independant CAN and TIMERS driver"
   128 		echo	"		\"generic\" for have independant CAN and TIMERS driver"
   127 		echo	"		or"
   129 		echo	"		\"unix\" for unix-like systems"
       
   130 		echo	"		\"win32\" for win32 systems"
   128 		echo	"		\"hcs12\" for HCS12 micro-controller"
   131 		echo	"		\"hcs12\" for HCS12 micro-controller"
   129 		echo	"		\"ecos_lpc2138_sja1000\" for eCOS + Philips ARM LPC21381 + Philips SJA1000" 
   132 		echo	"		\"ecos_lpc2138_sja1000\" for eCOS + Philips ARM LPC21381 + Philips SJA1000" 
   130 		echo 	" --can=foo	Use 'foo' as CAN driver (can be either 'peak' or 'virtual')"
   133 		echo 	" --can=foo	Use 'foo' as CAN driver (can be either 'peak' or 'virtual')"
   131 		echo 	" --timers=foo	Use 'foo' as TIMERS driver (can be either 'unix' or 'xenomai')"
   134 		echo 	" --timers=foo	Use 'foo' as TIMERS driver (can be either 'unix' or 'xenomai')"
   132 		echo	" --led=foo	Use 'foo' as DS-305 LED driver (use 'none' to disable or 'stdout')"
   135 		echo	" --led=foo	Use 'foo' as DS-305 LED driver (use 'none' to disable or 'stdout')"
   159 		echo "Could not find java VM ! Jaxe XML editor disabled !"
   162 		echo "Could not find java VM ! Jaxe XML editor disabled !"
   160 	else
   163 	else
   161 		SUB_OPT_JAXE=jaxe
   164 		SUB_OPT_JAXE=jaxe
   162 	fi
   165 	fi
   163 fi
   166 fi
   164 ###########################################################################
       
   165 #                      DEFAULT TARGET/DRIVERS GUESSING                    #
       
   166 ###########################################################################
       
   167 # If target not specified, try to gess one
       
   168 if [ "$SUB_TARGET" = "" ]; then
       
   169 	SUB_TARGET=generic
       
   170 fi
       
   171 
       
   172 # If target generic, try to gess can
       
   173 if [ "$SUB_TARGET" = "generic" -a "$SUB_CAN_DRIVER" = "" ]; then
       
   174 	if [ -e /usr/lib/libpcan.so ]; then 
       
   175 		echo "Choosing installed Peak driver as CAN driver."
       
   176 		SUB_CAN_DRIVER=peak
       
   177 	else
       
   178 		echo "Choosing virtual CAN driver."
       
   179 		SUB_CAN_DRIVER=virtual
       
   180 		SUB_LED_ENABLE=YES
       
   181 	fi
       
   182 fi
       
   183 
       
   184 if [ "$SUB_TARGET" = "generic" -a "$SUB_LED_DRIVER" = "" ]; then
       
   185 	echo "Choosing stdout LED driver."
       
   186 	SUB_LED_DRIVER=stdout
       
   187 fi
       
   188 
       
   189 if [ "$SUB_TARGET" = "generic" -a "$SUB_NVRAM_DRIVER" = "" ]; then
       
   190 	echo "Choosing binary file NVRAM driver. -- not implemented --"
       
   191 #	SUB_NVRAM_DRIVER=file
       
   192 fi
       
   193 
       
   194 # If target generic, try to gess timers
       
   195 if [ "$SUB_TARGET" = "generic" -a "$SUB_TIMERS_DRIVER" = "" ]; then
       
   196 	echo "Choosing unix timers driver."
       
   197 	SUB_TIMERS_DRIVER=unix
       
   198 fi
       
   199 
       
   200 if [ "$SUB_CAN_DRIVER" = "peak" ]; then
       
   201 	if [ ! -e /usr/lib/libpcan.so ]; then 
       
   202 		echo "Peak driver hasn't been installed !"
       
   203 		exit -1
       
   204 	fi
       
   205 fi
       
   206 
   167 
   207 ###########################################################################
   168 ###########################################################################
   208 #                              GUESS OS/ARCH                              #
   169 #                              GUESS OS/ARCH                              #
   209 ###########################################################################
   170 ###########################################################################
   210 
   171 
   377 	# For shared library generation, it needs this
   338 	# For shared library generation, it needs this
   378 	SUB_PROG_CFLAGS=-fPIC
   339 	SUB_PROG_CFLAGS=-fPIC
   379 fi
   340 fi
   380 
   341 
   381 ###########################################################################
   342 ###########################################################################
       
   343 #                      DEFAULT TARGET/DRIVERS GUESSING                    #
       
   344 ###########################################################################
       
   345 # If target not specified, try to gess one
       
   346 if [ "$SUB_TARGET" = "" ]; then
       
   347 	if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
       
   348 		echo "Choosing win32 target"
       
   349 		SUB_TARGET=win32
       
   350 	else
       
   351 		echo "Choosing unix target"
       
   352 		SUB_TARGET=unix
       
   353 	fi
       
   354 fi
       
   355 
       
   356 # Try to gess can
       
   357 if [ "$SUB_CAN_DRIVER" = "" ]; then
       
   358 	if [ "$SUB_TARGET" = "unix" ]; then
       
   359 		if [ -e /usr/lib/libpcan.so ]; then 
       
   360 			echo "Choosing installed Peak driver as CAN driver."
       
   361 			SUB_CAN_DRIVER=peak
       
   362 		else
       
   363 			echo "Choosing virtual CAN driver."
       
   364 			SUB_CAN_DRIVER=virtual
       
   365 		fi
       
   366 	fi
       
   367 	if [ "$SUB_TARGET" = "win32" ]; then
       
   368 		echo "CAN driver for windows --Not Implemented--"
       
   369 	fi
       
   370 fi
       
   371 
       
   372 if [ "$SUB_TARGET" = "unix" -a "$SUB_LED_DRIVER" = "" ]; then
       
   373 	echo "Choosing stdout LED driver."
       
   374 	SUB_LED_DRIVER=stdout
       
   375 fi
       
   376 
       
   377 if [ "$SUB_TARGET" = "unix" -a "$SUB_NVRAM_DRIVER" = "" ]; then
       
   378 	echo "Choosing binary file NVRAM driver. -- not implemented --"
       
   379 #	SUB_NVRAM_DRIVER=file
       
   380 fi
       
   381 
       
   382 # If target is unix, default timers also
       
   383 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "" ]; then
       
   384 	echo "Choosing unix timers driver."
       
   385 	SUB_TIMERS_DRIVER=unix
       
   386 fi
       
   387 
       
   388 # Warn for unstalled peak driver if choosen
       
   389 if [ "$SUB_CAN_DRIVER" = "peak" ]; then
       
   390 	if [ ! -e /usr/lib/libpcan.so ]; then 
       
   391 		echo "Peak driver hasn't been installed !"
       
   392 		exit -1
       
   393 	fi
       
   394 fi
       
   395 
       
   396 ###########################################################################
   382 #              TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS                  #
   397 #              TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS                  #
   383 ###########################################################################
   398 ###########################################################################
       
   399 if [ "$SUB_TARGET" = "generic" ]; then
       
   400 	if [ "$US_TO_TIMEVAL_FACTOR" = "" ]; then
       
   401 		US_TO_TIMEVAL_FACTOR=1
       
   402 	fi
       
   403 	if [ "$TIMEVAL" = "" ]; then
       
   404 		TIMEVAL=UNS64
       
   405 	fi
       
   406 	if [ "$TIMEVAL_MAX" = "" ]; then
       
   407 		TIMEVAL_MAX=0xffffffffffffffff
       
   408 	fi
       
   409 fi
       
   410 
   384 if [ "$SUB_TARGET" = "hcs12" ]; then
   411 if [ "$SUB_TARGET" = "hcs12" ]; then
   385 	# Only if we want to compile for a µC HCS12
   412 	# Only if we want to compile for a µC HCS12
   386 	# search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ?
   413 	# search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ?
   387 	if [ "$CC" = "" ]; then
   414 	if [ "$CC" = "" ]; then
   388 		which m6811-elf-gcc >/dev/null 2>&1
   415 		which m6811-elf-gcc >/dev/null 2>&1
   397 		else
   424 		else
   398 			CC=m6811-elf-gcc
   425 			CC=m6811-elf-gcc
   399 			SUB_PROG_CFLAGS=-m68hc12
   426 			SUB_PROG_CFLAGS=-m68hc12
   400 		fi
   427 		fi
   401 	fi
   428 	fi
   402 	# hcs12 driver implement its own timers
       
   403 	SUB_TIMERS_ENABLE=YES
       
   404 fi	
   429 fi	
   405 
   430 
   406 if [ "$SUB_TARGET" = "ecos_lpc2138_sja1000" ]; then
   431 if [ "$SUB_TARGET" = "ecos_lpc2138_sja1000" ]; then
   407 	# search for gcc arm compiler arm-elf-gcc or arm-elf-gcc ?
   432 	# search for gcc arm compiler arm-elf-gcc or arm-elf-gcc ?
   408 	if [ "$CC" = "" ]; then
   433 	if [ "$CC" = "" ]; then
   417 	fi
   442 	fi
   418 	# ecos sja1000 driver implements calls needed by LSS.
   443 	# ecos sja1000 driver implements calls needed by LSS.
   419 	SUB_LSS_ENABLE=YES
   444 	SUB_LSS_ENABLE=YES
   420 	SUB_LED_ENABLE=YES
   445 	SUB_LED_ENABLE=YES
   421 	SUB_NVRAM_ENABLE=YES
   446 	SUB_NVRAM_ENABLE=YES
   422 	# ecos driver implement its own timers
       
   423 	SUB_TIMERS_ENABLE=NO
       
   424 fi
   447 fi
   425 
   448 
   426 
   449 
   427 #### CAN_DRIVER ####
   450 #### CAN_DRIVER ####
   428 
   451 
   429 if [ "$SUB_CAN_DRIVER" = "peak" ]; then
   452 if [ "$SUB_CAN_DRIVER" = "peak" ]; then
   430 	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lpcan
   453 	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lpcan
       
   454 fi
       
   455 
       
   456 if [ "$SUB_CAN_DRIVER" = "none" ]; then
       
   457 	SUB_CAN_DRIVER=
   431 fi
   458 fi
   432 
   459 
   433 #### TIMERS_DRIVER ####
   460 #### TIMERS_DRIVER ####
   434 
   461 
   435 if [ "$SUB_TIMERS_DRIVER" = "unix" ]; then
   462 if [ "$SUB_TIMERS_DRIVER" = "unix" ]; then
   438 
   465 
   439 if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
   466 if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
   440 	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lnative\
   467 	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lnative\
   441 \	-L`$XENO_CONFIG --library-dir`
   468 \	-L`$XENO_CONFIG --library-dir`
   442 	SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ `$XENO_CONFIG --xeno-cflags`
   469 	SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ `$XENO_CONFIG --xeno-cflags`
       
   470 fi
       
   471 
       
   472 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then
       
   473 	SUB_TIMERS_DRIVER=
   443 fi
   474 fi
   444 
   475 
   445 #### LED_DRIVER ####
   476 #### LED_DRIVER ####
   446 #enable led support if a led driver have been selected.
   477 #enable led support if a led driver have been selected.
   447 if [ "$SUB_LED_DRIVER" != "" ]; then
   478 if [ "$SUB_LED_DRIVER" != "" ]; then
   573  SDO_MAX_SIMULTANEOUS_TRANSFERTS\
   604  SDO_MAX_SIMULTANEOUS_TRANSFERTS\
   574  NMT_MAX_NODE_ID\
   605  NMT_MAX_NODE_ID\
   575  SDO_TIMEOUT_MS\
   606  SDO_TIMEOUT_MS\
   576  MAX_NB_TIMER\
   607  MAX_NB_TIMER\
   577  CANOPEN_BIG_ENDIAN\
   608  CANOPEN_BIG_ENDIAN\
   578  CANOPEN_LITTLE_ENDIAN ; do
   609  CANOPEN_LITTLE_ENDIAN\
       
   610  US_TO_TIMEVAL_FACTOR\
       
   611  TIMEVAL\
       
   612  TIMEVAL_MAX; do
   579 if [ "${!i}" = "" ]; then
   613 if [ "${!i}" = "" ]; then
   580 echo "// $i is not defined" >> include/config.h
   614 echo "// $i is not defined" >> include/config.h
   581 else
   615 else
   582 echo "#define $i ${!i}" >> include/config.h
   616 echo "#define $i ${!i}" >> include/config.h
   583 fi
   617 fi
   603 fi
   637 fi
   604 
   638 
   605 ###########################################################################
   639 ###########################################################################
   606 #                              CREATE MAKEFILES                           #
   640 #                              CREATE MAKEFILES                           #
   607 ###########################################################################
   641 ###########################################################################
       
   642 # General Makefiles
   608 MAKEFILES=Makefile.in\
   643 MAKEFILES=Makefile.in\
   609 \ src/Makefile.in\
   644 \ src/Makefile.in\
   610 \ drivers/Makefile.in\
   645 \ drivers/Makefile.in\
   611 \ objdictgen/Makefile.in\
   646 \ objdictgen/Makefile.in\
   612 \ examples/Makefile.in
   647 \ examples/Makefile.in
   613 
   648 
       
   649 # Drivers dependent Makefiles
       
   650 if [ "$SUB_TIMERS_DRIVER" != "" ]; then
       
   651 	MAKEFILES=$MAKEFILES\
       
   652 \	drivers/timers_$SUB_TIMERS_DRIVER/Makefile.in
       
   653 fi
       
   654 
       
   655 if [ "$SUB_CAN_DRIVER" != "" ]; then
       
   656 	MAKEFILES=$MAKEFILES\
       
   657 \	drivers/can_$SUB_CAN_DRIVER/Makefile.in
       
   658 fi
       
   659 
       
   660 if [ "$SUB_LED_DRIVER" != "" ]; then
       
   661 	MAKEFILES=$MAKEFILES\
       
   662 \	drivers/led_$SUB_LED_DRIVER/Makefile.in
       
   663 fi
       
   664 
       
   665 if [ "$SUB_NVRAM_DRIVER" != "" ]; then
       
   666 	MAKEFILES=$MAKEFILES\
       
   667 \	drivers/nvram_$SUB_NVRAM_DRIVER/Makefile.in
       
   668 fi
       
   669 
       
   670 # Target dependent Makefiles
       
   671 MAKEFILES=$MAKEFILES\ drivers/$SUB_TARGET/Makefile.in
       
   672 
       
   673 if [ "$SUB_TARGET" = "unix" ]; then
       
   674 	MAKEFILES=$MAKEFILES\
       
   675 \	examples/AppliMaster_Linux/Makefile.in\
       
   676 \	examples/AppliSlave_Linux/Makefile.in\
       
   677 \	examples/TestMasterSlave/Makefile.in
       
   678 fi
       
   679 
   614 if [ "$SUB_TARGET" = "hcs12" ]; then
   680 if [ "$SUB_TARGET" = "hcs12" ]; then
   615 	MAKEFILES=$MAKEFILES\
   681 	MAKEFILES=$MAKEFILES\
   616 \	drivers/hcs12/Makefile.in\
       
   617 \	examples/AppliMaster_HCS12/Makefile.in\
   682 \	examples/AppliMaster_HCS12/Makefile.in\
   618 \	examples/AppliSlave_HCS12/Makefile.in\
   683 \	examples/AppliSlave_HCS12/Makefile.in\
   619 \	examples/gene_SYNC_HCS12/Makefile.in
   684 \	examples/gene_SYNC_HCS12/Makefile.in
   620 fi
   685 fi
   621 
   686 
   622 if [ "$SUB_TIMERS_DRIVER" != "" ]; then
       
   623 	MAKEFILES=$MAKEFILES\
       
   624 \	drivers/timers_$SUB_TIMERS_DRIVER/Makefile.in
       
   625 fi
       
   626 
       
   627 if [ "$SUB_CAN_DRIVER" != "" ]; then
       
   628 	MAKEFILES=$MAKEFILES\
       
   629 \	drivers/can_$SUB_CAN_DRIVER/Makefile.in
       
   630 fi
       
   631 
       
   632 if [ "$SUB_LED_DRIVER" != "" ]; then
       
   633 	MAKEFILES=$MAKEFILES\
       
   634 \	drivers/led_$SUB_LED_DRIVER/Makefile.in
       
   635 fi
       
   636 
       
   637 if [ "$SUB_NVRAM_DRIVER" != "" ]; then
       
   638 	MAKEFILES=$MAKEFILES\
       
   639 \	drivers/nvram_$SUB_NVRAM_DRIVER/Makefile.in
       
   640 fi
       
   641 
       
   642 if [ "$SUB_TARGET" = "generic" ]; then
       
   643 	MAKEFILES=$MAKEFILES\
       
   644 \	drivers/generic/Makefile.in\
       
   645 \	examples/AppliMaster_Linux/Makefile.in\
       
   646 \	examples/AppliSlave_Linux/Makefile.in\
       
   647 \	examples/TestMasterSlave/Makefile.in
       
   648 fi
       
   649 
       
   650 if [ "$SUB_TARGET" = "ecos_lpc2138_sja1000" ]; then
   687 if [ "$SUB_TARGET" = "ecos_lpc2138_sja1000" ]; then
   651 	MAKEFILES=$MAKEFILES\
   688 	MAKEFILES=$MAKEFILES\
   652 \	drivers/ecos_lpc2138_sja1000/Makefile.in\
       
   653 \	examples/ecos_lpc2138_sja1000/src/Makefile.in
   689 \	examples/ecos_lpc2138_sja1000/src/Makefile.in
   654 fi
   690 fi
   655 
   691 
   656 for makefile_in in $MAKEFILES; do
   692 for makefile_in in $MAKEFILES; do
   657 	makefile=`echo $makefile_in | sed 's:.in$::'`
   693 	makefile=`echo $makefile_in | sed 's:.in$::'`