The issue is that if a peripheral needs to enable interrupts (or anything else partly protected by the SoftDevice) and is configured before enabling the SoftDevice, the NVIC_* functions must be used in the initialization and the sd_* functions for disabling/de-initialization. This can quickly lead to strange code and unforeseen bugs. The same is true for using the sd_mutex* etc.
So what is considered "best practice" for this issue when using the SoftDevice?
My initial thought would be to enable the SoftDevice immediately after initializing clocks and anything else that the SoftDevice might be depend on, and always use sd_* everywhere. And wait to enable the device manager, advertising, etc. until it makes sense to do so.
This does make debugging a bit more problematic. But are there any other drawbacks that I am missing? Or does anyone have a better approach?
A define to indicate if a SoftDevice is used could be added to make drivers etc. more general, but for BLE-centered applications this define would need to be checked quite a lot of places.