9
0
Fork 0

Add a generic GCC stdarg.h header file

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4919 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-07-08 14:50:43 +00:00
parent 92475f95bb
commit f10595f98f
14 changed files with 296 additions and 26 deletions

View File

@ -2967,4 +2967,11 @@
* arch/arm/*/lpc43xx and configs/lpc4330-xplorer and code complete and
ready for testing. Hopefully, verified LPC43xx support will appear
in NuttX-6.20.
* include/nuttx/stdarg.h: If CONFIG_ARCH_STDARG_H=y is defined, the top-level
makefile will copy the generic (GCC-only) stdarg.h header file from
include/nuttx/stdarg.h to include/stdarg.h. So for the architectures
that cannot use their GCC toolchain's stdarg.h file, they can use this
alternative by defining CONFIG_ARCH_STDARG_H=y. If CONFIG_ARCH_STDARG_H,
is not defined, then the redirecting stdarg.h header file will stay
out-of-the-way in include/nuttx/.

View File

@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec">
<i>NuttX RTOS Porting Guide</i>
</font></big></h1>
<p>Last Updated: June 19, 2012</p>
<p>Last Updated: July 8, 2012</p>
</td>
</tr>
</table>
@ -837,7 +837,7 @@
The port supports serial, timer0, spi, and usb.
</li>
<li><code>configs/mirtoo/code>:
<li><code>configs/mirtoo</code>:
This is the port to the DTX1-4000L &quot;Mirtoo&quot; module.
This module uses MicroChipPIC32MX250F128D.
See the <a href="http://www.dimitech.com/">Dimitech</a> website for further information.
@ -4330,11 +4330,69 @@ build
</p></ul>
<li>
The architecture may provide custom versions of certain standard header files:
<p>
The architecture may provide custom versions of certain standard header files:
</p>
<ul>
<li><b><code>CONFIG_ARCH_STDBOOL_H</code></b>.
<p>
The <code>stdbool.h</code> header file can be found at <code>nuttx/include/stdbool.h</code>.
However, that header includes logic to redirect the inclusion of an architecture specific header file like:
</p>
<ul><pre>
#ifdef CONFIG_ARCH_STDBOOL_H
# include &lt;arch/stdbool.h&gt;
#else
...
#endif
</pre></ul>
<p>
Recall that that include path, <code>include/arch</code>, is a symbolic link and will refer to a version of <code>stdbool.h</code> at <code>nuttx/arch/&lt;architecture&gt;/include/stdbool.h</code>.
</p>
</li>
<li><b><code>CONFIG_ARCH_STDINT_H</code></b>.
<p>
Similar logic exists for the <code>stdint.h</code> header file can also be found at <code>nuttx/include/stdint.h</code>.
<ul><pre>
#ifdef CONFIG_ARCH_STDBOOL_H
# include &lt;arch/stdinit.h&gt;
#else
...
#endif
</pre></ul>
</p>
</li>
<li><b><code>CONFIG_ARCH_MATH_H</code></b>.
<p>
There is also a re-directing version of <code>math.h</code> in the source tree. However, it resides out-of-the-way at <code>include/nuttx/math.h</code> because it conflicts too often with the system <code>math.h</code>.
If <code>CONFIG_ARCH_MATH_H=y</code> is defined, however, the top-level makefile will copy the redirecting <code>math.h</code> header file from <code>include/nuttx/math.h</code> to <code>include/math.h</code>.
<code>math.h</code> will then include the architecture-specific version of <code>math.h</code> that you must provide at <code>nuttx/arch/&lt;architecture&gt;/include/math.h</code>.
</p>
<ul><pre>
#ifdef CONFIG_ARCH_MATH_H
# include &lt;arch/math.h&gt;
#endif
</pre></ul>
<p>
So for the architectures that define <code>CONFIG_ARCH_MATH_H=y</code>, <code>include/math.h</code> will be the redirecting <code>math.h</code> header file; for the architectures that don't select <code>CONFIG_ARCH_MATH_H</code>, the redirecting <code>math.h</code> header file will stay out-of-the-way in <code>include/nuttx/</code>.
</p>
</li>
<li><b><code>CONFIG_ARCH_STDARG_H</code></b>.
<p>
There is also a redirecting version of <code>stdarg.h</code> in the source tree as well.
It also resides out-of-the-way at <code>include/nuttx/stdarg.h</code>.
This is because you should normally use your toolchain's <code>stdarg.h</code> file.
But sometimes, your toolchain's <code>stdarg.h</code> file may have other header file dependencies and so may not be usable in the NuttX build environment.
In those cases, you may have to create a architecture-specific <code>stdarg.h</code> header file at <code>nuttx/arch/&lt;architecture&gt;/include/stdarg.h</code>
</p>
<p>
If <code>CONFIG_ARCH_STDARG_H=y</code> is defined, the top-level makefile will copy the re-directing <code>stdarg.h</code> header file from <code>include/nuttx/stdarg.h</code> to <code>include/stdarg.h</code>.
So for the architectures that cannot use their toolchain's <code>stdarg.h</code> file, they can use this alternative by defining <code>CONFIG_ARCH_STDARG_H=y</code> and providing.
If <code>CONFIG_ARCH_STDARG_H</code>, is not defined, then the <code>stdarg.h</code> header file will stay out-of-the-way in <code>include/nuttx/.</code>
</p>
</li>
</ul>
</li>
<ul><p>
<code>CONFIG_ARCH_MATH_H</code>, <code>CONFIG_ARCH_STDBOOL_H</code>, <code>CONFIG_ARCH_STDINT_H</code>
</p></ul>
<li>
<p><code>CONFIG_ARCH_ROMGETC</code>:

View File

@ -1,8 +1,8 @@
############################################################################
# Makefile
#
# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -251,7 +251,7 @@ BIN = nuttx$(EXEEXT)
all: $(BIN)
.PHONY: context clean_context check_context export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
# Targets used to copy include/nuttx/math.h. If CONFIG_ARCH_MATH_H is
# Target used to copy include/nuttx/math.h. If CONFIG_ARCH_MATH_H is
# defined, then there is an architecture specific math.h header file
# that will be included indirectly from include/math.h. But first, we
# have to copy math.h from include/nuttx/. to include/.
@ -263,6 +263,18 @@ else
include/math.h:
endif
# Target used to copy include/nuttx/stdarg.h. If CONFIG_ARCH_STDARG_H is
# defined, then there is an architecture specific stdarg.h header file
# that will be included indirectly from include/stdarg.h. But first, we
# have to copy stdarg.h from include/nuttx/. to include/.
ifeq ($(CONFIG_ARCH_STDARG_H),y)
include/stdarg.h: include/nuttx/stdarg.h
@cp -f include/nuttx/stdarg.h include/stdarg.h
else
include/stdarg.h:
endif
# Targets used to build include/nuttx/version.h. Creation of version.h is
# part of the overall NuttX configuration sequency. Notice that the
# tools/mkversion tool is cuilt and used to create include/nuttx/version.h
@ -343,7 +355,7 @@ dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(
# the config.h and version.h header files in the include/nuttx directory and
# the establishment of symbolic links to configured directories.
context: check_context include/nuttx/config.h include/nuttx/version.h include/math.h dirlinks
context: check_context include/nuttx/config.h include/nuttx/version.h include/math.h include/stdarg.h dirlinks
@for dir in $(CONTEXTDIRS) ; do \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" context; \
done
@ -357,6 +369,7 @@ clean_context:
@rm -f include/nuttx/config.h
@rm -f include/nuttx/version.h
@rm -f include/math.h
@rm -f include/stdarg.h
@$(DIRUNLINK) include/arch/board
@$(DIRUNLINK) include/arch/chip
@$(DIRUNLINK) include/arch

View File

@ -135,7 +135,7 @@ Notes about Header Files
Header Files Provided by Your Toolchain.
Certain header files, such as setjmp.h, stdargs.h, and math.h, may still
Certain header files, such as setjmp.h, stdarg.h, and math.h, may still
be needed from your toolchain and your compiler may not, however, be able
to find these if you compile NuttX without using standard header file.
If that is the case, one solution is to copy those header file from
@ -171,6 +171,12 @@ Notes about Header Files
than to include that archicture-specific math.h header file as the
system math.h header file.
stdarg.h
In most cases, the correct version of stdarg.h is the version provided with your toolchain. However, sometimes there are issues with with using your toolchains stdarg.h. For example, it may attempt to draw in header files that do not exist in NuttX or perhaps the header files that is uses are not compatible with the NuttX header files. In those cases, you can use an architecture-specific stdarg.h header file by defining CONFIG_ARCH_STDARG_H=y.
See the discussion above for the math.h header. This setting works exactly
the same for the stdarg.h header file.
CONFIGURING NUTTX
^^^^^^^^^^^^^^^^^

View File

@ -1002,6 +1002,12 @@ o ARM (arch/arm/)
recall the control, but something like this should be used before
executing the SVCall so that it vectors directly to the SVC
handler.
Another, more standard option would be to use interrupt priority
levels to control interrupts. In that case, (1) The SVC would
be the highest priority interrupt (0), (2) irqsave() would set
the interrupt mask level to just above that, and (2) irqrestore
would restore the interrupt level. This would not be diffult,
but does affect a lot of files!
Status: Open
Priority: Low

View File

@ -0,0 +1,59 @@
/****************************************************************************
* arch/arm/include/stdarg.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
*
****************************************************************************/
#ifndef __ARCH_ARM_INCLUDE_STDARG_H
#define __ARCH_ARM_INCLUDE_STDARG_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* This should work with any modern gcc (newer than 3.4 or so) */
#define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#define va_copy(d,s) __builtin_va_copy(d,s)
/****************************************************************************
* Public Types
****************************************************************************/
typedef __builtin_va_list va_list;
#endif /* __ARCH_ARM_INCLUDE_STDARG_H */

