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: "Bin Cheng" <bin dot cheng at arm dot com>
- To: "'Freddie Chopin'" <freddie_chopin at op dot pl>, <newlib at sourceware dot org>
- Date: Sat, 8 Jun 2013 18:44:19 +0800
- Subject: RE: [RFC]New implementation of C89 streamio for resource limited bare metal systems
- References: <008201ce61d5$c4ff5840$4efe08c0$ at firstname.lastname@example.org> <51B07833 dot 1090004 at embedded-brains dot de> <009d01ce635e$1fa44ce0$5eece6a0$ at email@example.com> <51B1A688 dot 90809 at op dot pl>
Thanks for your comments.
> -----Original Message-----
> From: firstname.lastname@example.org [mailto:email@example.com] On
> Behalf Of Freddie Chopin
> Sent: Friday, June 07, 2013 5:23 PM
> To: firstname.lastname@example.org
> Subject: Re: [RFC]New implementation of C89 streamio for resource limited
> metal systems
> 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
> > 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
> An option like that (maybe even an configure option for setting BUFSIZ
> messing with source files [; ) would be great! Unbuffered stream should be
> unbuffered [;
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
> > 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
> *printf to be *iprintf (and the same for scanf). I guess it would be
> 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)
It requires lots of change of command line options, but yes, this should
> 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
I don't think there is such case in libc, yet not sure about libm.