[Tinyos-2-commits] CVS: tinyos-2.x/tools/tinyos/safe tos-ramsize, 1.1, 1.2
John Regehr
regehr at users.sourceforge.net
Fri Apr 10 16:03:26 PDT 2009
Update of /cvsroot/tinyos/tinyos-2.x/tools/tinyos/safe
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1036
Modified Files:
tos-ramsize
Log Message:
fix
Index: tos-ramsize
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/safe/tos-ramsize,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tos-ramsize 10 Apr 2009 22:11:00 -0000 1.1
--- tos-ramsize 10 Apr 2009 23:03:24 -0000 1.2
***************
*** 135,139 ****
return ($1, $2);
} else {
! die "FAIL: expected 'x, y' got '$pair'";
}
}
--- 135,139 ----
return ($1, $2);
} else {
! die "tos-ramsize FAIL: expected 'x, y' got '$pair'";
}
}
***************
*** 142,146 ****
(my $addr) = @_;
my $code = $args{$addr};
! die "FAIL" if (!($code =~ /.(\-?[0-9]+)/));
return 2+$1;
}
--- 142,146 ----
(my $addr) = @_;
my $code = $args{$addr};
! die "tos-ramsize FAIL" if (!($code =~ /.(\-?[0-9]+)/));
return 2+$1;
}
***************
*** 172,176 ****
sub disassemble ($) {
(my $fn) = @_;
! open INF, "avr-objdump -zsD $fn |" or die "FAIL: can't open input file $fn";
my $linenum = 0;
my $text_go = 0;
--- 172,176 ----
sub disassemble ($) {
(my $fn) = @_;
! open INF, "avr-objdump -zsD $fn |" or die "tos-ramsize FAIL: can't open input file $fn";
my $linenum = 0;
my $text_go = 0;
***************
*** 227,235 ****
$raw_addr = $address;
} else {
! die "FAIL" if ($raw_addr != $address);
}
($bytes =~ s/\s//g);
while (length($bytes)>0) {
! die "FAIL" if (length($bytes)==1);
my $b = substr $bytes, 0, 2;
$bytes = substr $bytes, 2, length($bytes)-2;
--- 227,235 ----
$raw_addr = $address;
} else {
! die "tos-ramsize FAIL" if ($raw_addr != $address);
}
($bytes =~ s/\s//g);
while (length($bytes)>0) {
! die "tos-ramsize FAIL" if (length($bytes)==1);
my $b = substr $bytes, 0, 2;
$bytes = substr $bytes, 2, length($bytes)-2;
***************
*** 239,243 ****
} else {
print "cannot parse raw text: '$line'\n";
! die "FAIL";
}
}
--- 239,243 ----
} else {
print "cannot parse raw text: '$line'\n";
! die "tos-ramsize FAIL";
}
}
***************
*** 278,282 ****
# paranoid: don't ignore lines that look funny
! die "FAIL: can't understand '$line'";
}
}
--- 278,282 ----
# paranoid: don't ignore lines that look funny
! die "tos-ramsize FAIL: can't understand '$line'";
}
}
***************
*** 375,381 ****
sub jmp_call_target ($) {
(my $addr) = @_;
! die "FAIL" if ($insns{$addr} ne "jmp" && $insns{$addr} ne "call");
my $code = $args{$addr};
! die "FAIL" if (!($code =~ /0x([0-9a-f]+)/) && $code != 0);
if (($code =~ /0x([0-9a-f]+)/)) {
return hex ($1);
--- 375,381 ----
sub jmp_call_target ($) {
(my $addr) = @_;
! die "tos-ramsize FAIL" if ($insns{$addr} ne "jmp" && $insns{$addr} ne "call");
my $code = $args{$addr};
! die "tos-ramsize FAIL" if (!($code =~ /0x([0-9a-f]+)/) && $code != 0);
if (($code =~ /0x([0-9a-f]+)/)) {
return hex ($1);
***************
*** 404,408 ****
# skip size depends on size of subsequent insn
if (is_skip ($addr)) {
! die "FAIL: $hex_addr" if (!defined($insn_size{$addr}));
my $next = $addr + $insn_size{$addr};
if (!defined($insn_size{$next})) {
--- 404,408 ----
# skip size depends on size of subsequent insn
if (is_skip ($addr)) {
! die "tos-ramsize FAIL: $hex_addr" if (!defined($insn_size{$addr}));
my $next = $addr + $insn_size{$addr};
if (!defined($insn_size{$next})) {
***************
*** 413,417 ****
}
! die "FAIL";
}
--- 413,417 ----
}
! die "tos-ramsize FAIL";
}
***************
*** 604,608 ****
# wrong it's highly unlikely that all jump table entries
# will point to actual instructions
! die "FAIL" if (!defined($insns{$targ}));
push @targets, $targ;
--- 604,608 ----
# wrong it's highly unlikely that all jump table entries
# will point to actual instructions
! die "tos-ramsize FAIL" if (!defined($insns{$targ}));
push @targets, $targ;
***************
*** 705,709 ****
# wrong it's highly unlikely that all jump table entries
# will point to actual instructions
! die "FAIL" if (!defined($insns{$targ}));
push @targets, $targ;
--- 705,709 ----
# wrong it's highly unlikely that all jump table entries
# will point to actual instructions
! die "tos-ramsize FAIL" if (!defined($insns{$targ}));
push @targets, $targ;
***************
*** 1104,1110 ****
# FIXME: avr-gcc-412 initializes SP both in
# crt0 and in main(), we can believe the second one
! #die "FAIL: multiple initialization of SP?";
}
! die "FAIL" if ($initial_depth < 0 || $initial_depth >= $RAM_SIZE{$platform});
$initial_stack_depth = $initial_depth;
replace_insn ($addr, $size, 0, "init_sp");
--- 1104,1110 ----
# FIXME: avr-gcc-412 initializes SP both in
# crt0 and in main(), we can believe the second one
! #die "tos-ramsize FAIL: multiple initialization of SP?";
}
! die "tos-ramsize FAIL" if ($initial_depth < 0 || $initial_depth >= $RAM_SIZE{$platform});
$initial_stack_depth = $initial_depth;
replace_insn ($addr, $size, 0, "init_sp");
***************
*** 1206,1210 ****
} elsif ($insn eq "jump_table") {
my $listref = $jump_lists{$addr};
! die "FAIL" if (!defined($listref));
@succ = @{$listref};
} elsif (is_fallthrough ($addr)) {
--- 1206,1210 ----
} elsif ($insn eq "jump_table") {
my $listref = $jump_lists{$addr};
! die "tos-ramsize FAIL" if (!defined($listref));
@succ = @{$listref};
} elsif (is_fallthrough ($addr)) {
***************
*** 1220,1229 ****
if (is_direct_call ($addr)) {
$target = get_target ($addr);
! die "FAIL" if (!defined($target));
} else {
my $target_func = $ICALL_TARGETS{$last_label};
if (defined($target_func)) {
$target = $label_to_addr{$target_func};
! die "FAIL" if (!defined($target));
} else {
$diehere{$addr} = "cannot process raw icall at $hex_addr";
--- 1220,1229 ----
if (is_direct_call ($addr)) {
$target = get_target ($addr);
! die "tos-ramsize FAIL" if (!defined($target));
} else {
my $target_func = $ICALL_TARGETS{$last_label};
if (defined($target_func)) {
$target = $label_to_addr{$target_func};
! die "tos-ramsize FAIL" if (!defined($target));
} else {
$diehere{$addr} = "cannot process raw icall at $hex_addr";
***************
*** 1249,1255 ****
sub compute_global_size($) {
(my $fn) = @_;
! open INF, "avr-objdump -h $fn |" or die "FAIL: can't open input file $fn";
! my $data_size;
! my $bss_size;
while (my $line = <INF>) {
--- 1249,1255 ----
sub compute_global_size($) {
(my $fn) = @_;
! open INF, "avr-objdump -h $fn |" or die "tos-ramsize FAIL: can't open input file $fn";
! my $data_size = 0;
! my $bss_size = 0;
while (my $line = <INF>) {
***************
*** 1265,1270 ****
}
close INF;
- die "FAIL" if (!defined($data_size));
- die "FAIL" if (!defined($bss_size));
return ($data_size, $bss_size);
}
--- 1265,1268 ----
***************
*** 1318,1326 ****
(my $addr, my $old_depth) = @{$lref};
! die "FAIL" if (!defined $addr);
my $hex_addr = sprintf "%x", $addr;
if (!defined($insns{$addr})) {
! die "FAIL: no instruction at address $hex_addr";
}
--- 1316,1324 ----
(my $addr, my $old_depth) = @{$lref};
! die "tos-ramsize FAIL" if (!defined $addr);
my $hex_addr = sprintf "%x", $addr;
if (!defined($insns{$addr})) {
! die "tos-ramsize FAIL: no instruction at address $hex_addr";
}
***************
*** 1328,1332 ****
my $xxx = $diehere{$addr};
if (defined ($xxx)) {
! die "FAIL: $xxx";
}
--- 1326,1330 ----
my $xxx = $diehere{$addr};
if (defined ($xxx)) {
! die "tos-ramsize FAIL: $xxx";
}
***************
*** 1339,1343 ****
my $se = $stack_effect{$addr};
! die "FAIL: no stack effect for $insn" if (!defined($se));
my $new_depth;
if ($se == $ZERO_STACK) {
--- 1337,1341 ----
my $se = $stack_effect{$addr};
! die "tos-ramsize FAIL: no stack effect for $insn" if (!defined($se));
my $new_depth;
if ($se == $ZERO_STACK) {
***************
*** 1353,1357 ****
# something is very wrong
if ($new_depth > $RAM_SIZE{$platform}) {
! printf "FAIL: stack depth exceeds RAM size at %x\n", $hex_addr;
die;
}
--- 1351,1355 ----
# something is very wrong
if ($new_depth > $RAM_SIZE{$platform}) {
! printf "tos-ramsize FAIL: stack depth exceeds RAM size at %x\n", $hex_addr;
die;
}
***************
*** 1359,1364 ****
# require balanced stack #1
if ($insn eq "reti") {
! die "FAIL" if ($vec_type ne "intr");
! die "FAIL" if ($new_depth != 0);
next;
}
--- 1357,1362 ----
# require balanced stack #1
if ($insn eq "reti") {
! die "tos-ramsize FAIL" if ($vec_type ne "intr");
! die "tos-ramsize FAIL" if ($new_depth != 0);
next;
}
***************
*** 1366,1371 ****
# require balanced stack #2
if ($insn eq "ret") {
! die "FAIL" if ($vec_type ne "func");
! die "FAIL -- unbalanced stack on return from $func_name" if ($new_depth != 0);
next;
}
--- 1364,1369 ----
# require balanced stack #2
if ($insn eq "ret") {
! die "tos-ramsize FAIL" if ($vec_type ne "func");
! die "tos-ramsize FAIL -- unbalanced stack on return from $func_name" if ($new_depth != 0);
next;
}
***************
*** 1505,1514 ****
}
}
! die "FAIL graph algo bug" if (!$found);
print " $addr_to_label{$f} $f -> $addr_to_label{$found} $found\n";
$f = $found;
}
print " $addr_to_label{$f} $f -> $addr_to_label{$min_func} $min_func\n";
! die "FAIL";
}
}
--- 1503,1512 ----
}
}
! die "tos-ramsize FAIL graph algo bug" if (!$found);
print " $addr_to_label{$f} $f -> $addr_to_label{$found} $found\n";
$f = $found;
}
print " $addr_to_label{$f} $f -> $addr_to_label{$min_func} $min_func\n";
! die "tos-ramsize FAIL";
}
}
***************
*** 1635,1639 ****
my $result = GetOptions ("verbosity=i" => \$verbosity);
! die "FAIL" if (!$result);
if (scalar(@ARGV) != 2) {
--- 1633,1637 ----
my $result = GetOptions ("verbosity=i" => \$verbosity);
! die "tos-ramsize FAIL" if (!$result);
if (scalar(@ARGV) != 2) {
***************
*** 1642,1649 ****
$platform = $ARGV[0];
! die "FAIL: unknown platform '$platform'" if (!defined($RAM_SIZE{$platform}));
my $file = $ARGV[1];
! die "FAIL: '$file' not found" if (!(-f $file));
disassemble ($file);
--- 1640,1651 ----
$platform = $ARGV[0];
! die "tos-ramsize FAIL: unknown platform '$platform'" if (!defined($RAM_SIZE{$platform}));
my $file = $ARGV[1];
! die "tos-ramsize FAIL: '$file' not found" if (!(-f $file));
!
! if ($verbosity > 1) {
! print "analyzing elf file '$file' for platform '$platform'\n";
! }
disassemble ($file);
***************
*** 1661,1665 ****
if ($verbosity > 2) {
- print "\n";
foreach my $addr (sort bynum keys %insns) {
if (!$visited{$addr}) {
--- 1663,1666 ----
***************
*** 1673,1677 ****
if ($verbosity > 0) {
- print "\n";
print "BSS segment size is ${bss_size}, data segment size is ${data_size}\n";
}
--- 1674,1677 ----
More information about the Tinyos-2-commits
mailing list