aboutsummaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-05-22 21:39:30 +0200
committerpx4dev <px4@purgatory.org>2013-05-22 21:39:30 +0200
commit437d9e4180b6248d0f0a4176c875b41deceef17d (patch)
tree689af295626df673c13994f435ed221ba6f268e5 /nuttx
parente67022f874f0fa091ed7dffd617c70c0c0253b5c (diff)
parent78d29045c4da2d5ed4cea50fc2184b57dea01951 (diff)
downloadpx4-firmware-437d9e4180b6248d0f0a4176c875b41deceef17d.tar.gz
px4-firmware-437d9e4180b6248d0f0a4176c875b41deceef17d.tar.bz2
px4-firmware-437d9e4180b6248d0f0a4176c875b41deceef17d.zip
Merge branch 'fmuv2_bringup' into fmuv2_bringup_io2
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/.gitignore28
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_otgfsdev.c1
-rwxr-xr-xnuttx/configs/px4fmu/nsh/defconfig4
-rw-r--r--nuttx/libc/stdio/lib_libdtoa.c32
-rw-r--r--nuttx/libc/stdio/lib_libvsprintf.c7
5 files changed, 67 insertions, 5 deletions
diff --git a/nuttx/.gitignore b/nuttx/.gitignore
new file mode 100644
index 000000000..0d763ab2a
--- /dev/null
+++ b/nuttx/.gitignore
@@ -0,0 +1,28 @@
+*.a
+.config
+.config-e
+.configX-e
+.depend
+.version
+arch/arm/include/board
+arch/arm/include/chip
+arch/arm/src/board
+arch/arm/src/chip
+include/apps
+include/arch
+include/math.h
+include/nuttx/config.h
+include/nuttx/version.h
+Make.defs
+Make.dep
+mkdeps
+nuttx
+nuttx-export.zip
+nuttx.bin
+nuttx.hex
+setenv.sh
+System.map
+tools/mkconfig
+tools/mkconfig.exe
+tools/mkversion
+tools/mkversion.exe
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