<?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>MQX Software SolutionsのトピックRe: floating point printf / sprintf in 3.8.1</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189780#M3590</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply, David.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The hardware does support hardware FPU. In the earlier version of MQX (3.7) the hardware FPU was not implemented, and therefore it was turned off. When I first updated to the latest MQX (3.8), I did not turn it on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Sep 2012 02:03:53 GMT</pubDate>
    <dc:creator>keithtang</dc:creator>
    <dc:date>2012-09-25T02:03:53Z</dc:date>
    <item>
      <title>floating point printf / sprintf in 3.8.1</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189776#M3586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used to be able to compile and run perfectly the following simple C code in MQX 3.8:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF" face="courier new,courier"&gt;float f = &lt;FONT color="#0000FF" face="courier new,courier"&gt;(float)temperature / 32.0 * 0.125;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF" face="courier new,courier"&gt;printf("temp: %3.1f\n", f);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However it hangs in MQX3.8.1, which I had to modify to work using the div_t data type:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF" face="courier new,courier"&gt;div_t n = div(f,1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF" face="courier new,courier"&gt;printf("temp: %02d.%d\n", n.quot, n.rem);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same happens to the sprintf() function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure, but I have a feeling it has to do with the PSP_HAS_FPU being enabled?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone can help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 11:58:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189776#M3586</guid>
      <dc:creator>keithtang</dc:creator>
      <dc:date>2012-08-16T11:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: floating point printf / sprintf in 3.8.1</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189777#M3587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To add to this, the regular operand '%' does not work with this compiler for some reasons.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 13:02:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189777#M3587</guid>
      <dc:creator>keithtang</dc:creator>
      <dc:date>2012-08-16T13:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: floating point printf / sprintf in 3.8.1</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189778#M3588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I have solved this. Apparently the floating point support was set to "software floating point" by default. I changed it to hardware, recompiled, and it seems to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 15:56:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189778#M3588</guid>
      <dc:creator>keithtang</dc:creator>
      <dc:date>2012-08-16T15:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: floating point printf / sprintf in 3.8.1</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189779#M3589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;keith tang wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I think I have solved this. Apparently the floating point support was set to "software floating point" by default. I changed it to hardware, recompiled, and it seems to work.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not the correct solution.&amp;nbsp; Unless you're using a 120/150MHz Kinetis or some other CPU with a hardware FPU, you shouldn't set it to hardware floating point.&amp;nbsp; The correct solution is to put&lt;/P&gt;&lt;P&gt;#define MQX_INCLUDE_FLOATING_POINT_IO&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;in user_config.h and recompile your PSP.&amp;nbsp; This will include floating point code in _io_printf() and _io_scanf().&amp;nbsp; I'm guessing that maybe they defaulted that to 0 starting in MQX 3.8.1 to keep default code size down.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:41:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189779#M3589</guid>
      <dc:creator>dmarks_ls</dc:creator>
      <dc:date>2020-10-29T09:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: floating point printf / sprintf in 3.8.1</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189780#M3590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply, David.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The hardware does support hardware FPU. In the earlier version of MQX (3.7) the hardware FPU was not implemented, and therefore it was turned off. When I first updated to the latest MQX (3.8), I did not turn it on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 02:03:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/floating-point-printf-sprintf-in-3-8-1/m-p/189780#M3590</guid>
      <dc:creator>keithtang</dc:creator>
      <dc:date>2012-09-25T02:03:53Z</dc:date>
    </item>
  </channel>
</rss>