View File

@ -552,6 +552,9 @@ static inline void up_enablebreaks(struct up_dev_s *priv, bool enable)
* Configure the U[S]ART divisors to accomplish the desired BAUD given the
* U[S]ART base frequency.
*
* This computationally intensive algorithm is based on the same logic
* used in the NXP sample code.
*
****************************************************************************/
void up_setbaud(struct up_dev_s *priv)

View File

@ -538,10 +538,62 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_ARCH_STRNCPY, CONFIG_ARCH_STRLEN, CONFIG_ARCH_STRNLEN
CONFIG_ARCH_BZERO
The architecture may provide custom versions of certain
standard header files:
The architecture may provide custom versions of certain standard header
files:
CONFIG_ARCH_MATH_H, CONFIG_ARCH_STDBOOL_H, CONFIG_ARCH_STDINT_H
CONFIG_ARCH_STDBOOL_H - The stdbool.h header file can be found at
nuttx/include/stdbool.h. However, that header includes logic to redirect
the inclusion of an architecture specific header file like:
#ifdef CONFIG_ARCH_STDBOOL_H
# include <arch/stdbool.h>
#else
...
#endif
Recall that that include path, include/arch, is a symbolic link and
will refer to a version of stdbool.h at nuttx/arch/<architecture>/include/stdbool.h.
CONFIG_ARCH_STDINT_H - Similar logic exists for the stdint.h header
file can also be found at nuttx/include/stdint.h.
#ifdef CONFIG_ARCH_STDBOOL_H
# include <arch/stdinit.h>
#else
...
#endif
CONFIG_ARCH_MATH_H - There is also a re-directing version of math.h in
the source tree. However, it resides out-of-the-way at include/nuttx/math.h
because it conflicts too often with the system math.h. If CONFIG_ARCH_MATH_H=y
is defined, however, the top-level makefile will copy the redirecting
math.h header file from include/nuttx/math.h to include/math.h. math.h
will then include the architecture-specific version of math.h that you
must provide at nuttx/arch/>architecture</include/math.h.
#ifdef CONFIG_ARCH_MATH_H
# include <arch/math.h>
#endif
So for the architectures that define CONFIG_ARCH_MATH_H=y, include/math.h
will be the redirecting math.h header file; for the architectures that
don't select CONFIG_ARCH_MATH_H, the redirecting math.h header file will
stay out-of-the-way in include/nuttx/.
CONFIG_ARCH_STDARG_H - There is also a redirecting version of stdarg.h in
the source tree as well. It also resides out-of-the-way at include/nuttx/stdarg.h.
This is because you should normally use your toolchain's stdarg.h file. But
sometimes, your toolchain's stdarg.h file may have other header file
dependencies and so may not be usable in the NuttX build environment. In
those cases, you may have to create a architecture-specific stdarg.h header
file at nuttx/arch/>architecture</include/stdarg.h
If CONFIG_ARCH_STDARG_H=y is defined, the top-level makefile will copy the
re-directing stdarg.h header file from include/nuttx/stdarg.h to
include/stdarg.h. So for the architectures that cannot use their toolchain's
stdarg.h file, they can use this alternative by defining CONFIG_ARCH_STDARG_H=y
and providing. If CONFIG_ARCH_STDARG_H, is not defined, then the stdarg.h
header file will stay out-of-the-way in include/nuttx/.
CONFIG_ARCH_ROMGETC - In Harvard architectures, data accesses and
instruction accesses occur on different busses, perhaps

