<?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のトピックRe: How to Turn Off All Optimizations/Eliminate SP debug info incorrect warning/etc</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-Turn-Off-All-Optimizations-Eliminate-SP-debug-info/m-p/135663#M1748</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;The symptoms you are describing are not directly related to optimization but rather to ANSI C standard definition.&lt;/DIV&gt;&lt;DIV&gt;You say "promotions to longs, the way certain #defines are taken when their size is not specified".&lt;/DIV&gt;&lt;DIV&gt;Please remember that ANSI C standard defines that integral promotion rule apply for arithmetic operation which do not involve a long operand.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That means if you have an assignment as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; myLong&amp;nbsp;= myInt1*myInt2;&lt;/DIV&gt;&lt;DIV&gt;the expression myInt1*myInt2 will be evaluated on 16-bit and then signed extended to 32-bits.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;To make sure the expression is evaluated on 32-bits, you have to cast one of the operands as&amp;nbsp;a long.&lt;/DIV&gt;&lt;DIV&gt;This is done as follows:&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp; myLong&amp;nbsp;= (long)myInt1*myInt2;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;for operand defined as macro (in a define), just add the suffix L to the constant to make sure it is interpreted as&amp;nbsp; a long.&lt;/DIV&gt;&lt;DIV&gt;For example&lt;/DIV&gt;&lt;DIV&gt;#define myInt1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10L&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you really want to disable optimization proceed as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; - Open the project in the IDE&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; - Open the Target Settings dialog (Press ALT + F7)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; - Switch to "Compiler for HC12"&amp;nbsp;panel&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;- Click on the "Options" button&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; - THere are a lot of optimization you can disable there. This will be taken only for the current project.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;However note that some optimization cannot be disable at al.&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I hope this helps.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Nov 2006 19:27:42 GMT</pubDate>
    <dc:creator>CrasyCat</dc:creator>
    <dc:date>2006-11-08T19:27:42Z</dc:date>
    <item>
      <title>How to Turn Off All Optimizations/Eliminate SP debug info incorrect warning/etc</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-Turn-Off-All-Optimizations-Eliminate-SP-debug-info/m-p/135662#M1747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi. I am using CodeWarrior 3.1 for HCS12.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am having some problems with promotions to longs, the way certain #define's are taken when their size is not specified,&amp;nbsp;etc mysterious results when an unsigned char member of a structure is a multiplicand versus a standalone unsigned char, understanding what is implementation dependent and what is not, AND ALL THAT GOOD STUFF.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;I am experimenting with various snippets of code, and all too often the optimizations are obfuscating what is observed in the debugger.&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is there a way to setup a project so that all optimization is turned off (just for that project) ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If there is no way to localize the compiler settings to that one project, can someone explain to me how to turn off all the optimizations anyway?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Nov 2006 07:03:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-Turn-Off-All-Optimizations-Eliminate-SP-debug-info/m-p/135662#M1747</guid>
      <dc:creator>YeOldeBDM</dc:creator>
      <dc:date>2006-11-08T07:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to Turn Off All Optimizations/Eliminate SP debug info incorrect warning/etc</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-Turn-Off-All-Optimizations-Eliminate-SP-debug-info/m-p/135663#M1748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;The symptoms you are describing are not directly related to optimization but rather to ANSI C standard definition.&lt;/DIV&gt;&lt;DIV&gt;You say "promotions to longs, the way certain #defines are taken when their size is not specified".&lt;/DIV&gt;&lt;DIV&gt;Please remember that ANSI C standard defines that integral promotion rule apply for arithmetic operation which do not involve a long operand.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That means if you have an assignment as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; myLong&amp;nbsp;= myInt1*myInt2;&lt;/DIV&gt;&lt;DIV&gt;the expression myInt1*myInt2 will be evaluated on 16-bit and then signed extended to 32-bits.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;To make sure the expression is evaluated on 32-bits, you have to cast one of the operands as&amp;nbsp;a long.&lt;/DIV&gt;&lt;DIV&gt;This is done as follows:&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp; myLong&amp;nbsp;= (long)myInt1*myInt2;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;for operand defined as macro (in a define), just add the suffix L to the constant to make sure it is interpreted as&amp;nbsp; a long.&lt;/DIV&gt;&lt;DIV&gt;For example&lt;/DIV&gt;&lt;DIV&gt;#define myInt1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10L&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you really want to disable optimization proceed as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; - Open the project in the IDE&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; - Open the Target Settings dialog (Press ALT + F7)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; - Switch to "Compiler for HC12"&amp;nbsp;panel&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;- Click on the "Options" button&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; - THere are a lot of optimization you can disable there. This will be taken only for the current project.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;However note that some optimization cannot be disable at al.&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I hope this helps.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Nov 2006 19:27:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-Turn-Off-All-Optimizations-Eliminate-SP-debug-info/m-p/135663#M1748</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-11-08T19:27:42Z</dc:date>
    </item>
  </channel>
</rss>

