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 5

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 5 ZTEX
    sdcc -mmcs51 --code-loc 0x0200 --code-size 0x3800 --xram-loc 0x3A00 --xram-size 0x600 --iram-size 256 $PEEPH $3 $base.tmp.c -o $base.ihx
47 2 ZTEX
    ec="$?"
48
    if [ "$ec" != 0 ]; then
49
        exit $ec
50
    fi
51
 
52
    addr=`grep ".*:.* _DeviceDescriptor" $base.map | (
53 5 ZTEX
        read a b c
54
        if [ "$c" = "_DeviceDescriptor" ]; then
55
            echo 0x${b#*:}
56
        else
57
            echo 0x${a#*:}
58
        fi
59 2 ZTEX
    )`
60
    echo "Addr=$addr"
61
    if [ $((addr & 1)) = "0" ]; then
62
        exit 0
63
    else
64
        if [ "$bytePad" != "" ]; then
65
            echo "USB Descriptors not word aligned, -DPAD_BYTE has no effect"
66
            exit 3
67
        else
68
            bytePad="-D PAD_BYTE"
69
        fi
70
    fi
71
done

powered by: WebSVN 2.1.0

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