2 # BCU SDK bcu development enviroment
3 # Copyright (C) 2005-2007 Martin Koegler <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@
/bcugen3
21 EMBED
=@BINDIR@
/embedprogid
32 progname
="`basename \"$0\"`"
37 $progname $version Copyright 2005-2007 Martin Koegler <mkoegler@auto.tuwien.ac.at>
38 creates a bcu image using the configuration in the config file
40 Usage: $progname [options] config_file
42 -Ixxx adds xxx to the include path
43 -ixxx stores image as xxx (default:config_file.load)
44 -Dxxx uses xxx as temorary directory and keep temporary files there
45 (warning: all content can be lost)
53 if [ $keep != 1 ]; then
67 value
="`echo x\"$1\" | sed -e 's/^x-.//'`"
69 -D*) keep
=1; TMP
="$value" ;;
73 -*) echo "$progname: unknown option $1"
81 echo "$progname: expect config.file"
87 if [ ! -f "$IN" ]; then
88 echo "$progname: $IN not found"
92 if [ "x$OUT" == "x" ]; then
96 if [ "x$TMP" == "x" ]; then
97 TMP
=`mktemp -u bcusdk.XXXXXXXXXX`||
exit 1
99 elif [ ! -e "$TMP" ]; then
103 if [ ! -d $TMP ]; then
104 echo "can not create directory $TMP"
110 if [ $keep != 1 ]; then
111 trap "rm -r $TMP; exit 1" 1 2 3 5 10 13 15
114 $BCUGEN "$IN" "$TMP/c.h" "$TMP/c.i" "$TMP/p1.s" "$TMP/p.var" || error
116 VAR
=`cat "$TMP/p.var"`
118 if [ ! -f "$LIB/lib$VAR.a" ]; then
119 echo "unknown variant $VAR"
123 $TGCC -E $INC -I.
-o "$TMP/c.inc" -x c
"$TMP/c.i" || error
125 echo "#include \"c.h\"">"$TMP/c.c"
126 echo "#include \"c.inc\"">>"$TMP/c.c"
128 $TGCC -c -O3 -Os -Wall -Winline -gstabs -I$SINC -o "$TMP/c.o" "$TMP/c.c" || error
129 $TAS -I$SINC -o "$TMP/p1.o" "$TMP/p1.s" || error
131 $TLD -Map "$TMP/elf.map" -N -T "$LD/$VAR.link" --move-sections --relax -o "$TMP/elf" "$TMP/c.o" "$TMP/p1.o" -\
( -lc -lm `$TGCC -print-libgcc-file-name` "$LIB/lib$VAR.a" -\
) || error
132 $TLD -Map "$TMP/load.map" -T $LD/genload.link
-o "$TMP/load" "$TMP/elf" || error
135 cp "$TMP/load" "$OUT" || error
137 if [ $keep != 1 ]; then