From ecf2f747edae9ffc3eb0057958da41915cbfac19 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 22 Jun 2005 02:47:54 +0000 Subject: Daniel's fix that loads codecs in their own memory space git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6794 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/Makefile | 20 +++++++++++++++----- apps/plugins/plugin.lds | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 7 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index fa0e8b8..44e055d 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile @@ -22,6 +22,7 @@ endif LDS := plugin.lds LINKFILE := $(OBJDIR)/pluginlink.lds +LINKCODEC := $(OBJDIR)/codeclink.lds DEPFILE = $(OBJDIR)/dep-plugins # This sets up 'SRC' based on the files mentioned in SOURCES @@ -51,9 +52,16 @@ endif all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE) ifndef SIMVER -$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a - @echo "LD "`basename $@` - @$(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map +$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(LINKCODEC) $(BUILDDIR)/libplugin.a + $(SILENT)(file=`basename $@`; \ + echo "LD $$file"; \ + match=`grep $$file CODECS`; \ + if test -z "$$match"; then \ + LINKWITH=$(LINKFILE); \ + else \ + LINKWITH=$(LINKCODEC); \ + fi; \ + $(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin -lgcc -T$$LINKWITH -Wl,-Map,$(OBJDIR)/$*.map) $(OBJDIR)/%.rock : $(OBJDIR)/%.elf @echo "OBJCOPY "`basename $@` @@ -104,12 +112,14 @@ $(BUILDDIR)/libplugin.a: @mkdir -p $(OBJDIR)/lib @$(MAKE) -C lib OBJDIR=$(OBJDIR)/lib -# MEM should be passed on to this makefile with the chosen memory size given -# in number of MB $(LINKFILE): $(LDS) @echo "build $@" @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P - >$@ +$(LINKCODEC): $(LDS) + @echo "build $@" + @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) -DCODEC $(INCLUDES) $(TARGET) $(DEFINES) -E -P - >$@ + $(SUBDIRS): @echo "MAKE in $@" @mkdir -p $(OBJDIR)/$@ diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index 3b9ac8a..619bb0e 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds @@ -22,17 +22,30 @@ OUTPUT_FORMAT(elf32-sh) #define DRAMORIG 0x09000000 + STUBOFFSET #endif +#ifdef CODEC +#define CODEC_SIZE 0x3C000 +#else +#define CODEC_SIZE 0 +#endif + #if MEMORYSIZE >= 32 #define PLUGIN_LENGTH 0xC0000 #else #define PLUGIN_LENGTH 0x8000 #endif -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH + +#if CODEC_SIZE > 0 +#define THIS_LENGTH CODEC_SIZE +#else +#define THIS_LENGTH PLUGIN_LENGTH +#endif + +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - CODEC_SIZE #define PLUGIN_ORIGIN (DRAMORIG + (DRAMSIZE)) MEMORY { - PLUGIN_RAM : ORIGIN = PLUGIN_ORIGIN, LENGTH = PLUGIN_LENGTH + PLUGIN_RAM : ORIGIN = PLUGIN_ORIGIN, LENGTH = THIS_LENGTH #ifdef IRIVER_H100 PLUGIN_IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE #endif -- cgit v1.1