FreeRTOS Preemptive Kernel
This post presents the sixth and the last phase of porting FreeRTOS for AEMB processor.
In the previous post, both interrupt and interrupt handling were implemented to serve the mechanism of the preemptive kernel. Although, things seemed fine and set, yet the kernel failed to work when FreeRTOS tasks were created.
This problem by far was one of the most complex problems that I faced during my progress in the project. It was hard to tell what was going wrong!!
Upon doing program debugging by using the combination of both GTKWave and printf, I managed to crack the issue. Apparently, it was an early enabling for the processor global interrupt which blocked the scheduler from kicking the first task. Therefore, enabling the interrupt in the proper place solved the problem and as a result I managed to demonstrate Preemptive Multitasking.
The following figure shows the preemptive multitasking when all the created tasks share the same priority.
If a task has a higher priority than others it will be chosen by the scheduler to use the processor resources. Priority of a task can be set before running the program or during the execution of the task itself.
This post concludes the project of porting FreeRTOS for AEMB processor. If you have any questions/inquiries, don’t hesitate to drop me a comment.
Be well and all the best!