<?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>Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49539/segmentation-fault-when-debugging-nrf52840-dk</link><description>Hello, I am developping on a nrf52840-DK board and try to debug using a Black Magic probe. Software is based on softdevice, GCC build chain and Visual Studio Code with Cortex-debug extension. For now, we advertise on BLE and send the battery voltage when</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Jul 2019 17:26:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49539/segmentation-fault-when-debugging-nrf52840-dk" /><item><title>RE: Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/thread/197674?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 17:26:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8f328c9-16c8-4692-af5c-902629789948</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;As &lt;a href="https://devzone.nordicsemi.com/members/hkn"&gt;Håkon Alseth&lt;/a&gt; said, it sounds like the classic problem of Halting Debug with a SoftDevice:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48647/ble-debugging-on-nrf52/193088#193088"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/48647/ble-debugging-on-nrf52/193088#193088&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I know nothing about this &amp;quot;Black Magic&amp;quot; probe, but Segger seem to be the only ones to have implemented Monitor Mode Debug for Cortex-M. They say it should be transparent to the IDE, but it does require that you use a J-Link.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/thread/197652?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 14:28:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e47db20-57a5-4df2-8f8d-ce553941937d</guid><dc:creator>Fredcoach</dc:creator><description>&lt;p&gt;Yes, for sure, it is the soft device.&lt;/p&gt;
&lt;p&gt;You talked about an assertion callback. Is it possible to get this callback, ignore it and continue?&lt;/p&gt;
&lt;p&gt;I know that the comm will fail but it will still allow to follow the code and, thus, understand many things.&lt;/p&gt;
&lt;p&gt;I use the reset button after the segmentation fault.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Fred&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/thread/197650?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 14:22:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1956c048-d7a0-4ff1-a0da-dba4b6d2e5eb</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>[quote user="Fredcoach"]What do you mean by &amp;quot;mon reset&amp;quot;?&amp;nbsp;[/quote]
&lt;p&gt;a debugger issued reset.&amp;nbsp;&lt;/p&gt;
[quote user="Fredcoach"]Yes, I can probably ignore the assert (do I have to intercept it to see it?), but I don&amp;#39;t know what to do after a segmentation fault.[/quote]
&lt;p&gt;Given that it stops in the address space of the softdevice, I suspect that the seg fault is actually the softdevice asserting.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t used a BMP&amp;nbsp;myself, but address-wise (&lt;span&gt;0x00015522)&lt;/span&gt;; it&amp;#39;s the SoftDevice.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/thread/197648?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 14:11:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af7840ff-ad5f-4cdb-92ae-fdb8893693cf</guid><dc:creator>Fredcoach</dc:creator><description>&lt;p&gt;Yes, I can probably ignore the assert (do I have to intercept it to see it?), but I don&amp;#39;t know what to do after a segmentation fault.&lt;/p&gt;
&lt;p&gt;What do you mean by &amp;quot;mon reset&amp;quot;?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/thread/197645?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 14:00:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:508c72d5-3d44-4313-b43b-1f2646cbfa2f</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Well, technically, you can ignore the assertion callback from the softdevice, but I would not recommend it. You&amp;#39;d need a reset to recover the SoftDevice at that point.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The bluetooth LE communication relies on a peer device as well, so halting/running would break the link anyway.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can still use the debugger, just know that you need to do a &amp;quot;mon reset&amp;quot; if you continue after halting while the SoftDevice is actively doing something.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/thread/197643?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 13:46:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c36e8f6-0979-4cf2-8d4a-b4ffbfd393cd</guid><dc:creator>Fredcoach</dc:creator><description>&lt;p&gt;Thanks for the answers.&lt;/p&gt;
&lt;p&gt;Thus, stepping Inside the code is not possible...&lt;/p&gt;
&lt;p&gt;Is it possible to disable these assertions?&lt;/p&gt;
&lt;p&gt;If not, I don&amp;#39;t clearly see why to use a debugger.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Frederic&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/thread/197540?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 08:42:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a56e6a8b-bb55-4d09-baf5-d0cd4acd71c6</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Your debugging experience here doesn&amp;#39;t look like it&amp;#39;s optimal.&lt;/p&gt;
&lt;p&gt;Have you considered contacting BMP community (via &lt;a href="https://github.com/blacksphere/blackmagic"&gt;https://github.com/blacksphere/blackmagic&lt;/a&gt; or similar) to ask about this?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Since you&amp;#39;re new to debugging with a Softdevice running, do note that if you halt/run while the softdevice is active (advertising or in a connection), you will assert.&lt;/p&gt;
&lt;p&gt;This is because halting using the debugger halts only the CPU, while keeping peripherals like the radio, rtc, timers, etc. running. When resuming again, all these peripherals are then set, and the softdevice asserts if events are triggered in a abnormal&amp;nbsp;order.&lt;/p&gt;
&lt;p&gt;Setting a breakpoint is OK, but if you continue again; you will assert.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Segmentation fault when debugging nRF52840-DK</title><link>https://devzone.nordicsemi.com/thread/197350?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2019 11:25:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:965b723a-950a-481e-9402-943034d7157c</guid><dc:creator>niebert</dc:creator><description>&lt;p&gt;It is possible that there are compatibility issues with the black magic probe (and this is likely the reason why you cannot flash with it). If you have that alternative, use openocd, e.g. with an STLink programmer or a CMSIS DAP programmer or even bit banging from a raspberry PI, all&amp;nbsp;work&amp;nbsp;great, also for flashing.&lt;/p&gt;
&lt;p&gt;As much as I like the concept of BMP, it remains limited since all targets must be known in the firmware. OpenOCD remains more universal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>