Hi! I’m currently trying to port FreeRTOS to the Coldfire MCF5329, but I’m kind of stuck with the freertos "software" interrupt (for task switching) (the "YIELD interrupt". (On the Coldfire V2 Implementation its Interrupt Source 16 on intc0). Why this is done through interrupt and not through a trap? Question is: on my implementation on the Coldfire V3 i don’t have an unused interrupt 16 and the only unused interrupt in that area is not working (seems to be reserved (interrupt 29 on intc0)). Thx in advance!!
I believe the key thing is that there are several spots which can cause a task reschedule, and they all need to leave the stack in compatible states, these being the YIELD routine and an interrupt requesting a reschedule (either the timer interrupt, or another interrupt that has done something to unblock a task).
The interrupt is used as an easy method of supporting interrupt nesting. The interrupt can in effect be ‘pended’ and then execute when all the other higher priority interrupts have completed. This means any number of interrupts can nest and any number of the nested interrupts can ask for a context switch, but only one will occur. As richard_damon says, it also allows the same method to be used from interrupts as from tasks. Traps are synchronous, so cannot be used in that way. Any interrupt that can be requested from software, and can have its priority set (in accordance with configKERNEL_INTERRUPT_PRIORITY) can be used. Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.