<?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>SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50708/sigtrap-on-sd_softdevice_enable</link><description>I&amp;#39;m compiling a custom application using the CMake scripts in the nRF mesh SDK. The first time I flash to the nRF52832 a SIGTRAP occurs on sd_softdevice_enable. I cannot continue from this. If I flash again, it does not occur. Any idea what might be happening</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Aug 2019 06:08:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50708/sigtrap-on-sd_softdevice_enable" /><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/203199?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 06:08:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f71efd3a-d7b6-410d-a934-80f7c0fc4d2a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Maybe you can try to append --noir (&amp;quot;Do not initialize the CPU registers on startup.&amp;quot;) to the list of GDB server argument to see if that helps.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/203043?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 11:11:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4c26608-352a-4da2-b0a1-c6604149047d</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Yes I think this is the reason. If I run &amp;quot;mon reset&amp;quot; in gdb and then continue, I hit the breakpoint. Can I get JLinkGDBServer to do this when running?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/203036?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 11:02:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5d26829-4984-4ae2-9237-a0c5c5e4e118</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Perhaps it is because JLinkGDBServer is not actually resetting the target so the SIGTRAP has already occurred...And breakpoints do work when JLinkGDBServer downloads the firmware image, until the SIGTRAP in the softdevice enable. So if correct, either I need to make JLinkGDBServer reset the target or I use JLinkGDBServer to download the image but somehow prevent it setting the PC register...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/203035?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 10:59:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5dea4258-5795-465f-8327-2498dec99c01</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Ah, turns out the default in CLion 2019.2 uses JLinkGDBServer to download the firmware image when changes are made, and it seems to set the PC register after doing that:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/usr/local/bin/JLinkGDBServer -device nrf52 -strict -timeout 0 -nogui -if swd -speed 1000 -endian little
SEGGER J-Link GDB Server V6.44h Command Line Version

JLinkARM.dll V6.44h (DLL compiled May  3 2019 17:40:32)

Command line: -device nrf52 -strict -timeout 0 -nogui -if swd -speed 1000 -endian little
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 nrf52
Target interface:              SWD
Target interface speed:        1000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Error during pretty printers setup: Undefined info command: &amp;quot;pretty-printer&amp;quot;.  Try &amp;quot;help info&amp;quot;.

