94 --arch=*) SUB_ARCH_NAME=$optarg;; |
94 --arch=*) SUB_ARCH_NAME=$optarg;; |
95 --os=*) SUB_OS_NAME=$optarg;; |
95 --os=*) SUB_OS_NAME=$optarg;; |
96 --prefix=*) SUB_PREFIX=$optarg;; |
96 --prefix=*) SUB_PREFIX=$optarg;; |
97 --target=*) SUB_TARGET=$optarg;; |
97 --target=*) SUB_TARGET=$optarg;; |
98 --can=*) SUB_CAN_DRIVER=$optarg;; |
98 --can=*) SUB_CAN_DRIVER=$optarg;; |
99 --led=*) SUB_LED_DRIVER=$optarg;; |
|
100 --nvram=*) SUB_NVRAM_DRIVER=$optarg;; |
|
101 --timers=*) SUB_TIMERS_DRIVER=$optarg;; |
99 --timers=*) SUB_TIMERS_DRIVER=$optarg;; |
102 --disable-Ox) DISABLE_OPT=1; |
100 --disable-Ox) DISABLE_OPT=1; |
103 echo "On user request: Won't optimize with \"-Ox\"";; |
101 echo "On user request: Won't optimize with \"-Ox\"";; |
104 --debug) DEBUG=1; |
102 --debug) DEBUG=1; |
105 echo "Debug messages enabled !!";; |
103 echo "Debug messages enabled !!";; |
106 --debugPDO) DEBUG=PDO; |
104 --debugPDO) DEBUG=PDO; |
107 echo "Debug messages (PDO) enabled !!";; |
105 echo "Debug messages (PDO) enabled !!";; |
108 --enable-lss) SUB_LSS_ENABLE=YES; |
|
109 echo "On user request: Will enable Auto Baudrate detect Feature";; |
|
110 --desable-timers) SUB_TIMERS_ENABLE=NO; |
106 --desable-timers) SUB_TIMERS_ENABLE=NO; |
111 echo "On user request: Will enable built-in timer dispatch Feature";; |
107 echo "On user request: Will enable built-in timer dispatch Feature";; |
112 --MAX_CAN_BUS_ID=*) MAX_CAN_BUS_ID=$1;; |
108 --MAX_CAN_BUS_ID=*) MAX_CAN_BUS_ID=$1;; |
113 --SDO_MAX_LENGTH_TRANSFERT=*) SDO_MAX_LENGTH_TRANSFERT=$1;; |
109 --SDO_MAX_LENGTH_TRANSFERT=*) SDO_MAX_LENGTH_TRANSFERT=$1;; |
114 --SDO_MAX_SIMULTANEOUS_TRANSFERTS=*) SDO_MAX_SIMULTANEOUS_TRANSFERTS=$1;; |
110 --SDO_MAX_SIMULTANEOUS_TRANSFERTS=*) SDO_MAX_SIMULTANEOUS_TRANSFERTS=$1;; |
125 echo " --target=foo Use 'foo' as build target." |
121 echo " --target=foo Use 'foo' as build target." |
126 echo " \"generic\" for have independant CAN and TIMERS driver" |
122 echo " \"generic\" for have independant CAN and TIMERS driver" |
127 echo " \"unix\" for unix-like systems" |
123 echo " \"unix\" for unix-like systems" |
128 echo " \"win32\" for win32 systems" |
124 echo " \"win32\" for win32 systems" |
129 echo " \"hcs12\" for HCS12 micro-controller" |
125 echo " \"hcs12\" for HCS12 micro-controller" |
130 echo " \"ecos_lpc2138_sja1000\" for eCOS + Philips ARM LPC21381 + Philips SJA1000" |
|
131 echo " --can=foo Use 'foo' as CAN driver (can be either 'peak', 'lincan' or 'virtual')" |
126 echo " --can=foo Use 'foo' as CAN driver (can be either 'peak', 'lincan' or 'virtual')" |
132 echo " --timers=foo Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')" |
127 echo " --timers=foo Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')" |
133 echo " --led=foo Use 'foo' as DS-305 LED driver (use 'none' to disable or 'stdout')" |
|
134 echo " --nvram=foo Use 'foo' as NVRAM driver (use 'none' to disable or 'file')" |
|
135 echo " --disable-Ox Disable gcc \"-Ox\" optimizations." |
128 echo " --disable-Ox Disable gcc \"-Ox\" optimizations." |
136 echo " --debug Enable debug messages." |
129 echo " --debug Enable debug messages." |
137 echo " --debugPDO Enable debug messages, using PDO." |
130 echo " --debugPDO Enable debug messages, using PDO." |
138 echo " --enable-lss Enable Auto Baudrate detect Feature" |
|
139 echo |
131 echo |
140 echo "Stack compilation constants" |
132 echo "Stack compilation constants" |
141 echo " --MAX_CAN_BUS_ID [=1] Number of can bus to use" |
133 echo " --MAX_CAN_BUS_ID [=1] Number of can bus to use" |
142 echo " --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO" |
134 echo " --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO" |
143 echo " --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently" |
135 echo " --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently" |
350 fi |
342 fi |
351 fi |
343 fi |
352 if [ "$SUB_TARGET" = "win32" ]; then |
344 if [ "$SUB_TARGET" = "win32" ]; then |
353 echo "CAN driver for windows --Not Implemented--" |
345 echo "CAN driver for windows --Not Implemented--" |
354 fi |
346 fi |
355 fi |
|
356 |
|
357 if [ "$SUB_TARGET" = "unix" -a "$SUB_LED_DRIVER" = "" ]; then |
|
358 echo "Choosing stdout LED driver." |
|
359 SUB_LED_DRIVER=stdout |
|
360 fi |
|
361 |
|
362 if [ "$SUB_TARGET" = "unix" -a "$SUB_NVRAM_DRIVER" = "" ]; then |
|
363 echo "Choosing binary file NVRAM driver. -- not implemented --" |
|
364 # SUB_NVRAM_DRIVER=file |
|
365 fi |
347 fi |
366 |
348 |
367 # If target is unix, default timers also |
349 # If target is unix, default timers also |
368 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "" ]; then |
350 if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "" ]; then |
369 echo "Choosing unix timers driver." |
351 echo "Choosing unix timers driver." |
413 SUB_PROG_CFLAGS=-m68hc12 |
395 SUB_PROG_CFLAGS=-m68hc12 |
414 fi |
396 fi |
415 fi |
397 fi |
416 fi |
398 fi |
417 |
399 |
418 if [ "$SUB_TARGET" = "ecos_lpc2138_sja1000" ]; then |
|
419 # search for gcc arm compiler arm-elf-gcc or arm-elf-gcc ? |
|
420 if [ "$CC" = "" ]; then |
|
421 which arm-elf-gcc >/dev/null 2>&1 |
|
422 if (( $? )); then |
|
423 echo "error : Could not find arm-elf-gcc" |
|
424 else |
|
425 CC=arm-elf-gcc |
|
426 SUB_PROG_CFLAGS="-mcpu=arm7tdmi -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Os \ |
|
427 -ffunction-sections -fdata-sections -fno-exceptions -finline-functions" |
|
428 fi |
|
429 fi |
|
430 # ecos sja1000 driver implements calls needed by LSS. |
|
431 SUB_LSS_ENABLE=YES |
|
432 SUB_LED_ENABLE=YES |
|
433 SUB_NVRAM_ENABLE=YES |
|
434 fi |
|
435 |
|
436 |
|
437 #### CAN_DRIVER #### |
400 #### CAN_DRIVER #### |
438 |
401 |
439 if [ "$SUB_CAN_DRIVER" = "peak" ]; then |
402 if [ "$SUB_CAN_DRIVER" = "peak" ]; then |
440 if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then |
403 if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then |
441 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lrtdm |
404 SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lrtdm |
487 RTCAN_SOCKET=1 |
450 RTCAN_SOCKET=1 |
488 fi |
451 fi |
489 |
452 |
490 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then |
453 if [ "$SUB_TIMERS_DRIVER" = "none" ]; then |
491 SUB_TIMERS_DRIVER= |
454 SUB_TIMERS_DRIVER= |
492 fi |
|
493 |
|
494 #### LED_DRIVER #### |
|
495 #enable led support if a led driver have been selected. |
|
496 if [ "$SUB_LED_DRIVER" != "" ]; then |
|
497 SUB_LED_ENABLE=YES |
|
498 fi |
|
499 #if "none" driver is selected led feature is enabled but driver not compiled |
|
500 if [ "$SUB_LED_DRIVER" = "none" ]; then |
|
501 SUB_LED_DRIVER= |
|
502 fi |
|
503 #if "disable" driver is selected led feature is disabled |
|
504 if [ "$SUB_LED_DRIVER" = "disable" ]; then |
|
505 SUB_LED_ENABLE= |
|
506 SUB_LED_DRIVER= |
|
507 fi |
|
508 |
|
509 #### NVRAM_DRIVER #### |
|
510 #enable nvram support if a nvram driver have been selected. |
|
511 if [ "$SUB_NVRAM_DRIVER" != "" ]; then |
|
512 SUB_NVRAM_ENABLE=YES |
|
513 fi |
|
514 #if "none" driver is selected nvram feature is enabled but driver not compiled |
|
515 if [ "$SUB_NVRAM_DRIVER" = "none" ]; then |
|
516 SUB_NVRAM_DRIVER= |
|
517 fi |
|
518 #if "disable" driver is selected nvram feature is disabled |
|
519 if [ "$SUB_NVRAM_DRIVER" = "disable" ]; then |
|
520 SUB_NVRAM_ENABLE= |
|
521 SUB_NVRAM_DRIVER= |
|
522 fi |
455 fi |
523 |
456 |
524 ########################################################################### |
457 ########################################################################### |
525 # GUESS COMPILER # |
458 # GUESS COMPILER # |
526 ########################################################################### |
459 ########################################################################### |
689 if [ "$SUB_CAN_DRIVER" != "" ]; then |
622 if [ "$SUB_CAN_DRIVER" != "" ]; then |
690 MAKEFILES=$MAKEFILES\ |
623 MAKEFILES=$MAKEFILES\ |
691 \ drivers/can_$SUB_CAN_DRIVER/Makefile.in |
624 \ drivers/can_$SUB_CAN_DRIVER/Makefile.in |
692 fi |
625 fi |
693 |
626 |
694 if [ "$SUB_LED_DRIVER" != "" ]; then |
|
695 MAKEFILES=$MAKEFILES\ |
|
696 \ drivers/led_$SUB_LED_DRIVER/Makefile.in |
|
697 fi |
|
698 |
|
699 if [ "$SUB_NVRAM_DRIVER" != "" ]; then |
|
700 MAKEFILES=$MAKEFILES\ |
|
701 \ drivers/nvram_$SUB_NVRAM_DRIVER/Makefile.in |
|
702 fi |
|
703 |
|
704 # Target dependent Makefiles |
627 # Target dependent Makefiles |
705 MAKEFILES=$MAKEFILES\ drivers/$SUB_TARGET/Makefile.in |
628 MAKEFILES=$MAKEFILES\ drivers/$SUB_TARGET/Makefile.in |
706 |
629 |
707 if [ "$SUB_TARGET" = "unix" ]; then |
630 if [ "$SUB_TARGET" = "unix" ]; then |
708 MAKEFILES=$MAKEFILES\ |
631 MAKEFILES=$MAKEFILES\ |
709 \ examples/AppliMaster_Linux/Makefile.in\ |
|
710 \ examples/AppliSlave_Linux/Makefile.in\ |
|
711 \ examples/TestMasterSlave/Makefile.in |
632 \ examples/TestMasterSlave/Makefile.in |
712 fi |
633 fi |
713 |
634 |
714 if [ "$SUB_TARGET" = "hcs12" ]; then |
635 if [ "$SUB_TARGET" = "hcs12" ]; then |
715 MAKEFILES=$MAKEFILES\ |
636 MAKEFILES=$MAKEFILES\ |
716 \ examples/AppliMaster_HCS12/Makefile.in\ |
|
717 \ examples/AppliSlave_HCS12/Makefile.in\ |
|
718 \ examples/gene_SYNC_HCS12/Makefile.in |
637 \ examples/gene_SYNC_HCS12/Makefile.in |
719 fi |
|
720 |
|
721 if [ "$SUB_TARGET" = "ecos_lpc2138_sja1000" ]; then |
|
722 MAKEFILES=$MAKEFILES\ |
|
723 \ examples/ecos_lpc2138_sja1000/src/Makefile.in |
|
724 fi |
638 fi |
725 |
639 |
726 for makefile_in in $MAKEFILES; do |
640 for makefile_in in $MAKEFILES; do |
727 makefile=`echo $makefile_in | sed 's:.in$::'` |
641 makefile=`echo $makefile_in | sed 's:.in$::'` |
728 echo "Creating $makefile" |
642 echo "Creating $makefile" |
734 s:SUB_OS_NAME:${SUB_OS_NAME}: |
648 s:SUB_OS_NAME:${SUB_OS_NAME}: |
735 s:SUB_ARCH_NAME:${SUB_ARCH_NAME}: |
649 s:SUB_ARCH_NAME:${SUB_ARCH_NAME}: |
736 s:SUB_OPT_CFLAGS:${SUB_OPT_CFLAGS}: |
650 s:SUB_OPT_CFLAGS:${SUB_OPT_CFLAGS}: |
737 s:SUB_TARGET:${SUB_TARGET}: |
651 s:SUB_TARGET:${SUB_TARGET}: |
738 s:SUB_BINUTILS_PREFIX:${SUB_BINUTILS_PREFIX}: |
652 s:SUB_BINUTILS_PREFIX:${SUB_BINUTILS_PREFIX}: |
739 s:SUB_LSS_ENABLE:${SUB_LSS_ENABLE}: |
|
740 s:SUB_LED_ENABLE:${SUB_LED_ENABLE}: |
|
741 s:SUB_NVRAM_ENABLE:${SUB_NVRAM_ENABLE}: |
|
742 s:SUB_TIMERS_ENABLE:${SUB_TIMERS_ENABLE}: |
653 s:SUB_TIMERS_ENABLE:${SUB_TIMERS_ENABLE}: |
743 s:SUB_TIMERS_DRIVER:timers_${SUB_TIMERS_DRIVER}: |
654 s:SUB_TIMERS_DRIVER:timers_${SUB_TIMERS_DRIVER}: |
744 s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}: |
655 s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}: |
745 s:SUB_LED_DRIVER:led_${SUB_LED_DRIVER}: |
|
746 s:SUB_NVRAM_DRIVER:nvram_${SUB_NVRAM_DRIVER}: |
|
747 " > $makefile |
656 " > $makefile |
748 done |
657 done |
749 |
658 |
750 echo "All done." |
659 echo "All done." |