<?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>debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10217/debugging-softdevice-applications-with-gdb</link><description>Hi Nordic, 
 Running a gdb session on nRF51, it is difficult to debug the code beyond the SoftDevice initialization. Then, I have to step through with (gdb)ni, but this is not convenient, and on top of that, system events don&amp;#39;t seem to fire up. 
 I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Dec 2015 13:45:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10217/debugging-softdevice-applications-with-gdb" /><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37911?ContentTypeID=1</link><pubDate>Wed, 02 Dec 2015 13:45:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a13121dc-4304-4c02-9cf2-56501962551c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The application is always reaching the assembly breakpoint you set in main.c when I try it here. Also able to do memory dumps at this point.  Have you tried to halt after softdevice init and do instructions steps (ni) to verify that it&amp;#39;s stuck in the softdevice (address is below 0x16000)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37905?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2015 14:34:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f221d36a-27c9-4333-91e8-15bf9887a9c0</guid><dc:creator>Jean-Louis Bonnaff&amp;#233;</dc:creator><description>&lt;p&gt;Confirmed. SoftDevice 7.1.0 @0x16000. The problem is I am getting stack overflows when increasing the RSA key size, and I&amp;#39;d like to estimate the available RAM space at specific points in the program. I am using JLinkGdbServer, setting a breakpoint and continue. If the breakpoint is before softdevice init, I am able to run (gdb) dump memory ram.dump 0x20000000 0x20004000. If the breakpoint is after, the GDB prompt never comes back, and the backtrace shows the exec in hanging in softdevice init.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37904?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2015 14:15:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea5c129d-3a4a-4288-ab1b-846fcc0fc656</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Assume it&amp;#39;s s110 v.7.x.x as the start address is 0x16000? That said, it was a false alarm regarding the hardfault, somehow the softdevice was being erased after I loaded .elf file earlier, guess it was to late in the evening. Now I&amp;#39;m able to debug the project. It advertises for a couple of seconds and I&amp;#39;m able to connect to it, but could you explain the problem you experience so I have a better idea of what to look for, and also what the expected behavior should be  when not using any ext sensors?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37903?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2015 02:35:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:994b09a6-a2b1-4deb-8233-bd6d3339d3cf</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;what softdevice is that code compiled to use? I was going to try running it and see if I can also fail totally to work out what&amp;#39;s going on. Is there a reason by the way that you omit the frame pointers? If you do get manage to get gdb hooked into the code at a breakpoint, not having them is going to make it somewhat harder to debug beyond your current stack frame.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37909?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 15:26:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ec999d9-004f-47ba-bf54-795b2497cfa4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi, I&amp;#39;m using the nRF51 DK kit. Tried running your code but it goes into hardfault. Could you send me your project on project on a  PM or  at &lt;a href="http://www.nordicsemi.com/eng/Support-Community/Contact-Support-Team"&gt;mypage&lt;/a&gt; so I can try to debug it further?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37908?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 15:11:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:778f132d-a900-4831-905f-e5112d3a08e2</guid><dc:creator>Jean-Louis Bonnaff&amp;#233;</dc:creator><description>&lt;p&gt;Optimization level is zero. My gcc flags are : -ffunction-sections  -mcpu=cortex-m0 -mthumb -mabi=aapcs  --std=gnu99 -mfloat-abi=soft -ggdb -O0 -fomit-frame-pointer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37907?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 14:53:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71d13308-60f7-4556-ad20-3da20abb01e5</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;What is your level of code optimisation? If it is different than 0, try turning it off (to 0). I am also using gdb - it is hard to debug during connections etc, but not impossible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37906?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 14:52:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1be9d9a3-ef5a-469c-bfc3-3e41305fd2b4</guid><dc:creator>Jean-Louis Bonnaff&amp;#233;</dc:creator><description>&lt;p&gt;Indeed the softdevice was initialized with NRF_CLOCK_LFCLKSRC_XTAL_50_PPM. However, changing to other values doesn&amp;#39;t make a difference. Breakpoints beyond softdevice_handler_init are not reached. Attached ELF for reference (compiled for a nRF51 board, GPIO are remapped). Which refdesign are you using ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37912?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2015 08:12:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52b46eef-b28c-4587-b174-f4f8f0ae58ab</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Does the softdevice init ever return to main context? It will hang in an endless loop within the SD if you&amp;#39;ve chosen selected the NRF_CLOCK_LFCLKSRC_XTAL_x_PPM enum as the SD will wait for the crystal to start up. &lt;a href="https://devzone.nordicsemi.com/question/953/what-low-frequency-clock-sources-can-i-use/"&gt;LF clock source&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;If you are able to share your .out/.elf file with debug symbols I can try to debug it as well and see if I can find some clues (code must work on the nRF51 DK kit).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37910?ContentTypeID=1</link><pubDate>Mon, 23 Nov 2015 15:39:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17aa5094-51b7-452b-bd74-f23f10d9c49e</guid><dc:creator>Jean-Louis Bonnaff&amp;#233;</dc:creator><description>&lt;p&gt;Thanks for the hint. The &amp;quot;RAM painting + breakpoints&amp;quot; seems a valid approach. However, the crux of my problem is I cannot take gdb beyond the SoftDevice init, so I am not able to break, halt, step, etc. Unfortunately, setting PRIMASK doesn&amp;#39;t help either.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: debugging softdevice applications with gdb</title><link>https://devzone.nordicsemi.com/thread/37902?ContentTypeID=1</link><pubDate>Mon, 16 Nov 2015 12:56:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4f724b8-a567-4e1e-a458-5de4de41a408</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi, It&amp;#39;s not possible to single step while the softdevice is in use as you may know already. That is, you can do it to some extent as explained in this &lt;a href="https://devzone.nordicsemi.com/question/1489/can-i-debug-ble-program/#reply-1504"&gt;thread&lt;/a&gt;. What you can do is to set breakpoints and see if the are reached during program execution. E.g., place a breakpoint in app_error.c-&amp;gt;app_error_handler() to see if any of the calls to the softdevice has returned an error code. You can also use &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v10.0.0/lib_trace.html?cp=4_1_0_3_6"&gt;trace&lt;/a&gt; to log debug data over UART or Segger RTT.&lt;/p&gt;
&lt;p&gt;Some suggestions if you suspect stack overflow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Allocate more stack and see if you still experience problems.&lt;/li&gt;
&lt;li&gt;Halt the cpu when you think the stack may have overflown and read the stack pointer (R13) value. Then check against your .map file from the build output and see if the SP is outside the allocated call stack range.&lt;/li&gt;
&lt;li&gt;&amp;quot;paint&amp;quot; the ram above the application region with a known pattern at startup, and let the application run for some time. Then halt cpu and read the RAM to determine the max. stack usage.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>