<?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>CodeWarrior for MCUのトピックOptimization problem</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505058#M12810</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a problem with this code when activate optimization:&lt;/P&gt;&lt;P&gt;inside main i have this cycle, that waiting a trigger of interrupt to proceed:&lt;/P&gt;&lt;P&gt;for(;;)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;WaitTrigger();&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void WaitTrigger(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (!appTrigger)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; appTrigger = FALSE;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and appTrigger&amp;nbsp; is forced TRUE by interrupt.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with -O0 working fine, but if I insert -O1 stop work.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can disable the optimization in this area, or other idea to enable the optimization?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Mar 2016 10:42:11 GMT</pubDate>
    <dc:creator>neuzzo</dc:creator>
    <dc:date>2016-03-03T10:42:11Z</dc:date>
    <item>
      <title>Optimization problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505058#M12810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a problem with this code when activate optimization:&lt;/P&gt;&lt;P&gt;inside main i have this cycle, that waiting a trigger of interrupt to proceed:&lt;/P&gt;&lt;P&gt;for(;;)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;WaitTrigger();&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void WaitTrigger(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (!appTrigger)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; appTrigger = FALSE;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and appTrigger&amp;nbsp; is forced TRUE by interrupt.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with -O0 working fine, but if I insert -O1 stop work.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can disable the optimization in this area, or other idea to enable the optimization?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 10:42:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505058#M12810</guid>
      <dc:creator>neuzzo</dc:creator>
      <dc:date>2016-03-03T10:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505059#M12811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Riccardo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;To workaround the problem, you may use compiler pragma to&lt;STRONG&gt; &lt;/STRONG&gt;disable the optimization locally for this ISR. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;To dig into the problem, we need to know the CodeWarrior version you're using. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;For Classic CodeWarrior, please:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;1)Start the IDE and click on Help | About Freescale(Metrowerks) CodeWarrior. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;2)Click on Installed Products&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;3)Provide us all info displayed. Or you can save them in a txt file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;For Eclipse CodeWarrior, please:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;1)Start the IDE and click on Help | About CodeWarrior Development Studio. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;2)Provide us the info displayed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;And an example project will be greatly appreciated. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Fiona Kuang&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Technical Information &amp;amp; Commercial Support&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 12:37:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505059#M12811</guid>
      <dc:creator>TICS_Fiona</dc:creator>
      <dc:date>2016-03-03T12:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505060#M12812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Fiona, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the replay.&lt;/P&gt;&lt;P&gt;The &lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;CodeWarrior version is 10.6, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;The MCU used are MKE02Z64.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;I have create the grid of software with PE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 13:50:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505060#M12812</guid>
      <dc:creator>neuzzo</dc:creator>
      <dc:date>2016-03-03T13:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505061#M12813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello neuzzo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;CodeWarrior v10.6 is an old version, please upgrade to CW10.6.6. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Please first install CW10.6.4 which can be downloaded from:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL style="list-style-type: lower-alpha;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;&lt;A href="https://community.nxp.com/www.freescale.com/cwmcu10" target="test_blank"&gt;www.freescale.com/cwmcu10&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Its update v10.6.5 and v10.6.6 are also available at the same link.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Further information and the release notes are available on the following Freescale community page:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-143655"&gt;https://community.freescale.com/docs/DOC-143655&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;To workaround the problem, you may use compiler pragma to disable the optimization locally for this ISR. For GCC compiler, it should be : &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;#pragma GCC optimize ("O0")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;For details, please refer to the link below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;&lt;A href="http://stackoverflow.com/questions/2219829/how-to-prevent-gcc-optimizing-some-statements-in-c"&gt;http://stackoverflow.com/questions/2219829/how-to-prevent-gcc-optimizing-some-statements-in-c&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;Hope this helps!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1.5pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Fiona Kuang&lt;/P&gt;&lt;P&gt;Technical Information &amp;amp; Commercial Support&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2016 05:22:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505061#M12813</guid>
      <dc:creator>TICS_Fiona</dc:creator>
      <dc:date>2016-03-09T05:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505062#M12814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make sure you declared all variables shared between main application code and an ISR as "volatile", e.g. like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;volatile unsigned int appTrigger;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Short explanation: "volatile" tells the compiler to not make any assumptions about the content of the variable. That is essential for all variables that are used in a (for the compiler) non-deterministic way (i.e. ISR).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;MJW&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2016 08:30:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Optimization-problem/m-p/505062#M12814</guid>
      <dc:creator>MJW</dc:creator>
      <dc:date>2016-03-09T08:30:22Z</dc:date>
    </item>
  </channel>
</rss>

