Why don't we correct the kernel tick count in tickless idle when eSleepStatus == eNoTasksWaitingTimeout

Hello,

I am looking at the tickless idle functionality that FreeRTOS provides: Low Power Support - FreeRTOS™.

I wonder why we don’t call vTaskStepTick() in the snippet below after we come out of sleep. We do it in the “else” case though.

if( eSleepStatus == eNoTasksWaitingTimeout )
        {
            /* It is not necessary to configure an interrupt to bring the
            microcontroller out of its low power state at a fixed time in the
            future. */
            prvSleep();
        }

In the example on that page, the code doesn’t set up any timer to track the time spent in sleep nor to limit that time for the eNoTasksWaitingTimeout case. Thus it wouldn’t know what value to pass vTaskStepTick(). And the end result is the system tick count is allowed to stall for as long as that sleep lasts.

Typically if the application allows unlimited sleep with no timeout, then it also doesn’t care if the system tick count loses that sleep time.

The eSleepStatus value of eNoTasksWaitingTimeout indicates that no task is present in the ready queue to be scheduled, hence this being an RTOS it makes more sense for the system to sleep till a task is moved from “Blocked” to “Ready” state.