Cortex M7 Triggering Hard fault randomly at different places

Hello,

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?

Thanks,
Shinoy

I don’t think V7.3.0 supports the M7.

History:

  • 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).

History file indicates M7 support was added in V8.2.1, which was when the first production chip was available FreeRTOS-Kernel/History.txt at main · FreeRTOS/FreeRTOS-Kernel · GitHub

Thanks Richard Barry.

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?

Interrupts are assigned priority from 11 to 15

configKERNEL_INTERRUPT_PRIORITY 255
configMAX_SYSCALL_INTERRUPT_PRIORITY 175 // 0xAF

SysTick_IRQn 15
OTG_FS_IRQn 11
ETH_IRQn 13
EXTI0_IRQn 13
EXTI1_IRQn 13
EXTI4_IRQn 13
EXTI9_5_IRQn 13
USART1_IRQn 13
USART2_IRQn 13
USART3_IRQn 13
UART5_IRQn 13
UART4_IRQn 13
UART7_IRQn 13

Thanks
Shinoy