Add an 'export' target to the NuttX top-level Makefile

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3771 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-07-11 22:52:51 +00:00
parent ef2d7974c8
commit 03faf1cc17
18 changed files with 424 additions and 49 deletions

View file

@ -1897,3 +1897,7 @@
window graphic was left on the display for a time.
6.7 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* Makefile: Added a export target that will bundle up all of the NuttX
libraries, header files, and the startup object into an export-able
tarball.

View file

@ -35,6 +35,7 @@
TOPDIR := ${shell pwd | sed -e 's/ /\\ /g'}
-include ${TOPDIR}/.config
-include ${TOPDIR}/.version
-include ${TOPDIR}/Make.defs
# Default tools
@ -56,6 +57,14 @@ ARCH_SRC = $(ARCH_DIR)/src
ARCH_INC = $(ARCH_DIR)/include
BOARD_DIR = configs/$(CONFIG_ARCH_BOARD)
# Version string (only if a non-zero version is specified)
ifdef CONFIG_VERSION_STRING
ifneq ($(CONFIG_VERSION_MAJOR),0)
VERSION = -$(CONFIG_VERSION_STRING)
endif
endif
# Add-on directories. These may or may not be in place in the
# NuttX source tree (they must be specifically installed)
#
@ -238,9 +247,10 @@ endif
BIN = nuttx$(EXEEXT)
all: $(BIN)
.PHONY: context clean_context check_context subdir_clean clean subdir_distclean distclean
.PHONY: context clean_context check_context export subdir_clean clean subdir_distclean distclean
# Build the mkconfig tool used to create include/nuttx/config.h
tools/mkversion:
@$(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion
@ -252,10 +262,12 @@ $(TOPDIR)/.version:
fi
# Create the include/nuttx/version.h file
include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion
tools/mkversion $(TOPDIR) > include/nuttx/version.h
# Build the mkconfig tool used to create include/nuttx/config.h
tools/mkconfig:
@$(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig
@ -454,6 +466,15 @@ pass2dep: context
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" EXTRADEFINES=$(KDEFINE) depend; \
done
# The export target will package the NuttX libraries and header files into
# an exportable package (These needs some extension for the KERNEL build;
# it needs to receive USERLIBS and create a libuser.a).
export: pass2deps
@tools/mkexport.sh -t "$(TOPDIR)" -a "$(CONFIG_ARCH)" -l "$(NUTTXLIBS)"
# Housekeeping targets: dependencies, cleaning, etc.
depend: pass1dep pass2dep
subdir_clean:
@ -470,6 +491,7 @@ endif
clean: subdir_clean
@rm -f $(BIN) nuttx.* mm_test *.map *~
@rm -f nuttx-export*
subdir_distclean:
@for dir in $(CLEANDIRS) ; do \

16
TODO
View file

@ -1,4 +1,4 @@
NuttX TODO List (Last updated July 8, 2011)
NuttX TODO List (Last updated July 12, 2011)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nuttx/
@ -17,7 +17,7 @@ nuttx/
(1) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/)
(1) Documentation (Documentation/)
(4) Build system / Toolchains
(5) Build system / Toolchains
(7) Linux/Cywgin simulation (arch/sim)
(4) ARM (arch/arm/)
(1) ARM/C5471 (arch/arm/src/c5471/)
@ -545,6 +545,18 @@ o Build system
Priority: Low. Use of setenv.sh is optional and most platforms do not have
this problem. Scripts will be fixed one-at-a-time as is appropropriate.
Description: The top-level Makefile 'export' target that will bundle up all of the
NuttX libraries, header files, and the startup object into an export-able
tarball. This target uses the tools/mkexport.sh script. Issues:
1. This script assumes the host archiver ar may not be appropriate for
non-GCC toolchains
2. For the kernel build, the user libriars should be built into some
libuser.a. The list of user libraries would have to accepted with
some new argument, perhaps -u.
Status: Open
Priority: Low.
o Linux/Cywgin simulation (arch/sim)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -187,6 +187,16 @@ nuttx$(EXEEXT): pass1.ihx nuttx.ihx
@packihx nuttx.ihx > $(TOPDIR)/nuttx$(EXEEXT)
@cp -f nuttx.map $(TOPDIR)/.
# This is part of the top-level export target
export_head: uboard/libboard$(LIBEXT) p_head$(OBJEXT)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f up_head$(OBJEXT) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# This target builds a test program to verify interrupt context switching. irqtest is
# a PHONY target that just sets upt the up_irqtest build correctly

View file

@ -55,7 +55,7 @@ else
-I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) -I$(TOPDIR)/sched
endif
HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
@ -87,7 +87,7 @@ VPATH = chip:common:$(ARCH_SUBDIR)
all: $(HEAD_OBJ) libarch$(LIBEXT)
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
@ -101,9 +101,9 @@ libarch$(LIBEXT): $(OBJS)
board/libboard$(LIBEXT):
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_AOBJ) $(EXTRA_OBJS) \
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y)
@export flashloc=`$(OBJDUMP) --all-headers $(NUTTX)$(EXEEXT) | grep _eronly | cut -d' ' -f1`; \
@ -119,6 +119,18 @@ endif
mv $(NUTTX).flashimage $(NUTTX)$(EXEEXT); \
fi
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Dependencies
.depend: Makefile chip/Make.defs $(SRCS)
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \

