<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Computing your stack size</title>
	<atom:link href="http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/feed/" rel="self" type="application/rss+xml" />
	<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/</link>
	<description>Thoughts on embedded systems by Nigel Jones</description>
	<lastBuildDate>Sun, 06 May 2012 10:34:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Nigel Jones</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-1962</link>
		<dc:creator>Nigel Jones</dc:creator>
		<pubDate>Fri, 17 Sep 2010 12:56:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-1962</guid>
		<description>I haven&#039;t worked with the LPC2129. I will guess that ROM_start__ is defined to be at 0x44 because the first 0x44 bytes are reserved for the interrupt vector table. I don&#039;t know about the RAM - possibly that the first 0x40 bytes are actually consumed by special function registers? As for what to set the various stack sizes to. Well clearly in the first example a lot of the stacks aren&#039;t being used. Based on their names it appears that one stack is reserved for a fast interrupt (for example). If you aren&#039;t using a fast interrupt then you don&#039;t need stack space for it. Conversely if you are using a fast interrupt then you will need to reserve stack space for it. The amount depends on what the fast interrupt handler does.</description>
		<content:encoded><![CDATA[<p>I haven&#8217;t worked with the LPC2129. I will guess that ROM_start__ is defined to be at 0&#215;44 because the first 0&#215;44 bytes are reserved for the interrupt vector table. I don&#8217;t know about the RAM &#8211; possibly that the first 0&#215;40 bytes are actually consumed by special function registers? As for what to set the various stack sizes to. Well clearly in the first example a lot of the stacks aren&#8217;t being used. Based on their names it appears that one stack is reserved for a fast interrupt (for example). If you aren&#8217;t using a fast interrupt then you don&#8217;t need stack space for it. Conversely if you are using a fast interrupt then you will need to reserve stack space for it. The amount depends on what the fast interrupt handler does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GADDOUR zied</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-1960</link>
		<dc:creator>GADDOUR zied</dc:creator>
		<pubDate>Fri, 17 Sep 2010 10:36:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-1960</guid>
		<description>I begin to develop a program for LPC2129 with IAR EWARM 5.4
I found that there is a file. ICF when I must to configure for that the linker
to the IAR generates. hex specific to my application.
i have problem to understand how i can configure its parameters.

i found an example of file .ICF in an example of project with IAR.

program_in_flash.icf file in leds example provided with iar contains these
details.

/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000044;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x40000040;
define symbol __ICFEDIT_region_RAM_end__ = 0x40003FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x200;
define symbol __ICFEDIT_size_svcstack__ = 0x0;
define symbol __ICFEDIT_size_irqstack__ = 0x100;
define symbol __ICFEDIT_size_fiqstack__ = 0x0;
define symbol __ICFEDIT_size_undstack__ = 0x0;
define symbol __ICFEDIT_size_abtstack__ = 0x0;
define symbol __ICFEDIT_size_heap__ = 0x200;

according datasheet ROM_start = 0x00000000. why is declared 0x00000044 ?
same RAM_start = 0x40000000. I don&#039;t understand why is declared 0x40000040 ?

and how to initialize the sizes of the stacks?
what criteria of choice are initialized these stacks?
I find in other examples:

they are different parameters of the first example

/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x2000;
define symbol __ICFEDIT_size_svcstack__ = 0x100;
define symbol __ICFEDIT_size_irqstack__ = 0x100;
define symbol __ICFEDIT_size_fiqstack__ = 0x100;
define symbol __ICFEDIT_size_undstack__ = 0x100;
define symbol __ICFEDIT_size_abtstack__ = 0x100;
define symbol __ICFEDIT_size_heap__ = 0x8000;

I do not understand what I put as the size for each stack</description>
		<content:encoded><![CDATA[<p>I begin to develop a program for LPC2129 with IAR EWARM 5.4<br />
I found that there is a file. ICF when I must to configure for that the linker<br />
to the IAR generates. hex specific to my application.<br />
i have problem to understand how i can configure its parameters.</p>
<p>i found an example of file .ICF in an example of project with IAR.</p>
<p>program_in_flash.icf file in leds example provided with iar contains these<br />
details.</p>
<p>/*-Memory Regions-*/<br />
define symbol __ICFEDIT_region_ROM_start__ = 0&#215;00000044;<br />
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;<br />
define symbol __ICFEDIT_region_RAM_start__ = 0&#215;40000040;<br />
define symbol __ICFEDIT_region_RAM_end__ = 0x40003FFF;<br />
/*-Sizes-*/<br />
define symbol __ICFEDIT_size_cstack__ = 0&#215;200;<br />
define symbol __ICFEDIT_size_svcstack__ = 0&#215;0;<br />
define symbol __ICFEDIT_size_irqstack__ = 0&#215;100;<br />
define symbol __ICFEDIT_size_fiqstack__ = 0&#215;0;<br />
define symbol __ICFEDIT_size_undstack__ = 0&#215;0;<br />
define symbol __ICFEDIT_size_abtstack__ = 0&#215;0;<br />
define symbol __ICFEDIT_size_heap__ = 0&#215;200;</p>
<p>according datasheet ROM_start = 0&#215;00000000. why is declared 0&#215;00000044 ?<br />
same RAM_start = 0&#215;40000000. I don&#8217;t understand why is declared 0&#215;40000040 ?</p>
<p>and how to initialize the sizes of the stacks?<br />
what criteria of choice are initialized these stacks?<br />
I find in other examples:</p>
<p>they are different parameters of the first example</p>
<p>/*-Sizes-*/<br />
define symbol __ICFEDIT_size_cstack__ = 0&#215;2000;<br />
define symbol __ICFEDIT_size_svcstack__ = 0&#215;100;<br />
define symbol __ICFEDIT_size_irqstack__ = 0&#215;100;<br />
define symbol __ICFEDIT_size_fiqstack__ = 0&#215;100;<br />
define symbol __ICFEDIT_size_undstack__ = 0&#215;100;<br />
define symbol __ICFEDIT_size_abtstack__ = 0&#215;100;<br />
define symbol __ICFEDIT_size_heap__ = 0&#215;8000;</p>
<p>I do not understand what I put as the size for each stack</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nigel Jones</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-1182</link>
		<dc:creator>Nigel Jones</dc:creator>
		<pubDate>Fri, 25 Jun 2010 12:09:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-1182</guid>
		<description>Sure. All good linkers allow you to request a call tree report. Different vendors call it different things. In IAR&#039;s case, they call it a &quot;static overlay map&quot;. What this does is show you all the functions called by a function and the size of the stack at each stage of the call. Here is a &lt;a href=&quot;http://embeddedgurus.com/stack-overflow/files/2010/06/Call-Tree.jpg&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; to an example of the output.

By carefully examining this information it is possible to very accurately determine your stack usage. It&#039;s also very useful when you are in a pinch for determining where to restructure your code so as to minimize stack usage. For example, you may decide to disable a stack consuming interrupt in the worst case function so as to minimize the peak stack usage.
I hope this helps.</description>
		<content:encoded><![CDATA[<p>Sure. All good linkers allow you to request a call tree report. Different vendors call it different things. In IAR&#8217;s case, they call it a &#8220;static overlay map&#8221;. What this does is show you all the functions called by a function and the size of the stack at each stage of the call. Here is a <a href="http://embeddedgurus.com/stack-overflow/files/2010/06/Call-Tree.jpg" rel="nofollow">link</a> to an example of the output.</p>
<p>By carefully examining this information it is possible to very accurately determine your stack usage. It&#8217;s also very useful when you are in a pinch for determining where to restructure your code so as to minimize stack usage. For example, you may decide to disable a stack consuming interrupt in the worst case function so as to minimize the peak stack usage.<br />
I hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: balaji</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-1181</link>
		<dc:creator>balaji</dc:creator>
		<pubDate>Fri, 25 Jun 2010 07:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-1181</guid>
		<description>Hi  Nigel,

Can you give more information on examining the linker output when we are tight on memory.</description>
		<content:encoded><![CDATA[<p>Hi  Nigel,</p>
<p>Can you give more information on examining the linker output when we are tight on memory.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nigel Jones</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-144</link>
		<dc:creator>Nigel Jones</dc:creator>
		<pubDate>Wed, 03 Jun 2009 16:57:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-144</guid>
		<description>I&#039;m glad you found them useful.</description>
		<content:encoded><![CDATA[<p>I&#39;m glad you found them useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scotty</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-143</link>
		<dc:creator>Scotty</dc:creator>
		<pubDate>Tue, 02 Jun 2009 21:16:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-143</guid>
		<description>Hey, thanks for the tips. I wish I would&#039;ve come across this at the beginning of the project.</description>
		<content:encoded><![CDATA[<p>Hey, thanks for the tips. I wish I would&#8217;ve come across this at the beginning of the project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nigel Jones</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-142</link>
		<dc:creator>Nigel Jones</dc:creator>
		<pubDate>Tue, 31 Mar 2009 12:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-142</guid>
		<description>GregK is quite correct. I touched upon this topic &lt;a HREF=&quot;http://www.embeddedgurus.net/stack-overflow/2008/09/efficient-c-tips-4-use-speed.html/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Like many other developers, I build both a debug and a release target. With the debug target, I typically have optimization set to a minimum. With the release target, I always have optimization set to the maximum. One of the reasons is because changing it can dramatically affect your stack size. Incidentally, I have had the odd occasion in which I have had to switch from speed to size optimization. As and when you do this, it&#039;s essential to recompute your stack size.</description>
		<content:encoded><![CDATA[<p>GregK is quite correct. I touched upon this topic <a HREF="http://www.embeddedgurus.net/stack-overflow/2008/09/efficient-c-tips-4-use-speed.html/" rel="nofollow">here</a>. Like many other developers, I build both a debug and a release target. With the debug target, I typically have optimization set to a minimum. With the release target, I always have optimization set to the maximum. One of the reasons is because changing it can dramatically affect your stack size. Incidentally, I have had the odd occasion in which I have had to switch from speed to size optimization. As and when you do this, it&#8217;s essential to recompute your stack size.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GregK</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-141</link>
		<dc:creator>GregK</dc:creator>
		<pubDate>Tue, 24 Mar 2009 21:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-141</guid>
		<description>My advise:Is worth to keep your compiler options constant during development. Small change from -O2 to -O3 could cause big different in stack(s) consumptions.</description>
		<content:encoded><![CDATA[<p>My advise:Is worth to keep your compiler options constant during development. Small change from -O2 to -O3 could cause big different in stack(s) consumptions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan Bowens</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-140</link>
		<dc:creator>Alan Bowens</dc:creator>
		<pubDate>Fri, 06 Mar 2009 07:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-140</guid>
		<description>Nice article on function pointers.  I&#039;ve been using exactly the same state machine approach for a while now, but you give a cogent explanation that I can hand to newbies to quickly get them up to speed.</description>
		<content:encoded><![CDATA[<p>Nice article on function pointers.  I&#8217;ve been using exactly the same state machine approach for a while now, but you give a cogent explanation that I can hand to newbies to quickly get them up to speed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nigel Jones</title>
		<link>http://embeddedgurus.com/stack-overflow/2009/03/computing-your-stack-size/comment-page-1/#comment-139</link>
		<dc:creator>Nigel Jones</dc:creator>
		<pubDate>Thu, 05 Mar 2009 00:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2009/03/01/computing-your-stack-size/#comment-139</guid>
		<description>I look forward to hearing what you have to say on this Mike.</description>
		<content:encoded><![CDATA[<p>I look forward to hearing what you have to say on this Mike.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

