Chris O'Byrne - YAVRTOS |
|||||||||||
|
YAVRTOS
v1.7(2008-Mar-01)HistoryYAVRTOS was my Christmas 2007-2008 project. I decided to do it
What's in a name?YAVRTOS stands for Yet Another Atmel® AVR® Real-Time Operating SystemTerms and ConditionsYAVROTS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.YAVROTS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. Pre-requisitesI've developed this using the WinAVR™ compiler (http://winavr.sourceforge.net/), and the AVR® Studio debugger (available from http://www.atmel.com/). I've only tested it against an ATmega32 so far.StatusAt present, this project has not been rigorously tested. I've run many tests against the AVR® Studio debugger running an ATmega32, and everything seems to work. I've started to use it on another project, and I've met with success. This other project uses mailboxes (which in turn use semaphores) fairly extensively, and it also bit-bang receives serial data at 4800 baud on an 8MHz ATmega32.Apart from testing, there are some other things I want to do with this project
What all this means is that you should check back here often for updates, and you should check that YAVRTOS works as expected in your application. If you find a bug, please email me (my email address is at the bottom of the page). What is a real-time operating system?Processors are only actually only able to do one thing at a time, whereas we need them to do more than one thing at a time (e.g. update the display while checking for keypresses while reading the serial port). A real-time operating system (RTOS) provides facilities for achieving that.What is a task?A task does one of the things (e.g. update the display, check for keypresses, read the serial port) that the application needs done. The real-time operating system allows tasks to execute concurrently, while providing facilities for e.g. tasks to communicate with each other. See the task page for more information.What is a tick?The RTOS needs to be able to switch betwen tasks - they way it does this is by using a regular processor interrupt (e.g. one of the timer interrupts). Every such interrupt is called a "tick". These interrupts must be set up before the RTOS is started. See Interrupt Service Routines for more information.What is the task scheduler?The task scheduler (or "task switcher") is the central component of the RTOS. It is responsible for ensuring that the tasks are run according to the rules of priority. It runs every tick, and it also runs when anything happens that may change the list of runnable tasks (e.g. a mutex being released, or a semaphore changing value).When the task scheduler runs, it effectively generates a list of the highest-priority runnable tasks. If one of those tasks has just had control of the processor, it runs the next task in the list, otherwise it runs the first task in the list. What is the stack?The stack is the standard stack that the processor implements with its stack pointer. However, when more than one task can be executing at a time, the stack becomes more complicated. In particular, every task must have its own stack, and the size of this stack is specified when the task is created. And, each stack must be large enough to accommodate all the uses the task puts the stack to.As well as a stack for each task, there is another "system" stack - this stack is used by ISRs, and must also be large enough to accommodate the requirements of the ISRs. If it is possible for more than one ISR to be running concurrently, then the system stack must be large enough to accommodate the requirements of all the ISRs that could be running concurrently. What are the uses the stack is put to?The stack is used -
What happens if the stack isn't big enough?Memory corruption, and hence a probable spectacular (and untraceable) crash.Further reading |
||||||||||
YAVRTOS and YAVRTOS documentation Copyright © 2007-2008 Chris O'Byrne. Email - chris <at> obyrne <dot> com