<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>cannot retarget getchar/read/getch</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/44397/cannot-retarget-getchar-read-getch</link><description>I&amp;#39;m using SDK 15.0 on an nRF52840 dongle. I&amp;#39;ve been able to retarget the output functions (outputting through the CDC UART) but so far I can&amp;#39;t seem to use getchar() in my higher level code and have it correctly hook into the received data stream from</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Fri, 08 Mar 2019 19:55:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/44397/cannot-retarget-getchar-read-getch" /><item><title>RE: cannot retarget getchar/read/getch</title><link>https://test-devzone.nordicsemi.com/thread/175138?ContentTypeID=1</link><pubDate>Fri, 08 Mar 2019 19:55:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:075221ad-b437-4b00-99fa-0608eb242c25</guid><dc:creator>user3482</dc:creator><description>&lt;p&gt;I don&amp;#39;t think it is libc issue but rather bad implementation in retarget.c. &amp;nbsp;Proper retarget is like this:&lt;/p&gt;
&lt;p&gt;base :&amp;nbsp;&lt;a href="https://github.com/I-SYST/EHAL/blob/master/src/stddev.c&amp;nbsp;"&gt;github.com/.../stddev.c&amp;#160;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;uart retarget implementation :&amp;nbsp;&lt;a href="https://github.com/I-SYST/EHAL/blob/master/src/uart_retarget.c"&gt;https://github.com/I-SYST/EHAL/blob/master/src/uart_retarget.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;use case example :&amp;nbsp;&lt;a href="https://github.com/I-SYST/EHAL/blob/master/exemples/uart/uart_retarget_demo.cpp"&gt;github.com/.../uart_retarget_demo.cpp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cannot retarget getchar/read/getch</title><link>https://test-devzone.nordicsemi.com/thread/175126?ContentTypeID=1</link><pubDate>Fri, 08 Mar 2019 17:38:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d8ca9e7-3dff-4eaa-8029-0e2b9738492b</guid><dc:creator>user4098</dc:creator><description>&lt;p&gt;(man this &amp;quot;new&amp;quot; devzone is a terrible, terrible website. It&amp;#39;s sacrificing actual usability for glitz and flashy UI!)&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My code is not based off of anything, I just copied the retarget.c from an old project long, long ago and have been modifying and using it on several ARM systems, not just Nordic.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The .map file shows that getchar() is implemneted in libc.a (arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard/libc.a) -- perhaps this has nothing to do with Nordic&amp;#39;s SDK at all and everything to do with a bad implementation in libc which ships with gcc-arm-none-eabi-7-2018-q2-update.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cannot retarget getchar/read/getch</title><link>https://test-devzone.nordicsemi.com/thread/174810?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 13:17:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f813f35-c01f-40cb-b879-3f9f760c64af</guid><dc:creator>user2116</dc:creator><description>&lt;p&gt;Hi Andrew&lt;/p&gt;
&lt;p&gt;Is your project based on one of the existing SDK examples?&lt;/p&gt;
&lt;p&gt;If yes, which one?&lt;/p&gt;
&lt;p&gt;The map file should show which module implements the getchar() function, even if the source code does not. Could you have a look there, or share it with me?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cannot retarget getchar/read/getch</title><link>https://test-devzone.nordicsemi.com/thread/174581?ContentTypeID=1</link><pubDate>Wed, 06 Mar 2019 13:43:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf0cafc5-513e-4495-b39b-f274e19d656b</guid><dc:creator>user4098</dc:creator><description>&lt;p&gt;No IDE, just gcc and a Makefile.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;im not sure I made the issue clear. getchar() is present in the binary. Something has implemented it, and it&amp;rsquo;s not calling any of the normal retargeted functions (__getchar, _read, _fgetc, etc.). The getchar implementation appears to be in one of the binary-only libraries in SDK15.0, as grepping the entire source tree reveals nothing useful.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Because of this, I can&amp;rsquo;t call getchar() I my high level code and have it actually pull data from my data source. stdio works (fgetc, etc) but I&amp;rsquo;m trying to understand the getchar issue.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cannot retarget getchar/read/getch</title><link>https://test-devzone.nordicsemi.com/thread/174552?ContentTypeID=1</link><pubDate>Wed, 06 Mar 2019 12:59:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:169954a8-479c-4914-8624-dd02c2e725f1</guid><dc:creator>user2116</dc:creator><description>&lt;p&gt;Hi Andrew&lt;/p&gt;
&lt;p&gt;Which IDE/compiler are you using?&lt;/p&gt;
&lt;p&gt;getchar() should be implemented in the retarget file, but I don&amp;#39;t think any of our examples use it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>