<?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>Stack Tracing with softdevice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7587/stack-tracing-with-softdevice</link><description>Hi, 
 I want to implement stack tracing to check stack overflow and remaining stack. I followed the implementation given in example github.com/.../memory_watcher. 
 Memory watcher code is not working when I am using softdevice S120 along with my application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Jun 2015 10:05:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7587/stack-tracing-with-softdevice" /><item><title>RE: Stack Tracing with softdevice</title><link>https://devzone.nordicsemi.com/thread/27055?ContentTypeID=1</link><pubDate>Mon, 29 Jun 2015 10:05:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98d8fddc-e597-4463-ae34-8dc10899c34f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I figured that the while statement was there for debugging :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stack Tracing with softdevice</title><link>https://devzone.nordicsemi.com/thread/27054?ContentTypeID=1</link><pubDate>Mon, 29 Jun 2015 10:01:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5473c58-608a-412b-bff5-f67c414fee94</guid><dc:creator>Swetika</dc:creator><description>&lt;p&gt;Sorry for typo mistake. I will rewrite the code again:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
{
register uint32_t __regProcessStackPointer  __ASM(&amp;quot;msp&amp;quot;);
     stackStart = (uint32_t )__regProcessStackPointer;
     stackEnd = stackStart - 0x800; //stack size 2048
  while(1)
{
  ////
}
return 0;
}

uint32_t getRemainingStack(void)
{
    uint32_t currentSP;
    uint32_t stack;
    register uint32_t __regProcessStackPointer  __ASM(&amp;quot;msp&amp;quot;);
     currentSP = (uint32_t )__regProcessStackPointer;
     stack = currentSP - stackEnd;
    return (stack);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stack Tracing with softdevice</title><link>https://devzone.nordicsemi.com/thread/27053?ContentTypeID=1</link><pubDate>Wed, 17 Jun 2015 08:28:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5177268a-8dc6-47b8-976a-8c2b0dc52c2f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;nicely done&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stack Tracing with softdevice</title><link>https://devzone.nordicsemi.com/thread/27052?ContentTypeID=1</link><pubDate>Wed, 17 Jun 2015 08:12:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27b40e4f-525d-4246-aa8a-4cc8140cead4</guid><dc:creator>Swetika</dc:creator><description>&lt;p&gt;Hi Aryan,&lt;/p&gt;
&lt;p&gt;I found that  Keil startup files do not expose the stack nor the heap location in memory. Till now the solution i implemented is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
{
register uint32_t __regProcessStackPointer  __ASM(&amp;quot;msp&amp;quot;);
	 stackStart = (uint32_t )__regProcessStackPointer;
	 stackEnd = stackStart - 0x800; //stack size 2048
}

uint32_t getRemainingStack(void)
{
	uint32_t currentSP;
	uint32_t stack;
	register uint32_t __regProcessStackPointer  __ASM(&amp;quot;msp&amp;quot;);
	 currentSP = (uint32_t )__regProcessStackPointer;
	 stack = currentSP - stackEnd;
	return (stack);
  while(1)
{
  ////
}
return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To get the stack usage periodically, getRemainingStack handler is called by app timer every 10ms.  It is polling method. but idea was have get an exception whenever stack overflow happens.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stack Tracing with softdevice</title><link>https://devzone.nordicsemi.com/thread/27051?ContentTypeID=1</link><pubDate>Tue, 16 Jun 2015 20:27:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:612af2e2-93fc-440a-bd3a-430eb96f09ec</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I will have to try this out in my leisure time, hope someone who has already tried this gives us an answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>