<?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>Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/477/can-i-debug-ble-program</link><description>Hi,
Can I debug BLE program? for example ble_app_hrs and ble_app_proximity. If not, why and how can I test and evaluate my BLE proram ? 
 Best
Regards</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Feb 2018 17:31:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/477/can-i-debug-ble-program" /><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/122179?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 17:31:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d38b1ef3-7827-4114-8d88-8b70bd2f28a6</guid><dc:creator>Mark Rages</dc:creator><description>&lt;p&gt;Using the Black Magic Probe debugger, PRIMASK is not broken out as a separate register, so the following is equivalent:&lt;/p&gt;
&lt;pre&gt;define hook-stop
  set $special=($special | 1)
end

define hook-run
  set $special=($special &amp;amp; ~1)
end

define hook-continue
  set $special=($special &amp;amp; ~1)
end
&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2502?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2017 16:37:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:726da628-b7dd-4c36-9ce5-642b4a355907</guid><dc:creator>thoughtful</dc:creator><description>&lt;p&gt;So one will need to modify their source at any location where a breakpoint is needed? yikes!
So what is the best tool chain for Nordic that works well?  Where is the information for how to
get started debugging (like setup and to breakpoint)?   I am presently seeking a flexible easy to toolchain for bluetooth arm cortex development.  Hoping I can do it with Nordic as the target, but if the evaluation dk toolchain is too much a maze of issues with nordic I will be seeking another supplier.  Does amaze me how companies will spend a fortune and then not do and give a series of proven steps to use (develop) with their product.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2501?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2016 08:06:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6201f24-5192-46cf-a780-723a64fb5645</guid><dc:creator>Michael Ambrus</dc:creator><description>&lt;p&gt;Works like a charm! Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2500?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2016 07:23:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08397e00-3361-4bbe-96e6-2aec4dcc5bef</guid><dc:creator>wemsoft</dc:creator><description>&lt;p&gt;Add the following line in you code just before breakpoint:&lt;/p&gt;
&lt;p&gt;__ASM volatile (&amp;quot;MSR primask, %0&amp;quot; : : &amp;quot;r&amp;quot; (0x1) : &amp;quot;memory&amp;quot;);&lt;/p&gt;
&lt;p&gt;This will set PRIMASK register. You will be able to step debuger until you hit one of the sd_ calls.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2499?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2016 06:04:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5003dc3f-4243-46cc-9484-55919e76d33b</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Setting PRIMASK to 1 will not stop any interrupt source from generating interrupt request signals. It only prevents the CPU from entering any exception (with configurable priority, i.e. all interrupts except RESET, NMI and HardFault) as long as PRIMASK is 1. That is also the reason why the sd_* calls won&amp;#39;t work while PRIMASK is 1 as they are implemented as SVCalls, which triggers an interrupt which executes the SD functions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2498?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2016 15:19:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73fdd905-3a2d-4392-b916-063de0a2461d</guid><dc:creator>Michael Ambrus</dc:creator><description>&lt;p&gt;Øyvind: Me and my team are struggling with this aspect too. Not being able to debug SD ISR:s with GDB is giving us grief.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not familiar with primask from before but it seems to be a control register for enabling/disabling interrupts. Or actually, the CPU:s ability to respond to them:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/CHDBIBGJ.html"&gt;infocenter.arm.com/.../index.jsp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We can automate this either in gdb-script or as an inline assembly in code. Would setting this bit stop the soft-device itself or will some HW continue to generate interrupts? Preferably one would like the source of the interrupts to also stop.&lt;/p&gt;
&lt;p&gt;This debugging technique, even if that breaks RT-requirements for SD, being able to step at least until next sd_* or ISR return would make a huge difference.&lt;/p&gt;
&lt;p&gt;== Edit ==
Here&amp;#39;s a gdb-script based solution:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;define hook-stop
    set $primask=1
end

define hook-run
    set $primask=0
end 

define hook-continue
    set $primask=0
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It will set primask to 1 on each stop, and release the IRQ-block it on each continue or run. Save as file objfile-gdb.gdb for automatic load or load explicitly using gdb&amp;#39;s -x option.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2497?ContentTypeID=1</link><pubDate>Tue, 17 Sep 2013 11:14:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81578d01-b7a1-43fc-95bc-9dc3ef8ff044</guid><dc:creator>shali lv</dc:creator><description>&lt;p&gt;thanks all
I have got it. I have other questions are going to ask. hope you helps .&lt;/p&gt;
&lt;p&gt;sincerely yous&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2496?ContentTypeID=1</link><pubDate>Tue, 17 Sep 2013 08:36:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a80b291-19d4-4b87-afac-94295e0fdab3</guid><dc:creator>steven</dc:creator><description>&lt;p&gt;hi,
i use uart port ,to out some debug message.
but the ble stack is Time slice so,when you release you have to disable uart
to sure function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2495?ContentTypeID=1</link><pubDate>Tue, 17 Sep 2013 07:27:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb9bd810-4388-4bf2-a1c4-2e11a74c294f</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you stop the execution somewhere in the application code e.g. by using a breakpoint, you can step forward from there if you set the PRIMASK CPU system register to 1 after hitting the breakpoint. You can do this in the &amp;quot;Registers&amp;quot; window in Keil while in debugging mode.&lt;/p&gt;
&lt;p&gt;There are a couple of limitations: You can only step until you hit an sd_* API call or return from an ISR, and you can not set PRIMASK back to 0 and resume execution as stopping the execution breaks the real time properties of the BLE stack. Also, no new interrupts will happen after PRIMASK is set to 1.&lt;/p&gt;
&lt;p&gt;I hope this helps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I debug BLE program?</title><link>https://devzone.nordicsemi.com/thread/2494?ContentTypeID=1</link><pubDate>Tue, 17 Sep 2013 05:38:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1877b613-8e43-4b09-899c-2f7b601c9817</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;You can to a degree.  The debugger in Keil uVision runs normally, but if the softdevice is initialized and you hit a breakpoint, then you cannot resume from there (or, you can, but things don&amp;#39;t work).  Also you cannot step through or anything like that when using softdevice.  At least this is my experience.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>