View file

@ -64,7 +64,7 @@ CFLAGS += $(INCLUDES)
CXXFLAGS += $(INCLUDES)
AFLAGS += $(INCLUDES)
HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
@ -96,7 +96,7 @@ VPATH = chip:common:$(ARCH_SUBDIR)
all: $(HEAD_OBJ) libarch$(LIBEXT)
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
@ -110,9 +110,9 @@ libarch$(LIBEXT): $(OBJS)
board/libboard$(LIBEXT):
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_AOBJ) $(EXTRA_OBJS) \
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
@$(NM) $(NUTTX)$(EXEEXT) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
@ -123,6 +123,18 @@ nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
mv $(NUTTX).flashimage $(NUTTX)$(EXEEXT); \
fi
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Dependencies
.depend: Makefile chip/Make.defs $(SRCS)
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \

View file

@ -56,7 +56,7 @@ else
-I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) -I$(TOPDIR)/sched
endif
HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
@ -88,7 +88,7 @@ VPATH = chip:common:$(ARCH_SUBDIR)
all: $(HEAD_OBJ) libarch$(LIBEXT)
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
@ -102,9 +102,9 @@ libarch$(LIBEXT): $(OBJS)
board/libboard$(LIBEXT):
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_AOBJ) \
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y)
@export flashloc=`$(OBJDUMP) --all-headers $(NUTTX)$(EXEEXT) | grep _eronly | cut -d' ' -f1`; \
@ -120,6 +120,18 @@ endif
mv $(NUTTX).flashimage $(NUTTX)$(EXEEXT); \
fi
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Dependencies
.depend: Makefile chip/Make.defs $(SRCS)
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \

View file

@ -53,7 +53,7 @@ else
-I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) -I$(TOPDIR)/sched
endif
HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
@ -85,7 +85,7 @@ VPATH = chip:common:$(ARCH_SUBDIR)
all: $(HEAD_OBJ) libarch$(LIBEXT)
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
@ -99,9 +99,9 @@ libarch$(LIBEXT): $(OBJS)
board/libboard$(LIBEXT):
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_AOBJ) $(EXTRA_OBJS) \
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
@$(NM) $(NUTTX)$(EXEEXT) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
@ -112,6 +112,18 @@ nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
mv $(NUTTX).flashimage $(NUTTX)$(EXEEXT); \
fi
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Dependencies
.depend: Makefile chip/Make.defs $(SRCS)
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \

View file

@ -78,6 +78,12 @@ nuttx$(EXEEXT):
@$(OBJCOPY) -S -O binary $(TOPDIR)/$@ nuttx.img
@cp nuttx.img $(TOPDIR)/kernel.img
# This is part of the top-level export target
export_head:
# Dependencies
.depend: Makefile $(SRCS)
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@

