Working toward successful link using aslink
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@21 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
954c1d9364
commit
925f45b933
@ -62,6 +62,8 @@ CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
|
||||
LDFLAGS = $(ARCHSCRIPT)
|
||||
EXTRA_LIBS =
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
|
||||
ifeq ("${CONFIG_DEBUG}","y")
|
||||
|
@ -35,26 +35,33 @@
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS = up_vectors.S up_saveusercontext.S up_fullcontextrestore.S
|
||||
ASRCS = up_vectors.S up_saveusercontext.S up_fullcontextrestore.S
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ASRCS += up_lowputc.S
|
||||
ASRCS += up_lowputc.S
|
||||
endif
|
||||
AOBJS = $(ASRCS:.S=.o)
|
||||
AOBJS = $(ASRCS:.S=.o)
|
||||
|
||||
CSRCS = up_initialize.c up_initialstate.c up_idle.c up_doirq.c \
|
||||
up_irq.c up_syscall.c up_dataabort.c up_prefetchabort.c \
|
||||
up_undefinedinsn.c up_interruptcontext.c up_timerisr.c \
|
||||
up_createstack.c up_usestack.c up_releasestack.c \
|
||||
up_exit.c up_assert.c up_blocktask.c up_unblocktask.c \
|
||||
up_releasepending.c up_reprioritizertr.c up_copystate.c \
|
||||
up_schedulesigaction.c up_sigdeliver.c up_serial.c
|
||||
COBJS = $(CSRCS:.c=.o)
|
||||
CSRCS = up_initialize.c up_initialstate.c up_idle.c up_doirq.c \
|
||||
up_irq.c up_syscall.c up_dataabort.c up_prefetchabort.c \
|
||||
up_undefinedinsn.c up_interruptcontext.c up_timerisr.c \
|
||||
up_createstack.c up_usestack.c up_releasestack.c \
|
||||
up_exit.c up_assert.c up_blocktask.c up_unblocktask.c \
|
||||
up_releasepending.c up_reprioritizertr.c up_copystate.c \
|
||||
up_schedulesigaction.c up_sigdeliver.c up_serial.c
|
||||
COBJS = $(CSRCS:.c=.o)
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
LINKOBJS =
|
||||
LINKLIBS =
|
||||
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
|
||||
LIBGCC = ${shell $(CC) -print-libgcc-file-name}
|
||||
|
||||
all: up_head.o libarch$(LIBEXT)
|
||||
|
||||
@ -70,6 +77,25 @@ libarch$(LIBEXT): $(OBJS)
|
||||
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
|
||||
done ; )
|
||||
|
||||
nuttx:
|
||||
$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ \
|
||||
$(addprefix $(TOPDIR)/,$(LINKOBJS)) \
|
||||
--start-group $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group
|
||||
@$(NM) $(TOPDIR)/$@ | \
|
||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)/System.map
|
||||
@export vflashstart=`$(OBJDUMP) --all-headers $(TOPDIR)/$@ | grep _vflashstart | cut -d' ' -f1`; \
|
||||
if [ ! -z "$$vflashstart" ]; then \
|
||||
$(OBJCOPY) --adjust-section-vma=.vector=0x$$vflashstart $(TOPDIR)/$@ $(TOPDIR)/$@.flashimage; \
|
||||
mv $(TOPDIR)/$@.flashimage $(TOPDIR)/$@; \
|
||||
fi
|
||||
ifeq ($(CONFIG_RRLOAD_BINARY),y)
|
||||
@$(TOPDIR)/tools/mkimage.sh $(TOPDIR)/$@ $(TOPDIR)/$@.rr
|
||||
@if [ -w /tftpboot ] ; then \
|
||||
cp -f $(TOPDIR)/$@.rr /tftpboot/$@.rr.${CONFIG_ARCH}; \
|
||||
fi
|
||||
endif
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
touch $@
|
||||
|
@ -61,6 +61,8 @@ CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
|
||||
LDFLAGS = $(ARCHSCRIPT)
|
||||
EXTRA_LIBS = -lc
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
|
||||
ifeq ("${CONFIG_DEBUG}","y")
|
||||
|
@ -35,26 +35,33 @@
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS = up_setjmp.S
|
||||
AOBJS = $(ASRCS:.S=.o)
|
||||
CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_initialstate.c \
|
||||
up_createstack.c up_usestack.c up_releasestack.c \
|
||||
up_unblocktask.c up_blocktask.c up_releasepending.c up_reprioritizertr.c \
|
||||
up_exit.c up_schedulesigaction.c up_allocateheap.c up_devconsole.c
|
||||
COBJS = $(CSRCS:.c=.o)
|
||||
ASRCS = up_setjmp.S
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
CSRCS = up_initialize.c up_idle.c up_interruptcontext.c \
|
||||
up_initialstate.c up_createstack.c up_usestack.c \
|
||||
up_releasestack.c up_unblocktask.c up_blocktask.c \
|
||||
up_releasepending.c up_reprioritizertr.c \
|
||||
up_exit.c up_schedulesigaction.c up_allocateheap.c \
|
||||
up_devconsole.c
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
all: up_head.o libarch$(LIBEXT)
|
||||
LINKOBJS =
|
||||
LINKLIBS =
|
||||
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
|
||||
$(AOBJS): %.o: %.S
|
||||
all: up_head$(OBJEXT) libarch$(LIBEXT)
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
|
||||
|
||||
$(COBJS) up_head.o: %.o: %.c
|
||||
$(COBJS) up_head$(OBJEXT): %$(OBJEXT): %.c
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
libarch$(LIBEXT): $(OBJS)
|
||||
@ -63,6 +70,15 @@ libarch$(LIBEXT): $(OBJS)
|
||||
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
|
||||
done ; )
|
||||
|
||||
nuttx:
|
||||
$(CC) $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ \
|
||||
$(addprefix $(TOPDIR)/,$(LINKOBJS)) \
|
||||
-Wl,--start-group $(LDLIBS) $(EXTRA_LIBS) -Wl,--end-group
|
||||
@$(NM) $(TOPDIR)/$@ | \
|
||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)/System.map
|
||||
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
touch $@
|
||||
@ -70,10 +86,10 @@ libarch$(LIBEXT): $(OBJS)
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
rm -f libarch$(LIBEXT) *.o *~
|
||||
rm -f libarch$(LIBEXT) *~
|
||||
if [ ! -z "$(OBJEXT)" ]; then rm -f *$(OBJEXT); fi
|
||||
|
||||
distclean: clean
|
||||
rm -f Make.dep .depend
|
||||
|
||||
|
||||
-include Make.dep
|
||||
|
Loading…
Reference in New Issue
Block a user