Some features and performance optimizations will not be available.

Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan  7 2019 14:07:15
Hardware: V1.00
S/N: 682644303
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Reading 64 bytes @ address 0x00029CC0
Read 2 bytes @ address 0x00029D4A (Data = 0x481A)
Reading 64 bytes @ address 0x00027D40
Read 2 bytes @ address 0x00027D98 (Data = 0x4A39)
Read 4 bytes @ address 0x00029D38 (Data = 0x462ABE00)
Reading 64 bytes @ address 0x2000FFC0
Read 4 bytes @ address 0x00029A22 (Data = 0xBD00B003)
Downloading 16144 bytes @ address 0x00026000
Downloading 15968 bytes @ address 0x00029F10
Downloading 16016 bytes @ address 0x0002DD70
Downloading 16016 bytes @ address 0x00031C00
Downloading 16080 bytes @ address 0x00035A90
Downloading 16080 bytes @ address 0x00039960
Downloading 15936 bytes @ address 0x0003D830
Downloading 16096 bytes @ address 0x00041670
Downloading 16336 bytes @ address 0x00045550
Downloading 16352 bytes @ address 0x00049520
Downloading 2580 bytes @ address 0x0004D500
Downloading 104 bytes @ address 0x0004DF14
Downloading 16 bytes @ address 0x0004DF7C
Downloading 8 bytes @ address 0x0004DF8C
Downloading 8 bytes @ address 0x0004DF94
Downloading 16 bytes @ address 0x0004DF9C
Downloading 184 bytes @ address 0x0004DFAC
Downloading 20 bytes @ address 0x0004E064
Downloading 16 bytes @ address 0x0004E078
Downloading 8 bytes @ address 0x0004E088
Downloading 2132 bytes @ address 0x0004E090
Downloading 20 bytes @ address 0x0004E8E4
Comparing flash   [....................] Done.
Verifying flash   [....................] Done.
Writing register (PC = 0x   298ec)
Reading 64 bytes @ address 0x00029CC0
Read 2 bytes @ address 0x00029D4A (Data = 0x481A)
Reading 64 bytes @ address 0x00027D40
Read 2 bytes @ address 0x00027D98 (Data = 0x4A39)
Debugger connected to tcp:localhost:2331
Setting breakpoint @ address 0x00027D98, Size = 2, BPHandle = 0x0001
Setting breakpoint @ address 0x00029D4A, Size = 2, BPHandle = 0x0002
Starting target CPU...
...Target halted (DBGRQ, PC = 0x00000A64)
Reading all registers
Removing breakpoint @ address 0x00027D98, Size = 2
Removing breakpoint @ address 0x00029D4A, Size = 2
Read 4 bytes @ address 0x00000A64 (Data = 0x471868DB)
Read 2 bytes @ address 0x00000A64 (Data = 0x68DB)
Signal: SIGTRAP (Trace/breakpoint trap)
Reading 64 bytes @ address 0x00000A40
Read 4 bytes @ address 0x2000FFCC (Data = 0x61000000)
Reading 64 bytes @ address 0x2000FFC0
Read 4 bytes @ address 0x0002A1FA (Data = 0xDF114770)
Read 4 bytes @ address 0x0002A310 (Data = 0xFAB04604)
Read 4 bytes @ address 0x000276D4 (Data = 0x2300B968)
Read 4 bytes @ address 0x0002831E (Data = 0xFC07F7FE)
Read 4 bytes @ address 0x000262EA (Data = 0xBD082000)
Read 4 bytes @ address 0x0002628E (Data = 0xFF05F01D)
Reading 64 bytes @ address 0x00026240
Read 4 bytes @ address 0x00026298 (Data = 0x20010000)
Read 4 bytes @ address 0x00026296 (Data = 0x00000008)
Read 4 bytes @ address 0x000262A4 (Data = 0x20003B58)
Read 4 bytes @ address 0x000262AA (Data = 0x00002000)
Reading 64 bytes @ address 0x2000FF80
Reading 64 bytes @ address 0x0002A1C0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So now after disabling that (because I&amp;#39;m using the CMake flash_ target to write the firmware) it doesn&amp;#39;t happen. However, breakpoints I set are not being hit:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/usr/local/bin/JLinkGDBServer -device nrf52 -strict -timeout 0 -nogui -if swd -speed 1000 -endian little
SEGGER J-Link GDB Server V6.44h Command Line Version

JLinkARM.dll V6.44h (DLL compiled May  3 2019 17:40:32)

Command line: -device nrf52 -strict -timeout 0 -nogui -if swd -speed 1000 -endian little
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 nrf52
Target interface:              SWD
Target interface speed:        1000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Error during pretty printers setup: Undefined info command: &amp;quot;pretty-printer&amp;quot;.  Try &amp;quot;help info&amp;quot;.

Some features and performance optimizations will not be available.

Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan  7 2019 14:07:15
Hardware: V1.00
S/N: 682644303
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Reading 64 bytes @ address 0x00027D40
Read 2 bytes @ address 0x00027D98 (Data = 0x4A39)
Read 4 bytes @ address 0x00029D38 (Data = 0x462ABE00)
Reading 64 bytes @ address 0x2000FFC0
Read 4 bytes @ address 0x00029A22 (Data = 0xBD00B003)
Debugger connected to tcp:localhost:2331
Setting breakpoint @ address 0x00027D98, Size = 2, BPHandle = 0x0001
Starting target CPU...
Reading all registers
Removing breakpoint @ address 0x00027D98, Size = 2
Read 4 bytes @ address 0x00029D38 (Data = 0x462ABE00)
Reading 64 bytes @ address 0x2000FFC0
Read 4 bytes @ address 0x00029A22 (Data = 0xBD00B003)
Signal: SIGTRAP (Trace/breakpoint trap)
Read 4 bytes @ address 0x00029A22 (Data = 0xBD00B003)
Reading 64 bytes @ address 0x00029CC0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here a breakpoint is set at a point before a&amp;nbsp;SIGTRAP occurs, but it is not hit. Do you have any suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/203027?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 10:21:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15c64c99-0887-4eef-a97b-8a6e683a45e2</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I haven&amp;#39;t had this problem with GDB. Are there some GDB scripts included in the Mesh SDK?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How I usually start a debug session with GDB without .gdbinit:&lt;/p&gt;
&lt;p&gt;1. Start the Jlink GDB server&lt;/p&gt;
&lt;p&gt;2. Open a new terminal and run &amp;quot;arm-none-eabi-gdb &amp;lt;app&amp;gt;.elf&lt;/p&gt;
&lt;p&gt;(gdb) target remote localhost:2331&lt;/p&gt;
&lt;p&gt;(gdb) b main&lt;/p&gt;
&lt;p&gt;(gdb) c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/203024?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 10:07:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3db04f2f-c0cc-4bf0-9d7e-45fb5bf0a64a</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Yes! That worked. Is there a similar solution for GDB?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/203017?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 09:53:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:276cebe2-a219-4e48-8c86-e355cc1eb0f5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I was able to replicate this here. Ozone use debugger commands to manually set the&amp;nbsp;SP and PC register with the values from the application&amp;#39;s vector table. This breaks the normal startup sequence and the Softdevice&amp;#39;s reset handler will not get executed.&lt;/p&gt;
&lt;p&gt;Please try to comment out the declaration of AfterTargetReset() and&amp;nbsp;AfterTargetDownload() in your ozone project file (*.jdebug).&amp;nbsp;That should fix the problem.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/202903?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 17:04:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5eccbd63-cc7c-401a-a469-31911341aa2a</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;This also happens in Ozone:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot-2019_2D00_08_2D00_07-at-18.00.13.png" /&gt;&lt;/p&gt;
&lt;p&gt;When in this state, running the command gives:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;$ nrfjprog --readregs
R0:   0x00000010
R1:   0x2000FFB0
R2:   0xA801BE2C
R3:   0xA801BE00
R4:   0x2000445C
R5:   0x00000000
R6:   0x00000000
R7:   0x00000000
R8:   0x00000000
R9:   0x00000000
R10:  0x20000000
R11:  0x00000000
R12:  0x00000000
SP:   0x2000FF90
LR:   0xFFFFFFF1
PC:   0x00000A64
xPSR: 0x81000003
MSP:  0x2000FF90
PSP:  0x00000000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Resetting and running again:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ nrfjprog --reset
Applying system reset.
Run.
$ nrfjprog --readregs
R0:   0x00000000
R1:   0x00000001
R2:   0x00000000
R3:   0x01010001
R4:   0x00004001
R5:   0x2000FFC8
R6:   0x00027D7D
R7:   0x00040001
R8:   0x00000004
R9:   0x00000000
R10:  0x20000000
R11:  0x00000000
R12:  0x00000000
SP:   0x2000FFA0
LR:   0x0002EBE5
PC:   0x00029D14
xPSR: 0x21000000
MSP:  0x2000FFA0
PSP:  0x00000000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Does this mean the hardfault is not occurring when running without the debugger?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SIGTRAP on sd_softdevice_enable</title><link>https://devzone.nordicsemi.com/thread/202840?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 13:15:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7894d71e-d3ae-4150-94d0-8b22fef1e531</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The Softdevice must be programmed at least partially for the program execution to reach the main app. I remember seeing similar issues before with&amp;nbsp;Segger embedded Studio where a fault exception gets triggered on sd_ enable, but&amp;nbsp;then it has been related to debugger configuration. Maybe you can try to just reset the device instead of flashing it again, then read out the CPU registers to see if the fault also gets triggered when you&amp;#39;re&amp;nbsp;not debugging with GDB.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &amp;quot;nrfjprog --readregs&amp;quot; command will read out the CPU registers&amp;nbsp;where the last byte of xPSR will tell you the current interrupt number (=3 if hardfault =0 if none).&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>