<?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>Application crash at higher optimization levels</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35631/application-crash-at-higher-optimization-levels</link><description>Hi 
 The application I&amp;#39;m currently working on has three debug settings: 
 
 DEBUG preprocessor symbol 
 Optimization level 0 
 NRF_LOG at debug level (using RTT) 
 
 ...and works fine. 
 But when I increase the optimization level (from 1 to 3) AND change</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Jun 2018 12:00:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35631/application-crash-at-higher-optimization-levels" /><item><title>RE: Application crash at higher optimization levels</title><link>https://devzone.nordicsemi.com/thread/137088?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 12:00:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78819c09-f783-46fe-a586-d0ba6635ef4d</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Does it also happen on those other log levels when the optimization level is kept at 0?&lt;/p&gt;
&lt;p&gt;We have not experienced any such behavior with the SDK or any examples within it, so it is most likely something that you do in your particular application.&lt;/p&gt;
&lt;p&gt;Errors that arises when you enable optimization usually means that some crucial code is optimized away because to the compiler it looks like it is unnecessary.&lt;/p&gt;
&lt;p&gt;A common mistake that can give behavior similar to this is that you have a loop structure waiting for a variable to change in an interrupt routine. In such cases you should declare the variable &lt;code&gt;volatile&lt;/code&gt;, in order to tell the compiler that the variable may change at any time. Otherwise the check may be optimized away entirely, or the variable is kept in a register and not written to or read from memory every time it is used. That way, when the interrupt routine fires and changes the variable, it will not be detected from the other piece of code. In your case it may of course be something completely different, but that is a good first thing to check.&lt;/p&gt;
&lt;p&gt;If the above tips does not lead to any discoveries then I am afraid you must share the code for us to give any pointers to what might be wrong.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>