From c21e2e686fce7a7df5a933fd3bf06aa20e66c78b Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 2 Mar 2009 00:16:44 +0000 Subject: Calculate the optimal memory location for overlay plugins, and use plugin.lds for linking them. This gets rid of hand-adjusted archos.lds, making it easy to use overlay plugins on other lowmem targets. * Fix some duplicate and incorrect dependencies. * Change the way libs are filtered, so that a lib can be specified more than once. This allows to get rid of explicitly linking gcc-support.o, fixing empty plugins on some simulator platforms. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20163 a1c6a512-1295-4272-9138-f99709370657 --- tools/ovl_offset.pl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/ovl_offset.pl (limited to 'tools') diff --git a/tools/ovl_offset.pl b/tools/ovl_offset.pl new file mode 100644 index 0000000000..89c3468556 --- /dev/null +++ b/tools/ovl_offset.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +# Calculate the highest possible location for an overlay based +# on a reference map file (.refmap) + +sub map_scan { + my ($map) = @_; + my $ramstart = -1, $ramsize = -1, $startaddr = -1, $endaddr = -1; + open (MAP, "<$map"); + while () { + if ($_ =~ /^PLUGIN_RAM +0x([0-9a-f]+) +0x([0-9a-f]+)$/) { + $ramstart = hex($1); + $ramsize = hex($2); + } + elsif ($_ =~ / +0x([0-9a-f]+) +_?plugin_start_addr = ./) { + $startaddr = hex($1); + } + elsif ($_ =~ / +0x([0-9a-f]+) +_?plugin_end_addr = ./) { + $endaddr = hex($1); + } + } + close (MAP); + if ($ramstart < 0 || $ramsize < 0 || $startaddr < 0 || $endaddr < 0 + || $ramstart != $startaddr) { + printf "Could not analyze map file.\n"; + exit 1; + } + return $ramstart + $ramsize - $endaddr; +} + +printf map_scan($ARGV[0]) & ~0xf; -- cgit v1.2.3