Reduce stack usage of _vfiprintf_r()

Corinna Vinschen
Wed Oct 10 17:53:00 GMT 2012

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

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 Vinschen
Cygwin Project Co-Leader
Red Hat

More information about the Newlib mailing list