<?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>LPC MicrocontrollersのトピックRe: How does printf work?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-does-printf-work/m-p/827207#M33047</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-content-finding="Community" data-userid="327693" data-username="dorin.petre@falcon.ro" href="https://community.nxp.com/people/dorin.petre@falcon.ro"&gt;Dorin Petre&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support, please refer to the Fig 1.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2018-10-08_15-31-22.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/74065i2C86FECCFDA00537/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-10-08_15-31-22.jpg" alt="2018-10-08_15-31-22.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;Fig 1&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Oct 2018 07:33:50 GMT</pubDate>
    <dc:creator>jeremyzhou</dc:creator>
    <dc:date>2018-10-08T07:33:50Z</dc:date>
    <item>
      <title>How does printf work?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-does-printf-work/m-p/827206#M33046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on a LPC804 with MCUXPRESSO.&lt;/P&gt;&lt;P&gt;I am using the Redlib (nohost -nf) - Library support with the following preprocessor defines:&lt;/P&gt;&lt;P&gt;__REDLIB__&lt;BR /&gt;PRINTF_FLOAT_ENABLE=0&lt;BR /&gt;CR_INTEGER_PRINTF&lt;BR /&gt;CPU_LPC804M101JDH24&lt;BR /&gt;CPU_LPC804M101JDH24_cm0plus&lt;BR /&gt;SDK_DEBUGCONSOLE=0&lt;BR /&gt;CR_PRINTF_CHAR&lt;BR /&gt;__MCUXPRESSO&lt;BR /&gt;__USE_CMSIS&lt;BR /&gt;DEBUG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the printf - character by character with only interger only implementation.&lt;/P&gt;&lt;P&gt;It is redirected to work with a uart driver to print in a terminal. In the driver I have a software buffer of 20 bytes, and it works fine if I give it a for loop with 200 bytes, it just waits to have space to put the next byte and I can see all of them on the terminal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;printf("Print this sequence that is longer then 20 bytes &lt;SPAN&gt;0123456789&lt;/SPAN&gt;&lt;SPAN&gt;10111213141516171819&lt;/SPAN&gt;&lt;SPAN&gt;\n\r&lt;/SPAN&gt;");&lt;/P&gt;&lt;P&gt;- works just fine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;printf("&lt;SPAN&gt;Print this sequence that is longer then 20 bytes&lt;/SPAN&gt;")&lt;/P&gt;&lt;P&gt;for(uint8_t i = 0; i &amp;lt; 20; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;printf("%d, ",&amp;nbsp; i);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;printf("\n\r");&lt;/P&gt;&lt;P&gt;- here some times I get HardFault or I get garbage&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I saw that in the&amp;nbsp;MCUXpresso_IDE_User_Guide.pdf on&amp;nbsp;15.5.1 Redlib printf Variants(page 136)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"It is possible to switch to using “character-by-character” versions of these functions (which do&lt;BR /&gt;not require heap space) by specifying the build define “CR_PRINTF_CHAR” (which should be&lt;BR /&gt;set at the project level). This can be useful, for example, if you are retargeting printf() to write&lt;BR /&gt;out over a UART (as detailed below)- as in this case it is pointless creating a temporary buffer to&lt;BR /&gt;store the whole string, only to then print it out over the UART one character at a time"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the printf has arguments does it still uses malloc() to store the arguments?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2018 14:53:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-does-printf-work/m-p/827206#M33046</guid>
      <dc:creator>dorin_petre</dc:creator>
      <dc:date>2018-10-04T14:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: How does printf work?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-does-printf-work/m-p/827207#M33047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-content-finding="Community" data-userid="327693" data-username="dorin.petre@falcon.ro" href="https://community.nxp.com/people/dorin.petre@falcon.ro"&gt;Dorin Petre&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support, please refer to the Fig 1.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2018-10-08_15-31-22.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/74065i2C86FECCFDA00537/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-10-08_15-31-22.jpg" alt="2018-10-08_15-31-22.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;Fig 1&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Oct 2018 07:33:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-does-printf-work/m-p/827207#M33047</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2018-10-08T07:33:50Z</dc:date>
    </item>
  </channel>
</rss>

