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 rm -f $TMP/nios2_auto.cdl
86 sopc_builder --update_classes_and_exit --no_splash -s --projectpath `cygpath -m $ptf_name`
87 `cygpath -m \`which gtf-generate\`` \
88 --gtf=`cygpath -m $NIOS_ECOS/hal/nios2/arch/current/gtf/nios2_auto.cdl.gtf` \
89 --output-directory=`cygpath -m $TMP` --ptf="$ptf_name" --cpu="$cpu_name"
92 echo "No such PTF file"
96 echo "Invalid Parameter usage"
101 echo "Invalid Parameter usage"
105 echo "Too many paramaters"