This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
W dniu 2013-06-08 12:44, Bin Cheng pisze:
I missed the part that __sbprintf has been changed into non-inline, so the big buffer isn't a problem anymore. Though __sbprintf can be guarded by an option still.
Yes that's true - the function is not inlined anymore, so the 1024B (or other size if BUFSIZ is redefined) buffer is allocated on stack only if you use unbuffered stream. Anyway - I think it would be a nice option to disable this optimization, so that unbuffered streams would not use so much stack. For this reason I have to provide my own handling of assert failure - in MCUs I just don't see the normal version - using fiprintf() and this 1kB buffer (stderr is unbuffered) - working reliably.
But one challenge is how to make floating point weak symbol without re-implement the stream io routines, because floating point is tight coupled with integer in current implementation.Well, if you don't want to use floating point AT ALL you can just redefineall*printf to be *iprintf (and the same for scanf). I guess it would beenough tohave sth like this added to compilation: -Dprintf=iprintf -Dfprintf=fiprintf -Dsprintf=siprintf ... -Dscanf=iscanf -Dfscanf=fiscanf -Dsscanf=siscanf ... (for all available "types" of these functions)It requires lots of change of command line options, but yes, this should work.
It's probably possible to do that with linker script, but I'm not sure how to do that in a generic way. Doing sth like this:
EXTERN(siprintf); sprintf = siprintf;works (you call sprintf, but siprintf is actually called), but this has a problem that each symbol within EXTERN will be linked, even if not used... And without EXTERN there's a linker script error that siprintf symbol is undefined...
4\/3!!
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |