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 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.


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]