Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Netduino Plus 2 : double.ToString failing on home built firmware 4.2.2

firmware failes 4.2.2 gcc

  • Please log in to reply
1 reply to this topic

#1 Nicolas Besson

Nicolas Besson

    New Member

  • Members
  • Pip
  • 9 posts

Posted 10 July 2014 - 05:39 AM

Hi All


I have  been able to build the Netduino Plus 2 firmware revision 4.2.2 with GCC yagarto tool using the wiki instructions (, and I have discovered that the double.ToString API is not behaving as expected with this build (see below code snippet).

The DFU firmware file called myfirmware-forsanitycheck.dfu contained in the package provided in the wiki page behave the same and is a god starting point to test the folowing code snippet.


            double dValue = 10.20;
            Debug.Print("-- value : " + dValue.ToString("F1"));
The expected result should be :
-- value : 10.2
but you get :
-- value : -545128520.00000000000000010
The strange thing is that the official Netduino Plus 2 4.2.2 firmware (http://forums.netdui...2-firmware-v422) provided by Netduino is behaving correctly (the diffrence is that RealView is used to build that one).
Thanks to this issue report (http://netmf.codeple...m/workitem/1385) I have identified that in CLR file DeviceCode\pal\tinycrt\tinycrt.cpp at line 221 in function hal_snprintf_double, is the place where the conversion is done. But unfortunately the source code seems correct.
So is anybody could give me some inputs to track down that issue and work on a fix ?
- Billounet

#2 CW2


    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 13 July 2014 - 11:15 AM

If I remember it correctly, Yagarto comes with libraries that do not have support for double (and 64-bit integers, so long.ToString() does not work correctly either). You'd need to build custom toolchain with newlib configuration options --enable-newlib-io-long-long and --enable-newlib-io-long-double.


Alternatively, you can use GCC Tools for ARM.

Also tagged with one or more of these keywords: firmware, failes, 4.2.2, gcc

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.