Jeffrey has a write-up on implementing a simple scheduler for the MSP430. He uses the MSP430F5529(  128Kb Flash and 8Kb RAM ) Launchpad as a base to test his OS.

The scheduler currently supports 3 tasks, but can be expanded to handle more. The good thing about the design is that it can be migrated to other architectures with a few changes.

MSP430F series uses 20-bit address space. Some other MSP430 series has a 16-bit address. So if you want to migrate it to such architectures, make sure you make necessary – The extra 4bits in addition to the 16bits are stored along with status register(SR) which needs to be corrected.

You can find his code base on github. The video below shows three tasks – first task for blinking the red LED at a particular rate, the second for blinking the green LED at a particular rate and last one for reading both the buttons. When you press the button, you could toggle the blinking of both the LED’s.

He would still like to make a few improvements to the code:

1) Try to send data via serial port in a task
2) Find a way to compute the stack consumed by each task and send this value via serial port
3) The scheduler is premptive. Try implementing a co-operative scheduler.
4) In cooperative scheduler, also add a feature to find the free time left in a process.

This is a good way to start learning basic scheduler/os fundamentals. Code, test and experiment it yourself. We are looking forward to future blog posts from Jeffrey

Via Dangerous Prototypes