3 # Calculate the highest possible location for an overlay based
4 # on a reference map file (.refmap)
8 my $ramstart = -1, $ramsize = -1, $startaddr = -1, $endaddr = -1;
11 if ($_ =~ /^PLUGIN_RAM +0x([0-9a-f]+) +0x([0-9a-f]+)$/) {
15 elsif ($_ =~ / +0x([0-9a-f]+) +_?plugin_start_addr = ./) {
18 elsif ($_ =~ / +0x([0-9a-f]+) +_?plugin_end_addr = ./) {
23 if ($ramstart < 0 || $ramsize < 0 || $startaddr < 0 || $endaddr < 0
24 || $ramstart != $startaddr) {
25 printf "Could not analyze map file.\n";
28 return $ramstart + $ramsize - $endaddr;
31 printf map_scan
($ARGV[0]) & ~0xf;