<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPCXpresso IDEのトピックRe: Release vs Debug Builds - One Works, One Doesn't</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579282#M24031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by frame on Thu Apr 12 07:56:06 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I don' want to bring coals to Newcastle, but there is one common issue revealed with higher optimization levels.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Beginners usually forget the [B][COLOR=Blue]volatile[/COLOR][/B] qualifier in important cases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Especially peripheral registers and variables used in interrupts are critical.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As I assume you use CMSIS headers, I guess it is related to variables used in interrupts..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are really interrested, try to debug the release version - you might be surprised.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:12:27 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:12:27Z</dc:date>
    <item>
      <title>Release vs Debug Builds - One Works, One Doesn't</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579279#M24028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ajacks504 on Thu Apr 12 06:59:19 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a very simple applications, it works like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Power on reset.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Send some TXT out of the SCI port.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Configure a SPI sensor (SSP0).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Send some more TXT out of the SCI port about the success or failure of configuring the the SPI sensor (SSP0).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Enter a infintite loop where I wait for a flag to be set by an interrupt with the "WFI" instruction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the flag gets set, I read the value of the SPI sensor (SSP0) and output it over the other SPI port (SSP1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The flag is set in an interrupt routine on the falling edge of PIO1_0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code works great when I build the "debug" version and fails when I try the "release" version.&amp;nbsp; The way that it fails is this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The SCI port output works, but it reports that configuring the SPI sensor fails, and I never hit my interrupt routine.&amp;nbsp; I know that I'm getting the interrupts in hardware, but my routine never gets hit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, right now, I'm guessing that somehow the SPI peripheral isn't being configured properly in the "release" version, but I have no clue as to why my interrupt routine isn't being hit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[B]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any clues for me about the differences between "debug" and "release" builds that might cause such behavior?[/B]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adam&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:12:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579279#M24028</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Release vs Debug Builds - One Works, One Doesn't</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579280#M24029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Thu Apr 12 07:16:22 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: ajacks504&lt;/STRONG&gt;&lt;BR /&gt;[B]Does anyone have any clues for me about the differences between "debug" and "release" builds that might cause such behavior?[/B]&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, Code Red does :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://support.code-red-tech.com/CodeRedWiki/CompilerOptimization?&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:12:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579280#M24029</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Release vs Debug Builds - One Works, One Doesn't</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579281#M24030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ajacks504 on Thu Apr 12 07:47:05 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;That was fast, thanks for the link to that Zero, good read, good to know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've got a few software timing loops, I marked the counters in them as volatile, but it didn't fix them, I'll change them to use a timer or systick.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll dial back the optimization and see where it gets me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just don't really see how this will get further optimized:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;void SensorStartupDelay()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; volatile uint32_t i;

&amp;nbsp;&amp;nbsp;&amp;nbsp; for (i = 0; i &amp;lt; 500000; i++) __NOP();
&amp;nbsp;&amp;nbsp;&amp;nbsp; UARTSend( SENSOR_START_DELAY, sizeof(SENSOR_START_DELAY) );
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;Anyway, I know, I know, I'm a bad programmer &lt;SPAN class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;&lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:12:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579281#M24030</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Release vs Debug Builds - One Works, One Doesn't</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579282#M24031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by frame on Thu Apr 12 07:56:06 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I don' want to bring coals to Newcastle, but there is one common issue revealed with higher optimization levels.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Beginners usually forget the [B][COLOR=Blue]volatile[/COLOR][/B] qualifier in important cases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Especially peripheral registers and variables used in interrupts are critical.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As I assume you use CMSIS headers, I guess it is related to variables used in interrupts..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are really interrested, try to debug the release version - you might be surprised.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:12:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579282#M24031</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Release vs Debug Builds - One Works, One Doesn't</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579284#M24033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ajacks504 on Thu Apr 12 08:36:34 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I turned off optimization on the "release" build, now I'm back to working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried adding the volatile qualifier on interrupts, no fix.&amp;nbsp; I'll need to look closely at the SSP_IOConfig(), SSP_Init(), GPIOInit(), GPIOSetDir(), GPIOIntEnable() and GPIOSetInterrupt() CMSIS functions and see if some of that maybe is getting optimized away.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for all the help guys.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:12:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579284#M24033</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Release vs Debug Builds - One Works, One Doesn't</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579286#M24035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Thu Apr 12 09:26:21 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: ajacks504&lt;/STRONG&gt;&lt;BR /&gt; I still don't see just how exactly, but that will come.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW, ARM is warning you :eek:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;4.5 Timing and delays&lt;BR /&gt;&lt;BR /&gt;It is common, when programming for PIC devices, to use NOP instructions as a way of consuming time. The execution time of NOP instructions is easily determined from the system clock speed. When developing for Cortex-M3 devices this cannot be relied on as the pipeline is free to “fold out” NOP instructions from the instruction stream. When this happens, they do not consume time at all.&lt;BR /&gt;Deterministic delays in Cortex-M3 systems must therefore make use of a timer peripheral.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;See: &lt;/SPAN&gt;&lt;A href="http://"&gt;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0234a/index.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:12:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579286#M24035</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Release vs Debug Builds - One Works, One Doesn't</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579287#M24036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ajacks504 on Thu Apr 12 13:51:57 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Yep, what I find extremely weird is that the for loop NOP C code, when compiled give assembly that doesn't actually contain a NOP instruction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the NOP might not even get executed, why is there a NOP instruction?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The other strange thing is that in the LPC1114 user manual 9.3.9, it says:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Remark: The synchronizer between the GPIO and the
NVIC blocks causes a delay of 2 clocks. [B]It is recommended
to add two NOPs[/B] after the clear of the interrupt edge
detection logic before the exit of the interrupt service
routine.&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The synchronizer is probably just 2 cascaded D flip flops, so adding 2 clks makes sense, but if the NOPs are going to get “folded out,” why ask that we insert NOPs?&amp;nbsp; The compiler can't be THAT smart huh?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:12:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579287#M24036</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Release vs Debug Builds - One Works, One Doesn't</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579288#M24037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atomicdog on Thu Apr 12 16:14:09 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The LPC1114 is a cortex-M0 not a cortex-M3. One of the selling points for M0 is that it has deterministic instruction cycles.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:12:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Release-vs-Debug-Builds-One-Works-One-Doesn-t/m-p/579288#M24037</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:12:31Z</dc:date>
    </item>
  </channel>
</rss>