View file

@ -1,7 +1,7 @@
############################################################################
# arch/sh/src/Makefile
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(TOPDIR)/sched
HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
@ -65,7 +65,7 @@ VPATH = chip:common
all: $(HEAD_OBJ) libarch$(LIBEXT)
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
@ -79,9 +79,9 @@ libarch$(LIBEXT): $(OBJS)
board/libboard$(LIBEXT):
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
nuttx: $(HEAD_AOBJ) board/libboard$(LIBEXT)
nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(HEAD_AOBJ) \
@$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(HEAD_OBJ) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y)
@export flashloc=`$(OBJDUMP) --all-headers $(TOPDIR)/$@ | grep _eronly | cut -d' ' -f1`; \
@ -97,6 +97,18 @@ endif
mv $(TOPDIR)/$@.flashimage $(TOPDIR)/$@; \
fi
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Dependencies
.depend: Makefile chip/Make.defs $(SRCS)
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \

View file

@ -1,7 +1,7 @@
############################################################################
# arch/sim/src/Makefile
#
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -154,6 +154,12 @@ nuttx$(EXEEXT): cleanrel nuttx.rel $(HOSTOBJS)
sort > $(TOPDIR)/System.map
@rm -f nuttx.rel
# This is part of the top-level export target
export_head:
# Dependencies
.depend: Makefile $(SRCS)
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@

View file

@ -53,7 +53,7 @@ else
-I$(ARCH_SRCDIR)/$(ARCH_SUBDIR) -I$(TOPDIR)/sched
endif
HEAD_AOBJ = $(HEAD_ASRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
ASRCS = $(CHIP_ASRCS) $(CMN_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
@ -85,7 +85,7 @@ VPATH = chip:common:$(ARCH_SUBDIR)
all: $(HEAD_OBJ) libarch$(LIBEXT)
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
@ -99,9 +99,9 @@ libarch$(LIBEXT): $(OBJS)
board/libboard$(LIBEXT):
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT)
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx$(EXEEXT)"
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_AOBJ) $(EXTRA_OBJS) \
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) \
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y)
@export flashloc=`$(OBJDUMP) --all-headers $(NUTTX)$(EXEEXT) | grep _eronly | cut -d' ' -f1`; \
@ -117,6 +117,18 @@ endif
mv $(NUTTX).flashimage $(NUTTX)$(EXEEXT); \
fi
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Dependencies
.depend: Makefile chip/Make.defs $(SRCS)
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \

View file

@ -53,7 +53,7 @@ LDFLAGS = @"${shell cygpath -w $(ARCHSRCDIR)/nuttx.linkcmd}"
endif
HEAD_ASRC = $(HEAD_SSRC:.S=$(ASMEXT))
HEAD_AOBJ = $(HEAD_SSRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_SSRC:.S=$(OBJEXT))
SSRCS = $(CHIP_SSRCS) $(CMN_SSRCS)
ASRCS = $(SSRCS:.S=$(ASMEXT))
@ -77,10 +77,10 @@ $(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
@cat $@.tmp | sed -e "s/^#/;/g" > $@
@rm $@.tmp
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %$(ASMEXT)
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT)
$(call ASSEMBLE, $<, $@)
else
$(OBJS) $(HEAD_AOBJ): %$(OBJEXT): %.S
$(OBJS) $(HEAD_OBJ): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
endif
@ -99,7 +99,7 @@ ifeq ($(COMPILER),zneocc.exe)
nuttx.linkcmd: $(LINKCMDTEMPLATE)
@cp -f $(LINKCMDTEMPLATE) nuttx.linkcmd
@echo "\"${shell cygpath -w $(TOPDIR)/nuttx}\"= \\" >>nuttx.linkcmd
@echo " \"${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_AOBJ)}\", \\" >>nuttx.linkcmd
@echo " \"${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_OBJ)}\", \\" >>nuttx.linkcmd
@( for lib in $(LINKLIBS); do \
echo " \"`cygpath -w $(TOPDIR)/$${lib}`\", \\" >>nuttx.linkcmd; \
done ; )
@ -110,7 +110,7 @@ else
nuttx.linkcmd:
endif
nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) nuttx.linkcmd
@echo "LD: nuttx.hex"
@$(LD) $(LDFLAGS)
@ -121,6 +121,18 @@ nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd
@$(MKDEP) --dep-path chip --dep-path common $(CC) -- $(CFLAGS) -- $(DEPSRCS) >Make.dep
@touch $@
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Dependencies
depend: .depend
clean:

