diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-26 22:14:28 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-26 22:14:28 +0000 |
commit | e3872c255c376176d377b0cb03ceedfe4b487242 (patch) | |
tree | 29e7e91187bc9192125e8d22dbf0408886fd1a97 | |
parent | 06c5cbbff4968fac4181d2204b1985252f4d5016 (diff) | |
download | px4-nuttx-e3872c255c376176d377b0cb03ceedfe4b487242.tar.gz px4-nuttx-e3872c255c376176d377b0cb03ceedfe4b487242.tar.bz2 px4-nuttx-e3872c255c376176d377b0cb03ceedfe4b487242.zip |
Add a directory to hold board-specific drivers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@151 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/ChangeLog | 1 | ||||
-rw-r--r-- | nuttx/Documentation/NuttxPortingGuide.html | 13 | ||||
-rw-r--r-- | nuttx/Makefile | 34 | ||||
-rw-r--r-- | nuttx/TODO | 26 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/Makefile | 21 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_assert.c | 4 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_head.S | 2 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/up_internal.h | 2 | ||||
-rw-r--r-- | nuttx/configs/README.txt | 12 | ||||
-rw-r--r-- | nuttx/configs/c5471evm/defconfig | 20 | ||||
-rw-r--r-- | nuttx/configs/m68332evb/defconfig | 12 | ||||
-rw-r--r-- | nuttx/configs/ntosd-dm320/defconfig | 12 | ||||
-rw-r--r-- | nuttx/configs/pjrc-8051/defconfig | 6 | ||||
-rw-r--r-- | nuttx/configs/sim/defconfig | 12 |
14 files changed, 129 insertions, 48 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 7814921b2..67d641ea6 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -87,6 +87,7 @@ errno; pthread_setscheduler() now returns the correct errno. * Added pthread_setschedprio(). * Added directories to hold board-specific header files + * Added directories to hold board-specific drivers * Started m68322 diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index c970198fc..e609b5287 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -295,6 +295,8 @@ below and discussed in the following paragraphs:</p> <ul><pre> <<i>board-name</i>> |-- include/ + |-- src/ + | `-- Makefile |-- Make.defs |-- defconfig `-- setenv.sh @@ -311,6 +313,17 @@ below and discussed in the following paragraphs:</p> and <code>arch/<arch-name>/src/</code>. </li> <li> + <code>src/</code>: + This directory contains board specific drivers. + This directory will be linked as <config>arch/<arch-name>/src/board</config> at configuration + time and will be integrated into the build system. + </li> + <li> + <code>src/Makefile</code>: + This makefile will be invoked to build the board specific drivers. + It must support the following targets: <code>libext$(LIBEXT)</code>, <code>clean</code>, and <code>distclean</code>. + </li> + <li> <code>Make.defs</code>: This makefile fragment provides architecture and tool-specific build options. It will be included by all other makefiles in the build (once it is installed). This make fragment diff --git a/nuttx/Makefile b/nuttx/Makefile index 34cc90910..69ad07da2 100644 --- a/nuttx/Makefile +++ b/nuttx/Makefile @@ -80,12 +80,21 @@ include/arch/board: Make.defs include/arch fi @ln -s $(TOPDIR)/$(BOARD_DIR)/include include/arch/board -context: check_context include/nuttx/config.h include/arch include/arch/board +$(ARCH_SRC)/board: Make.defs + @if [ -e $(ARCH_SRC)/board ]; then \ + if [ -h $(ARCH_SRC)/board ]; then \ + rm -f $(ARCH_SRC)/board ; \ + else \ + echo "$(ARCH_SRC)/board exists but is not a symbolic link" ; \ + exit 1 ; \ + fi ; \ + fi + @ln -s $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board + +context: check_context include/nuttx/config.h include/arch include/arch/board $(ARCH_SRC)/board clean_context: - rm -f include/nuttx/config.h - rm -f include/arch - rm -f include/arch/board + rm -f include/nuttx/config.h include/arch include/arch/board $(ARCH_SRC)/board check_context: @if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \ @@ -123,19 +132,26 @@ depend: $(MAKE) -C $$dir TOPDIR=$(TOPDIR) depend ; \ done -clean: +subdir_clean: @for dir in $(SUBDIRS) ; do \ - $(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \ + if [ -e $$dir/Makefile ]; then \ + $(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \ + fi \ done $(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) clean $(MAKE) -C mm -f Makefile.test TOPDIR=$(TOPDIR) clean + +clean: subdir_clean rm -f $(BIN) $(BIN).* mm_test *.map *~ -distclean: clean clean_context +subdir_distclean: @for dir in $(SUBDIRS) ; do \ - $(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \ + if [ -e $$dir/Makefile ]; then \ + $(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \ + fi \ done - $(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR=$(TOPDIR) distclean + +distclean: clean subdir_distclean clean_context rm -f Make.defs setenv.sh .config diff --git a/nuttx/TODO b/nuttx/TODO index 9f83c3e42..c15c8d23b 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -27,15 +27,16 @@ o pthreads - pthread_cancel(): Should implemenent cancellation points and pthread_testcancel() o Libraries -- There needs to be some kind of mutual exclusion protection on buffered - I/O. If two threads try fflush-ing at the same time, there is corruption - of the output. -- At present, there is a failure in the examples/ostest POSIX timer - test when CONFIG_DEBUG is enabled. This is almost certainly yet - another case where printf (or its kin) are being called from a - sensitive area in the OS. -- I am now seeing the same thing with the dm320 barrier test. - Apparently printf has some thread safety issues. +- There seems to be some kind of failure in the mutual exclusion logic on + buffered, "standard," IO. + - If two threads try fflush-ing at the same time, there is corruption + of the output. + - Yhere is a failure in the examples/ostest POSIX timer + test when CONFIG_DEBUG is enabled. This is almost certainly yet + another case where printf (or its kin) are being called from a + sensitive area in the OS. + - I am now seeing the same thing with the dm320 barrier test. + Apparently printf has some thread safety issues. o File system - Add some concept like mount points to handle mounted "real" filesystems. @@ -47,6 +48,13 @@ o Documentation - Document filesystem, library o Build system +- Names under arch are incorrect. These should hold processor architectures. + c5471 should be arm7 + dm320 should be arm9 + pjrc-8051 should be 805x +- SoC-specific logic should be in subdirectories under arch/<processor-name>. + Eg. arm7/include/c5471 should hold c5471 specific header files +- configs/pjrc-8051 should be configs/pjrc-87c52 o Applications & Tests diff --git a/nuttx/arch/c5471/src/Makefile b/nuttx/arch/c5471/src/Makefile index b282cbf8d..770c4e3a6 100644 --- a/nuttx/arch/c5471/src/Makefile +++ b/nuttx/arch/c5471/src/Makefile @@ -51,7 +51,7 @@ CSRCS = up_initialize.c up_initialstate.c up_idle.c up_doirq.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 \ - up_delay.c up_allocateheap.c up_leds.c up_watchdog.c + up_delay.c up_allocateheap.c up_watchdog.c COBJS = $(CSRCS:.c=.o) SRCS = $(ASRCS) $(CSRCS) @@ -65,6 +65,8 @@ LINKLIBS = LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) +BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board + LIBGCC = ${shell $(CC) -print-libgcc-file-name} all: up_head.o libarch$(LIBEXT) @@ -81,9 +83,12 @@ libarch$(LIBEXT): $(OBJS) { echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \ done ; ) -nuttx: $(LINKOBJS) - $(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \ - --start-group $(LDLIBS) --end-group $(EXTRA_LIBS) $(LIBGCC) +board/libboard$(LIBEXT): + $(MAKE) -C board TOPDIR=$(TOPDIR) libboard$(LIBEXT) + +nuttx: $(LINKOBJS) board/libboard$(LIBEXT) + $(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(LINKOBJS) \ + --start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC) @$(NM) $(TOPDIR)/$@ | \ grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ sort > $(TOPDIR)/System.map @@ -100,15 +105,23 @@ ifeq ($(CONFIG_RRLOAD_BINARY),y) endif .depend: Makefile $(SRCS) + echo $(SRCS) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + $(MAKE) -C board TOPDIR=$(TOPDIR) depend touch $@ depend: .depend clean: rm -f libarch$(LIBEXT) *.o *~ + @if [ -e board/Makefile ]; then \ + $(MAKE) -C board TOPDIR=$(TOPDIR) clean ; \ + fi distclean: clean rm -f Make.dep .depend + @if [ -e board/Makefile ]; then \ + $(MAKE) -C board TOPDIR=$(TOPDIR) distclean ; \ + fi -include Make.dep diff --git a/nuttx/arch/c5471/src/up_assert.c b/nuttx/arch/c5471/src/up_assert.c index 6edc2c4df..0dad02f89 100644 --- a/nuttx/arch/c5471/src/up_assert.c +++ b/nuttx/arch/c5471/src/up_assert.c @@ -79,7 +79,7 @@ static inline uint32 up_getsp(void) * Name: up_stackdump ************************************************************/ -#ifdef CONFIG_C5471_STACKDUMP +#ifdef CONFIG_ARCH_STACKDUMP static void up_stackdump(void) { _TCB *rtcb = (_TCB*)g_readytorun.head; @@ -137,7 +137,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ (void)irqsave(); for(;;) { -#ifdef CONFIG_C5471_LEDS +#ifdef CONFIG_ARCH_LEDS up_ledon(LED_PANIC); up_delay(250); up_ledoff(LED_PANIC); diff --git a/nuttx/arch/c5471/src/up_head.S b/nuttx/arch/c5471/src/up_head.S index 770caddce..d681a177e 100644 --- a/nuttx/arch/c5471/src/up_head.S +++ b/nuttx/arch/c5471/src/up_head.S @@ -117,7 +117,7 @@ __start: #endif /* Initialize onboard LEDs */ -#ifdef CONFIG_C5471_LEDS +#ifdef CONFIG_ARCH_LEDS bl up_ledinit #endif diff --git a/nuttx/arch/c5471/src/up_internal.h b/nuttx/arch/c5471/src/up_internal.h index 60cc25273..fc5f92f7b 100644 --- a/nuttx/arch/c5471/src/up_internal.h +++ b/nuttx/arch/c5471/src/up_internal.h @@ -153,7 +153,7 @@ extern void up_maskack_irq(int irq); /* Defined in up_leds.c */ -#ifdef CONFIG_C5471_LEDS +#ifdef CONFIG_ARCH_LEDS extern void up_ledinit(void); extern void up_ledon(int led); extern void up_ledoff(int led); diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 5962c34a4..e15c57c36 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -25,6 +25,8 @@ following characteristics: <board-name> |-- include/ + |-- src/ + | `-- Makefile |-- Make.defs |-- defconfig `-- setenv.sh @@ -32,12 +34,20 @@ following characteristics: Summary of Files ^^^^^^^^^^^^^^^^ -include/ -- This directoy contains board specific header files. This +include/ -- This directory contains board specific header files. This directory will be linked as include/arch/board at configuration time and can be included via '#include <arch/board/header.h>'. These header file can only be included by files in arch/<arch-name>include/ and arch/<arch-name>/src +src/ -- This directory contains board specific drivers. This + directory will be linked as arch/<arch-name>/src/board at configuration + time and will be integrated into the build system. + +src/Makefile -- This makefile will be invoked to build the board specific + drivers. It must support the following targets: libext$(LIBEXT), clean, + and distclean. + Make.defs -- This makefile fragment provides architecture and tool-specific build options. It will be included by all other makefiles in the build (once it is installed). This make fragment diff --git a/nuttx/configs/c5471evm/defconfig b/nuttx/configs/c5471evm/defconfig index a65cdb435..2971805c5 100644 --- a/nuttx/configs/c5471evm/defconfig +++ b/nuttx/configs/c5471evm/defconfig @@ -35,15 +35,19 @@ # # architecture selection # -# CONFIG_ARCH - identifies the arch subdirectory -# CONFIG_ARCH_name - for use in C code -# CONFIG_BOARD - identifies the configs subdirectory -# CONFIG_BARD_name - for use in C code +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_name - for use in C code. This identifies the +# particular chip or SoC that the architecture is implemented +# in. +# CONFIG_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_BOARD_name - for use in C code # CONFIG_ROM_VECTORS - unique to c5471 # CONFIG_DRAM_END - the size of installed DRAM. # Unique to c5471 -# CONFIG_C5471_LEDS - Use LEDs to show state. Unique to c5471. -# CONFIG_C5471_STACKDUMP - Do stack dumps after assertions +# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to c5471. +# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions # CONFIG_ARCH=c5471 CONFIG_ARCH_C5471=y @@ -51,8 +55,8 @@ CONFIG_BOARD=c5471evm CONFIG_BOARD_C5471EVM=y CONFIG_ROM_VECTORS=n CONFIG_DRAM_END=0x11000000 -CONFIG_C5471_LEDS=y -CONFIG_C5471_STACKDUMP=y +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_STACKDUMP=y # # C5471 specific device driver settings diff --git a/nuttx/configs/m68332evb/defconfig b/nuttx/configs/m68332evb/defconfig index 86a7e059a..c63dc6aa2 100644 --- a/nuttx/configs/m68332evb/defconfig +++ b/nuttx/configs/m68332evb/defconfig @@ -35,10 +35,14 @@ # # architecture selection # -# CONFIG_ARCH - identifies the arch subdirectory -# CONFIG_ARCH_name - for use in C code -# CONFIG_BOARD - identifies the configs subdirectory -# CONFIG_BARD_name - for use in C code +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_name - for use in C code. This identifies the +# particular chip or SoC that the architecture is implemented +# in. +# CONFIG_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_BOARD_name - for use in C code # CONFIG_DRAM_SIZE - Describes the installed DRAM. # CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions # diff --git a/nuttx/configs/ntosd-dm320/defconfig b/nuttx/configs/ntosd-dm320/defconfig index 1763fe0f4..7ea06e217 100644 --- a/nuttx/configs/ntosd-dm320/defconfig +++ b/nuttx/configs/ntosd-dm320/defconfig @@ -35,10 +35,14 @@ # # architecture selection # -# CONFIG_ARCH - identifies the arch subdirectory -# CONFIG_ARCH_name - for use in C code -# CONFIG_BOARD - identifies the configs subdirectory -# CONFIG_BARD_name - for use in C code +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_name - for use in C code. This identifies the +# particular chip or SoC that the architecture is implemented +# in. +# CONFIG_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_BOARD_name - for use in C code # CONFIG_ROM_VECTORS - unique to dm320 # CONFIG_DRAM_SIZE - Describes the installed DRAM. # CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions diff --git a/nuttx/configs/pjrc-8051/defconfig b/nuttx/configs/pjrc-8051/defconfig index 316bda2b4..cc5da93bd 100644 --- a/nuttx/configs/pjrc-8051/defconfig +++ b/nuttx/configs/pjrc-8051/defconfig @@ -35,9 +35,13 @@ # # Architecture selection # -# CONFIG_ARCH - identifies the arch subdirectory +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. # CONFIG_ARCH_8051 - Set if processor is 8051 family # CONFIG_ARCH_8052 = Set if processor is 8052 family +# CONFIG_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_BOARD_name - for use in C code # CONFIG_BOARD - identifies the configs subdirectory # CONFIG_BARD_name - for use in C code # diff --git a/nuttx/configs/sim/defconfig b/nuttx/configs/sim/defconfig index 13e1030ee..935ca1db2 100644 --- a/nuttx/configs/sim/defconfig +++ b/nuttx/configs/sim/defconfig @@ -35,10 +35,14 @@ # # architecture selection # -# CONFIG_ARCH - identifies the arch subdirectory -# CONFIG_ARCH_name - for use in C code -# CONFIG_BOARD - identifies the configs subdirectory -# CONFIG_BARD_name - for use in C code +# CONFIG_ARCH - identifies the arch subdirectory and, hence, the +# processor architecture. +# CONFIG_ARCH_name - for use in C code. This identifies the +# particular chip or SoC that the architecture is implemented +# in. +# CONFIG_BOARD - identifies the configs subdirectory and, hence, +# the board that supports the particular chip or SoC. +# CONFIG_BOARD_name - for use in C code # CONFIG_ARCH=sim CONFIG_ARCH_SIM=y |