2 # This script is a wrapper around configtool to restrict some options within
3 # configtool to those that make sense for your hardware as described in the
6 # Copyright (C) 2004 Altera Corporation
8 # This configure script is free software; the Free Software Foundation
9 # gives unlimited permission to copy, distribute and modify it.
11 # Altera gives unlimited permission to copy, distribute and modify
18 # Print general help message
22 echo "usage : nios2configtool --ptf= --cpu="
23 echo "--ptf= : points to your PTF file"
24 echo "--cpu= : Is the name of the cpu within that PTF you wish to run eCos on"
29 # Did they request the help option
31 if [ "$1" = "--help" ]
36 # Are either of the first two parameters non zero
38 if [ -z "$1" ] || [ -z "$2" ]
40 echo "Too few paramaters"
44 # Is the 3rd parameter zero?
49 # Cut off all but the --cmd=
51 opt1=`echo "$1" | cut -c -6`
52 opt2=`echo "$2" | cut -c -6`
53 if [ "$opt1" = "--ptf=" ] || [ "$opt1" = "--cpu=" ]
55 if [ "$opt1" = "$opt2" ]
57 echo "Invalid Parameter usage"
60 # Check that the second options is valid
62 if [ "$opt2" = "--cpu=" ] || [ "$opt2" = "--ptf=" ]
65 # Cut the --ptf= off the appropriate parameter and check that this
68 if [ "$opt1" = "--ptf=" ]
70 ptf_name=`echo "$1" | cut -c 7-`
71 cpu_name=`echo "$2" | cut -c 7-`
73 ptf_name=`echo "$2" | cut -c 7-`
74 cpu_name=`echo "$1" | cut -c 7-`
77 ptf_name=`cygpath -a -u "$ptf_name"`
82 # If the file nios2_auto.cdl already exists we have another session running or crashed
84 if [ -f "$TMP/nios2_auto.cdl" ]
86 echo -e "\nnios2configtool is already running. "
87 echo "Close down the other nios2configtool before starting this instance. "
88 echo -e "If you are not running nios2configtool, please delete the file \n""$TMP/nios2_auto.cdl"
90 sopc_builder --update_classes_and_exit --no_splash -s --projectpath `cygpath -m $ptf_name`
91 `cygpath -m \`which gtf-generate\`` \
92 --gtf=`cygpath -m $NIOS_ECOS/hal/nios2/arch/current/gtf/nios2_auto.cdl.gtf` \
93 --output-directory=`cygpath -m $TMP` --ptf="$ptf_name" --cpu="$cpu_name"
96 rm -f $TMP/nios2_auto.cdl
100 echo "No such PTF file"
104 echo "Invalid Parameter usage"
109 echo "Invalid Parameter usage"
113 echo "Too many paramaters"