<?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 Re: KDS printf issues with -nanolibc in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306533#M56</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For Cortex-M4, somehow an additional hook routine is needed: &lt;STRONG&gt;_isatty().&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;see &lt;A href="http://mcuoneclipse.com/2014/07/12/printf-for-the-frdm-k64f-board-and-kinetis-design-studio/" title="http://mcuoneclipse.com/2014/07/12/printf-for-the-frdm-k64f-board-and-kinetis-design-studio/"&gt;UART printf() for the FRDM-K64F Board and Kinetis Design Studio | MCU on Eclipse&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 13 Jul 2014 18:20:11 GMT</pubDate>
    <dc:creator>BlackNight</dc:creator>
    <dc:date>2014-07-13T18:20:11Z</dc:date>
    <item>
      <title>KDS printf issues with -nanolibc</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306527#M50</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- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've run into an issue with KDS when using the nanolibc library and printf.&amp;nbsp; With this library, the printf only prints the first character.&amp;nbsp; If I remove the linker option -nanolibc, then printf works as expected.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the attached project for the FRDM-K64F Freedom board.&amp;nbsp; I've used Processor Expert (PEx) to add MQX Lite and the ConsoleIO component.&amp;nbsp; The attached project uses the option -nanolibc, and shows the issue.&amp;nbsp; Debugging the issue, I put a breakpoint in the function _write() generated by the ConsoleIO component in CsIO1.c.&amp;nbsp; The parameter count for the character count to send out the UART is set to 1 when -nanolibc, no matter what the length of the printf string is.&amp;nbsp; If I remove the linker option -nanolibc and debug, the character count is passed correctly as expected.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't figured out how to debug the library for why the count parameter is 1, since I haven't found the library source code yet.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this when trying to use a device with less RAM than the K64.&amp;nbsp; In that device, using the default library didn't fit in the RAM, so I used the -nanolibc option for the smaller library.&amp;nbsp; Now the application fits, but I can't get the printf statements to work.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any guidance&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="12041_12041.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/119809i7746A90E5AA4BD0A/image-size/large?v=v2&amp;amp;px=999" role="button" title="12041_12041.jpg" alt="12041_12041.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="KDS-Debug.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/44010i0233212739DB1875/image-size/large?v=v2&amp;amp;px=999" role="button" title="KDS-Debug.jpg" alt="KDS-Debug.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="12040_12040.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/119810i76904ADF99D38747/image-size/large?v=v2&amp;amp;px=999" role="button" title="12040_12040.jpg" alt="12040_12040.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="KDS-Linker.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/43955iD3E2BDE74B4F9A34/image-size/large?v=v2&amp;amp;px=999" role="button" title="KDS-Linker.jpg" alt="KDS-Linker.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-339148"&gt;K64_MQXL_Printf.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 14:38:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306527#M50</guid>
      <dc:creator>dereksnell</dc:creator>
      <dc:date>2014-05-27T14:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: KDS printf issues with -nanolibc</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306528#M51</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm able to use printf() with nanolib without any issues (see attached project), but I'm not using MQXlite. I only can guess that there is a problem in the context of MQXlite?&lt;/P&gt;&lt;P&gt;Apart of that: I know that the library needs a lot of stack (&amp;gt; 1 KByte) if using printf(), so increasing the stack size per task can help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 14:34:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306528#M51</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2014-05-28T14:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: KDS printf issues with -nanolibc</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306529#M52</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Erich.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I bumped up the task stack size to 4KB, and still have the issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 16:51:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306529#M52</guid>
      <dc:creator>dereksnell</dc:creator>
      <dc:date>2014-05-28T16:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Re: KDS printf issues with -nanolibc</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306530#M53</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Derek,&lt;/P&gt;&lt;P&gt;My workaround is using AS1:Serial_LDD component.&amp;nbsp; Not sure if it helps size wise though.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 17:22:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306530#M53</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2014-05-28T17:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: KDS printf issues with -nanolibc</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306531#M54</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What about HEAP size? I see in another thread that the GNU library in KDS needs at least 400 bytes or more of HEAP space allocated in the linker file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jul 2014 12:03:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306531#M54</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2014-07-08T12:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: KDS printf issues with -nanolibc</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306532#M55</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Derek,&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;The parameter count for the character count to send out the UART is set to 1 when -nanolibc, no matter what the length of the printf string is.&amp;nbsp; If I remove the linker option -nanolibc and debug, the character count is passed correctly as expected.&lt;/P&gt;&lt;P&gt;The reason is that the newlib-nano is optimized for size/space to fit better smaller embedded devices. So the library implementation avoids buffering if possible. Instead, it writes characters by characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jul 2014 11:22:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306532#M55</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2014-07-09T11:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: KDS printf issues with -nanolibc</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306533#M56</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For Cortex-M4, somehow an additional hook routine is needed: &lt;STRONG&gt;_isatty().&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;see &lt;A href="http://mcuoneclipse.com/2014/07/12/printf-for-the-frdm-k64f-board-and-kinetis-design-studio/" title="http://mcuoneclipse.com/2014/07/12/printf-for-the-frdm-k64f-board-and-kinetis-design-studio/"&gt;UART printf() for the FRDM-K64F Board and Kinetis Design Studio | MCU on Eclipse&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jul 2014 18:20:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306533#M56</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2014-07-13T18:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Re: KDS printf issues with -nanolibc</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306534#M57</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all your help with this, Erich.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Increasing the heap and replacing _isatty() fixed the issues for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached are two projects that both run on the FRDM-K64F board using KDS v1.0.1 and the -nanolibc linker option.&amp;nbsp; One project is built with the Kinetis SDK and no Processor Expert (PEx).&amp;nbsp; The other project uses PEx and no SDK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the SDK project, the stack and heap size are set in the Assembler settings:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Assembler.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/45034i79F7FD69F344310D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Assembler.jpg" alt="Assembler.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the PEx project, the stack and heap sizes are set in the Build Options properties of the CPU component.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="PEx Heap.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/45035i26759676A5BC6417/image-size/large?v=v2&amp;amp;px=999" role="button" title="PEx Heap.jpg" alt="PEx Heap.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2014 15:14:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/KDS-printf-issues-with-nanolibc/m-p/306534#M57</guid>
      <dc:creator>dereksnell</dc:creator>
      <dc:date>2014-07-14T15:14:51Z</dc:date>
    </item>
  </channel>
</rss>

