<?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>MCUXpresso SDKのトピックRe: Simple printf formatting not working</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243912#M3095</link>
    <description>&lt;P&gt;I don't use semihosting (because my hardware is Teensy and... you know)&lt;BR /&gt;PRINTF -&amp;gt; DebugConsole_Printf and it looks like DebugConsole_Printf -&amp;gt; StrFormatPrintf (in fsl_str.c)&lt;BR /&gt;&lt;BR /&gt;There seems to be a lot of code disabled because I don't have the macro&amp;nbsp;PRINTF_ADVANCED_ENABLE defined.&amp;nbsp; I'm calling it a night, but I'll see if defining that fixes the issue and report back tomorrow.&amp;nbsp; I should have looked deeper before I posted - I assumed it was using the library implementation of printf (sprintf), but I guess I was wrong &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp; Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 11 Mar 2021 06:41:37 GMT</pubDate>
    <dc:creator>jeff_rosen</dc:creator>
    <dc:date>2021-03-11T06:41:37Z</dc:date>
    <item>
      <title>Simple printf formatting not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243887#M3093</link>
      <description>&lt;P&gt;I building a simple project to develop some interface code.&amp;nbsp; I'm using printf to send data to the debug console for verification of operation/calculations.&amp;nbsp; In the course of troubleshooting I discovered that printf is not honoring my format specifications.&lt;/P&gt;&lt;P&gt;If I add the following line of code:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;PRINTF("This is a test: %d, 0x%04X\n", -219, 0x242);&lt;/LI-CODE&gt;&lt;P&gt;I get the following output:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;This is a test: 219, 0x 242&lt;/LI-CODE&gt;&lt;P&gt;Notice that the sign is not output for "%d" and zero-padding is not honored for "%04X".&amp;nbsp; I have tried both redlib and newlib and it behaves the same.&amp;nbsp; Is there something obvious that I'm missing?&lt;BR /&gt;&lt;BR /&gt;This is using KSDK 2.8.2 (manifest 3.6.0) for an&amp;nbsp;MK66FX1M0VMD18.&lt;BR /&gt;MCUxpresso version 11.2.0&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 05:54:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243887#M3093</guid>
      <dc:creator>jeff_rosen</dc:creator>
      <dc:date>2021-03-11T05:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Simple printf formatting not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243897#M3094</link>
      <description>&lt;P&gt;I did a quick test (IDE 11.3.0, SDK 2.9, newlib-nano), and I get what I expect:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;This is a test: -219, 0x0242&lt;/LI-CODE&gt;&lt;P&gt;I did not use that PRINTF macro because not sure what you have behind it, I did use printf directly with semihosting.&lt;/P&gt;&lt;P&gt;I tried the same with newlib (semihosting) and had the same:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;This is a test: -219, 0x0242&lt;/LI-CODE&gt;&lt;P&gt;The difference between 11.2.0 and 11.3.0 is the GNU toolchain with the standard library, but I doubt it was a bug in the GNU libs for printf. So not sure why you have something different.&lt;/P&gt;&lt;P&gt;Can you check what your PRINTF does?&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 06:17:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243897#M3094</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2021-03-11T06:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Simple printf formatting not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243912#M3095</link>
      <description>&lt;P&gt;I don't use semihosting (because my hardware is Teensy and... you know)&lt;BR /&gt;PRINTF -&amp;gt; DebugConsole_Printf and it looks like DebugConsole_Printf -&amp;gt; StrFormatPrintf (in fsl_str.c)&lt;BR /&gt;&lt;BR /&gt;There seems to be a lot of code disabled because I don't have the macro&amp;nbsp;PRINTF_ADVANCED_ENABLE defined.&amp;nbsp; I'm calling it a night, but I'll see if defining that fixes the issue and report back tomorrow.&amp;nbsp; I should have looked deeper before I posted - I assumed it was using the library implementation of printf (sprintf), but I guess I was wrong &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 06:41:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243912#M3095</guid>
      <dc:creator>jeff_rosen</dc:creator>
      <dc:date>2021-03-11T06:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Simple printf formatting not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243942#M3096</link>
      <description>&lt;P&gt;In that case you have a lot of different layers in between. Anyway as you probably know I avoid for this (and many other reasons) printf. I'm using XFormat (&lt;A href="https://mcuoneclipse.com/2014/08/17/xformat-a-lightweight-printf-and-sprintf-alternative/" target="_blank"&gt;https://mcuoneclipse.com/2014/08/17/xformat-a-lightweight-printf-and-sprintf-alternative/&lt;/A&gt; ) which might not be perfect for any use case, but a least I have full control over it. The McuLib implementation of it is here in case you are interested:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/ErichStyger/McuOnEclipseLibrary/blob/master/lib/src/McuXFormat.c" target="_blank"&gt;https://github.com/ErichStyger/McuOnEclipseLibrary/blob/master/lib/src/McuXFormat.c&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 07:19:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1243942#M3096</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2021-03-11T07:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Simple printf formatting not working</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1244449#M3098</link>
      <description>&lt;P&gt;Thanks for the pointer Erich, I will check it out.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For those that might run into this behavior when using PRINTF directed to the DebugConsole, defining PRINTF_ADVANCED_ENABLE did in fact produce the expected output.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 00:50:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1244449#M3098</guid>
      <dc:creator>jeff_rosen</dc:creator>
      <dc:date>2021-03-12T00:50:43Z</dc:date>
    </item>
  </channel>
</rss>

