This is the mail archive of the
newlib@sourceware.org
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 cheng@arm.com> <51B07833 dot 1090004 at embedded-brains dot de> <009d01ce635e$1fa44ce0$5eece6a0$ at cheng@arm.com> <51B1A688 dot 90809 at op dot pl>
Hi Freddie,
Thanks for your comments.
> -----Original Message-----
> From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org] On
> Behalf Of Freddie Chopin
> Sent: Friday, June 07, 2013 5:23 PM
> To: newlib@sourceware.org
> Subject: Re: [RFC]New implementation of C89 streamio for resource limited
bare
> 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[1024] 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 [;
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.
>
> > 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)
It requires lots of change of command line options, but yes, this should
work.
>
> 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.
Thanks.
bin