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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [or32/] [tools/] [stob] - Blame information for rev 1777

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

Line No. Rev Author Line
1 1624 jcastillo
#!/usr/bin/perl
2
 
3
sub S0 {
4
        for ($i=0; $i<$length - 1; $i++) {
5
            $ch = hex (substr($data, $i*2, 2));
6
            printf STDERR "%c", $ch;
7
        }
8
        printf STDERR "\n";
9
}
10
 
11
sub S1 {
12
        printf "0000%s%02X%s\n",
13
                substr($data, 0, 4), $length - 3, substr($data, 4);
14
}
15
 
16
sub S2 {
17
        printf "00%s%02X%s\n",
18
                substr($data, 0, 6), $length - 4, substr($data, 6);
19
}
20
 
21
sub S3 {
22
        printf "%s%02X%s\n",
23
                substr($data, 0, 8), $length - 5, substr($data, 8);
24
}
25
 
26
sub S5 {
27
}
28
 
29
sub S7 {
30
        if ($start_slag) {
31
                printf "%s00\n", substr($data, 0, 8);
32
        }
33
}
34
 
35
sub S8 {
36
        if ($start_slag) {
37
                printf "00%s00\n", substr($data, 0, 6);
38
        }
39
}
40
 
41
sub S9 {
42
        if ($start_slag) {
43
                printf "0000%s00\n", substr($data, 0, 4);
44
        }
45
}
46
 
47
#
48
# MAIN
49
#
50
while(<>) {
51
        if ( /^S([0-357-9])([0-9A-F]{2})/ ) {
52
           $record_type = $1;
53
           $length = hex($2);
54
           $data = substr($_, 4, ($length-1) * 2);
55
           $checksum = hex(substr($_, ($length - 1) * 2 + 4, 2));
56
           $sub = "S$record_type";
57
           &$sub;
58
        }
59
}

powered by: WebSVN 2.1.0

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