Dear NXPs
S32K-RM.pdf
37.5.8.4 Allowed simultaneous flash operations
Based on the figure above, there is a **race condition** between CSEc and P-Flash read operations (as indicated by the red box).
Therefore, when calling `CSEC_DRV_VerifyMAC` from P-Flash, should the following workarounds be applied?
1. **Disable interrupts** before invoking `CSEC_DRV_VerifyMAC`, and **re-enable interrupts** after the function returns.
2. **Relocate `CSEC_DRV_VerifyMAC` to RAM** for execution (i.e., run the function from RAM rather than P-Flash).
Something similar was already discussed here:
It is sufficient to disable interrupts because CSEc driver in SDK already executes critical part of the code from RAM.
And there's one more thing - there's a difference between CSEC_DRV_VerifyMAC and CSEC_DRV_VerifyMACAddrMode (and CSEC_DRV_GenerateMAC and CSEC_DRV_GenerateMACAddrMode).
Only the pointer method (that's terminology from S32K1 reference manual. SDK API uses "addr mode") does not allow program flash access during the execution. Normal non-pointer method does not have such limitation.
Regards,
Lukas