1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2009-03-02 00:16:44 +00:00
parent ce1c189d50
commit c21e2e686f
11 changed files with 102 additions and 236 deletions

View file

@ -1,43 +0,0 @@
#include "config.h"
/* linker script for goban as an overlay */
OUTPUT_FORMAT(elf32-sh)
#define DRAMORIG 0x09000000
#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
#define OVERLAY_LENGTH 0x10000
#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH)
MEMORY
{
OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH
}
SECTIONS
{
.header : {
_plugin_start_addr = .;
KEEP(*(.header))
} > OVERLAY_RAM
.text : {
*(.text*)
} > OVERLAY_RAM
.rodata : {
*(.rodata*)
} > OVERLAY_RAM
.data : {
*(.data*)
} > OVERLAY_RAM
.bss : {
*(.bss*)
*(COMMON)
. = ALIGN(0x4);
_plugin_end_addr = .;
} > OVERLAY_RAM
}

View file

@ -7,7 +7,6 @@
# $Id$
#
GOBAN_SRCDIR := $(APPSDIR)/plugins/goban
GOBAN_BUILDDIR := $(BUILDDIR)/apps/plugins/goban
@ -18,31 +17,30 @@ OTHER_SRC += $(GOBAN_SRC)
ifndef SIMVER
ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
### archos recorder targets
GOBAN_INLDS := $(GOBAN_SRCDIR)/archos.lds
### lowmem targets
ROCKS += $(GOBAN_BUILDDIR)/goban.ovl
GOBAN_OUTLDS = $(GOBAN_BUILDDIR)/goban.link
GOBAN_OVLFLAGS = -T$(GOBAN_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
else
### all other targets
GOBAN_INLDS := $(APPSDIR)/plugins/plugin.lds
ROCKS += $(GOBAN_BUILDDIR)/goban.rock
endif
GOBAN_OVLFLAGS = -T$(GOBAN_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
GOBAN_OUTLDS = $(GOBAN_BUILDDIR)/goban.lds
else
### simulator
ROCKS += $(GOBAN_BUILDDIR)/goban.rock
GOBAN_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile
endif
$(GOBAN_OUTLDS): $(GOBAN_INLDS) $(GOBAN_OBJ)
$(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
$(GOBAN_BUILDDIR)/goban.rock: $(GOBAN_OBJ)
$(GOBAN_BUILDDIR)/goban.rock: $(GOBAN_OBJ) $(GOBAN_OUTLDS)
$(GOBAN_BUILDDIR)/goban.refmap: $(GOBAN_OBJ)
$(GOBAN_OUTLDS): $(PLUGIN_LDS) $(GOBAN_BUILDDIR)/goban.refmap
$(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
$(TOOLSDIR)/ovl_offset.pl $(GOBAN_BUILDDIR)/goban.refmap))
$(GOBAN_BUILDDIR)/goban.ovl: $(GOBAN_OBJ) $(GOBAN_OUTLDS)
$(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
$(filter %.o, $^) \
$(filter %.a, $^) \
$(filter %.a, $+) \
-lgcc $(GOBAN_OVLFLAGS)
$(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@