<?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 Debugger - variables not properly traced in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215640#M8475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi everybody,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Im fresh with freescale and codewarrior so&amp;nbsp;I hope&amp;nbsp;there is a quick method to fix my problem.&lt;/DIV&gt;&lt;DIV&gt;During debugging&amp;nbsp;C code (tested with different examples) some variables in Data:2 window are&amp;nbsp;heaving wrong content. Especially those which are passed as input parameters&amp;nbsp;in fuctions usually have strange values. For example if I pass two parameters in a function :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;InitTMR(word k=5, word l=1)&amp;nbsp;then during&amp;nbsp;debugging this function inside the k and l variables ussually having values like 0xE206,&amp;nbsp;0xE103&amp;nbsp;... or so (looking more as a memory address and not a value anymore).&lt;/DIV&gt;&lt;DIV&gt;What I expect this effect is caused by the fact that some variables are passed to the fuctions by using index register H:X&amp;nbsp;and then these variables&amp;nbsp;are&amp;nbsp;not tracable enymore by Data window.&amp;nbsp;I can imagine that they can be as well somehow optimized by compiler and that could&amp;nbsp;appear as well as a&amp;nbsp;strange behaviour of the debugger.&amp;nbsp;Anyway&amp;nbsp;I tried to turn off all optimization options in the compiler but that did not help at all. Do you have any solution for that problem or is there any other way to trace the value of&amp;nbsp;variables ? (I tried as well Inspect component but effect was the same)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;(by the way Im using version 6.1 build 7285 of CW with freescale HCS08)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;BR/Pawel&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Jan 2009 01:34:12 GMT</pubDate>
    <dc:creator>admin</dc:creator>
    <dc:date>2009-01-14T01:34:12Z</dc:date>
    <item>
      <title>Debugger - variables not properly traced</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215640#M8475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi everybody,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Im fresh with freescale and codewarrior so&amp;nbsp;I hope&amp;nbsp;there is a quick method to fix my problem.&lt;/DIV&gt;&lt;DIV&gt;During debugging&amp;nbsp;C code (tested with different examples) some variables in Data:2 window are&amp;nbsp;heaving wrong content. Especially those which are passed as input parameters&amp;nbsp;in fuctions usually have strange values. For example if I pass two parameters in a function :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;InitTMR(word k=5, word l=1)&amp;nbsp;then during&amp;nbsp;debugging this function inside the k and l variables ussually having values like 0xE206,&amp;nbsp;0xE103&amp;nbsp;... or so (looking more as a memory address and not a value anymore).&lt;/DIV&gt;&lt;DIV&gt;What I expect this effect is caused by the fact that some variables are passed to the fuctions by using index register H:X&amp;nbsp;and then these variables&amp;nbsp;are&amp;nbsp;not tracable enymore by Data window.&amp;nbsp;I can imagine that they can be as well somehow optimized by compiler and that could&amp;nbsp;appear as well as a&amp;nbsp;strange behaviour of the debugger.&amp;nbsp;Anyway&amp;nbsp;I tried to turn off all optimization options in the compiler but that did not help at all. Do you have any solution for that problem or is there any other way to trace the value of&amp;nbsp;variables ? (I tried as well Inspect component but effect was the same)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;(by the way Im using version 6.1 build 7285 of CW with freescale HCS08)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;BR/Pawel&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2009 01:34:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215640#M8475</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2009-01-14T01:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Debugger - variables not properly traced</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215641#M8476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;This is indeed caused by the compiler's optimizer. The CW debugger is too crappy to understand code optimized by the CW compiler...&lt;BR /&gt;&lt;BR /&gt;If it doesn't work to disable all optimization, you could write a debug version for the code like this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;void func(int x, int y)
{
  volatile int debug_x = x;
  volatile int debug_y = y;
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;That will make the debug versions of the variables visible.&lt;BR /&gt;&lt;BR /&gt;Another option is to look at the assembler code rather than the C code and single-step the assembler window while watching the accumulators and index registers.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2009 18:01:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215641#M8476</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2009-01-14T18:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Debugger - variables not properly traced</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215642#M8477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for the hint. At the moment I’m trying that method. For testing&amp;nbsp;little part of code it is ok but for a whole project I will need to find better solution.&amp;nbsp;Anyway It is hard to believe that there is no other way to make debugger working fine .... I would expect that there is somewhere an option&amp;nbsp;allowing to select between debug/release version ... as normally is done in professional environments. It looks like I will have to look for another environment&amp;nbsp;option ... hopefully IAR debugger&amp;nbsp;is dealing with that in a better way.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jan 2009 21:04:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215642#M8477</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2009-01-14T21:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Debugger - variables not properly traced</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215643#M8478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Yes, as a programmer comming from another environment you find it incredibly strange that CW has no option to remove all optimizations. I don't know how many times I have asked both old Metrowerks and recently Freescale to include such an option.&lt;BR /&gt;&lt;BR /&gt;It seems there is one compiler option in the latest compiler called "Disable all optimization" (-Ms O0). Whether it disables all optimization or just some, I don't know.&lt;BR /&gt;&lt;BR /&gt;Another option is to buy a 3rd party debugger. The CW compiler is a good one, but the CW debugger is so-so.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2009 16:03:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Debugger-variables-not-properly-traced/m-p/215643#M8478</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2009-01-16T16:03:13Z</dc:date>
    </item>
  </channel>
</rss>

