mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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:
parent
ce1c189d50
commit
c21e2e686f
11 changed files with 102 additions and 236 deletions
|
@ -26,24 +26,25 @@ PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o)
|
|||
PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o)
|
||||
PLUGINLIB_OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(PLUGINLIB_OBJ))
|
||||
|
||||
### build data / rules
|
||||
ifndef SIMVER
|
||||
PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds
|
||||
PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
|
||||
OVERLAYREF_LDS := $(BUILDDIR)/apps/plugins/overlay_ref.link
|
||||
endif
|
||||
|
||||
# multifile plugins (subdirs):
|
||||
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
|
||||
|
||||
# include <dir>.make from each subdir (yay!)
|
||||
$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
|
||||
|
||||
### build data / rules
|
||||
ifndef SIMVER
|
||||
PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds
|
||||
PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
|
||||
endif
|
||||
|
||||
OTHER_INC += -I$(APPSDIR)/plugins -I$(APPSDIR)/plugins/lib
|
||||
|
||||
# special compile flags for plugins:
|
||||
PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
|
||||
PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
|
||||
|
||||
$(ROCKS): $(PLUGINLIB) $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINBITMAPLIB)
|
||||
$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
|
||||
|
||||
$(PLUGINLIB): $(PLUGINLIB_OBJ)
|
||||
$(SILENT)$(shell rm -f $@)
|
||||
|
@ -54,11 +55,16 @@ $(PLUGINLINK_LDS): $(PLUGIN_LDS)
|
|||
$(shell mkdir -p $(dir $@))
|
||||
$(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
|
||||
|
||||
$(OVERLAYREF_LDS): $(PLUGIN_LDS)
|
||||
$(call PRINTS,PP $(@F))
|
||||
$(shell mkdir -p $(dir $@))
|
||||
$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=0)
|
||||
|
||||
$(BUILDDIR)/credits.raw credits.raw: $(DOCSDIR)/CREDITS
|
||||
$(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F)
|
||||
|
||||
# special dependencies
|
||||
$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a
|
||||
$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a $(PLUGINLIB)
|
||||
|
||||
# special pattern rule for compiling plugin lib (with -ffunction-sections)
|
||||
$(BUILDDIR)/apps/plugins/lib/%.o: $(ROOTDIR)/apps/plugins/lib/%.c
|
||||
|
@ -74,15 +80,22 @@ ifdef SIMVER
|
|||
PLUGINLDFLAGS = $(SHARED_FLAG) # <-- from Makefile
|
||||
else
|
||||
PLUGINLDFLAGS = -T$(PLUGINLINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map
|
||||
OVERLAYLDFLAGS = -T$(OVERLAYREF_LDS) -Wl,--gc-sections -Wl,-Map,$*.refmap
|
||||
endif
|
||||
|
||||
$(BUILDDIR)/%.rock: $(GCCSUPPORT_OBJ) $(BUILDDIR)/%.o $(PLUGINLINK_LDS)
|
||||
$(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
|
||||
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
|
||||
$(filter %.o, $^) \
|
||||
$(filter %.a, $^) \
|
||||
$(filter %.a, $+) \
|
||||
-lgcc $(PLUGINLDFLAGS)
|
||||
ifdef SIMVER
|
||||
$(SILENT)cp $(BUILDDIR)/$*.elf $@
|
||||
else
|
||||
$(SILENT)$(OC) -O binary $(BUILDDIR)/$*.elf $@
|
||||
endif
|
||||
endif
|
||||
|
||||
$(BUILDDIR)/%.refmap: $(BUILDDIR)/%.o $(OVERLAYREF_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
|
||||
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \
|
||||
$(filter %.o, $^) \
|
||||
$(filter %.a, $^) \
|
||||
-lgcc $(OVERLAYLDFLAGS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue