<?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>Retargeting printf under SEGGER Embedded Studio</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19214/retargeting-printf-under-segger-embedded-studio</link><description>Hi all, 
 I&amp;#39;m currently trying to get the UART example (no SoftDevice) to work under Segger Embedded Studio. What I know is, that retarget.c is used to redefine the neccesary functions for printf (stdio). 
 app_uart_get and app_uart_put work absolutely</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 15 May 2017 20:23:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19214/retargeting-printf-under-segger-embedded-studio" /><item><title>RE: Retargeting printf under SEGGER Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/74430?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 20:23:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dd10f15-8a1d-493f-9587-5deee0a99b70</guid><dc:creator>MattyIce</dc:creator><description>&lt;p&gt;@RichieJH, did you exclude retarget.c from the project, in addition to replacing printf() w/ SEGGER_RTT_printf()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retargeting printf under SEGGER Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/74429?ContentTypeID=1</link><pubDate>Sat, 25 Mar 2017 09:03:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a54cdc4-91e3-46ab-96e4-5c0e686204dc</guid><dc:creator>RichieJH</dc:creator><description>&lt;p&gt;I just faced the same issue after commenting out FILE __stdout and FILE __stdin and couldn&amp;#39;t quite get Jorgen&amp;#39;s response to work.&lt;/p&gt;
&lt;p&gt;Anyway I found an even quicker way, and that is to convert printf to SEGGER_RTT_printf(0, String).  So &lt;code&gt;printf(&amp;quot;\r\nUART Start!\r\n&amp;quot;)&lt;/code&gt; becomes &lt;code&gt;SEGGER_RTT_printf(0, &amp;quot;\r\nUART Start!\r\n&amp;quot;)&lt;/code&gt;.  Just ensure you have SEGGER_RTT_printf.c in your project.  Thought I would mention this in case other users of SES come across this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retargeting printf under SEGGER Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/74428?ContentTypeID=1</link><pubDate>Thu, 26 Jan 2017 10:20:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0f2b7da-2720-4643-b7e8-0addaea43b2b</guid><dc:creator>mcn</dc:creator><description>&lt;p&gt;Thank you for your answer!&lt;/p&gt;
&lt;p&gt;This is the solution:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Do not use the website, since there are minor mistakes in the code. Use this: &lt;a href="https://www.segger.com/downloads/embeddedstudio/EmbeddedStudio_v310i_manual.pdf"&gt;www.segger.com/.../EmbeddedStudio_v310i_manual.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;This is the easiest way:
a) Include stdarg.h&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;b)
Define a function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void uart_printf(const char *fmt, ...)
{
    char buf[80], *p;
    va_list ap;
    va_start(ap, fmt);
    vsnprintf(buf, sizeof(buf), fmt, ap);
    for (p = buf; *p; ++p)
    app_uart_put(*p);
    va_end(ap);
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;c) Use this function, done :)&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retargeting printf under SEGGER Embedded Studio</title><link>https://devzone.nordicsemi.com/thread/74427?ContentTypeID=1</link><pubDate>Wed, 25 Jan 2017 09:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26da5b51-9f5e-497f-8993-e716cf1411dd</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The file &lt;em&gt;retarget.c&lt;/em&gt; only contains redefinition of the stdio functions for ARM and GCC libraries. It is &lt;a href="https://devzone.nordicsemi.com/question/29200/retargeting/?answer=29203#post-id-29203"&gt;not supported&lt;/a&gt; by Segger Embedded Studio. Have a look at &lt;a href="https://studio.segger.com/index.htm?https://studio.segger.com/libc_customizing_putchar.htm"&gt;this page&lt;/a&gt; about how you can customize the output of putchar in SES.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>