This is the mail archive of the
mailing list for the newlib project.
Re: [RFC]New implementation of C89 streamio for resource limited bare metal systems
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: newlib at sourceware dot org
- Date: Fri, 07 Jun 2013 11:23:20 +0200
- Subject: Re: [RFC]New implementation of C89 streamio for resource limited bare metal systems
- References: <008201ce61d5$c4ff5840$4efe08c0$ at email@example.com> <51B07833 dot 1090004 at embedded-brains dot de> <009d01ce635e$1fa44ce0$5eece6a0$ at firstname.lastname@example.org>
W dniu 2013-06-07 11:05, Bin Cheng pisze:
2) This implementation substantially decreases stack usage for printf
routines, because of a char buffer in newlib's __sbprintf function.
This can be fixed by simply disabling the optimization for un-buffered files
(under configuration options).
So we can even drop this implementation and achieving same code size goal.
An option like that (maybe even an configure option for setting BUFSIZ
without messing with source files [; ) would be great! Unbuffered stream
should be unbuffered [;
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
redefine all *printf to be *iprintf (and the same for scanf). I guess it
would be enough to have 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)
The only case where this would NOT work is if newlib itself uses
floating point variants of these functions "inside". Does it? In that
case maybe it would be possible to override the symbols via linker
script or by just providing trampoline function(s) (vfprintf() calling
vfiprintf() would probably be enough).