smaller ramsize for newlib-nano builds

Sebastian Huber sebastian.huber@embedded-brains.de
Fri Feb 2 06:05:00 GMT 2018


On 01/02/18 20:42, Orlando Arias wrote:
> On 02/01/2018 07:57 AM, Corinna Vinschen wrote:
>> On Jan 31 17:50, Jaap de Wolff wrote:
>>> I am working with embedded systems with have very limited ram resources.
>>>
>>> As known current version of the newlib-nano build uses 364 bytes of ram for
>>> __global_locale
>>>
>> This build option should be available via a configure option, ideally.
>> Also, the change itself basically changes __global_locale to read only,
>> so I wonder if the name of the option shouldn't reflect that, kind of
>> like
>>
>>    ./configure --enable-readonly-locale
>>
>> or
>>
>>    ./configure --enable-const-locale
>>
>>> I realize that MB_CAPABLE must be off for this modification, but are there
>>> other implications?
>> I don't think so, but a potential patch submission should make sure that
>> under normal circumstances no write access occurs with this option.
> Greetings,
>
> For a while I have been contemplating making a patch set that provides
> an option to utilize only the C locale, removing all locale stuff from
> newlib at build time. Moving the __global_locale to ROM may be a good
> temporary solution, however, it will not work well for resource limited
> devices. For example, the MSP430F2013 provides only 2 kB of ROM and the
> MSP430F2003 has only 1 kB. This is about 1/6 and 1/3 of the total
> program capacity of the device, respectively ( further exacerbating the
> problem is that these particular devices only provide 128 B of RAM).
>
> Unfortunately, I do not have much time to actually work on this
> proposal, but I am willing to give it a shot if I can find some
> documentation on how current locale stuff is implemented in newlib
> (other than ``the code is the documentation''). Any pointers on this
> would be greatly appreciated.

A long term solution (I am not sure if it is feasible in Newlib) would 
be to use C11 thread-local storage instead of the custom thread-local 
storage via the struct _reent. With C11 thread-local storage the linker 
would do all the dirty work.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Newlib mailing list