View file

@ -1,7 +1,7 @@
############################################################################
# arch/z80/src/Makefile
#
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without

View file

@ -45,7 +45,7 @@ CPPFLAGS += -D__ASSEMBLY__
# There should be one head source (.asm file)
HEAD_AOBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT))
# Assembly sources and objects
@ -84,9 +84,9 @@ HEAP_BASE = ${shell ./mkhpbase.sh}
############################################################################
# Targets
all: $(HEAD_AOBJ) libarch$(LIBEXT)
all: $(HEAD_OBJ) libarch$(LIBEXT)
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %$(ASMEXT)
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT)
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
@ -143,7 +143,7 @@ board/libboard$(LIBEXT):
# This target builds the final executable
pass1.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboard$(LIBEXT)
pass1.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: pass1.ihx"
@echo "--" >pass1.lnk # Non-interactive
@echo "-k $(BOARDDIR)" >>pass1.lnk # Path to board library
@ -168,15 +168,15 @@ endif
@echo "-m" >>pass1.lnk # Generate a map file
@echo "-j" >>pass1.lnk # Generate a symbol file
@echo "pass1.ihx" >>pass1.lnk # Path to head object
@echo "$(HEAD_AOBJ)" >>pass1.lnk # Path to head object
@echo "$(HEAD_OBJ)" >>pass1.lnk # Path to head object
@echo "-e" >>pass1.lnk # End of script
@$(LD) -f pass1.lnk
@rm -f up_mem.h asm_mem.h
@rm -f up_allocateheap$(OBJEXT) $(HEAD_AOBJ) libarch$(LIBEXT)
@rm -f up_allocateheap$(OBJEXT) $(HEAD_OBJ) libarch$(LIBEXT)
@$(MAKE) TOPDIR="$(TOPDIR)" libarch$(LIBEXT)
@$(MAKE) TOPDIR="$(TOPDIR)" $(HEAD_AOBJ)
@$(MAKE) TOPDIR="$(TOPDIR)" $(HEAD_OBJ)
nuttx.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboard$(LIBEXT)
nuttx.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx.ihx"
@echo "--" >nuttx.lnk # Non-interactive
@echo "-k $(BOARDDIR)" >>nuttx.lnk # Path to board library
@ -201,7 +201,7 @@ endif
@echo "-m" >>nuttx.lnk # Generate a map file
@echo "-j" >>nuttx.lnk # Generate a symbol file
@echo "nuttx.ihx" >>nuttx.lnk # Path to head object
@echo "$(HEAD_AOBJ)" >>nuttx.lnk # Path to head object
@echo "$(HEAD_OBJ)" >>nuttx.lnk # Path to head object
@echo "-e" >>nuttx.lnk # End of script
@$(LD) -f nuttx.lnk
@ -215,6 +215,16 @@ else
@packihx nuttx.ihx > $(TOPDIR)/nuttx$(EXEEXT)
endif
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Build dependencies
.depend: Makefile up_mem.h asm_mem.h chip/Make.defs $(DEPSRCS)

View file

