URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [armnommu/] [lib/] [extractinfo.perl] - Rev 1781
Go to most recent revision | Compare with Previous | Blame | View Log
#!/usr/bin/perl
$OBJDUMP=$ARGV[0];
sub swapdata {
local ($num) = @_;
return substr($num, 6, 2).substr($num, 4, 2).substr ($num, 2, 2).substr ($num, 0, 2);
}
open (DATA, $OBJDUMP.' --full-contents --section=.data getconsdata.o | grep \'^ 00\' |') ||
die ('Cant objdump!');
#print "phase 1\n";
while (<DATA>) {
($addr, $data0, $data1, $data2, $data3) = split (' ');
# print "$addr, $data0, $data1, $data2, $data3\n";
$dat[hex($addr)] = hex(&swapdata($data0));
$dat[hex($addr)+4] = hex(&swapdata($data1));
$dat[hex($addr)+8] = hex(&swapdata($data2));
$dat[hex($addr)+12] = hex(&swapdata($data3));
}
close (DATA);
# print "phase 2\n";
open (DATA, $OBJDUMP.' --syms getconsdata.o | grep \' O .data\' |') ||
die ('Cant objdump!');
while (<DATA>) {
($addr, $flag1, $flag2, $sect, $size, $name) = split (' ');
# print "$addr, $flag1, $flag2, $sect, $size, $name\n";
$nam[hex($addr)] = $name;
}
close (DATA);
# print "phase 3\n";
print "/*\n * *** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! ***\n */\n";
for ($i = 0; $i < hex($addr)+12; $i ++) {
print "unsigned long $nam[$i] = $dat[$i];\n" if $dat[$i];
print "#define __HAS_$nam[$i]\n" if $dat[$i];
}
Go to most recent revision | Compare with Previous | Blame | View Log