<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Floating-point size Cortex-M0 vs ATMega328 in MCUXpresso IDE</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/Floating-point-size-Cortex-M0-vs-ATMega328/m-p/800979#M2834</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm writing an Arduino port for the LPC1114 chip (towards a systematically porting method for any microcontroller) and so far so good, until I discovered a (n extremely) code size increase when using floating point arithmetic (FPA). When Arduino UNO uses FPA the size code is barely increased; however in my Cortex-M0 the increasing is about 7 KB!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There must be something I'm overseeing in the LPCXpresso toolchain, so any hint is welcomed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In both cases, LPCXpresso IDE and Wiring, the code is (roughly):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void) &lt;BR /&gt;{&lt;BR /&gt; init();&lt;/P&gt;&lt;P&gt;pinMode( LED_BUILTIN, OUTPUT );&lt;BR /&gt; digitalWrite( LED_BUILTIN, LOW );&lt;BR /&gt; Serial.begin( 115200, SERIAL_8N1 );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while( 1 )&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; int adcVal = analogRead( A0 );&lt;BR /&gt;&amp;nbsp; Serial.println( (adcVal * 3.3) / 1023 );&lt;BR /&gt;&amp;nbsp; delay( 100 );&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ARDUINO: Sketch uses 3670 bytes from 32256&lt;/P&gt;&lt;P&gt;LPCXPRESSO: 13972 bytes out of 32KB (with -Os and NewLibNano(nohost) enabled)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any comments are welcomed!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jul 2018 19:10:23 GMT</pubDate>
    <dc:creator>fjrg76</dc:creator>
    <dc:date>2018-07-30T19:10:23Z</dc:date>
    <item>
      <title>Floating-point size Cortex-M0 vs ATMega328</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Floating-point-size-Cortex-M0-vs-ATMega328/m-p/800979#M2834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm writing an Arduino port for the LPC1114 chip (towards a systematically porting method for any microcontroller) and so far so good, until I discovered a (n extremely) code size increase when using floating point arithmetic (FPA). When Arduino UNO uses FPA the size code is barely increased; however in my Cortex-M0 the increasing is about 7 KB!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There must be something I'm overseeing in the LPCXpresso toolchain, so any hint is welcomed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In both cases, LPCXpresso IDE and Wiring, the code is (roughly):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void) &lt;BR /&gt;{&lt;BR /&gt; init();&lt;/P&gt;&lt;P&gt;pinMode( LED_BUILTIN, OUTPUT );&lt;BR /&gt; digitalWrite( LED_BUILTIN, LOW );&lt;BR /&gt; Serial.begin( 115200, SERIAL_8N1 );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while( 1 )&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; int adcVal = analogRead( A0 );&lt;BR /&gt;&amp;nbsp; Serial.println( (adcVal * 3.3) / 1023 );&lt;BR /&gt;&amp;nbsp; delay( 100 );&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ARDUINO: Sketch uses 3670 bytes from 32256&lt;/P&gt;&lt;P&gt;LPCXPRESSO: 13972 bytes out of 32KB (with -Os and NewLibNano(nohost) enabled)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any comments are welcomed!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 19:10:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Floating-point-size-Cortex-M0-vs-ATMega328/m-p/800979#M2834</guid>
      <dc:creator>fjrg76</dc:creator>
      <dc:date>2018-07-30T19:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Floating-point size Cortex-M0 vs ATMega328</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Floating-point-size-Cortex-M0-vs-ATMega328/m-p/800980#M2835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the first place, I would suggest that you try using MCUXpresso IDE - which replaced the old LPCXpresso IDE product about 18 months ago. The current version is v10.2.1. More information along with product download links are available from : &lt;A href="https://www.nxp.com/mcuxpresso/ide"&gt;https://www.nxp.com/mcuxpresso/ide&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regards to your problem, IIRC, the version of Newlib/NewlibNano provided (as part of the ARM GCC tools)&amp;nbsp;in some version of LPCXpresso IDE did have some code size issues with its floating point support code of the sort that you are seeing. And I think that ARM resolved these in later versions of the GCC tools.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you continue to see issues with the latest tools, please do a clean of your project, then use the Export option on the Quickstart Panel - and post the example ZIP file here for us to look at.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MCUXpresso IDE Support&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2018 11:30:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Floating-point-size-Cortex-M0-vs-ATMega328/m-p/800980#M2835</guid>
      <dc:creator>lpcxpresso_supp</dc:creator>
      <dc:date>2018-07-31T11:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Floating-point size Cortex-M0 vs ATMega328</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Floating-point-size-Cortex-M0-vs-ATMega328/m-p/800981#M2836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My mistake: I'm using MCUXpresso 10.2.1, and I don't know why I wrote LPCXpresso.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other thing I didn't mention is that the port I'm writing is being compiled with C++ 11, with newlibnano(no host). I think I forget to set the floating point library: FPv?-XX. I will try it ASAP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Sep 2018 03:41:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Floating-point-size-Cortex-M0-vs-ATMega328/m-p/800981#M2836</guid>
      <dc:creator>fjrg76</dc:creator>
      <dc:date>2018-09-22T03:41:46Z</dc:date>
    </item>
  </channel>
</rss>

