Quick Noobie Question Concerning OS

jacwit wrote on Wednesday, February 29, 2012:

Hi Folks-

I am trying to get my unsupported port working on an HCS12XA256 processor. I have narrowed down my problem to the context switch. My system tick is working etc. But there is an issue in the context switch that I am working on. My question is not about the prorting problem rather in using the OS itself.

I have created two real simple tasks where each flashes a separate LED. I have disabled pre-emption (configUSE_PREEMPTION=0). My objective is to see if, for each task, I can run the task to completion then perfrom a context switch using the portYIELD() macro. Each task is running the the required for(;:wink: {} loop. There are three tasks running. The idle task plus the two LED tasks.

Since I dont have a working OS to test this out on at the moment, is my approach acceptable? In essence, I’m trying to emulate a simple round robin shecheduler. Both tasks are at the same priority, but higher than the idle task.

rtel wrote on Wednesday, February 29, 2012:

A port has to switch context form an interrupt and also from a task (when it yields, blocks, or unblocks another task).  Your test is a good starting point in getting the context switch working from the task.  Once that is working you can do the same from the interrupt.

In your test, if there is no preemption, both tasks have the same priority, and the priority is above the idle task then………the first task should run until it calls taskYIELD, then the next task should run until it calls taskYIELD, then the first task should run again, and so on back and forth between the tasks.  The idle task should never run.


jacwit wrote on Thursday, March 01, 2012:

Thanks for the clarification.

This is quite an impressive piece of work and I really hope to get it working on my processor. I will purchase the documentation once I have the basic port going. I know where my problem is now and working on the fix.