diff --git a/ChangeLog b/ChangeLog index 9ec47e3b16..7dfca5422b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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/. diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index d73fafbfef..d3689da49f 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

NuttX RTOS Porting Guide

-

Last Updated: June 19, 2012

+

Last Updated: July 8, 2012

@@ -837,7 +837,7 @@ The port supports serial, timer0, spi, and usb. -
  • configs/mirtoo/code>: +
  • configs/mirtoo: This is the port to the DTX1-4000L "Mirtoo" module. This module uses MicroChipPIC32MX250F128D. See the Dimitech website for further information. @@ -4330,11 +4330,69 @@ build

  • - The architecture may provide custom versions of certain standard header files: +

    + The architecture may provide custom versions of certain standard header files: +

    +
  • -
  • CONFIG_ARCH_ROMGETC: diff --git a/Makefile b/Makefile index 1d26ed5802..ea83d69ee2 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ ############################################################################ # Makefile # -# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt # # 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 diff --git a/README.txt b/README.txt index 66f3aa3ec0..a767257539 100644 --- a/README.txt +++ b/README.txt @@ -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 ^^^^^^^^^^^^^^^^^ diff --git a/TODO b/TODO index 8c777ae4c4..33d48027d7 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/arch/arm/include/stdarg.h b/arch/arm/include/stdarg.h new file mode 100644 index 0000000000..653d34a6ff --- /dev/null +++ b/arch/arm/include/stdarg.h @@ -0,0 +1,59 @@ +/**************************************************************************** + * arch/arm/include/stdarg.h + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 */ diff --git a/arch/arm/src/lpc43xx/lpc43_serial.c b/arch/arm/src/lpc43xx/lpc43_serial.c index d3f718d0a0..2d4ea9aac7 100644 --- a/arch/arm/src/lpc43xx/lpc43_serial.c +++ b/arch/arm/src/lpc43xx/lpc43_serial.c @@ -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) diff --git a/configs/README.txt b/configs/README.txt index 4937818ddd..a9b2d38364 100644 --- a/configs/README.txt +++ b/configs/README.txt @@ -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 + #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//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 + #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 + #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 +// Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. +// Author: Gregory Nutt // // 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 +#include //*************************************************************************** // Namespace diff --git a/include/cxx/cstddef b/include/cxx/cstddef index 440b680f4c..73dbcd526e 100644 --- a/include/cxx/cstddef +++ b/include/cxx/cstddef @@ -2,7 +2,7 @@ // include/cxx/cstddef // // Copyright (C) 2009 Gregory Nutt. All rights reserved. -// Author: Gregory Nutt +// Author: Gregory Nutt // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions diff --git a/include/cxx/cstdint b/include/cxx/cstdint index d476137718..d662c5dc73 100644 --- a/include/cxx/cstdint +++ b/include/cxx/cstdint @@ -1,8 +1,8 @@ //*************************************************************************** // include/cxx/cstdint // -// Copyright (C) 2009 Gregory Nutt. All rights reserved. -// Author: Gregory Nutt +// Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. +// Author: Gregory Nutt // // 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 diff --git a/include/nuttx/math.h b/include/nuttx/math.h index e444972419..84dbea6e03 100644 --- a/include/nuttx/math.h +++ b/include/nuttx/math.h @@ -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//include/math.h file which will be included below: + * an arch//include/math.h file which will be included below: */ #ifdef CONFIG_ARCH_MATH_H diff --git a/include/nuttx/stdarg.h b/include/nuttx/stdarg.h new file mode 100644 index 0000000000..45d16b2d1c --- /dev/null +++ b/include/nuttx/stdarg.h @@ -0,0 +1,64 @@ +/**************************************************************************** + * include/nuttx/stdarg.h + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +/* 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//include/math.h file which will be included + * below: + */ + +#ifdef CONFIG_ARCH_STDARG_H +# include +#endif + +/**************************************************************************** + * Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __INCLUDE_NUTTX_STDARG_H */