<?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 Manuplating Stack Size in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Manuplating-Stack-Size/m-p/178462#M12703</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp; wish to manipulate stack size for individual function.&lt;/P&gt;&lt;P&gt;My default stack size is 0x80 (128 bytes).&lt;/P&gt;&lt;P&gt;I have a function in which I dynamically allocate and dealloacte memory dynamically (about 120 bytes). I do-not wish to make it an global variable because it will unnecessary occupy RAM space rest of time when not used.&lt;/P&gt;&lt;P&gt;Any suggestion.&lt;/P&gt;&lt;P&gt;Can also someone explain me if implication of stack size.&lt;/P&gt;&lt;P&gt;If I declare to particular size of stack and don't use it completely then would I suffer internal fragmentation.&lt;/P&gt;&lt;P&gt;I am using MC9S08LG32 controller and CW 10.2&lt;/P&gt;&lt;P&gt;Thank You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Jul 2012 13:36:02 GMT</pubDate>
    <dc:creator>sandeepnaik</dc:creator>
    <dc:date>2012-07-07T13:36:02Z</dc:date>
    <item>
      <title>Manuplating Stack Size</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Manuplating-Stack-Size/m-p/178462#M12703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp; wish to manipulate stack size for individual function.&lt;/P&gt;&lt;P&gt;My default stack size is 0x80 (128 bytes).&lt;/P&gt;&lt;P&gt;I have a function in which I dynamically allocate and dealloacte memory dynamically (about 120 bytes). I do-not wish to make it an global variable because it will unnecessary occupy RAM space rest of time when not used.&lt;/P&gt;&lt;P&gt;Any suggestion.&lt;/P&gt;&lt;P&gt;Can also someone explain me if implication of stack size.&lt;/P&gt;&lt;P&gt;If I declare to particular size of stack and don't use it completely then would I suffer internal fragmentation.&lt;/P&gt;&lt;P&gt;I am using MC9S08LG32 controller and CW 10.2&lt;/P&gt;&lt;P&gt;Thank You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jul 2012 13:36:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Manuplating-Stack-Size/m-p/178462#M12703</guid>
      <dc:creator>sandeepnaik</dc:creator>
      <dc:date>2012-07-07T13:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Stack Size</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Manuplating-Stack-Size/m-p/178463#M12704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use malloc and free function but getting error &lt;STRONG&gt;Out of Allocation Space Segment RAM at Address 0x131&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I have made provision that stack is down moving from last location of RAM.&lt;/P&gt;&lt;P&gt;I am of the belief that this error is due to stack size constraint. Is it true?&lt;/P&gt;&lt;P&gt;Any suggestions!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jul 2012 14:12:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Manuplating-Stack-Size/m-p/178463#M12704</guid>
      <dc:creator>sandeepnaik</dc:creator>
      <dc:date>2012-07-07T14:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Stack Size</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Manuplating-Stack-Size/m-p/178464#M12705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dynamic memory allocation does not use the stack, but uses a separate heap.&amp;nbsp; The default size of the heap is 2000 bytes, which exceeds your total RAM resources for the device you are using.&amp;nbsp; It is possible to reduce the heap size, but this will require you to rebuild some library files.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.freescale.com/message/19417#19417" title="https://community.freescale.com/message/19417#19417"&gt;https://community.freescale.com/message/19417#19417&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suggest that you try to avoid using malloc().&amp;nbsp; if the memory allocation can be handled as one or more local variable(s) within a function, increase the stack size by an appropriate amount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if the variables require to be accessible by more than one function, they will need to be defined as static (or global), outside of any function.&amp;nbsp; If the&amp;nbsp;memory block has different types of usage at different times, this might be handled by defining a union.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Jul 2012 02:27:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Manuplating-Stack-Size/m-p/178464#M12705</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2012-07-08T02:27:29Z</dc:date>
    </item>
  </channel>
</rss>

