<?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>printf() make something wrong</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46955/printf-make-something-wrong</link><description>Hi ,I&amp;#39;m working on nrf_MESH v2.20 and nrf_SDK v15.0 and SESV3.40. 
 In the project of light_switch-&amp;gt;proxy_client ,I use printf() to print something and it can work well and everything is OK.But after I pull out USB (for debugging ) the board can not work</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 May 2019 11:28:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46955/printf-make-something-wrong" /><item><title>RE: printf() make something wrong</title><link>https://devzone.nordicsemi.com/thread/185933?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 11:28:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc66dc45-a18c-4c58-b631-d5d7386235ef</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>[quote user="zhengrui"]If I define&amp;nbsp;RETARGET_ENABLE as 0, the firmware can run anytime.[/quote]
&lt;p&gt;&amp;nbsp;That is good, meaning that SES then disables the inbuilt __putchar() used for the debugging terminal.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Keep this to 0 if you are not debugging.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf() make something wrong</title><link>https://devzone.nordicsemi.com/thread/185813?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 02:14:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16428e24-a519-41a3-8245-42c5c298c9bd</guid><dc:creator>zhengrui</dc:creator><description>&lt;p&gt;In the ble_uart example we can know it use retarget.c file and the code-changed function _putchar() is defined in it.Also RETARGET_ENABLE is true in sdk_config.h.&lt;/p&gt;
&lt;p&gt;Now I remove retarget.c in ble_uart project and it can work in debug mode but the firmware does&amp;nbsp;&lt;span&gt;not run when not in debug mode (RETARGET_ENABLE is true).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If I define&amp;nbsp;RETARGET_ENABLE as 0, the firmware can run anytime.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf() make something wrong</title><link>https://devzone.nordicsemi.com/thread/185644?ContentTypeID=1</link><pubDate>Tue, 07 May 2019 08:45:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7b2cc4d-a8b7-4108-85c3-6a0876506372</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="zhengrui"]Thanks ,it works now though it still has an error report just as the picture above.[/quote]
&lt;p&gt;Could you explain in step-by-step what you are doing and what error message is shown?&lt;/p&gt;
&lt;p&gt;From your current sequence, it seems like you are removing power from the debugger while the debug session is on-going, which will terminate the session.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf() make something wrong</title><link>https://devzone.nordicsemi.com/thread/185640?ContentTypeID=1</link><pubDate>Tue, 07 May 2019 08:24:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ee4fc88-225b-47c0-96d8-eb2861868ed5</guid><dc:creator>zhengrui</dc:creator><description>&lt;p&gt;Thanks ,it works now though it still has an error report just as the picture above.&lt;/p&gt;
&lt;p&gt;I can find the _putchar() is defined in retarget.c but I don&amp;#39;t use it or .h file.Is there some connection?&lt;/p&gt;
&lt;p&gt;And I have tried this file in ble_uart example,I find that if I define RETARGET_ENABLE as true and remove retarget.c it still works in debug mode but never run when not in debug mode (if &lt;span&gt;RETARGET_ENABLE as failure my firmware will always run&lt;/span&gt;).&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know why the program acts this way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf() make something wrong</title><link>https://devzone.nordicsemi.com/thread/185451?ContentTypeID=1</link><pubDate>Mon, 06 May 2019 11:29:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a54ca3e-6ca9-4720-b6d0-e793e55a5b22</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]In the project of light_switch-&amp;gt;proxy_client ,I use printf() to print something and it can work well and everything is OK.But after I pull out USB (for debugging ) the board can not work anymore.[/quote]
&lt;p&gt;If I understand correctly, your firmware does not run when not in debug mode.&lt;/p&gt;
&lt;p&gt;Could this be the issue?&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/34784/conflicting-types-for-_putchar/133776#133776"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/34784/conflicting-types-for-_putchar/133776#133776&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>