[En-Nut-Discussion] Floating Point Memory Usage

Harald Kipp harald.kipp at egnite.de
Thu Oct 10 09:27:42 CEST 2013

Hi Bob,

On 08.10.2013 22:35, Bob Wirka wrote:

> Realized today that floating point eats an automatic 16K of ram on the first call to _sbrk(). I should read the manuals...

Ahh, yes! I knew, that there was something else miserably wrong with
newlib's float <-> ASCII conversion, but forgot about this one. There
are in fact two problems here.

First of all the code is very old spaghetti code. I was unable to find
any alternative. There are a few projects, but they present simplified
versions only and may fail in some situations.

Second problem is, that the code allocates heap memory. Newlib does not
provide its own heap management, but calls the OS via sbrk(). Nut/OS
provides a dummy function in nut/crt/sbrk.c, allocating LIB_HEAPSIZE
bytes. So far this is not in the Configurator. Alternatively you can add


to nutbld\UserConf.mk to reduce this size.

Michael Fischer reported this problem, when upgrading newlib for a new
YAGARTO version some years ago and after some discussions with him the
sbrk() was added and seemed to work since that time. Floats were rarely
used on memory-constrained systems, so nobody cares.



More information about the En-Nut-Discussion mailing list