<?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>ColdFire/68K Microcontrollers and ProcessorsのトピックRe: QE128 how to determine stack/heap/ram size?</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/QE128-how-to-determine-stack-heap-ram-size/m-p/177782#M7080</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The way I figure out how much stack I am using is as follows...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1. start your project, up to the point where you initialize your stack pointer (a7); the a7 value is the top (highest memory address) of your stack.&lt;/DIV&gt;&lt;DIV&gt;2. determine your stack size from your .lcf or .xmap file.&lt;/DIV&gt;&lt;DIV&gt;3. the bottom of your stack (lowest memory address)&amp;nbsp;is at a7 minus the stack size.&lt;/DIV&gt;&lt;DIV&gt;4. use Debug -&amp;gt; ColdFire -&amp;gt; Fill Memory to fill your entire stack, from the bottom address for the whole stack size, to 0xaa.&lt;/DIV&gt;&lt;DIV&gt;5. run your application, with a representative workload.&lt;/DIV&gt;&lt;DIV&gt;6. break into the debugger.&lt;/DIV&gt;&lt;DIV&gt;7. use Data -&amp;gt; View Memory to view the bottom address of your stack.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Now look for the *first* non-0xaa byte in your stack and that was your last unused stack location (ignore any 0xaa's after the first non-0xaa byte, as they are just holes in your stack).&amp;nbsp; If you don't see any 0xaa's at the bottom address, you've overflowed your stack.&amp;nbsp; If you only see a few, you're close to overflowing your stack.&amp;nbsp; If you see a whole bunch, you're OK.&amp;nbsp; (And if you see tons, you might be able to get by with a smaller stack.)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This assumes you never change stack pointers -- if you're using threading libraries, they might well do that, and you have to initialize *all* stacks and check them all that way.&amp;nbsp; (We actually do this at runtime during thread creation/cleanup at work, and it gives you a nice overview as long as you're not overflowing -- when you overflow, you never make it to cleanup code...)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You can get an idea of your static RAM usage from your .xmap file -- sorry, I can't help you for determining heap usage, if you're doing dynamic memory allocations.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-- Rich&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Aug 2008 00:47:09 GMT</pubDate>
    <dc:creator>RichTestardi</dc:creator>
    <dc:date>2008-08-02T00:47:09Z</dc:date>
    <item>
      <title>QE128 how to determine stack/heap/ram size?</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/QE128-how-to-determine-stack-heap-ram-size/m-p/177781#M7079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using a MCF51QE128 and I'm starting to see some strange problems that I can massage away, but I'm concerned I'm running out of space.&amp;nbsp; I'm not sure how to tell if I'm overflowing my stack or RAM space.&amp;nbsp; Is there a good way to see this using the tools?&amp;nbsp; I'm using CW6.1.&amp;nbsp; Is there a document that I've missed describing how stack, heap, and ram are managed in the 8k space?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, is there some type of limitation for how stack and heap sizes must be created?&amp;nbsp; The default lcf uses 1k for stack and 1k for heap, but adding to only the stack or heap prevents the solution from running.&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 22:01:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/QE128-how-to-determine-stack-heap-ram-size/m-p/177781#M7079</guid>
      <dc:creator>Toe</dc:creator>
      <dc:date>2008-08-01T22:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: QE128 how to determine stack/heap/ram size?</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/QE128-how-to-determine-stack-heap-ram-size/m-p/177782#M7080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The way I figure out how much stack I am using is as follows...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1. start your project, up to the point where you initialize your stack pointer (a7); the a7 value is the top (highest memory address) of your stack.&lt;/DIV&gt;&lt;DIV&gt;2. determine your stack size from your .lcf or .xmap file.&lt;/DIV&gt;&lt;DIV&gt;3. the bottom of your stack (lowest memory address)&amp;nbsp;is at a7 minus the stack size.&lt;/DIV&gt;&lt;DIV&gt;4. use Debug -&amp;gt; ColdFire -&amp;gt; Fill Memory to fill your entire stack, from the bottom address for the whole stack size, to 0xaa.&lt;/DIV&gt;&lt;DIV&gt;5. run your application, with a representative workload.&lt;/DIV&gt;&lt;DIV&gt;6. break into the debugger.&lt;/DIV&gt;&lt;DIV&gt;7. use Data -&amp;gt; View Memory to view the bottom address of your stack.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Now look for the *first* non-0xaa byte in your stack and that was your last unused stack location (ignore any 0xaa's after the first non-0xaa byte, as they are just holes in your stack).&amp;nbsp; If you don't see any 0xaa's at the bottom address, you've overflowed your stack.&amp;nbsp; If you only see a few, you're close to overflowing your stack.&amp;nbsp; If you see a whole bunch, you're OK.&amp;nbsp; (And if you see tons, you might be able to get by with a smaller stack.)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This assumes you never change stack pointers -- if you're using threading libraries, they might well do that, and you have to initialize *all* stacks and check them all that way.&amp;nbsp; (We actually do this at runtime during thread creation/cleanup at work, and it gives you a nice overview as long as you're not overflowing -- when you overflow, you never make it to cleanup code...)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You can get an idea of your static RAM usage from your .xmap file -- sorry, I can't help you for determining heap usage, if you're doing dynamic memory allocations.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;-- Rich&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Aug 2008 00:47:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/QE128-how-to-determine-stack-heap-ram-size/m-p/177782#M7080</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2008-08-02T00:47:09Z</dc:date>
    </item>
  </channel>
</rss>

