RAM not getting written before reset on stm32f769n
I am working on a hard fault handler were I want to store some key values into ram before resetting. This data will then be further handled at next boot up.
My problem is that the data does not get written into RAM unless I step through the writing code with a debugger. I am using the NVIC_SystemReset for resetting which comes with the STM sdk and looks like below.
**
\brief System Reset
\details Initiates a system reset request to reset the MCU.
*/
__STATIC_INLINE void NVIC_SystemReset(void)
{
__DSB(); /* Ensure all outstanding memory accesses included
buffered write are completed before reset */
SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
SCB_AIRCR_SYSRESETREQ_Msk);
__DSB(); /* Ensure completion of memory access */
for(;;) /* wait until reset */
{
__NOP();
}
}According to the documentation the __DSB() macro should take care of ensuring that any pending memory writes are completed.
Since the data gets written when stepping through with the debugger I am ruling out optimizations issues.
The compiler used is gcc-arm-none-eabi-7-2017-q4-major and my target is the stm32f769ni.