diff options
author | px4dev <px4@purgatory.org> | 2013-05-19 21:51:35 +0200 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2013-05-19 21:51:35 +0200 |
commit | b7d430e3c06c10411419bfc8bfb30574f7a9cb56 (patch) | |
tree | 994a105907415d5b6d877c436126410b25562aa4 /nuttx | |
parent | c6b7eb1224426d9ec2e6d59a3df4c7443449109a (diff) | |
parent | 504b6d12561d68874ded4c1f747c21926a065045 (diff) | |
download | px4-firmware-b7d430e3c06c10411419bfc8bfb30574f7a9cb56.tar.gz px4-firmware-b7d430e3c06c10411419bfc8bfb30574f7a9cb56.tar.bz2 px4-firmware-b7d430e3c06c10411419bfc8bfb30574f7a9cb56.zip |
Merge branch 'master' of https://github.com/PX4/Firmware into fmuv2_bringup
Fix px4iov2 build issue by selecting the correct NuttX config.
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_otgfsdev.c | 1 | ||||
-rwxr-xr-x | nuttx/configs/px4fmu/nsh/defconfig | 4 | ||||
-rw-r--r-- | nuttx/libc/stdio/lib_libdtoa.c | 32 | ||||
-rw-r--r-- | nuttx/libc/stdio/lib_libvsprintf.c | 7 |
4 files changed, 39 insertions, 5 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c index 2c9ae4cac..0fcd463e0 100644 --- a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c +++ b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c @@ -1512,7 +1512,6 @@ static inline void stm32_ep0out_receive(FAR struct stm32_ep_s *privep, int bcnt) DEBUGASSERT(privep && privep->ep.priv); priv = (FAR struct stm32_usbdev_s *)privep->ep.priv; - DEBUGASSERT(priv->ep0state == EP0STATE_SETUP_OUT); ullvdbg("EP0: bcnt=%d\n", bcnt); usbtrace(TRACE_READ(EP0), bcnt); diff --git a/nuttx/configs/px4fmu/nsh/defconfig b/nuttx/configs/px4fmu/nsh/defconfig index cf30b835f..02e224302 100755 --- a/nuttx/configs/px4fmu/nsh/defconfig +++ b/nuttx/configs/px4fmu/nsh/defconfig @@ -647,10 +647,14 @@ CONFIG_DISABLE_POLL=n # CONFIG_LIBC_FIXEDPRECISION - Sets 7 digits after dot for printing: # 5.1234567 # CONFIG_HAVE_LONG_LONG - Enabled printf("%llu) +# CONFIG_LIBC_STRERR - allow printing of error text +# CONFIG_LIBC_STRERR_SHORT - allow printing of short error text # CONFIG_NOPRINTF_FIELDWIDTH=n CONFIG_LIBC_FLOATINGPOINT=y CONFIG_HAVE_LONG_LONG=y +CONFIG_LIBC_STRERROR=n +CONFIG_LIBC_STRERROR_SHORT=n # # Allow for architecture optimized implementations diff --git a/nuttx/libc/stdio/lib_libdtoa.c b/nuttx/libc/stdio/lib_libdtoa.c index 29f61fd76..395a55b61 100644 --- a/nuttx/libc/stdio/lib_libdtoa.c +++ b/nuttx/libc/stdio/lib_libdtoa.c @@ -43,6 +43,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ +#include <math.h> /**************************************************************************** * Pre-processor Definitions @@ -104,6 +105,13 @@ static void zeroes(FAR struct lib_outstream_s *obj, int nzeroes) * Private Functions ****************************************************************************/ +static void lib_dtoa_string(FAR struct lib_outstream_s *obj, const char *str) +{ + while (*str) { + obj->put(obj, *str++); + } +} + /**************************************************************************** * Name: lib_dtoa * @@ -137,9 +145,23 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, int nchars; /* Number of characters to print */ int dsgn; /* Unused sign indicator */ int i; + bool done_decimal_point = false; + + /* special handling for NaN and Infinity */ + if (isnan(value)) { + lib_dtoa_string(obj, "NaN"); + return; + } + if (isinf(value)) { + if (value < 0.0d) { + obj->put(obj, '-'); + } + lib_dtoa_string(obj, "Infinity"); + return; + } /* Non-zero... positive or negative */ - + if (value < 0) { value = -value; @@ -178,6 +200,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, if (prec > 0 || IS_ALTFORM(flags)) { obj->put(obj, '.'); + done_decimal_point = true; /* Always print at least one digit to the right of the decimal point. */ @@ -203,6 +226,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, /* Print the decimal point */ obj->put(obj, '.'); + done_decimal_point = true; /* Print any leading zeros to the right of the decimal point */ @@ -249,6 +273,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, /* Print the decimal point */ obj->put(obj, '.'); + done_decimal_point = true; /* Always print at least one digit to the right of the decimal * point. @@ -285,8 +310,9 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, } /* Finally, print any trailing zeroes */ - - zeroes(obj, prec); + if (done_decimal_point) { + zeroes(obj, prec); + } /* Is this memory supposed to be freed or not? */ diff --git a/nuttx/libc/stdio/lib_libvsprintf.c b/nuttx/libc/stdio/lib_libvsprintf.c index 9a391610d..2cc7950f7 100644 --- a/nuttx/libc/stdio/lib_libvsprintf.c +++ b/nuttx/libc/stdio/lib_libvsprintf.c @@ -1215,7 +1215,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list a fmt = FMT_RJUST; width = 0; #ifdef CONFIG_LIBC_FLOATINGPOINT - trunc = 0; + trunc = 6; #endif #endif @@ -1245,6 +1245,11 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list a { #ifndef CONFIG_NOPRINTF_FIELDWIDTH fmt = FMT_RJUST0; +#ifdef CONFIG_LIBC_FLOATINGPOINT + if (IS_HASDOT(flags)) { + trunc = 0; + } +#endif #endif } #if 0 |