printf/scanf not working with long long int (int64_t)
mickael9 opened this issue · 4 comments
It seems that printf() (or scanf) will not accept %lld or anything with "ll".
Can something be done about this ?
Thanks!
After some research, I found that gcc4mbed links with -lc_s
By removing all _s
in the SYS_LIBS line of gcc4mbed.mk, printf("%lld") works!
Perhaps this could be made configurable then?
Related information from the GNU Tools for ARM Embedded Processors Q&A area:
https://answers.launchpad.net/gcc-arm-embedded/+question/219065
https://answers.launchpad.net/gcc-arm-embedded/+question/220287
In the future I can try to make this a makefile option. I have pending memory heap debugging changes which depend on the version of newlib being used. Those changes will become more complicated if I need to support both versions of newlib. I would rather wait and hope that someone just adds 64-bit integer support to newlib but of course this will grow the size of the resulting binaries unless they hook in that support in a fashion similar to floating point.
In my working branch, I have introduced a fix for this in af7a1ad
The user can now set NEWLIB_NANO=0 in their makefile and GCC4MBED will instead use the standard newlib instead of newlib-nano. This will grow the size of the user's binary but it supports things like 64-bit integers in _scanf/_printf routines.
I will close this bug once this change makes it into the official master branch. I have a few more features to add to GCC4MBED and lots more testing to perform before this happens though.