<?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>Region RAM overflowed with stack</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7212/region-ram-overflowed-with-stack</link><description>Hey everyone, 
 I&amp;#39;m developing an application using the IoT SDK . The first part of the application consisted of a normal BLE peripheral to interact with an android app. The second part consists of getting the peripheral connected to the internet through</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 May 2015 13:51:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7212/region-ram-overflowed-with-stack" /><item><title>RE: Region RAM overflowed with stack</title><link>https://devzone.nordicsemi.com/thread/25479?ContentTypeID=1</link><pubDate>Thu, 28 May 2015 13:51:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01df002e-869b-4921-838d-4c6715843f9a</guid><dc:creator>maxpaynner</dc:creator><description>&lt;p&gt;Uploading the whole project is a big nono since my company&amp;#39;s policy prevents me doing it. But I&amp;#39;ll try to be more specific. I&amp;#39;ve also added &lt;a href="https://devzone.nordicsemi.com/question/39385/checking-for-memory-usage-on-runtime/"&gt;this&lt;/a&gt; new question that is related to this one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Region RAM overflowed with stack</title><link>https://devzone.nordicsemi.com/thread/25478?ContentTypeID=1</link><pubDate>Thu, 28 May 2015 11:02:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdb96e4b-27f0-4086-a758-31cc8f8c5066</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;The application can use the remainder of RAM, but the amount is fixed after compilation. The size of the call stack changes at run time. I&amp;#39;m not sure what could cause this, and I don&amp;#39;t see why low memory would cause it. I feel we are moving into a new question here, could you add it separately? Maybe link to this one. It would be helpful if you could upload your complete project so we can have a look, you could also elaborate a bit on what result you expect, and what the results are.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Region RAM overflowed with stack</title><link>https://devzone.nordicsemi.com/thread/25477?ContentTypeID=1</link><pubDate>Wed, 27 May 2015 15:41:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93d68e07-1e5a-443a-a12f-d4452ccc7cb6</guid><dc:creator>maxpaynner</dc:creator><description>&lt;p&gt;Hey Petter,&lt;/p&gt;
&lt;p&gt;I was able to get this to compile by &lt;em&gt;reducing&lt;/em&gt; the ammount of heap and ram I&amp;#39;m using. I think this lets the program use the remainder &amp;quot;free&amp;quot; ram, no?
Thing is I get really weird behaviour with my application now. For example: in my application I have to poll for values from external inputs. I&amp;#39;m using the application timers as per your examples. When I have the IP stack initialized the timer only runs two times and then stops. When it runs, the results are not what I&amp;#39;d expect. Is this a sign of low memory?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Region RAM overflowed with stack</title><link>https://devzone.nordicsemi.com/thread/25476?ContentTypeID=1</link><pubDate>Tue, 26 May 2015 15:43:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97780a00-838f-42bd-b3fc-0d01f1690763</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;&amp;quot;region RAM overflowed with stack&amp;quot; means that your application requires too much RAM.&lt;/p&gt;
&lt;p&gt;If you have the chip version with 16kB and the SoftDevice use 8kB, the application doesn&amp;#39;t have 8kB left.&lt;/p&gt;
&lt;p&gt;You need to include the call stack and heap into the calculation. Both of these are set to 2048 bytes, in most (if not all) of our examples. This leaves 4kB for the application.&lt;/p&gt;
&lt;p&gt;The S110 SoftDevice uses a maximum call stack of 1536 bytes (see Section 11.2 in the SDS for more info). With the stack size set to 2048, this leaves a maximum call stack of 512 bytes for the application.&lt;/p&gt;
&lt;p&gt;Heap is mainly used by malloc() and calloc(). The S110 SoftDevice doesn&amp;#39;t use any heap, this is also true for ble_app_hrs, and most of the other examples in the SDK (maybe not the serializer examples). I&amp;#39;m not sure about the IoT SDK. You can try to decrease it.&lt;/p&gt;
&lt;p&gt;I think you should try to figure out how much RAM you have left with only the first part of your application.&lt;/p&gt;
&lt;p&gt;Total RAM usage will be RW-data + Zi-data. RW data is variables != 0, while ZI-data (zero initialized data) is variables set to 0. (The RW-data and Zi-data is displayed in the build output in Keil, I&amp;#39;m not sure about GCC. Add a new question about it?)&lt;/p&gt;
&lt;p&gt;The ipv6_coap_client example from the IoT SDK gives these figures:&lt;/p&gt;
&lt;p&gt;RW-data=228 ZI-data=8524&lt;/p&gt;
&lt;p&gt;This is in total 8752 bytes, and subtracting the call stack and the heap, the application ends up with 4656 bytes.&lt;/p&gt;
&lt;p&gt;Please let me know if anything is unclear.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>