<?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: Problem with local  variables when debugging with CW 4.5 and 9s12X in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131349#M1151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Just wondering, which debugger do you use?&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Apr 2007 01:17:29 GMT</pubDate>
    <dc:creator>CompilerGuru</dc:creator>
    <dc:date>2007-04-25T01:17:29Z</dc:date>
    <item>
      <title>Problem with local  variables when debugging with CW 4.5 and 9s12X</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131345#M1147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have this function&amp;nbsp; :&lt;/DIV&gt;&lt;DIV&gt;BYTE GainToIndice(BYTE gain)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;BYTE i,g,ind;&lt;BR /&gt;&amp;nbsp;SBYTE diff;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;g=0xFF;&lt;BR /&gt;&amp;nbsp;for (i=0;i&amp;lt;BufConfig.nbgains;i++)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;diff=BufConfig.gains[i].gain-gain;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (diff&amp;lt;0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;diff=-diff;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(diff&amp;lt;g)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g=diff;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ind=i;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I call it&amp;nbsp;in my main program like GainToIndice(100)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When i debug it and look for example gain the value is 255. The value of i is always 52&amp;nbsp;&amp;nbsp;whereas BufConfig.nbgains is 12, the value of g never changes (always 0). However the result is true.&lt;/DIV&gt;&lt;DIV&gt;I have tried a lot of -on optimisations but i didn't find the correct for my problem.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2007 20:24:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131345#M1147</guid>
      <dc:creator>calou</dc:creator>
      <dc:date>2007-04-20T20:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with local  variables when debugging with CW 4.5 and 9s12X</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131346#M1148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I invented the missing parts (like the BufConfig struct) and stepped once through your code and it looks ok to me. i was incrementing properly.&lt;BR /&gt;The only reason I could imagine your behavior is if the debugger is not able to read the stack, but then it would not behave properly. Can you check if the location the debugger shows for the i variable is the one the code is using?&lt;BR /&gt;Also note that your code below does not have any effect at all. GainToIndice is missing a return, and also no global is ever written.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;BR /&gt;PS: I take "However the result is true." as it steps through the code as you expect it too. There is no result or side effect in that code to observe.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Apr 2007 00:56:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131346#M1148</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2007-04-21T00:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with local  variables when debugging with CW 4.5 and 9s12X</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131347#M1149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Daniel,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In my code i forgot to paste return(ind).&lt;/DIV&gt;&lt;DIV&gt;I don't understand very well your question. When i put a breakpoint on diff=BufConfig.gains[i].gain-gain for the firs time&lt;/DIV&gt;&lt;DIV&gt;I have :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;diff = \x00 (0)&lt;BR /&gt;&amp;nbsp;g = \xD5 (213)&lt;BR /&gt;&amp;nbsp;gain = 'x' (120)&lt;BR /&gt;&amp;nbsp;i = \x00 (0)&lt;BR /&gt;&amp;nbsp;ind = \x95 (149)&lt;BR /&gt;It is very strange. And the values depends where i put the breakpoint!&lt;/DIV&gt;&lt;DIV&gt;I note too that when i check gain, its value is the result of BufConfig.gains[i].gain-gain&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you for help&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 14:28:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131347#M1149</guid>
      <dc:creator>calou</dc:creator>
      <dc:date>2007-04-23T14:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with local  variables when debugging with CW 4.5 and 9s12X</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131348#M1150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello again,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My problem is solved. It was a bug of my debugger. An update of the debugger software and now it is good.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 20:25:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131348#M1150</guid>
      <dc:creator>calou</dc:creator>
      <dc:date>2007-04-23T20:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with local  variables when debugging with CW 4.5 and 9s12X</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131349#M1151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Just wondering, which debugger do you use?&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2007 01:17:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-with-local-variables-when-debugging-with-CW-4-5-and/m-p/131349#M1151</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2007-04-25T01:17:29Z</dc:date>
    </item>
  </channel>
</rss>

