Greetings,,
what happens if FAULTMASK is set in cortex-m3/m4 and one or more serious fault happened like bus fault, MPU violation, invalid instruction, stack corruption.. etc will the processor enter a lockup? if not what would be the status of the processor? what will happen to the currently executed program/code.. since HardFault handler is not executed to remedy the issue.. if you can elaborate and give as much explanation and details as possible and if you can share some cases and examples it would be very appreciated..
Thank you..
Hi ghaflims, Yasuhiko-san,
FAULTMASK can be set by any privileged software (including privileged thread mode).
However, a software need to handle FAULTMASK carefully as this block the HardFault handling.
So if things go wrong, it could end up with LOCKUP:
- Invalid instruction -> LOCKUP
- MPU violation -> depends on MPU setting
- Bus error -> depends on fault type and setting
- Stack corruption -> depends on what end up happening. It might end up with branching to invalida address, or so many different possibilities.
Software developers using FAULTMASK in their fault handler need to understand the risk they are taking.
In practice, many of the error handling operations can be done without setting FAULTMASK. For example, the error reporting code can run without setting FAULTMASK.
regards,
Joseph