9
0
Fork 0

Add a directory to hold board-specific drivers

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@151 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2007-03-26 22:14:28 +00:00
parent f8d3e64b7c
commit bc06cdcd56
14 changed files with 129 additions and 48 deletions

View File

@ -87,6 +87,7 @@
errno; pthread_setscheduler() now returns the correct errno. errno; pthread_setscheduler() now returns the correct errno.
* Added pthread_setschedprio(). * Added pthread_setschedprio().
* Added directories to hold board-specific header files * Added directories to hold board-specific header files
* Added directories to hold board-specific drivers
* Started m68322 * Started m68322

View File

@ -295,6 +295,8 @@ below and discussed in the following paragraphs:</p>
<ul><pre> <ul><pre>
&lt;<i>board-name</i>&gt; &lt;<i>board-name</i>&gt;
|-- include/ |-- include/
|-- src/
| `-- Makefile
|-- Make.defs |-- Make.defs
|-- defconfig |-- defconfig
`-- setenv.sh `-- 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> 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>. and <code>arch/&lt;arch-name&gt;/src/</code>.
</li> </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> <li>
<code>Make.defs</code>: This makefile fragment provides architecture and <code>Make.defs</code>: This makefile fragment provides architecture and
tool-specific build options. It will be included by all other 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 fi
@ln -s $(TOPDIR)/$(BOARD_DIR)/include include/arch/board @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: clean_context:
rm -f include/nuttx/config.h rm -f include/nuttx/config.h include/arch include/arch/board $(ARCH_SRC)/board
rm -f include/arch
rm -f include/arch/board
check_context: check_context:
@if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \ @if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \
@ -123,19 +132,26 @@ depend:
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) depend ; \ $(MAKE) -C $$dir TOPDIR=$(TOPDIR) depend ; \
done done
clean: subdir_clean:
@for dir in $(SUBDIRS) ; do \ @for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \ if [ -e $$dir/Makefile ]; then \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \
fi \
done done
$(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) clean $(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) clean
$(MAKE) -C mm -f Makefile.test TOPDIR=$(TOPDIR) clean $(MAKE) -C mm -f Makefile.test TOPDIR=$(TOPDIR) clean
clean: subdir_clean
rm -f $(BIN) $(BIN).* mm_test *.map *~ rm -f $(BIN) $(BIN).* mm_test *.map *~
distclean: clean clean_context subdir_distclean:
@for dir in $(SUBDIRS) ; do \ @for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \ if [ -e $$dir/Makefile ]; then \
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \
fi \
done done
$(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR=$(TOPDIR) distclean
distclean: clean subdir_distclean clean_context
rm -f Make.defs setenv.sh .config rm -f Make.defs setenv.sh .config

View File

@ -27,15 +27,16 @@ o pthreads
- pthread_cancel(): Should implemenent cancellation points and pthread_testcancel() - pthread_cancel(): Should implemenent cancellation points and pthread_testcancel()
o Libraries o Libraries
- There needs to be some kind of mutual exclusion protection on buffered - There seems to be some kind of failure in the mutual exclusion logic on
I/O. If two threads try fflush-ing at the same time, there is corruption buffered, "standard," IO.
of the output. - If two threads try fflush-ing at the same time, there is corruption
- At present, there is a failure in the examples/ostest POSIX timer of the output.
test when CONFIG_DEBUG is enabled. This is almost certainly yet - Yhere is a failure in the examples/ostest POSIX timer
another case where printf (or its kin) are being called from a test when CONFIG_DEBUG is enabled. This is almost certainly yet
sensitive area in the OS. another case where printf (or its kin) are being called from a
- I am now seeing the same thing with the dm320 barrier test. sensitive area in the OS.
Apparently printf has some thread safety issues. - I am now seeing the same thing with the dm320 barrier test.
Apparently printf has some thread safety issues.
o File system o File system
- Add some concept like mount points to handle mounted "real" filesystems. - Add some concept like mount points to handle mounted "real" filesystems.
@ -47,6 +48,13 @@ o Documentation
- Document filesystem, library - Document filesystem, library
o Build system 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 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_exit.c up_assert.c up_blocktask.c up_unblocktask.c \
up_releasepending.c up_reprioritizertr.c up_copystate.c \ up_releasepending.c up_reprioritizertr.c up_copystate.c \
up_schedulesigaction.c up_sigdeliver.c up_serial.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) COBJS = $(CSRCS:.c=.o)
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
@ -65,6 +65,8 @@ LINKLIBS =
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
LIBGCC = ${shell $(CC) -print-libgcc-file-name} LIBGCC = ${shell $(CC) -print-libgcc-file-name}
all: up_head.o libarch$(LIBEXT) all: up_head.o libarch$(LIBEXT)
@ -81,9 +83,12 @@ libarch$(LIBEXT): $(OBJS)
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \ { echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
done ; ) done ; )
nuttx: $(LINKOBJS) board/libboard$(LIBEXT):
$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \ $(MAKE) -C board TOPDIR=$(TOPDIR) libboard$(LIBEXT)
--start-group $(LDLIBS) --end-group $(EXTRA_LIBS) $(LIBGCC)
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)/$@ | \ @$(NM) $(TOPDIR)/$@ | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map sort > $(TOPDIR)/System.map
@ -100,15 +105,23 @@ ifeq ($(CONFIG_RRLOAD_BINARY),y)
endif endif
.depend: Makefile $(SRCS) .depend: Makefile $(SRCS)
echo $(SRCS)
$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(MAKE) -C board TOPDIR=$(TOPDIR) depend
touch $@ touch $@
depend: .depend depend: .depend
clean: clean:
rm -f libarch$(LIBEXT) *.o *~ rm -f libarch$(LIBEXT) *.o *~
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR=$(TOPDIR) clean ; \
fi
distclean: clean distclean: clean
rm -f Make.dep .depend rm -f Make.dep .depend
@if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR=$(TOPDIR) distclean ; \
fi
-include Make.dep -include Make.dep

View File

@ -79,7 +79,7 @@ static inline uint32 up_getsp(void)
* Name: up_stackdump * Name: up_stackdump
************************************************************/ ************************************************************/
#ifdef CONFIG_C5471_STACKDUMP #ifdef CONFIG_ARCH_STACKDUMP
static void up_stackdump(void) static void up_stackdump(void)
{ {
_TCB *rtcb = (_TCB*)g_readytorun.head; _TCB *rtcb = (_TCB*)g_readytorun.head;
@ -137,7 +137,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
(void)irqsave(); (void)irqsave();
for(;;) for(;;)
{ {
#ifdef CONFIG_C5471_LEDS #ifdef CONFIG_ARCH_LEDS
up_ledon(LED_PANIC); up_ledon(LED_PANIC);
up_delay(250); up_delay(250);
up_ledoff(LED_PANIC); up_ledoff(LED_PANIC);

View File

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

View File

@ -153,7 +153,7 @@ extern void up_maskack_irq(int irq);
/* Defined in up_leds.c */ /* Defined in up_leds.c */
#ifdef CONFIG_C5471_LEDS #ifdef CONFIG_ARCH_LEDS
extern void up_ledinit(void); extern void up_ledinit(void);
extern void up_ledon(int led); extern void up_ledon(int led);
extern void up_ledoff(int led); extern void up_ledoff(int led);

View File

@ -25,6 +25,8 @@ following characteristics:
<board-name> <board-name>
|-- include/ |-- include/
|-- src/
| `-- Makefile
|-- Make.defs |-- Make.defs
|-- defconfig |-- defconfig
`-- setenv.sh `-- setenv.sh
@ -32,12 +34,20 @@ following characteristics:
Summary of Files 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 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 be included via '#include <arch/board/header.h>'. These header file
can only be included by files in arch/<arch-name>include/ and can only be included by files in arch/<arch-name>include/ and
arch/<arch-name>/src 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 Make.defs -- This makefile fragment provides architecture and
tool-specific build options. It will be included by all other tool-specific build options. It will be included by all other
makefiles in the build (once it is installed). This make fragment makefiles in the build (once it is installed). This make fragment

