<?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>NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69142/nrf_log-print-double-precision-float-number</link><description>I am on SDK15.3, NRF52840, armgcc, makefile, console 
 I need to print a double float number in format of &amp;quot;x.xxxxE-xx&amp;quot;. I already know that NRF_LOG can only print float with MARKER, so I use sprintf to format the number into a string buffer first, and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 19 Dec 2020 18:43:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69142/nrf_log-print-double-precision-float-number" /><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/285934?ContentTypeID=1</link><pubDate>Sat, 19 Dec 2020 18:43:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2dc625f-788b-4fdc-973c-868a4739cabd</guid><dc:creator>Takeshi Goda</dc:creator><description>&lt;p&gt;hi,jorgen&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I also encountered this problem. I struggled for a day and was puzzled.&lt;/p&gt;
&lt;p&gt;I tried all the methods in the world.&lt;/p&gt;
&lt;p&gt;your last hint makes me feel you are Linus.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/284388?ContentTypeID=1</link><pubDate>Thu, 10 Dec 2020 16:32:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2116cb07-6b03-4516-b3f4-72162932eea0</guid><dc:creator>rolandash</dc:creator><description>&lt;p&gt;Although it sounds like making no&amp;nbsp;sense to me, your last hint just made my day :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/284164?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 16:37:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1209a5e-d1fb-4c25-963b-e0a19c430f40</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I do not see any ways that the logger backend could be causing this. However, one thing you should try is to use&amp;nbsp;&lt;a title="Macro for copying a string to internal logger buffer if logs are deferred." href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__nrf__log.html#ga5cd6a091973b5f459618ea53c4e47d4e"&gt;NRF_LOG_PUSH&lt;/a&gt;() to push the string to the internal string buffer if this is part of a larger application, and you are using &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_nrf_log.html?cp=7_1_3_27_0_1#lib_nrf_log_deferred"&gt;deferred logging&lt;/a&gt;. The string may be overwritten on the stack before it is processed by the logger backends. It could look like this is the problem in your latest log message, since the length seems to be correct at 11.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/284159?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 16:17:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd811baa-ec89-41f6-9b59-59eaef7b4a9d</guid><dc:creator>rolandash</dc:creator><description>&lt;p&gt;thanks you &lt;a href="https://devzone.nordicsemi.com/members/jorgen"&gt;Jørgen&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I forgot to mention I am using RTT as backend of NRF_LOG&lt;/p&gt;
&lt;p&gt;Does that matter?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/284144?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 15:32:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31e2f8b1-99a7-4ee9-8bba-4fc4589c8fab</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;This is the project I initially used for testing with SDK 15.3.0:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8360.double_5F00_float_5F00_test.zip"&gt;devzone.nordicsemi.com/.../8360.double_5F00_float_5F00_test.zip&lt;/a&gt;. There is also included a hex-file in the _build directory in case you want to test that.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure if the compiler version or OS makes any difference, I&amp;#39;m just asking in order to try to recreate your environment as close as possible. Just tested with SDK 17.0.2 and&amp;nbsp;9 2019-q4-major, but this still works fine on my setup.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/284127?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 14:47:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f70bc9a4-8cdb-48df-8cfa-53ec4c02e41a</guid><dc:creator>rolandash</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I upgraded from previous version of SDK, and I am on MacOS, I think I am using following version:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;GNU Tools for Arm Embedded Processors 7-2017-q4-major&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Will&amp;nbsp;that make a difference?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you please upload your test project so&amp;nbsp;I can make a&amp;nbsp;comparison locally?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;thank you!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/284096?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 14:02:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8df72963-7e76-459b-929a-e18f39bbb9cd</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Are you using a different armgcc version than the default supported in SDK 15.3.0 (7 2018-q2-update)? Which OS are you building on?&lt;/p&gt;
&lt;p&gt;I tested again with an unmodified example, and adding these two additional flags (-lrdimon -u _printf_float) makes the output look like I posted above in this example as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/283872?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 15:11:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:060d3daf-05e0-4c56-93e9-095e983fa7db</guid><dc:creator>rolandash</dc:creator><description>&lt;p&gt;Thanks &lt;a href="https://devzone.nordicsemi.com/members/jorgen"&gt;Jørgen&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I tried your solution but I still get the same:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:11.836,486] &amp;lt;info&amp;gt; app: [KF] updated K gain: ?8, 11
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Perhaps some other flags I also missing?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_LOG print double precision float number</title><link>https://devzone.nordicsemi.com/thread/283549?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 13:11:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10d8a2a3-b33c-483e-b4e2-883392682ae6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The Makefiles in the SDK does not include float support for printf in armgcc by default. Please try adding the flags from &lt;a href="https://stackoverflow.com/a/25723994"&gt;this post&lt;/a&gt; to the&amp;nbsp;LIB_FILES, that seems to print the way you want in my test:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Add standard libraries at the very end of the linker input, after all objects
# that may need symbols provided by these libraries.
LIB_FILES += -lc -lnosys -lm -lrdimon -u _printf_float&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: [KF] updated K gain: 3.00088E+03, 11&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>