swingboard wrote on Friday, May 24, 2019:
pendsv do the ‘context switch’ works, and it keep the lowest interrupt priority is easy to understand.
but why set systick with the lowest interrupt priority too, does the freertos want to improve the performance of other interrupts and freertos think other interrupt is more important than systick?
in freertos design, the systick handler it do two works:
1, do xTaskIncrementTick
2, Pend the PendSV interrupt
it invokes the pendsv and give results to pendsv_handler, so there is no much sense to give systick higher interrupt priority?
richarddamon wrote on Friday, May 24, 2019:
To me it seems natural that the tick interrupt will be low priority. There is nothing happening in it that needs priority over other interrupts, there is no danger of ‘losing data’ if it gets delayed by another interrupt, and the results of the interrupt only has impact on the system when all the current interrupts are done, the resumption of the now current task after the scheduler runs.
It also can take a bit of time to run, as it needs to check the list of tasks with pending delays to see which ones need to be handled.
The one case where one might want it higher would be of one is adding functionality to the interrupt, (perhaps through the tick hook), and if one does that, and decides that for that reason it needs to be of a higher priority, then the programmer can override FreeRTOS assignment of the lowest priority and give it something higher.