View File

@ -35,15 +35,19 @@
# #
# architecture selection # architecture selection
# #
# CONFIG_ARCH - identifies the arch subdirectory # CONFIG_ARCH - identifies the arch subdirectory and, hence, the
# CONFIG_ARCH_name - for use in C code # processor architecture.
# CONFIG_BOARD - identifies the configs subdirectory # CONFIG_ARCH_name - for use in C code. This identifies the
# CONFIG_BARD_name - for use in C code # 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_ROM_VECTORS - unique to c5471
# CONFIG_DRAM_END - the size of installed DRAM. # CONFIG_DRAM_END - the size of installed DRAM.
# Unique to c5471 # Unique to c5471
# CONFIG_C5471_LEDS - Use LEDs to show state. Unique to c5471. # CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to c5471.
# CONFIG_C5471_STACKDUMP - Do stack dumps after assertions # CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
# #
CONFIG_ARCH=c5471 CONFIG_ARCH=c5471
CONFIG_ARCH_C5471=y CONFIG_ARCH_C5471=y
@ -51,8 +55,8 @@ CONFIG_BOARD=c5471evm
CONFIG_BOARD_C5471EVM=y CONFIG_BOARD_C5471EVM=y
CONFIG_ROM_VECTORS=n CONFIG_ROM_VECTORS=n
CONFIG_DRAM_END=0x11000000 CONFIG_DRAM_END=0x11000000
CONFIG_C5471_LEDS=y CONFIG_ARCH_LEDS=y
CONFIG_C5471_STACKDUMP=y CONFIG_ARCH_STACKDUMP=y
# #
# C5471 specific device driver settings # C5471 specific device driver settings