View File

@ -52,7 +52,7 @@ LPC4330-Xplorer board
Status
======
Where is the current status of the LPC43xx port:
This is the current status of the LPC43xx port:
- The basic OS test configuration is fully coded a ready for test.
This includes: SYSTICK system time, pin and GPIO configuration,
@ -89,7 +89,7 @@ Status
- SD/MMC,
- EMC,
- SPIFI,
- SPIFI*,
- USB0,
- USB1,
- Ethernet,
@ -104,6 +104,9 @@ Status
- Event monitor, and
- CAN,
* I am not sure, exactly, what is needed for SPIFI support. There
are not SPI registers listed in the user manual.
For the missing drivers some of these can be leveraged from other
MCUs that appear to support the same peripheral IP.

View File

@ -1,8 +1,8 @@
//***************************************************************************
// include/cxx/cstdarg
//
// Copyright (C) 2009 Gregory Nutt. All rights reserved.
// Author: Gregory Nutt <spudmonkey@racsa.co.cr>
// Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
// Author: Gregory Nutt <gnutt@nuttx.org>
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
@ -40,7 +40,7 @@
// Included Files
//***************************************************************************
#include <stdard.h>
#include <stdarg.h>
//***************************************************************************
// Namespace

View File

@ -2,7 +2,7 @@
// include/cxx/cstddef
//
// Copyright (C) 2009 Gregory Nutt. All rights reserved.
// Author: Gregory Nutt <spudmonkey@racsa.co.cr>
// Author: Gregory Nutt <gnutt@nuttx.org>
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions

View File

@ -1,8 +1,8 @@
//***************************************************************************
// include/cxx/cstdint
//
// Copyright (C) 2009 Gregory Nutt. All rights reserved.
// Author: Gregory Nutt <spudmonkey@racsa.co.cr>
// Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved.
// Author: Gregory Nutt <gnutt@nuttx.org>
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
@ -61,7 +61,7 @@ namespace std
using ::int_least32_t;
using ::int_least64_t;
using ::intmax_t;
using ::intintptr_t;
using ::intptr_t;
using ::uint8_t;
using ::uint16_t;
using ::uint32_t;
@ -75,8 +75,7 @@ namespace std
using ::uint_least32_t;
using ::uint_least64_t;
using ::uintmax_t;
using ::uintintptr_t;
}
using ::uintptr_t;
}
#endif // __INCLUDE_CXX_CSTDINT

View File

@ -45,7 +45,7 @@
/* If CONFIG_ARCH_MATH_H is defined, then the top-level Makefile will copy
* this header file to include/math.h where it will become the system math.h
* header file. In this case, the architecture specific code must provide
* an arch/<cpy>/include/math.h file which will be included below:
* an arch/<architecture>/include/math.h file which will be included below:
*/
#ifdef CONFIG_ARCH_MATH_H

View File

@ -0,0 +1,64 @@
/****************************************************************************
* include/nuttx/stdarg.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_STDARG_H
#define __INCLUDE_NUTTX_STDARG_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/* If CONFIG_ARCH_STDARG_H is defined, then the top-level Makefile will copy
* this header file to include/stdarg.h where it will become the system
* stdarg.h header file. In this case, the architecture specific code must
* provide an arch/<architecture>/include/math.h file which will be included
* below:
*/
#ifdef CONFIG_ARCH_STDARG_H
# include <arch/stdarg.h>
#endif
/****************************************************************************
* Type Definitions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#endif /* __INCLUDE_NUTTX_STDARG_H */