I ran into a lockup issue after FAULTMASK is set by cpsid f. The software is running in SDRAM, and MPU is enabled, so instruction can be executed from SDRAM. At last, I found the lockup issue is gone if HFNMIENA bit is set. But I don't fully understand why from the STM32F7 Series Cortex®-M7 processor programming manual(PM0253):
HFNMIENA bit description:
Enables the operation of MPU during hard fault, NMI, and FAULTMASK
When the MPU is enabled:
0: MPU is disabled during hard fault, NMI, and FAULTMASK handlers,
regardless of the value of the ENABLE bit.
1: The MPU is enabled during hard fault, NMI, and FAULTMASK handlers.
When the MPU is disabled, if this bit is set to 1 the behavior is
Unless HFNMIENA is set to 1, the MPU is not enabled when the processor is executing the handler for an exception with priority –1 or –2. These priorities are only possible when handling a hard fault or NMI exception, or when FAULTMASK is enabled. Setting the HFNMIENA bit to 1 enables the MPU when operating with these two priorities.
From the description, does that mean FAULTMASK is set will cause MPU is disabled if HFNMIENA bit is cleared?