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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [or32/] [tools/] [stob] - Rev 1781

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

#!/usr/bin/perl

sub S0 {
        for ($i=0; $i<$length - 1; $i++) {
            $ch = hex (substr($data, $i*2, 2));
            printf STDERR "%c", $ch;
        }
        printf STDERR "\n";
}

sub S1 {
        printf "0000%s%02X%s\n", 
                substr($data, 0, 4), $length - 3, substr($data, 4);
}

sub S2 {
        printf "00%s%02X%s\n",
                substr($data, 0, 6), $length - 4, substr($data, 6);
}

sub S3 {
        printf "%s%02X%s\n",
                substr($data, 0, 8), $length - 5, substr($data, 8);
}

sub S5 {
}

sub S7 {
        if ($start_slag) {
                printf "%s00\n", substr($data, 0, 8);
        }
}

sub S8 {
        if ($start_slag) {
                printf "00%s00\n", substr($data, 0, 6);
        }
} 

sub S9 {
        if ($start_slag) {
                printf "0000%s00\n", substr($data, 0, 4);
        }
}

#
# MAIN
#
while(<>) {
        if ( /^S([0-357-9])([0-9A-F]{2})/ ) {
           $record_type = $1;
           $length = hex($2);
           $data = substr($_, 4, ($length-1) * 2);
           $checksum = hex(substr($_, ($length - 1) * 2 + 4, 2));
           $sub = "S$record_type";
           &$sub;
        }
}

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

powered by: WebSVN 2.1.0

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