OpenCores
URL https://opencores.org/ocsvn/usb_fpga_1_11/usb_fpga_1_11/trunk

Subversion Repositories usb_fpga_1_11

[/] [usb_fpga_1_11/] [trunk/] [bin/] [bmpsdcc.sh] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
if [ "$1" = ""  ]; then
2
    echo "Usage: $0 <C file> <bmp flags> <sdcc flags>"
3
    exit 1
4
fi
5
 
6
exe=""
7
if [ "$WINDIR" != "" ]; then
8
    exe=".exe"
9
fi
10
 
11
BINDIR=`dirname $0`
12
BMP=bmp
13
if [ -x "$BINDIR/bmp$exe" ]; then
14
    BMP="$BINDIR/bmp$exe"
15
fi
16
 
17
if [ -f "$BINDIR/peeph.def" ]; then
18
    PEEPH="--peep-file $BINDIR/peeph.def"
19
fi
20
 
21
 
22
inp="$1"
23
if [ ! -f "$inp" -a -f "$inp.c" ]; then
24
    inp="$1.c"
25
fi
26
base=${inp%*.c}
27
 
28
if [ ! -f "$inp" ]; then
29
    echo "File not found: $inp"
30
    exit 2
31
fi
32
 
33
bytePad=""
34
while true; do
35
    if [ "$LINEINFO" = "no" ]; then
36
        li='//line %2 "%1"'
37
    else
38
        li='#line %2 "%1"'
39
    fi
40
    $BMP -c -l "$li" $2 $bytePad $inp -o $base.tmp.c
41
    ec="$?"
42
    if [ "$ec" != 0 ]; then
43
        exit $ec
44
    fi
45
 
46
    sdcc -mmcs51 --code-loc 0x0200 --code-size 0x2e00 --xram-loc 0x3200 --xram-size 0x1000 --iram-size 256 $PEEPH $3 $base.tmp.c -o $base.ihx
47
    ec="$?"
48
    if [ "$ec" != 0 ]; then
49
        exit $ec
50
    fi
51
 
52
    addr=`grep ".*:.* _DeviceDescriptor" $base.map | (
53
        read a b
54
        echo 0x${a#*:}
55
    )`
56
    echo "Addr=$addr"
57
    if [ $((addr & 1)) = "0" ]; then
58
        exit 0
59
    else
60
        if [ "$bytePad" != "" ]; then
61
            echo "USB Descriptors not word aligned, -DPAD_BYTE has no effect"
62
            exit 3
63
        else
64
            bytePad="-D PAD_BYTE"
65
        fi
66
    fi
67
done

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.