<?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>Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103905/bare-metal-gcc-nrf5340-audio-dk-printf-stdout-uart-output</link><description>I have made a bare metal app using gcc on Linux for the nRF5340 Audio DK. I&amp;#39;m able to start the segger gdb server, load the code, set a breakpoint, run and watch the LED&amp;#39;s flash as expected. 
 However, I don&amp;#39;t observe any printf/stdout output from the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 30 Aug 2025 12:56:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103905/bare-metal-gcc-nrf5340-audio-dk-printf-stdout-uart-output" /><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/547238?ContentTypeID=1</link><pubDate>Sat, 30 Aug 2025 12:56:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5ec95d6-3f8d-447c-b98e-e0695300a7f3</guid><dc:creator>rbence</dc:creator><description>&lt;p&gt;Thank you very much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/547156?ContentTypeID=1</link><pubDate>Fri, 29 Aug 2025 08:54:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95764d39-32b6-4e36-af8b-bf5a9afba1f3</guid><dc:creator>zener</dc:creator><description>&lt;p&gt;Yes, at least I have the location of the startup code in nrfx.git/mdk passed in my CFLAGS -I option. Which results in:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;Creating directory build
[CC] main.c --&amp;gt; build/main.o
Creating directory build/cmsis
[AS] /home/myuser/projects/nordic/nrfx.git/mdk/gcc_startup_nrf5340_application.S --&amp;gt; build/cmsis/startup.o
[CC] /home/myuser/projects/nordic/nrfx.git/mdk/system_nrf5340_application.c --&amp;gt; build/cmsis/system.o
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/546527?ContentTypeID=1</link><pubDate>Sat, 23 Aug 2025 11:07:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8c2d89a-bf4b-4faa-b2fb-80508cb044b1</guid><dc:creator>rbence</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I&amp;#39;m also trying to create a bare metal app. Did you use the contents of the nrfx/mdk folder? I mean the &lt;strong&gt;gcc_startup_nrf5340_application.s&lt;/strong&gt; and&amp;nbsp;&lt;span&gt;&lt;span&gt;&lt;strong&gt;system_nrf5340_application.c&lt;/strong&gt; and for linker script the&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;strong&gt;nrf5340_xxaa_application.ld?&lt;/strong&gt;&amp;nbsp;&lt;br /&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/446744?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 21:34:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22ae22a9-6641-4ee2-997f-2e526bb36f6c</guid><dc:creator>zener</dc:creator><description>&lt;p&gt;One more note: It&amp;#39;s also possible to use the JLinkRTTLogger and the output will end up in /tmp/stdout.log&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;/opt/SEGGER/JLink_Linux_V792e_x86_64/JLinkRTTLogger -SelectEmuBySN 1050169338 -Device NRF5340_XXAA_APP -If swd -Speed 4000 -RTTAddress auto-detection -RTTChannel 0 /tmp/stdout.log&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/446742?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 21:08:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b9c33e6-aa99-4f98-9285-172db55b8a7c</guid><dc:creator>zener</dc:creator><description>&lt;p&gt;A short note if somebody else would end up here due to search for the same.&lt;/p&gt;
&lt;p&gt;It was quite simple to retarget the stdio using the segger provided files. Basically all I had to do was to compile and link SEGGER_RTT.c and SEGGER_RTT_Syscalls_GCC.c and then observe the output on port 19021:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;$ nc localhost 19021&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;SEGGER J-Link V7.92e - Real time terminal output&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;SEGGER J-Link (unknown) V1.0, SN=1050169338&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;Process: JLinkGDBServerCLExe&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;Hello devkit&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;git sha1 09d8694e4695f6c44a5b4d307587e49dc3b5bfeb, branch rtt-output-support&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;By running this:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;int main()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt; printf(&amp;quot;Hello devkit\n&amp;quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;#ifdef GIT_SHA1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt; printf(&amp;quot;git sha1 %s, branch %s\n&amp;quot;,GIT_SHA1,GIT_BRANCH);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;#endif&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;...&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/446658?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 12:12:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95ac80fd-d126-40cc-b3ca-bf5c2b80fde2</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Unfortunately, we do not have a bare metal retarget implementation that works with &amp;#39;nrfx&amp;#39;. In the SDK, we use the Zephyr serial drivers for UART. For your UART send function, you can use the UARTE driver from the nrfx repo at&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/nrfx/tree/master"&gt;https://github.com/NordicSemiconductor/nrfx/tree/master&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For RTT, you need to&amp;nbsp;include the RTT source code in your project. The source code is included in the JLink installation and can be found in &amp;lt;jlink install dir&amp;gt;/Samples/RTT&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/446630?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 11:18:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85898f14-2315-43a2-9be6-abe4c53c851b</guid><dc:creator>zener</dc:creator><description>&lt;p&gt;Thanks! Is there such a retargeting library available already, e.g. on top of the nrfx uart or something using the segger serial port(s)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/446626?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 11:01:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4571881-46a8-410a-961f-d882d525a378</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Yes, you must retarget printf() to&amp;nbsp;redirect the output to&amp;nbsp;UART or RTT.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdio.h&amp;gt;

// low-level function used by printf() to write output data
int _write(int file, const char * p_char, int len)
{
    // TODO: send printf() bytes to UARTE
    
    return len;
}&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit:&amp;nbsp;&lt;/strong&gt;This stackoverflow post (&lt;a id="" href="https://stackoverflow.com/questions/55014043/how-do-you-implement-printf-in-gcc-from-newlib"&gt;https://stackoverflow.com/questions/55014043/how-do-you-implement-printf-in-gcc-from-newlib&lt;/a&gt;) covers this topic in more detail.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bare metal gcc nRF5340 Audio DK printf/stdout uart output?</title><link>https://devzone.nordicsemi.com/thread/446623?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 10:46:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78392143-806a-4bb8-a2b0-d89933e519ca</guid><dc:creator>zener</dc:creator><description>&lt;p&gt;I guess this boils down to if there is a uart or segger driver for the gcc stdio library to enable output of printf/stdout in the nrfx repository or even using CMSIS or similar, or is using explicit uart calls the only option?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>