free.pl


$map = $ARGV[0]; shift;
$boot = $ARGV[0]; shift;
$boot = eval($boot);
$size = $ARGV[0]; shift;
if ($size eq '') {
    $size = 16 * 1024;
} else {
    $size = eval($size);
}
$size -= $boot;
open(F, "<$map") || die "can't open $map!\n";
while (<F>) {
    if ($_ =~ /0x(\S+)\s+__data_load_end/) {
        $bytes = hex($1);
        $bytes -= $boot;
        print int((100*$bytes)/($size));
        printf('%c of flash in use',37);
        print " ($bytes bytes out of $size)\n";
    }
}

Back