This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CT-NG: floating point support in Newlibs printf?


Jeppe, All,

On Thursday 21 October 2010 12:55:30 Jeppe Ledet-Pedersen wrote:
> I have successfully compiled a toolchain for my ARM7TDMI with 
> crosstool-NG 1.8.1. I have used GCC 4.5.0, Newlib 1.18 and Binutils 
> 2.20.1, disabled EABI and software floating point. The full 
> build.log.bz2 can be downloaded from http://kom.aau.dk/~jledet/build.log.bz2
> 
> I can compile my codebase with no errors, but I am having trouble when 
> trying to use printf and siblings with floating point values. Everything 
> else, including printf's with integers, seems to work as expected.
[--SNIP--]

Care to see if the attached is working for you?

I was able to build a toolchain with it, but I have nothing to
test the result on.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
diff --git a/config/libc/newlib.in.2 b/config/libc/newlib.in.2
new file mode 100644
--- /dev/null
+++ b/config/libc/newlib.in.2
@@ -0,0 +1,17 @@
+# newlib second-part options
+
+config LIBC_NEWLIB_IO_FLOAT
+    bool
+    prompt "Enable float IOs"
+    default n
+    help
+      Enable support for IOs on floating point
+      values (float and double).
+
+config LIBC_NEWLIB_IO_LDBL
+    bool
+    prompt "Enable long double IOs"
+    default n
+    depends on LIBC_NEWLIB_IO_FLOAT
+    help
+      Enable support for IOs on long doubles.
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -59,6 +59,8 @@
 }
 
 do_libc_start_files() {
+    local -a newlib_opts
+
     CT_DoStep INFO "Installing C library"
 
     mkdir -p "${CT_BUILD_DIR}/build-libc"
@@ -66,6 +68,13 @@
 
     CT_DoLog EXTRA "Configuring C library"
 
+    if [ "${CT_LIBC_NEWLIB_IO_FLOAT}" = "y" ]; then
+        newlib_opts+=( "--enable-newlib-io-float" )
+    fi
+    if [ "${CT_LIBC_NEWLIB_IO_LDBL}" = "y" ]; then
+        newlib_opts+=( "--enable-newlib-io-long-double" )
+    fi
+
     # Note: newlib handles the build/host/target a little bit differently
     # than one would expect:
     #   build  : not used
@@ -79,7 +88,8 @@
     "${CT_SRC_DIR}/newlib-$(libc_newlib_version)/configure" \
         --host=${CT_BUILD}                              \
         --target=${CT_TARGET}                           \
-        --prefix=${CT_PREFIX_DIR}
+        --prefix=${CT_PREFIX_DIR}                       \
+        "${newlib_opts[@]}"
 
     CT_DoLog EXTRA "Building C library"
     CT_DoExecLog ALL make ${PARALLELMFLAGS}

--
For unsubscribe information see http://sourceware.org/lists.html#faq

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]