Follow-up from "Dynamically scale system clock based on load"
The following discussion from !481 (merged) should be addressed:
In this implementation, we have a kind of two-layer tickless idle implementation. First, the
portSUPPRESS_TICKS_AND_SLEEP()implementation from the FreeRTOS Cortex-M4 port switches the systick to a lower speed when entering tickless idle. Then we use its hooks (
configPRE_SLEEP_PROCESSING()) to implement our own tickless idle which kind of undoes the systick work from the FreeRTOS port.
Instead, from looking at https://www.freertos.org/low-power-tickless-rtos.html we can just drop the FreeRTOS port code entirely and implement
portSUPPRESS_TICKS_AND_SLEEP()directly. This reduces the amount of useless work done, allows us to theoretically sleep for as long as we want, and de-clutters the codepaths in our sleep routine.