@ -47,9 +47,9 @@ LDFLAGS = @"${shell cygpath -w $(ARCHSRCDIR)/nuttx.linkcmd}"
# Files and directories
ifneq ($(HEAD_SSRC),)
HEAD_GENSRC = $(HEAD_SSRC:.S=$(ASMEXT))
HEAD_AOBJ = $(HEAD_SSRC:.S=$(OBJEXT))
HEAD_OBJ = $(HEAD_SSRC:.S=$(OBJEXT))
else
HEAD_AOBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT))
HEAD_OBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT))
endif
SSRCS = $(CHIP_SSRCS) $(CMN_SSRCS)
@ -76,7 +76,7 @@ $(HEAD_GENSRC) $(GENSRCS) : %$(ASMEXT): %.S
@cat $@.tmp | sed -e "s/^#/;/g" > $@
@rm $@.tmp
$(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %$(ASMEXT)
$(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT)
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
@ -93,7 +93,7 @@ board/libboard$(LIBEXT):
nuttx.linkcmd: $(LINKCMDTEMPLATE)
@cp -f $(LINKCMDTEMPLATE) nuttx.linkcmd
@echo "\"${shell cygpath -w $(TOPDIR)/nuttx}\"= \\" >>nuttx.linkcmd
@echo " \"${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_AOBJ)}\", \\" >>nuttx.linkcmd
@echo " \"${shell cygpath -w $(ARCHSRCDIR)/$(HEAD_OBJ)}\", \\" >>nuttx.linkcmd
@( for lib in $(LINKLIBS); do \
echo " \"`cygpath -w $(TOPDIR)/$${lib}`\", \\" >>nuttx.linkcmd; \
done ; )
@ -120,7 +120,7 @@ ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
@echo " \"${shell cygpath -w $(ZDSZILOGLIBDIR)/uartf91$(LIBEXT)}\"" >>nuttx.linkcmd
endif
nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) nuttx.linkcmd
@echo "LD: nuttx.hex"
@$(LD) $(LDFLAGS)
@ -131,6 +131,18 @@ nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd
@$(MKDEP) --dep-path chip --dep-path common $(CC) -- $(CFLAGS) -- $(DEPSRCS) >Make.dep
@touch $@
# This is part of the top-level export target
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
exit 1; \
fi
# Dependencies
depend: .depend
clean:

View file

@ -529,6 +529,7 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
*/
#if defined(CONFIG_DEBUG) && defined (CONFIG_DEBUG_VERBOSE) && defined(CONFIG_DEBUG_FS)
memset(&decoded, 0, sizeof(struct mmcsd_csd_s));
decoded.csdstructure = csd[0] >> 30;
decoded.mmcspecvers = (csd[0] >> 26) & 0x0f;
decoded.taac.timevalue = (csd[0] >> 19) & 0x0f;

208
tools/mkexport.sh Executable file
View file

