0

I'm experimenting with NIOS II soft core, trying to minimize the footprint of my embedded app. One of the biggest gains I get comes from using the small C library (p 206):

The full newlib library functionality is often unnecessary for embedded systems, and undesirably large for systems needing a minimal RAM footprint. Altera provides a reduced-functionality reduced-size "Small C" version of newlib which allows smaller RAM footprints to be achieved.

One of the features stripped down from small C library is the locale support. However, when I try to use atof(), the linking fails because it calls localeconv() which is not there. For example, building the following sample

#include <stdlib.h>
int main(void) { return atof("0"); }

results in "/path/to/strtod.c:341: undefined reference to _localeconv_r" error. It's really a shame since the only thing atof() needs is the decimal_point definition.

What options do I have if I need to parse floats, besides including a modified copy of strtod.c in my software? Using regular C library (instead of the small one) increases my code footprint by 35kB which is a big deal for embedded SW.

Dmitry Grigoryev
  • 3,156
  • 1
  • 25
  • 53

0 Answers0