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()


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQdc11AAoJECkLFtN5Xr9fnz0H/1bcahSxJxCApylffHztgk6m
iAk9muLljFXIFQwf+xVrl39DlyTJQaJunI6C74OU9QP61Xuaa1Gyd6mtrLUcGSg3
JwWsLVmDkhB8RaEpPT4OS/eDM4ChSF4cdp7wfeg+N1kLlloHdO32EmVKpW1uo/Kz
8nQpdbAOiQryf8xJX1DozA10jquREy3HgZ0OjrQdumMOvNpc0se6VMSh8LpOQv1W
s17CYTrZoxsG8oW0VmPTSeAuhOzPFPV3Fm/smQ6RC+Dl7R+DVkx+SHWvB68o23Ga
Uwq6qb74K9larJWTHHcim8KDWdzE4JjZt3Vpq3m1ib+qg/IZRQOUXT+PUluxYcI=
=pdpt
-----END PGP SIGNATURE-----


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