<?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>topic Re: How to turn off code optimization in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161665#M4516</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  0154 160000       [4]     JSR   DUT_autotest:0x02af  531:      DUT_WAKEN_ClrVal();          0157 160000       [4]     JSR   DUT_autotest:0x032f  532:      DUT_WAKEN_SetVal();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Those JSR's to the end of the functions probably contain the code to clear/set the bit. However as far as I remember source stepping does bypass them, so either assembly step to see the toggle happening or switch that optimization off with -onf. Code will probably get&amp;nbsp;significantly&amp;nbsp;bigger.&lt;/P&gt;&lt;P&gt;My current guess is that the code still does what it should, but "just" source stepping does not behave as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:07:14 GMT</pubDate>
    <dc:creator>CompilerGuru</dc:creator>
    <dc:date>2020-10-29T09:07:14Z</dc:date>
    <item>
      <title>How to turn off code optimization</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161658#M4509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;codewarrior tries to drive me crazy... and it does this job quite good......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;somewhere in my code i want to toggle a pin to trigger my peripherals to do something...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DUT_WAKEN_ClrVal();DUT_WAKEN_SetVal();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i declared a been for a single pin DUT_WAKEN.&lt;/P&gt;&lt;P&gt;the whole day this worked and i was able to step through the debigger and he was executing this and measuring at the hardware showed the toggle... up to now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i did just small modifications on some code sorting but now debugger skips the ClrVal() and at the pins of the µC the pin keeps high.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i found codewarrior shortening my code here and there disabling to step to some portion of code but now it strips even the funtional parts...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can i turn off the whole optimization and shortening of code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my hc12 compiler options out of the box: -Cf -CPUHCS12 -Mb -TD4LD4LLD4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i cant really waste my last weeks of diploma thesis with trying to teach codewarrior to keep my code...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx for help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:07:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161658#M4509</guid>
      <dc:creator>HarryHirn</dc:creator>
      <dc:date>2020-10-29T09:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn off code optimization</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161659#M4510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it would help to see the whole code of the function where&amp;nbsp;DUT_WAKEN is invoked.&lt;/P&gt;&lt;P&gt;There must be a reason why the compiler skips out the invocation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also did you take a look at the preprocessor listing for this function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Nov 2010 19:00:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161659#M4510</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2010-11-09T19:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn off code optimization</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161660#M4511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Could you share how you have declared DUT_WAKEN_ClrVal()?&lt;/P&gt;&lt;P&gt;Have you declared your port with 'volatile'?&lt;/P&gt;&lt;P&gt;'volatile' tells the compiler not to optimize such things.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Nov 2010 19:01:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161660#M4511</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2010-11-09T19:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn off code optimization</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161661#M4512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry for taking so long to answer but we were off to lunch &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the function is a processor expert bean for general 1bit i/o&lt;/P&gt;&lt;P&gt;i did nothing than enabling the method creation of ClrVal und SetVal.&lt;/P&gt;&lt;P&gt;that leads to the auto generated code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#define DUT_WAKEN_ClrVal() ( \    (void)clrReg8Bits(PORTB, 8)        /* BIT3=0 */ \  )#define DUT_WAKEN_SetVal() ( \    (void)setReg8Bits(PORTB, 8)        /* BIT3=1 */ \  )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my function is a bit long because it proofs several cases...&lt;/P&gt;&lt;P&gt;ill try to short out repeated parts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;void DUT_autotest(void){    uint8_t temp = 0;  uint8_t temp2 = 0;  errorcode1 = 0;                  // Reset error code (volatile)  errorcode2 = 0;          /***** Flag Test *****/      DUT_power_mode(GOTOSLEEP);  FUNCTIONS_delay(10);  errorcode2 |= ((~DUT_RXD_GetVal() &amp;amp; 1) &amp;lt;&amp;lt; 6);  errorcode2 |= ((~DUT_ERRN_GetVal() &amp;amp; 1) &amp;lt;&amp;lt; 7);  DUT_WAKEN_ClrVal();  DUT_WAKEN_SetVal();  FUNCTIONS_delay(10);  errorcode2 |= (DUT_RXD_GetVal() &amp;lt;&amp;lt; 6);  errorcode2 |= (DUT_ERRN_GetVal() &amp;lt;&amp;lt; 7);            MUX_disconnect_all();           // Disconnect the whole DUT. It becomes unconnected and unpowered.}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i deleted repeated tests because they all look like this for different power modes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;errorcode is extern volatile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so the only thing this should do is read the two pins, generate a wake signla by toggling WAKEN and check that pins again...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dont know if this helps but in my opinion there is nothing to shorten for the compiler, but i am not a specialist in compilers... &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:07:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161661#M4512</guid>
      <dc:creator>HarryHirn</dc:creator>
      <dc:date>2020-10-29T09:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn off code optimization</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161662#M4513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok i figured out how i can make the compiler notice that i want to have that function &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i execute my self written delay function between them it works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DUT_WAKEN_ClrVal();FUNCTIONS_delay(10);        DUT_WAKEN_SetVal();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and i can step the debugger through both functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i only need the delay function between the Clr and SetVal functions once.&lt;/P&gt;&lt;P&gt;all of the calls, even if they are called like before, will execute correct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DUT_WAKEN_ClrVal();        DUT_WAKEN_SetVal();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i take away that delay function the compiler erases all of the ClrVal() function...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that or other ways (volatile) cant be the trick to make the compiler work as expected...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(or is it my misunderstanding of c programming)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:07:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161662#M4513</guid>
      <dc:creator>HarryHirn</dc:creator>
      <dc:date>2020-10-29T09:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn off code optimization</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161663#M4514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;PORTB should be volatile, so this could not be the problem.&lt;/P&gt;&lt;P&gt;Could you disassemble the code of DUT_autotest() and post it? Then we should see what really happens on the target.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Nov 2010 20:27:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161663#M4514</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2010-11-09T20:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn off code optimization</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161664#M4515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmmm, maybe if you tell me how to do that &lt;IMG alt=":smileysurprised:" class="emoticon emoticon-smileysurprised" id="smileysurprised" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-surprised.gif" title="Smiley Surprised" /&gt;&lt;/P&gt;&lt;P&gt;i found out that i can rightclick an disassemble, but where and how can i see that disassembled code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ok i was right, but codewarrior tried to hide the generated file from me &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i didnt want to post 1100 lines so i looked for the corresponding lines:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;522:      /***** Flag Test *****/  523:      DUT_connect_functional();  012c 4a000000     [7]     CALL  DUT_connect_functional,PAGE(DUT_connect_functional)  524:      DUT_power_mode(NORMAL);      0130 160000       [4]     JSR   DUT_autotest:0x0304  525:        526:      // GoToSleep  527:      DUT_power_mode(GOTOSLEEP);  0133 c602         [1]     LDAB  #2  0135 160000       [4]     JSR   DUT_autotest:0x0336  528:      FUNCTIONS_delay(10);  0138 c60a         [1]     LDAB  #10  013a 160000       [4]     JSR   DUT_autotest:0x0311  529:      errorcode2 |= ((~DUT_RXD_GetVal() &amp;amp; 1) &amp;lt;&amp;lt; 6);  013d 4a000000     [7]     CALL  DUT_RXD_GetVal,PAGE(DUT_RXD_GetVal)  0141 51           [1]     COMB    0142 c401         [1]     ANDB  #1  0144 87           [1]     CLRA    0145 cd0040       [2]     LDY   #64  0148 13           [3]     EMUL    0149 160000       [4]     JSR   DUT_autotest:0x02af  530:      errorcode2 |= ((~DUT_ERRN_GetVal() &amp;amp; 1) &amp;lt;&amp;lt; 7);  014c 160000       [4]     JSR   DUT_autotest:0x0309  014f 87           [1]     CLRA    0150 cd0080       [2]     LDY   #128  0153 13           [3]     EMUL    0154 160000       [4]     JSR   DUT_autotest:0x02af  531:      DUT_WAKEN_ClrVal();          0157 160000       [4]     JSR   DUT_autotest:0x032f  532:      DUT_WAKEN_SetVal();  533:      FUNCTIONS_delay(10);  015a 160000       [4]     JSR   DUT_autotest:0x02d2  534:      errorcode2 |= (DUT_RXD_GetVal() &amp;lt;&amp;lt; 6);  015d ce0040       [2]     LDX   #64  0160 b750         [1]     TFR   X,A  0162 12           [1]     MUL     0163 160000       [4]     JSR   DUT_autotest:0x02af  535:      errorcode2 |= (DUT_ERRN_GetVal() &amp;lt;&amp;lt; 7);  0166 d600         [3]     LDAB  _PORTAB:1  0168 c401         [1]     ANDB  #1  016a cd0080       [2]     LDY   #128  016d b760         [1]     TFR   Y,A  016f 12           [1]     MUL     0170 160000       [4]     JSR   DUT_autotest:0x02af  536:        537:      // Standby/Sleep&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in that file i looked for the adress of that&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;JSR   DUT_autotest:0x02af&lt;/PRE&gt;&lt;P&gt;and there it says&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;02af fa0000       [3]     ORAB  errorcode2:1
...
0309 d600         [3]     LDAB  _PORTAB:1&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i understand that file correctly &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;btw is there some kind of assembler code listing for the MC9S12DP ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:07:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161664#M4515</guid>
      <dc:creator>HarryHirn</dc:creator>
      <dc:date>2020-10-29T09:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn off code optimization</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161665#M4516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  0154 160000       [4]     JSR   DUT_autotest:0x02af  531:      DUT_WAKEN_ClrVal();          0157 160000       [4]     JSR   DUT_autotest:0x032f  532:      DUT_WAKEN_SetVal();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Those JSR's to the end of the functions probably contain the code to clear/set the bit. However as far as I remember source stepping does bypass them, so either assembly step to see the toggle happening or switch that optimization off with -onf. Code will probably get&amp;nbsp;significantly&amp;nbsp;bigger.&lt;/P&gt;&lt;P&gt;My current guess is that the code still does what it should, but "just" source stepping does not behave as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:07:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-turn-off-code-optimization/m-p/161665#M4516</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T09:07:14Z</dc:date>
    </item>
  </channel>
</rss>

