This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Faultmask, Caches and startup code (a writeup).

This is no question, just want to share experience:

In our RTOS we set FAULTMASK at the beginning to be sure no one interrupts the kernel startup phase. During this startup the user may setup the MPU and the variables are initialized.

Here is now the trap: If MPU_CTRL.HFNMIENA  is not set, then the default memory map is active which means areas in the internal RAM may end up in the cache where they reside even if the memory is later mapped non-cacheable.

As the Cortex-M manual states, the result is UNPREDICTABLE if later reads/writes end up in cache or memory. In our case (i.MXRT1064), any write ended up in the cache and the DMA did not see it.