Page 1 of 1

how to enable --enable-newlib-io-long-long or _WANT_IO_LONG_LONG

Posted: Sun May 24, 2020 8:03 pm
by danymogh
Hello,

i need 64 bit printf support but googling says it has to be enabled explicitly using compiler option

Code: Select all

--enable-newlib-io-long-long
Or a

Code: Select all

#define _WANT_IO_LONG_LONG
in the wiki

Code: Select all

https://github.com/stm32duino/wiki/wiki/Customize-build-options-using-build_opt.h
it says we can enable project specific compiler options but putting

Code: Select all

--enable-newlib-io-long-long
gives a compile warning.

how should I do this properly ?

Re: how to enable --enable-newlib-io-long-long or _WANT_IO_LONG_LONG

Posted: Mon May 25, 2020 8:20 am
by fpiSTM
Hi,
this options is for compiling the newlib library with the support enabled not for enable it dynamically.

https://sourceware.org/newlib/README
`configure' options
===================

Here is a summary of the `configure' options and arguments that are
most often useful for building NEWLIB. `configure' also has several other
options not listed here.

.....

`--enable-newlib-io-long-long'
Enable long long type support in IO functions like printf/scanf.
Disabled by default, but many hosts enable it in configure.host.
The core simply link against the newlib nano library provided with the toolchain.

You can use the Print API for Long Long:
https://github.com/stm32duino/Arduino_C ... #L101-L106

Code: Select all

#ifdef SUPPORT_LONGLONG
    void println(int64_t, uint8_t = DEC);
    void print(int64_t, uint8_t = DEC);
    void println(uint64_t, uint8_t = DEC);
    void print(uint64_t, uint8_t = DEC);
#endif
Looking in the toolchain, it seems it is enabled, STM32\tools\xpack-arm-none-eabi-gcc\9.2.1-1.1\arm-none-eabi\include\newlib-nano\newlib.h

Code: Select all

/* long long type support in IO functions like printf/scanf enabled */
/* #undef _WANT_IO_LONG_LONG */

Re: how to enable --enable-newlib-io-long-long or _WANT_IO_LONG_LONG

Posted: Mon May 25, 2020 1:10 pm
by danymogh
Hi,

you were right it's enabled for print but I can't get it to work for printf.

i've tried <inttypes.>c header with PRIu64 but it prints "ld". any ideas?

Re: how to enable --enable-newlib-io-long-long or _WANT_IO_LONG_LONG

Posted: Mon May 25, 2020 1:15 pm
by fpiSTM
danymogh wrote: Mon May 25, 2020 1:10 pm Hi,

you were right it's enabled for print but I can't get it to work for printf.

i've tried <inttypes.>c header with PRIu64 but it prints "ld". any ideas?
No idea about this. printf is limited with nano lib so maybe there is something to enable like for float management.