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]

Re: Reduce stack usage of _vfiprintf_r()


On Oct 10 21:33, Federico Terraneo wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 10/10/2012 06:20 PM, Corinna Vinschen wrote:
> > On Oct 10 17:59, Federico Terraneo wrote:
> >> [...] first of all, am not a newlib devloper, just a regular
> >> user. I noticed the exact same problem in RAM constrained ARM
> >> microcontrollers when using newlib together with an RTOS that I
> >> developed. The solution I found is different though, and is to
> >> apply a simple patch to newlib that redefines BUFSIZ to 512
> >> instead of 1024. That small change later became part of a larger
> >> patch that can be found here: 
> >> http://gitorious.org/miosix-kernel/miosix-kernel/blobs/master/miosix/compiler/gcc-patches/newlib.patch
> >>
> >> 
> The relevant lines are 32--39.
> > 
> > This isn't the right way to handle BUFSIZ.  The right thing to do
> > is to define __BUFSIZ__ for your target in
> > libc/include/sys/config.h:
> > 
> > #if defined(miosix)	/* Or whatever is the right preprocessor macro
> > */ #define __BUFSIZ__ 512 #endif
> > 
> > The same goes for many other settings.  See the config.h file for 
> > details.  XStormy16, for instance, a 16 bit target, defines
> > __BUFSIZ__ to 16 in that file.
> 
> This brings up an interesting question. For quite some time I've been
> distributing that newlib patch together with my kernel's build scripts
> (which build binutils, gcc, newlib, gdb). From the beginning I had the
> idea of pushing a properly cleaned up patch upstream adding support
> for the miosix OS into newlib, but never dared asking. Is such a patch
> likely to be accepted?

Sure.  That's what newlib is about.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]