@ -0,0 +1,208 @@
#!/bin/bash
# tools/mkexport.sh
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# TODO:
# 1. This script assumes the host archiver ar may not be appropriate for
# non-GCC toolchains
# 2. For the kernel build, the user libriars should be built into some
# libuser.a. The list of user libraries would have to accepted with
# some new argument, perhaps -u.
# Get the input parameter list
USAGE="USAGE: $0 [-d] -t <top-dir> -a <arch-dir> [-x <lib-ext>] -l \"lib1 [lib2 [lib3 ...]]\""
unset TOPDIR
unset ARCH
unset LIBLIST
LIBEXT=.a
while [ ! -z "$1" ]; do
case $1 in
-a )
shift
ARCH=$1
;;
-d )
set -x
;;
-l )
shift
LIBLIST=$1
;;
-t )
shift
TOPDIR=$1
;;
-x )
shift
LIBEXT=$1
;;
-h )
echo $USAGE
exit 0
;;
* )
echo "Unrecognized argument: $1"
echo $USAGE
exit 1
;;
esac
shift
done
# Check arguments
if [ -z "${TOPDIR}" -o -z "${ARCH}" -o -z "${LIBLIST}" ]; then
echo "MK: Missing required arguments"
echo $USAGE
exit 1
fi
if [ ! -d "${TOPDIR}" ]; then
echo "MK: Directory ${TOPDIR} does not exist"
exit 1
fi
if [ ! -f "${TOPDIR}/Make.defs" ]; then
echo "MK: File ${TOPDIR}/Make.defs does not exist"
exit 1
fi
ARCHSUBDIR="arch/${ARCH}/src"
ARCHDIR="${TOPDIR}/${ARCHSUBDIR}"
if [ ! -d "${ARCHDIR}" ]; then
echo "MK: Directory ${ARCHDIR} does not exist"
exit 1
fi
# Get the version string
if [ ! -f "${TOPDIR}/.version" ]; then
echo "MK: File ${TOPDIR}/.version does not exist"
exit 1
fi
source "${TOPDIR}/.version"
if [ ! -z "${CONFIG_VERSION_STRING}" -a "${CONFIG_VERSION_STRING}" != "0.0" ]; then
VERSION="-${CONFIG_VERSION_STRING}"
fi
# Create the export directory
EXPORTSUBDIR="nuttx-export${VERSION}"
EXPORTDIR="${TOPDIR}/${EXPORTSUBDIR}"
# If the export directory already exists, then remove it and create a new one
if [ -d "${EXPORTDIR}" ]; then
echo "MK: Removing old export directory"
rm -rf "${EXPORTDIR}"
fi
rm -f "${EXPORTDIR}.tar"
rm -f "${EXPORTDIR}.tar.gz"
mkdir "${EXPORTDIR}" || { echo "MK: 'mkdir ${EXPORTDIR}' failed"; exit 1; }
mkdir "${EXPORTDIR}/startup" || { echo "MK: 'mkdir ${EXPORTDIR}/startup' failed"; exit 1; }
mkdir "${EXPORTDIR}/libs" || { echo "MK: 'mkdir ${EXPORTDIR}/libs' failed"; exit 1; }
# Copy the NuttX include directory (retaining attributes and following symbolic links)
cp -LR --preserve=all "${TOPDIR}/include" "${EXPORTDIR}/." || \
{ echo "MK: 'cp ${TOPDIR}/include' failed"; exit 1; }
find "${EXPORTDIR}/include" -name .svn | xargs rm -rf
# Copy the startup object file(s)
make -C ${ARCHDIR} export_head TOPDIR=${TOPDIR} EXPORT_DIR="${EXPORTDIR}"
# Add the board library to the list of libraries
if [ -f "${ARCHDIR}/board/libboard${LIBEXT}" ]; then
LIBLIST="${LIBLIST} ${ARCHSUBDIR}/board/libboard${LIBEXT}"
fi
# Then process each library
for lib in ${LIBLIST}; do
if [ ! -f "${TOPDIR}/${lib}" ]; then
echo "MK: Library ${TOPDIR}/${lib} does not exist"
exit 1
fi
# Get some shorter names for the library
libname=`basename ${lib} ${LIBEXT}`
shortname=`echo ${libname} | sed -e "s/^lib//g"`
# Copy the application library unmodified
if [ "X${libname}" = "Xlibapps" ]; then
cp --preserve=all "${TOPDIR}/${lib}" "${EXPORTDIR}/libs/."
else
# Create a temporary directory and extract all of the objects there
# Hmmm.. this probably won't work if the archiver is not 'ar'
mkdir "${EXPORTDIR}/tmp" || \
{ echo "MK: 'mkdir ${EXPORTDIR}/tmp' failed"; exit 1; }
cd "${EXPORTDIR}/tmp" || \
{ echo "MK: 'cd ${EXPORTDIR}/tmp' failed"; exit 1; }
ar x "${TOPDIR}/${lib}"
# Rename each object file (to avoid collision when they are combined)
# and add the file to libnuttx
for file in `ls`; do
mv "${file}" "${shortname}-${file}"
ar rcs "${EXPORTDIR}/libs/libnuttx${LIBEXT}" "${shortname}-${file}"
done
cd "${TOPDIR}" || \
{ echo "MK: 'cd ${TOPDIR}' failed"; exit 1; }
rm -rf "${EXPORTDIR}/tmp"
fi
done
# Now tar up the whole export directory
cd "${TOPDIR}" || \
{ echo "MK: 'cd ${TOPDIR}' failed"; exit 1; }
tar cvf "${EXPORTSUBDIR}.tar" "${EXPORTSUBDIR}" 1>/dev/null 2>&1
gzip -f "${EXPORTSUBDIR}.tar"
# Clean up after ourselves
rm -rf "${EXPORTSUBDIR}"