AnsweredAssumed Answered

FreeRTOS: prvProcessExpiredTimer BUG

Question asked by Lukasz Przenioslo on Mar 29, 2018
Latest reply on Mar 29, 2018 by Lukasz Przenioslo

Hello there,

Firmware Package for Family STM32L4: 1.10.0


When using FreeRTOS timers, there is a bug in function prvProcessExpiredTimer (Middlewares/Third_Party/FreeRTOS/Source/timers.c, line 498). The last operation before returning from the function is calling the provided at initialization callback function:

    /* Call the timer callback. */
    pxTimer->pxCallbackFunction( ( TimerHandle_t ) pxTimer );

The arguments for the function is pxTimer, which is wrong, as the user has no way of extracting the address from pxTimer, since its type (Timer_t) is private... The only way to overcome this is to add a fixed address offset to hit the pvTimerID variable in the struct. This last line should look like this:


    /* Call the timer callback. */
    pxTimer->pxCallbackFunction( ( TimerHandle_t ) pxTimer->pvTimerID );

This way the callback function is really obtaining the value provided at init.

Could someone confirm please?