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
This commit is contained in:
patacongo 2007-03-26 22:14:28 +00:00
parent c0934f429d
commit 8e8fc062a5
14 changed files with 129 additions and 48 deletions

View File

@ -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

View File

@ -295,6 +295,8 @@ below and discussed in the following paragraphs:</p>
<ul><pre>
&lt;<i>board-name</i>&gt;
|-- include/
|-- src/
| `-- Makefile
|-- Make.defs
|-- defconfig
`-- setenv.sh
@ -310,6 +312,17 @@ below and discussed in the following paragraphs:</p>
These header file can only be included by files in <code>arch/&lt;arch-name&gt;/include/</code>
and <code>arch/&lt;arch-name&gt;/src/</code>.
</li>
<li>
<code>src/</code>:
This directory contains board specific drivers.
This directory will be linked as <config>arch/&lt;arch-name&gt;/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

View File

@ -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

26
TODO
View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -117,7 +117,7 @@ __start:
#endif
/* Initialize onboard LEDs */
#ifdef CONFIG_C5471_LEDS
#ifdef CONFIG_ARCH_LEDS
bl up_ledinit
#endif

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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
#

View File

@ -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

View File

@ -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
#

View File

@ -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