I'm having a very strange issue when trying to debug application code on my Nordic platform. I'm hoping that someone else can shed some light on the issue, or at least confirm if others are seeing it.
The background: ANT-based application using nRF51422 Using single wire debug (SWD) setup via Keil/Segger JLINK (NOT building source through Keil MDK)
My problem is that anytime I want to debug application code ("real" debugging using SWD, not UART print outs) I always get "stuck" in a SoftDevice call. For example, one of the first things that application code does is to enable the SoftDevice, calling sd_softdevice_enable(). If, while debugging, I place a breakpoint anywhere after this call (with no other breakpoints), I will never reach that breakpoint. I can halt the debugger and I am always at the same address, off in the SoftDevice stack. I can run or "step out" from this point all I like, but I will always stay in the same address range (always returning back to the same address, able to step to subsequent addresses, but never exiting the SD call).
I inadvertently discovered that, in a few of these scenarios, I can step a "magic number" of times and somehow I exit the SD address range and return to my application code. This does not work for most SD calls, and the "magic number" differs almost every time.
I know that at least one other developer at my company has seen this issue, on a separate (but very similar) project from my own, so I at least know I'm not crazy. If anyone can provide some insight on this, you would really make my Nordic development much more enjoyable.
Thanks!