summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-03-02 00:16:44 +0000
committerJens Arnold <amiconn@rockbox.org>2009-03-02 00:16:44 +0000
commitc21e2e686fce7a7df5a933fd3bf06aa20e66c78b (patch)
tree483500a54064c878fd12196ca7fd1fad1177c064 /tools
parentce1c189d509b1b88044f9821fa36f2461af07219 (diff)
downloadrockbox-c21e2e686fce7a7df5a933fd3bf06aa20e66c78b.tar.gz
rockbox-c21e2e686fce7a7df5a933fd3bf06aa20e66c78b.zip
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
Diffstat (limited to 'tools')
-rw-r--r--tools/ovl_offset.pl31
1 files changed, 31 insertions, 0 deletions
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 @@
1#!/usr/bin/perl
2
3# Calculate the highest possible location for an overlay based
4# on a reference map file (.refmap)
5
6sub map_scan {
7 my ($map) = @_;
8 my $ramstart = -1, $ramsize = -1, $startaddr = -1, $endaddr = -1;
9 open (MAP, "<$map");
10 while (<MAP>) {
11 if ($_ =~ /^PLUGIN_RAM +0x([0-9a-f]+) +0x([0-9a-f]+)$/) {
12 $ramstart = hex($1);
13 $ramsize = hex($2);
14 }
15 elsif ($_ =~ / +0x([0-9a-f]+) +_?plugin_start_addr = ./) {
16 $startaddr = hex($1);
17 }
18 elsif ($_ =~ / +0x([0-9a-f]+) +_?plugin_end_addr = ./) {
19 $endaddr = hex($1);
20 }
21 }
22 close (MAP);
23 if ($ramstart < 0 || $ramsize < 0 || $startaddr < 0 || $endaddr < 0
24 || $ramstart != $startaddr) {
25 printf "Could not analyze map file.\n";
26 exit 1;
27 }
28 return $ramstart + $ramsize - $endaddr;
29}
30
31printf map_scan($ARGV[0]) & ~0xf;