<?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 DbgConsole_PrintfFormattedData() does not implement width and precision as specified in Kinetis SDK v.2.0 API Reference Manual in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/DbgConsole-PrintfFormattedData-does-not-implement-width-and/m-p/663185#M7264</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to print a string of a width specified as an argument using the following syntax, as described on cppreference.com (&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Fio%2Fc%2Ffprintf" rel="nofollow noopener noreferrer" target="_blank"&gt;std::printf, std::fprintf, std::sprintf, std::snprintf - cppreference.com&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;`&lt;/P&gt;&lt;PRE&gt; const char* s = "Hello";
 PRINTF("\t[%10s]\n\t[%-10s]\n\t[%*s]\n\t[%-10.*s]\n\t[%-*.*s]\n",
 s, s, 10, s, 4, s, 10, 4, s);&lt;/PRE&gt;&lt;P&gt;`&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to the Kinetis SDK v.2.0 API Reference Manual, I expect to see the same result as the reference output on cppreference.com, which is the following&lt;/P&gt;&lt;P&gt;`&lt;/P&gt;&lt;PRE&gt; [ Hello]
 [Hello ]
 [ Hello]
 [Hell ]
 [Hell ]
`&lt;/PRE&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Instead I see the following output.
`
 [ Hello]
 [Hello ]
 [&lt;SPAN style="color: #ff6600;"&gt;*s&lt;/SPAN&gt;]
 [&lt;SPAN style="color: #ff6600;"&gt;*s&lt;/SPAN&gt;]
 [&lt;SPAN style="color: #ff6600;"&gt;*.*s&lt;/SPAN&gt;]
`&lt;/PRE&gt;&lt;P&gt;I verified that&amp;nbsp;PRINTF_ADVANCED_ENABLE is defined and that code is included in my executable, by stepping through DbgConsole_PrintfFormattedData(). Preliminary analysis seems to indicate that support for argument-based (`*`) width or precision is not implemented, contrary to the SDK API Reference Manual.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please confirm if I am overlooking any compilation setting that corrects this issue, or if you plan on addressing this in an upcoming SDK release.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Sep 2016 23:53:38 GMT</pubDate>
    <dc:creator>dan_teodorescu</dc:creator>
    <dc:date>2016-09-29T23:53:38Z</dc:date>
    <item>
      <title>DbgConsole_PrintfFormattedData() does not implement width and precision as specified in Kinetis SDK v.2.0 API Reference Manual</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/DbgConsole-PrintfFormattedData-does-not-implement-width-and/m-p/663185#M7264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to print a string of a width specified as an argument using the following syntax, as described on cppreference.com (&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Fio%2Fc%2Ffprintf" rel="nofollow noopener noreferrer" target="_blank"&gt;std::printf, std::fprintf, std::sprintf, std::snprintf - cppreference.com&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;`&lt;/P&gt;&lt;PRE&gt; const char* s = "Hello";
 PRINTF("\t[%10s]\n\t[%-10s]\n\t[%*s]\n\t[%-10.*s]\n\t[%-*.*s]\n",
 s, s, 10, s, 4, s, 10, 4, s);&lt;/PRE&gt;&lt;P&gt;`&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to the Kinetis SDK v.2.0 API Reference Manual, I expect to see the same result as the reference output on cppreference.com, which is the following&lt;/P&gt;&lt;P&gt;`&lt;/P&gt;&lt;PRE&gt; [ Hello]
 [Hello ]
 [ Hello]
 [Hell ]
 [Hell ]
`&lt;/PRE&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Instead I see the following output.
`
 [ Hello]
 [Hello ]
 [&lt;SPAN style="color: #ff6600;"&gt;*s&lt;/SPAN&gt;]
 [&lt;SPAN style="color: #ff6600;"&gt;*s&lt;/SPAN&gt;]
 [&lt;SPAN style="color: #ff6600;"&gt;*.*s&lt;/SPAN&gt;]
`&lt;/PRE&gt;&lt;P&gt;I verified that&amp;nbsp;PRINTF_ADVANCED_ENABLE is defined and that code is included in my executable, by stepping through DbgConsole_PrintfFormattedData(). Preliminary analysis seems to indicate that support for argument-based (`*`) width or precision is not implemented, contrary to the SDK API Reference Manual.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please confirm if I am overlooking any compilation setting that corrects this issue, or if you plan on addressing this in an upcoming SDK release.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2016 23:53:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/DbgConsole-PrintfFormattedData-does-not-implement-width-and/m-p/663185#M7264</guid>
      <dc:creator>dan_teodorescu</dc:creator>
      <dc:date>2016-09-29T23:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: DbgConsole_PrintfFormattedData() does not implement width and precision as specified in Kinetis SDK v.2.0 API Reference Manual</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/DbgConsole-PrintfFormattedData-does-not-implement-width-and/m-p/663186#M7265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've made a quick review on this fsl_debug_console.c file and in fact, it seems that &lt;STRONG&gt;width &lt;/STRONG&gt;and &lt;STRONG&gt;.precision&lt;/STRONG&gt; are not supported when an argument is passed (documentation is wrong on this point). I will ask KSDK team if this is supposed to be added in next releases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For now, If you want to add these feature (it is not difficult), you need to add some extra logic to current &lt;STRONG&gt;DbgConsole_PrintfFormattedData&lt;/STRONG&gt; function. I am attaching fsl_debug_console.c with this modifications where you can locate preprocessor conditionals for all logic needed to implement these parameters. (You can enable this macro (PRINTF_WIDTH_AS_PARAMETER = 1) on preprocessor's definitions to enable this extra logic). I modified the hello_world example and added these printing messages:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;PRINTF&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\t[%10s]\n\r"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; s&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;PRINTF&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\t[%-10s]\n\r"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; s&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;PRINTF&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\t[%*s]\n\r"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; s&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;PRINTF&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\t[%-10.*s]\n\r"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; s&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;PRINTF&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\t[%-*.*s]\n\r"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; s&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this is what I got:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="Console.jpg"&gt;&lt;IMG alt="Console.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/3941i1338CD1EB3C42C35/image-size/large?v=v2&amp;amp;px=999" title="Console.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this can help you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Isaac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:56:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/DbgConsole-PrintfFormattedData-does-not-implement-width-and/m-p/663186#M7265</guid>
      <dc:creator>isaacavila</dc:creator>
      <dc:date>2020-11-02T13:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: DbgConsole_PrintfFormattedData() does not implement width and precision as specified in Kinetis SDK v.2.0 API Reference Manual</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/DbgConsole-PrintfFormattedData-does-not-implement-width-and/m-p/663187#M7266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Isaac,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the same results as you are with the attached fix.&lt;/P&gt;&lt;P&gt;Thank you for the response and for providing the fix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2016 18:57:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/DbgConsole-PrintfFormattedData-does-not-implement-width-and/m-p/663187#M7266</guid>
      <dc:creator>dan_teodorescu</dc:creator>
      <dc:date>2016-10-12T18:57:26Z</dc:date>
    </item>
  </channel>
</rss>

