<?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>8-bit Microcontrollers中的主题 Re: variable 'not allocated'?</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143539#M6611</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 cannot tell you why your firmware is not working, but I can explain when the debugger specifies local variable are not allocated.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The debugger might notify that when local variables values are not stored on the stack, but kept in registers.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Also a local variable have a specific scope. They are valid only for the portion of the function where they are used.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;A local variable&amp;nbsp;might not be available any more after the last instruction&amp;nbsp;using it in the function.&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, 22 Aug 2007 14:22:14 GMT</pubDate>
    <dc:creator>CrasyCat</dc:creator>
    <dc:date>2007-08-22T14:22:14Z</dc:date>
    <item>
      <title>variable 'not allocated'?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143538#M6610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using code warrior to debug a firmware for a QG8 device. However, in the debug mode, most local variables are shown as 'not allocated'. And it seems the firmware doesn't work correctly too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed the stacksize in project.prm to 0xB0, but still have the problem. I guess it is the memory problem. So, I commented most part of the firmware, but the problem still exists.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What can cause this? How to solve it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 07:11:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143538#M6610</guid>
      <dc:creator>urlreader</dc:creator>
      <dc:date>2007-08-22T07:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: variable 'not allocated'?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143539#M6611</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 cannot tell you why your firmware is not working, but I can explain when the debugger specifies local variable are not allocated.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The debugger might notify that when local variables values are not stored on the stack, but kept in registers.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Also a local variable have a specific scope. They are valid only for the portion of the function where they are used.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;A local variable&amp;nbsp;might not be available any more after the last instruction&amp;nbsp;using it in the function.&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, 22 Aug 2007 14:22:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143539#M6611</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-08-22T14:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: variable 'not allocated'?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143540#M6612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Declaring the variable as "volatile" generally solves this problem for me.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Just remember to remove "volatile" when you've finished debugging if it's not actually required...&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by airbusboy20 on &lt;SPAN class="date_text"&gt;2007-08-28&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;09:00 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2007 14:57:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143540#M6612</guid>
      <dc:creator>airbusboy20</dc:creator>
      <dc:date>2007-08-28T14:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: variable 'not allocated'?</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143541#M6613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;I wonder did you really change the value of the local variables in the 'local scope'?&lt;BR /&gt;&lt;BR /&gt;I mean if you did not change the value of the local variables or changed them&amp;nbsp; somewhere outside the 'local scope', for instance, within a ISR, that could occur depends on your compiler and optimization level. Some compilers might consider the 'unchanged' variable is no use at all and remove them from the target code for optimization.&lt;BR /&gt;&lt;BR /&gt;So,&amp;nbsp; qualify them as 'volatile' to prevent&amp;nbsp; that, especially when you deal with variables changed in ISR. The following is an example from CW's help.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;volatile int x;
&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;PRE&gt;void main(void) {
&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;PRE&gt;  x = 0;
&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;PRE&gt;  ...
&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;PRE&gt;  if (x == 0) { // without volatile attribute, the
&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;PRE&gt;                // comparison may be optimized away!
&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;PRE&gt;    Error();    // Error() is called without compare!
&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;PRE&gt;  }
&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;PRE&gt;}
&lt;/PRE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:44:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/variable-not-allocated/m-p/143541#M6613</guid>
      <dc:creator>shrine</dc:creator>
      <dc:date>2020-10-29T08:44:13Z</dc:date>
    </item>
  </channel>
</rss>

