diff --git a/ChangeLog b/ChangeLog index 219245cfa2e669fbcf678c3bd1fc306c2f47376b..9e7bace448f1ef6044a06dfba6fcbd0d5a57dc70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. \ No newline at end of file diff --git a/Makefile b/Makefile index 07c07ddec85b0bee1aa199931feb739d88f565ed..9d14608739786c4b2dd6a5ce339f4d52dc39e308 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/TODO b/TODO index a2f1eb1f8a0dd8c2746d81ef3a69cd7e404674f9..88a86e06d258948f7d52bdab341911eb74dd87eb 100644 --- a/TODO +++ b/TODO @@ -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) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/arch/8051/src/Makefile b/arch/8051/src/Makefile index 6f1907bc426bd8ea51e005a8ff403d751997d0fd..f045189135475a5027e5d07775e7b1ced31aa287 100644 --- a/arch/8051/src/Makefile +++ b/arch/8051/src/Makefile @@ -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 diff --git a/arch/arm/src/Makefile b/arch/arm/src/Makefile index 22327afc0b5018f3ec99602138906fe144c3dff0..0875ad95c0514592c8363d5d3b6e3f935ab82198 100644 --- a/arch/arm/src/Makefile +++ b/arch/arm/src/Makefile @@ -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 ; \ diff --git a/arch/avr/src/Makefile b/arch/avr/src/Makefile index 1f8c41e7c2800e4ebaed611f1958011b60af7ade..7683bcfdd1187271830d4125ca1c737210ba7373 100644 --- a/arch/avr/src/Makefile +++ b/arch/avr/src/Makefile @@ -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 ; \ diff --git a/arch/hc/src/Makefile b/arch/hc/src/Makefile index d33dcc848946586c3704709f308706754f8297e1..57a6d43057b2aeb2a9a639f26a81ca7887559952 100755 --- a/arch/hc/src/Makefile +++ b/arch/hc/src/Makefile @@ -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 ; \ diff --git a/arch/mips/src/Makefile b/arch/mips/src/Makefile index 872b7e568aebb9036581485935101bb922b16653..19981282f49ce03ea80663bfbd2f29997a893448 100644 --- a/arch/mips/src/Makefile +++ b/arch/mips/src/Makefile @@ -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 ; \ diff --git a/arch/rgmp/src/Makefile b/arch/rgmp/src/Makefile index c881e2d6daa2160a74f6058da8e2fc137b842a7d..ae2c6887611c4fd851dafb86dc74ce26062158b4 100644 --- a/arch/rgmp/src/Makefile +++ b/arch/rgmp/src/Makefile @@ -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 $@ diff --git a/arch/sh/src/Makefile b/arch/sh/src/Makefile index 62b72133ee9cbc615202d2e08cd700c4e21e3c3b..56fe3ac5ed81b24231bac60872819fb93053f2c0 100644 --- a/arch/sh/src/Makefile +++ b/arch/sh/src/Makefile @@ -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 ; \ diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index f32f17b010e4c4f0a5fdaae1e48ef87adc285c42..397a2d84a67da852f061c25b171d232cbe9edacf 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -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 $@ diff --git a/arch/x86/src/Makefile b/arch/x86/src/Makefile index b943652769568bdde2e62b7cefdec7f16cea1e08..e0e92eacddee1c49aa9e72aeb84f3ce6fef3f654 100644 --- a/arch/x86/src/Makefile +++ b/arch/x86/src/Makefile @@ -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 ; \ diff --git a/arch/z16/src/Makefile b/arch/z16/src/Makefile index 86ab8d9181dd278cb0e466ac1e178702729d5d12..56ae6eb54cba0c8fc0cd47e6eff13fc05ce45832 100644 --- a/arch/z16/src/Makefile +++ b/arch/z16/src/Makefile @@ -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: diff --git a/arch/z80/src/Makefile b/arch/z80/src/Makefile index 6cc1463d0fecee52c80da70869812c5db606016b..93f32aa9d2c3c0cd089792eda4a3dd3956b227e1 100644 --- a/arch/z80/src/Makefile +++ b/arch/z80/src/Makefile @@ -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 diff --git a/arch/z80/src/Makefile.sdcc b/arch/z80/src/Makefile.sdcc index bc5e4aa7989e9b19d73f9bce12e624d90fe63a65..24099fc92b68c70444a8c62df2a28ac1c6315786 100644 --- a/arch/z80/src/Makefile.sdcc +++ b/arch/z80/src/Makefile.sdcc @@ -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) diff --git a/arch/z80/src/Makefile.zdsii b/arch/z80/src/Makefile.zdsii index 51db8771d4969eb4f294cf338401ec36fe2562d7..319d94cb290073a34bbd99651f4f7b16a87e13cc 100644 --- a/arch/z80/src/Makefile.zdsii +++ b/arch/z80/src/Makefile.zdsii @@ -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: diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index a37008614aa2475ce8034fdbbe0947137d0e6689..1434c440c6ee61ace134ae33a18a50b0b45404c8 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -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; diff --git a/tools/mkexport.sh b/tools/mkexport.sh new file mode 100755 index 0000000000000000000000000000000000000000..d7fede43f9d36c2dbda0f9c0163e9466775ce431 --- /dev/null +++ b/tools/mkexport.sh @@ -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}"