2 # BCU SDK bcu development enviroment
3 # Copyright (C) 2005-2007 Martin Kögler <mkoegler@auto.tuwien.ac.at>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 BCUGEN
=@BINDIR@
/bcugen1
21 EMBED
=@BINDIR@
/embedprogid
32 progname
="`basename \"$0\"`"
37 $progname $version Copyright 2005-2007 Martin Kögler <mkoegler@auto.tuwien.ac.at>
38 creates an application information for a BCU programm
40 Usage: $progname [options] config_file
42 -Ixxx adds xxx to the include path
43 -Dxxx uses xxx as temorary directory and keep temporary files there
44 (warning: all content can be lost)
45 -ixxx stores temporay images as xxx
46 -axxx stores application description as xxx (default:config_file.ai)
47 -cxxx stores ProgramID as xxx
55 if [ $keep != 1 ]; then
70 value
="`echo x\"$1\" | sed -e 's/^x-.//'`"
72 -D*) keep
=1; TMP
="$value" ;;
78 -*) echo "$progname: unknown option $1"
86 echo "$progname: expect config.file"
92 if [ ! -f "$IN" ]; then
93 echo "$progname: $IN not found"
97 if [ "x$OUT" == "x" ]; then
101 if [ "x$TMP" == "x" ]; then
102 TMP
=`mktemp -u bcusdk.XXXXXXXXXX`||
exit 1
104 elif [ ! -e "$TMP" ]; then
108 if [ ! -d $TMP ]; then
109 echo "can not create directory $TMP"
115 if [ $keep != 1 ]; then
116 trap "rm -r $TMP; exit 1" 1 2 3 5 10 13 15
119 $BCUGEN "$IN" "$TMP/config" "$TMP/ai" "$TMP/c.h" "$TMP/c.i" "$TMP/p.c" "$TMP/p1.s" "$TMP/p.var" || error
121 VAR
=`cat "$TMP/p.var"`
123 if [ ! -f "$LIB/lib$VAR.a" ]; then
124 echo "unknown variant $VAR"
128 $TGCC -E $INC -I.
-o "$TMP/c.inc" -x c
"$TMP/c.i" || error
130 echo "#include \"c.h\"">"$TMP/c.c"
131 echo "#include \"c.inc\"">>"$TMP/c.c"
133 $TGCC -c -O3 -Os -g -o "$TMP/p.o" "$TMP/p.c"|| error
134 $TGCC -c -O3 -Os -Wall -Winline -gstabs -I$SINC -o "$TMP/c.o" "$TMP/c.c" || error
135 $TAS -I$SINC -o "$TMP/p1.o" "$TMP/p1.s" || error
137 pushd "$TMP" >/dev
/null || error
139 echo "0.0.0" >bcusdk-version
140 $TAR cr conf config c.inc bcusdk-version || error
141 $EMBED ai conf ai.xml || error
142 popd >/dev
/null || error
144 cp "$TMP/ai.xml" "$OUT" || error
146 $TLD -Map "$TMP/elf.map" -N -T "$LD/$VAR.link" --move-sections --relax -o "$TMP/elf" "$TMP/c.o" "$TMP/p.o" "$TMP/p1.o" -\
( -lc -lm `$TGCC -print-libgcc-file-name` "$LIB/lib$VAR.a" -\
) || error
147 $TLD -Map "$TMP/load.map" -T $LD/genload.link
-o "$TMP/load" "$TMP/elf" || error
149 if [ "x$IMG" != "x" ]; then
150 cp "$TMP/load" "$IMG" || error
153 if [ "x$CFG" != "x" ]; then
154 cp "$TMP/conf" "$CFG" || error
157 if [ $keep != 1 ]; then