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

Post here first, or if you can't find a relevant section!
Post Reply
danymogh
Posts: 2
Joined: Sun May 24, 2020 7:58 pm

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

Post 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 ?
User avatar
fpiSTM
Posts: 1745
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

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

Post 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 */
danymogh
Posts: 2
Joined: Sun May 24, 2020 7:58 pm

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

Post 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?
User avatar
fpiSTM
Posts: 1745
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

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

Post 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.
Post Reply

Return to “General discussion”