I was developing application very similar to the basic ble_app_uart_pca10040_s132 example when I started getting random restarts and Segger Embedded Studio breaks at a strange location. Without SES the device just restarts without breaking after several minutes.
This happens also with the stock ble_app_uart example and the stack and memory range are weird (not sure from memory map where they actually belong).
RESETREAS is always 0x10004 which seems that the reset is from software.
It never hits the asserts or app_error_handler or app_error_fault_handler though like here.
I tried to debug it by stepping, but that causes softdevice to memfault.
The call stack and disassembly where SES breaks looks like this always:


It also does not seem to be any of the faults like HardFault.
Then the code continues back to main().
Weirdest part is that the restarts do not happen if a BLE device is connected to the Nordic UART. Only if no device is connected, then after several minutes it restarts.




