[En-Nut-Discussion] Problems using global variables and/or floating point numbers on Nut/Os (using ethernut 5)

Harald Kipp harald.kipp at egnite.de
Sat May 26 18:40:04 CEST 2012


Hi Vegard,

On 22.05.2012 09:09, Vegard Aaker wrote:

> I have done some more debugging, and still have similar issues. Using the
> example code uart.c works fine, but if I change the floating point value to
> become a global variable instead of a local value I get errors. The
> floating point value will remain 0.0 even if I change it.

Sorry for not responding earlier, I just returned from a 1 week trip to
Finland. Extraordinary nice weather, btw. Probably same in your area.

Please note, that the problem is with the print out of floats only. All
the math routines should work fine, you simply cannot print them. As a
first workaround, you may convert them to proper integer values for
printing. In this case you don't need to enable Nut/OS floating point
support at all.

http://www.cs.tut.fi/~jkorpela/round.html

Because the newlib routines used in printf are more system dependent
than they should be, it may be better to add our own float to ASCII
conversion into Nut/OS. That may take a bit more time to implement, though.

Best regards,

Harald





More information about the En-Nut-Discussion mailing list