<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>UART doesn&amp;#39;t work well with GCC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20254/uart-doesn-t-work-well-with-gcc</link><description>I try to move my project from Keil to GCC but I get some different behavior. To show the difference I use examples/ble_peripheral/ble_app_uart 
 The part of the code below writes &amp;quot;Starting&amp;quot; wait 500ms &amp;quot;.&amp;quot; wait 500ms &amp;quot;.&amp;quot; etc... 
 ...
#include &amp;quot;nrf_delay</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 Mar 2017 21:01:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20254/uart-doesn-t-work-well-with-gcc" /><item><title>RE: UART doesn't work well with GCC</title><link>https://devzone.nordicsemi.com/thread/78900?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2017 21:01:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:029a28ed-7e25-4934-8405-32ba5e67ce03</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;NRF_LOG works fine on custom boards, you just need to set the Tx and Rx pin numbers in sdk_config.h&lt;/p&gt;
&lt;p&gt;PS. Please post your solution in case its more flexible than usimg NRF_LOG&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART doesn't work well with GCC</title><link>https://devzone.nordicsemi.com/thread/78896?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2017 15:04:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ba6408d-0acf-485e-add1-3ae1ac499541</guid><dc:creator>manymany</dc:creator><description>&lt;p&gt;I use a custom board without J-Link so I think NRF_LOG couldn&amp;#39;t work in that case.&lt;/p&gt;
&lt;p&gt;For now as a workaround solution I created a custom printf including app_uart_put() which is working fine. But if somebody is able to use printf with GCC i&amp;#39;m interested to know how to to that. It seem that it is a very common feature, I don&amp;#39;t understand why nobody can give me a clear answer !&lt;/p&gt;
&lt;p&gt;As retarget.c contains &lt;strong&gt;#elif defined(&lt;strong&gt;GNUC&lt;/strong&gt;)&lt;/strong&gt; means that it is not only for Keil ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART doesn't work well with GCC</title><link>https://devzone.nordicsemi.com/thread/78898?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2017 13:18:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e28c5669-c52c-4757-8679-c22e95cb8d27</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Again, the &lt;code&gt;retarget.c&lt;/code&gt; file is Keil specific. I suggest that you use &lt;code&gt;NRF_LOG_INFO&lt;/code&gt; instead as this works with both Keil and GCC.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART doesn't work well with GCC</title><link>https://devzone.nordicsemi.com/thread/78895?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2017 11:36:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ef05094-b7d1-4d6a-90a9-876629432729</guid><dc:creator>manymany</dc:creator><description>&lt;p&gt;printf seems to use  _write from retarget.c&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int _write(int file, const char * p_char, int len)
{
    int i;

    UNUSED_PARAMETER(file);

    for (i = 0; i &amp;lt; len; i++)
    {
        UNUSED_VARIABLE(app_uart_put(*p_char++));
    }

    return len;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But nothing explain that it prints only lines (with \n).&lt;/p&gt;
&lt;p&gt;If I use app_uart_put() it print directly without waiting a &amp;quot;\n&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART doesn't work well with GCC</title><link>https://devzone.nordicsemi.com/thread/78899?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2017 09:52:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0533daf-d0ae-43c2-a32a-476c6b1dde2d</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;In the Keil projects we have included &lt;code&gt;retarget.c&lt;/code&gt;, which retargets printf() to app_uart_put(). Note that retarget is Keil specific, so you will have to do the same for GCC. Alternativly you can use the NRF_LOG macros as suggested by @rogerclark&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART doesn't work well with GCC</title><link>https://devzone.nordicsemi.com/thread/78897?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2017 06:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9c126e1-4373-4161-a762-e1008d185513</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;Not sure about printf, but using NRF_LOG commands I sometimes have to &amp;quot;flush&amp;quot; to see the data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>