<?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>snprintf with float leads to hardfault</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80756/snprintf-with-float-leads-to-hardfault</link><description>Hello, 
 I am modifying mqtt_simple example to send float over mqtt. 
 
 If I change %f to %d, it works without crash. 
 I have tried enable/disable FPU or increasing HEAP_MEM_POOL_SIZE in prj.conf but not working. 
 
 
 My workaround is to print %d.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Oct 2021 12:48:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80756/snprintf-with-float-leads-to-hardfault" /><item><title>RE: snprintf with float leads to hardfault</title><link>https://devzone.nordicsemi.com/thread/335105?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2021 12:48:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f31a17b3-ec78-4560-8a20-272a572262ab</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Good to hear it solved the issue &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Stack overflow is a quite typical error when something is wrong in Zephyr unfortunately. Running the debugger and trying to figure out the chain of events leading to it is usually the best way to try and figure out what is going on.&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><item><title>RE: snprintf with float leads to hardfault</title><link>https://devzone.nordicsemi.com/thread/334710?ContentTypeID=1</link><pubDate>Tue, 19 Oct 2021 02:47:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c026a41c-5a7f-4353-bbf7-817978901ae5</guid><dc:creator>kclauah</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the prompt reply.&lt;/p&gt;
&lt;p&gt;It works.&lt;/p&gt;
&lt;p&gt;But there is room for improvement in debug message. It is hard to guess &amp;quot;Stack overflow&amp;quot; equal missing &lt;em&gt;CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: snprintf with float leads to hardfault</title><link>https://devzone.nordicsemi.com/thread/334690?ContentTypeID=1</link><pubDate>Mon, 18 Oct 2021 18:57:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f3d8de4-3184-4a25-a34b-63cb9f3898be</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to enable CONFIG_NEWLIB_LIBC_FLOAT_PRINTF in your project, by adding this to your prj.conf file:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Using this configuration I was able to use snprintf with float parameters on the nRF9160.&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>