Add framework to support loadable ELF modules (not much logic in place yet)

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5250 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-10-24 16:46:12 +00:00
parent af8679c104
commit b49a2605d0
35 changed files with 1802 additions and 651 deletions
+27 -28
View File
@@ -1,7 +1,7 @@
############################################################################
# nxflat/Makefile
#
# Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -36,55 +36,54 @@
-include $(TOPDIR)/Make.defs
ifeq ($(WINTOOL),y)
INCDIROPT = -w
INCDIROPT = -w
endif
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/sched}
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/sched}
ifeq ($(CONFIG_NXFLAT),y)
include libnxflat/Make.defs
LIBNXFLAT_CSRCS += nxflat.c
endif
# Basic BINFMT source files
BINFMT_ASRCS =
BINFMT_CSRCS = binfmt_globals.c binfmt_register.c binfmt_unregister.c \
binfmt_loadmodule.c binfmt_unloadmodule.c binfmt_execmodule.c \
binfmt_exec.c binfmt_dumpmodule.c
binfmt_loadmodule.c binfmt_unloadmodule.c binfmt_execmodule.c \
binfmt_exec.c binfmt_dumpmodule.c
SYMTAB_ASRCS =
SYMTAB_CSRCS = symtab_findbyname.c symtab_findbyvalue.c \
symtab_findorderedbyname.c symtab_findorderedbyvalue.c
# Symbol table source files
SUBDIRS = libnxflat
BINFMT_CSRCS += symtab_findbyname.c symtab_findbyvalue.c \
symtab_findorderedbyname.c symtab_findorderedbyvalue.c
ASRCS = $(BINFMT_ASRCS) $(SYMTAB_ASRCS) $(LIBNXFLAT_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
# Add configured binary modules
CSRCS = $(BINFMT_CSRCS) $(SYMTAB_CSRCS) $(LIBNXFLAT_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
VPATH =
SUBDIRS =
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
include libnxflat/Make.defs
include libelf/Make.defs
BIN = libbinfmt$(LIBEXT)
BINFMT_AOBJS = $(BINFMT_ASRCS:.S=$(OBJEXT))
BINFMT_COBJS = $(BINFMT_CSRCS:.c=$(OBJEXT))
VPATH = libnxflat
BINFMT_SRCS = $(BINFMT_ASRCS) $(BINFMT_CSRCS)
BINFMT_OBJS = $(BINFMT_AOBJS) $(BINFMT_COBJS)
all: $(BIN)
BIN = libbinfmt$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
all: $(BIN)
$(BINFMT_AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
$(BINFMT_COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(BIN): $(OBJS)
@( for obj in $(OBJS) ; do \
$(BIN): $(BINFMT_OBJS)
@( for obj in $(BINFMT_OBJS) ; do \
$(call ARCHIVE, $@, $${obj}); \
done ; )
.depend: Makefile $(SRCS)
.depend: Makefile $(BINFMT_SRCS)
@$(MKDEP) --dep-path . --dep-path libnxflat \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(CC) -- $(CFLAGS) -- $(BINFMT_SRCS) >Make.dep
@touch $@
depend: .depend