This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Adding nrf_nvic_state_t nrf_nvic_state = {0}; causes code not to build. No reason for build failure

I am still trying to figure out what NVIC_SystemReset actually does and why a build and run always gives an error forcing me to press the reset button on the DK to function,

I found this text in the documentation:

In order to use this module, the following code has to be added to a .c file:

Definitions and declarations starting with __ (double underscore) in this header file are not intended for direct use by the application.

I had not done this, so I added it as a global in my 'main' file to see if NVIC_SystemReset() would behave in an expected manner and if that would fix the build and load issue I have on the nRF523840 DK. Well, after adding that line of code the build simply fails. No reason, no indication that this line of code caused it. The only reason I knew that it was the reason is because the code built before adding that one line of code.

So now I have another question. How is it that the documentation states that I MUST add this line to use NVIC calls through SoftDevice yet adding it causes the build to fail? Without that line the code mostly works, especially in debug mode. I did not catch this requirement earlier because it is not noted in the functions, but in a different place.

Is the documentation wrong? Perhaps misleading and that line is only needed for SOME of the NVIC SotfDevce calls? I am very confused. Something is not working right with respect to loading new code, and doing an NVIC_SystemReset when the module finishes (after a BTLE disconnect). The idea is that the NVIC_SystemReset should bring the module back to the program start as if the board just powered up.

Just did a global search for the implementation in some example in the SDK and there was none. The comment was found in several nrf_nvic.h files. This gets more confusing by the hour. Am I running down a rathole?

Related