View File

@ -35,10 +35,14 @@
# #
# architecture selection # architecture selection
# #
# CONFIG_ARCH - identifies the arch subdirectory # CONFIG_ARCH - identifies the arch subdirectory and, hence, the
# CONFIG_ARCH_name - for use in C code # processor architecture.
# CONFIG_BOARD - identifies the configs subdirectory # CONFIG_ARCH_name - for use in C code. This identifies the
# CONFIG_BARD_name - for use in C code # 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_DRAM_SIZE - Describes the installed DRAM.
# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions # CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
# #

View File

@ -35,10 +35,14 @@
# #
# architecture selection # architecture selection
# #
# CONFIG_ARCH - identifies the arch subdirectory # CONFIG_ARCH - identifies the arch subdirectory and, hence, the
# CONFIG_ARCH_name - for use in C code # processor architecture.
# CONFIG_BOARD - identifies the configs subdirectory # CONFIG_ARCH_name - for use in C code. This identifies the
# CONFIG_BARD_name - for use in C code # 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_ROM_VECTORS - unique to dm320
# CONFIG_DRAM_SIZE - Describes the installed DRAM. # CONFIG_DRAM_SIZE - Describes the installed DRAM.
# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions # CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions

View File

@ -35,9 +35,13 @@
# #
# Architecture selection # 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_8051 - Set if processor is 8051 family
# CONFIG_ARCH_8052 = Set if processor is 8052 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_BOARD - identifies the configs subdirectory
# CONFIG_BARD_name - for use in C code # CONFIG_BARD_name - for use in C code
# #

View File

@ -35,10 +35,14 @@
# #
# architecture selection # architecture selection
# #
# CONFIG_ARCH - identifies the arch subdirectory # CONFIG_ARCH - identifies the arch subdirectory and, hence, the
# CONFIG_ARCH_name - for use in C code # processor architecture.
# CONFIG_BOARD - identifies the configs subdirectory # CONFIG_ARCH_name - for use in C code. This identifies the
# CONFIG_BARD_name - for use in C code # 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
CONFIG_ARCH_SIM=y CONFIG_ARCH_SIM=y