<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Maximum limit of stack size using flag -D__STACK_SIZE  NRF52382</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21056/maximum-limit-of-stack-size-using-flag--d__stack_size-nrf52382</link><description>Hi, 
 I am running an application in which I set -D__STACK_SIZE=0x4000. After some research, I come to know that RAM is divided into 4 blocks the lower one is for the soft device and the final block is divided into two half one heap section one stack</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Apr 2017 07:29:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21056/maximum-limit-of-stack-size-using-flag--d__stack_size-nrf52382" /><item><title>RE: Maximum limit of stack size using flag -D__STACK_SIZE  NRF52382</title><link>https://devzone.nordicsemi.com/thread/82271?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 07:29:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25653293-bee9-4652-89cf-80ec10c0dbe8</guid><dc:creator>Prashant Singh</dc:creator><description>&lt;p&gt;Thanks Bjorn no further question on this topic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum limit of stack size using flag -D__STACK_SIZE  NRF52382</title><link>https://devzone.nordicsemi.com/thread/82270?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 06:09:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90bb98d5-de3c-4aac-a9a4-259a70216e44</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Happy to help. :) Let me know if you have any further questions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum limit of stack size using flag -D__STACK_SIZE  NRF52382</title><link>https://devzone.nordicsemi.com/thread/82269?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 14:06:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05187dd1-2f71-464e-8af0-6166fea42f31</guid><dc:creator>Prashant Singh</dc:creator><description>&lt;p&gt;Thanks Bjorn
In your answer, you mentioned  taking a look at the .map file to find out how much RAM the application uses  if I am getting it correct you are referring to .bss section and .data section&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum limit of stack size using flag -D__STACK_SIZE  NRF52382</title><link>https://devzone.nordicsemi.com/thread/82268?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 12:01:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc6ec762-c833-4d92-8723-4624db96749f</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Prashant,&lt;/p&gt;
&lt;p&gt;I am assuming that you referring to the portioning of the RAM shown below, when you say that RAM is divided in to four blocks.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/memory_5F00_map.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;The maximum limit that __STACK_SIZE can be set to will depend on how much RAM the application needs, but the absolute limit, i.e. if the application does not use RAM will be 0x20000000 +  - APP_RAM_BASE. Usually, that is not the case, so you&amp;#39;ll have to take a look in the .map file to find out how much RAM the application uses and then adjust the stack size accordingly. If you get linker error when compiling then you know that the stack is to large and you will have to reduce the size until it successfully compiles and then use the .map file as mentioned above.&lt;/p&gt;
&lt;p&gt;If you do not define&lt;code&gt;__STACK_SIZE&lt;/code&gt;, then it is usually set to &lt;code&gt;8192&lt;/code&gt; bytes, see the gcc_startup_nrf52.S file in &lt;code&gt;components\toolchain\gcc\&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>