<?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: Entry code in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136284#M905</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I see.&lt;BR /&gt;The problematic option is the -Ou (Optimize Dead Assignments).&lt;BR /&gt;Drop it from your command line, the resulting code is only different when HLI is present in a function, then the default (not specifying -ou/-onu) does not optimize this function.&lt;BR /&gt;But then -ou is present, it is optimized even though the dead assignment optimization is not aware of HLI. So the compiler takes the -ou as guarantee that no such access only by HLI case (as in yours) exists....&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;BR /&gt;PS: I did forward to the compiler team that the smart sliders do add this dangerous option automatically. So hopefully this silly behaviour will be fixed in the future.&lt;BR /&gt;Thanks for reporting :smileyhappy:&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 May 2006 15:16:16 GMT</pubDate>
    <dc:creator>CompilerGuru</dc:creator>
    <dc:date>2006-05-19T15:16:16Z</dc:date>
    <item>
      <title>Entry code</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136281#M902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;CW for HC12 v. 4.5 build 6039&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have the following function:&lt;/DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;void memfill(BYTE c) {&amp;nbsp;&amp;nbsp;&amp;nbsp; asm {&amp;nbsp; ldaa c
&amp;nbsp; ......&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; return;}&lt;/PRE&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;This was by CW for HC12 v. 3.1 compiled to&lt;/DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;/SPAN&gt;&lt;PRE&gt;PSHBLDAA 0,SP...PULARTC&lt;/PRE&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;which did work, but v. 4.5 compiles to&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;/SPAN&gt;&lt;PRE&gt;LEAS -1,SPLDAA 0,SP...LEAS 1,SPRTC&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;which does not work because the function parameter 'c' does not get saved to the stack and thus the LDAA 0,SP will load something undefined.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have in the same file an other routine which also returns the c-value, and that routine works on both versions.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is clearly some kind of optimizing issue, but what optimization option could I use to get the PSHB back?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 14:51:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136281#M902</guid>
      <dc:creator>Sten</dc:creator>
      <dc:date>2006-05-17T14:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Entry code</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136282#M903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;can you provided a complete compilable sample?&lt;BR /&gt;&lt;BR /&gt;When I just compiled the snippet you quoted, I do get the PSHB with V4.5. Please note also the exact options you use to compile.&lt;BR /&gt;&lt;BR /&gt;With -Ot, the code is fine as well. And when not optimizing for time, I dont see why the compiler should use the larger (but faster) LEAS instead of a PSHB.&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;412: typedef unsigned char BYTE;&lt;BR /&gt;413: void memfill(BYTE c) {&lt;BR /&gt;0000 37 [2] PSHB&lt;BR /&gt;414: asm {&lt;BR /&gt;415: ldaa c&lt;BR /&gt;0001 a680 [3] LDAA 0,SP&lt;BR /&gt;416: nop;&lt;BR /&gt;0003 a7 [1] NOP&lt;BR /&gt;417: }&lt;BR /&gt;418: return;&lt;BR /&gt;419: }&lt;BR /&gt;0004 32 [3] PULA&lt;BR /&gt;0005 3d [5] RTS&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2006 04:45:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136282#M903</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2006-05-18T04:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Entry code</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136283#M904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I made a new project and added the two functions memfill() and memnchr() and they did work alright with the default options. Then I did copy the option string from my real project, and then the memfill() was faulty again. So it is some of my options that is causing this. Attached is the test-project which causes faulty code.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can you please tell me which option do cause this.&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="http://www.freescale.com/files/community_files/CWCOMM/1067_comp_test.zip" rel="nofollow" target="_self"&gt;comp_test.zip&lt;/A&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by t.dowe on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-10-06&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;09:07 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2006 12:43:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136283#M904</guid>
      <dc:creator>Sten</dc:creator>
      <dc:date>2006-05-18T12:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Entry code</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136284#M905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I see.&lt;BR /&gt;The problematic option is the -Ou (Optimize Dead Assignments).&lt;BR /&gt;Drop it from your command line, the resulting code is only different when HLI is present in a function, then the default (not specifying -ou/-onu) does not optimize this function.&lt;BR /&gt;But then -ou is present, it is optimized even though the dead assignment optimization is not aware of HLI. So the compiler takes the -ou as guarantee that no such access only by HLI case (as in yours) exists....&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;BR /&gt;PS: I did forward to the compiler team that the smart sliders do add this dangerous option automatically. So hopefully this silly behaviour will be fixed in the future.&lt;BR /&gt;Thanks for reporting :smileyhappy:&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2006 15:16:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Entry-code/m-p/136284#M905</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2006-05-19T15:16:16Z</dc:date>
    </item>
  </channel>
</rss>

