Showing results for 
Search instead for 
Did you mean: 

HAL + FreeRTOS + FatFS Bug

Dirk Vermaak
Associate II


We have come across a bug in the code generated if you use FreeRTOS in STATIC memory mode (rather than the default dynamic mode) , with FatFs. (All generated from the CubeMX).

When we run the code we get two CONFIG ASSERTS in the RTOS and it is due to the fact that the FatFS code is calling xQueueCreateStatic and xBinarySemaphoreCreateStatic, but because it isn't aware that the RTOS is in static configuration, it doesn't allocate any memory for the queue or semaphore.

It's as simple as that. The fix we have is to simply override the creation of the queue and the semaphore with the correct static calls, with pre-allocated memory.


Same problem still observed with STM32CubeIDE 1.13.2 on STM32L4R5, CMSIS V1, FreeRTOS 10.3.1.