We have a strange problem with CORTEX M7 (STM32F765) running FreeRTOS version 7.3.0
Hard faults are getting triggered randomly at different places in software.
Most of the time It is the FreeRTOS code that is triggering the fault (observation from call stack)
No issue with interrupt priority settings and no stack overflow observed.
Listed below are some of the STM32f765 fault flags that are getting set when faults are triggered.
INVSTATE, PRECISERR, IMPRECISERR, BFARVALID, BFAR, UNALIGNED, INVALIDINSTRUCTION
Any pointers on what can trigger this kind of system behavior?
We created a Cortex-M4F port that covered the subset of the Cortex-M specification actually implemented by M4 devices.
Later the M7 was launched, at which time we updated the M4 port so it could also be used with the M7. That required additional memory barriers, etc.
r0p1 revision cores of the M7 contain an errata that required a specific FreeRTOS port that worked around the errata. So now if you use an r0p1 core you need to use this port, FreeRTOS-Kernel/portable/GCC/ARM_CM7/r0p1 at main · FreeRTOS/FreeRTOS-Kernel · GitHub otherwise you can use the Cortex-M4 port, but only ports since M7 support was added otherwise you are likely to get the symptoms you describe (missing memory barriers will create intermittent errors that will depend on clock speeds and whatever else the device is doing a the time).
We tried migrating to 10.2.0 version of FreeRTOS but the problem still persists.
Here is the Interrupt priority configuration that we are using. Is this fine?