Besides defining configASSERT you should also enable stack overflow checking for development/debugging.
Using assertions can help to catch a number of HardFaults with the possibility to trace back and identify the problem.
Having configASSERT
defined (in FreeRTOSConfig.h as documented) makes debugging a lot easier by stopping the debugger if the application hangs. If the hang is caused by an assertion, the application is halted in the forever loop usually the last part of the assertion code (as in example 2) and check the call stack for the cause of the assertion.
Except fatal application programming bugs the main reasons for application crashes are
- stack overflows (see above)
- wrong interrupt priorities for certain ports/MCUs e.g. with Cortex-M CPUs
STM32 (which one ?) comes with Cortex-M CPUs and the choosen interrupt priorities have to match configMAX_SYSCALL_INTERRUPT_PRIORITY
in your FreeRTOSConfig.h
See RTOS for ARM Cortex-M and mabe also this pretty good picture for details.