<?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>CodeWarrior Development ToolsのトピックRe: memory size</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372366#M2032</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can we read the SP at run time?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Jan 2015 06:01:14 GMT</pubDate>
    <dc:creator>rahulkrishna</dc:creator>
    <dc:date>2015-01-24T06:01:14Z</dc:date>
    <item>
      <title>memory size</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372364#M2030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can set the size of the stack in the linker file in Codewarrior S12x. Let us say the RAM is from 0x2000 to 0x2100, if the stack size is 0x100. The first variable will be stored at 0x2100 and keeps decreasing. But due to my wrong calculations the the stack exceeds beyond 0x100. There is no RAM below 0x2000 then how does the microcontroller handle this. please explain me.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 11:06:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372364#M2030</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2015-01-23T11:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: memory size</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372365#M2031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi rahul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;stack overflow error is always hard to detect. &lt;/P&gt;&lt;P&gt;If the stack grows into the heap/RAM, it will silently start to overwrite the data values in heap/RAM. that destroy contents in those memories.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if stack overflow overwrite some function pointer or PC pointer. the code may jump to unexpected address that we can't control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;does this answer your question?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Zhang Jun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 13:46:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372365#M2031</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2015-01-23T13:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: memory size</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372366#M2032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can we read the SP at run time?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jan 2015 06:01:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372366#M2032</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2015-01-24T06:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: memory size</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372367#M2033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello rahul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes we can read SP register in run time.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;I made a small sample code that measures stack usage. see attachment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Inside the code, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;- Function checkStack() stores the current SP value in a global variable and determines what was the lowest value reached by SP in an application.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;- Notice the convenient access to C variables from inline-assembly(asm(STS currentStack)). We are forced to use an assembly instruction because there is no access to the CPU registers in C. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;- The idea is to have every function in the application call checkStack() to measure the lowest stack address. Thus you can calculate the total stack worst case to allocate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Zhang Jun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 04:26:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372367#M2033</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2015-01-26T04:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: memory size</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372368#M2034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;P&gt;Thank you very much &lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:57:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372368#M2034</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2015-01-26T13:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: memory size</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372369#M2035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello rahul,&lt;/P&gt;&lt;P&gt;you are welcome!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Zhang Jun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 03:59:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/memory-size/m-p/372369#M2035</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2015-01-27T03:59:33Z</dc:date>
    </item>
  </channel>
</rss>

