<?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>disabling optimization on part of code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17118/disabling-optimization-on-part-of-code</link><description>hello all, 
 do you know if there is a way to disable code optimization only on some part of code? 
 I use optimization level 1 in Keil (otherwise the code does not fit in the 32KB Keil limitation). Do Unfortunately I just saw that the following command</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Oct 2016 11:19:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17118/disabling-optimization-on-part-of-code" /><item><title>RE: disabling optimization on part of code</title><link>https://devzone.nordicsemi.com/thread/65700?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2016 11:19:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76955852-e731-4ae0-a39b-4235679fd926</guid><dc:creator>bloobird0</dc:creator><description>&lt;p&gt;Thanks. It should do the work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: disabling optimization on part of code</title><link>https://devzone.nordicsemi.com/thread/65698?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2016 11:19:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:504d05f4-0776-4f8d-9659-efda98c0a1cf</guid><dc:creator>bloobird0</dc:creator><description>&lt;p&gt;@RK: I agree with you. Because the behaviour was not the same between optimization levels 0 and 1, I thought it could be an optimization problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: disabling optimization on part of code</title><link>https://devzone.nordicsemi.com/thread/65699?ContentTypeID=1</link><pubDate>Tue, 18 Oct 2016 08:59:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10a4a44b-a6ad-4e95-9675-1f06050f10ff</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You can set the optimization level of individual files in Keil by right-clicking them, select &amp;quot;Options for file&amp;quot; and then select the &amp;quot;C/C++&amp;quot; tab, see attached screenshot.&lt;/p&gt;
&lt;p&gt;-Bjørn&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/optimization.JPG" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: disabling optimization on part of code</title><link>https://devzone.nordicsemi.com/thread/65697?ContentTypeID=1</link><pubDate>Mon, 17 Oct 2016 23:06:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41f6d552-68ea-4f64-9b56-e370e3148955</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Just because you can&amp;#39;t set a breakpoint on the line doesn&amp;#39;t mean the code hasn&amp;#39;t been compiled. It&amp;#39;s been compiled and it&amp;#39;s in the executable, it just has been optimised so there is no debug information about that line.&lt;/p&gt;
&lt;p&gt;You have misidentified your problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: disabling optimization on part of code</title><link>https://devzone.nordicsemi.com/thread/65696?ContentTypeID=1</link><pubDate>Mon, 17 Oct 2016 17:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:093739d9-f132-4c7f-b9f9-3f536f13c463</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Not sure, but replacing the inline function with directly writing to the register as shown below might enable you to set a breakpoint.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;NRF_GPIO-&amp;gt;PIN_CNF[15] = (NRF_GPIO_PIN_SENSE_LOW &amp;lt;&amp;lt; GPIO_PIN_CNF_SENSE_Pos)
| (GPIO_PIN_CNF_DRIVE_S0S1 &amp;lt;&amp;lt; GPIO_PIN_CNF_DRIVE_Pos)
| (NRF_GPIO_PIN_PULLUP &amp;lt;&amp;lt; GPIO_PIN_CNF_PULL_Pos)
| (GPIO_PIN_CNF_INPUT_Connect &amp;lt;&amp;lt; GPIO_PIN_CNF_INPUT_Pos)
| (GPIO_PIN_CNF_DIR_Input &amp;lt;&amp;lt; GPIO_PIN_CNF_DIR_Pos);&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>