Jean J. Labrosse. CMP Books All trademarks and registered trademarks in this book are the property of their .. Obtaining the Current µC/OS-II Version. MicroC/OS II Describes the design and implementation of the MicroC/OS-II real- time operating system (RTOS). Wh Rate this book Jean J. Labrosse. are described in the book by Jean J. Labrosse entitled MicroC/OS-II, The Real- Time This book contains ALL the source code for µC/OS-II.
|Published (Last):||3 September 2018|
|PDF File Size:||2.53 Mb|
|ePub File Size:||17.40 Mb|
|Price:||Free* [*Free Regsitration Required]|
Jdan it has grown a whole community of embedded systems developers who have ported the RTOS to most major embedded environments. Second, I will do a short critique of the RTOS, looking at its best features and how it might be improved. The book serves two functions: An RTOS manages the processing time of a microcontroller or microprocessor by allowing the total work pending to be divided into logical units called tasks.
A task is like an independent program that has its own stack and register context; it is usually implemented as an infinite loop or a function that contains a system call to the kernel to de-schedule the task before the function returns.
A Real-Time Programmer’s Review of mC/OS-II
A multitasking program schedules multiple tasks by assigning each task a priority related to its importance and rapidly switches control of the bookk among them. The RTOS kernel arbitrates the task switching process and facilitates communication between tasks by managing mailboxes, queues, and semaphores. Semaphores allow tasks to share common system resources such as memory or peripherals, announce an event, or provide task synchronization.
In a preemptive operating system, a task is preempted when a system call or an interrupt service routine calls the scheduler and the scheduler finds a higher priority task is ready and uxos-ii to run.
The preempted task’s context is saved, and the preemptor task is swapped in by loading its context and giving it control of the CPU.
Since a preemptive kernel keeps track of which tasks are ready to run and have priority, and since no properly implemented task is immune to preemption, the task switch timing latencies for such an operating system are deterministic. A system running a preemptive RTOS can still fail to be “hard” real time if task starvation occurs i. He also provides useful code fragments that indicate how to write tasks and use the basic kernel services, which are handy when the project you’re working on is due yesterday.
Functions for managing a user-defined memory heap are also provided. The lowest priority task, which is always ready to run, is the idle task OSTaskIdleso it will execute when other tasks are not ready to run because they are waiting for an event such as a semaphore or mutex to become available, or a message to arrive at a mailbox, pipe, or queue. Here is an example of a typical main procedure and first task to run:.
This type of scheduler, where each task is mapped to a unique priority from a fixed pool of priority numbers, is called a bitmap scheduler.
The queue-based scheduler is often slower than the bitmap scheduler, but without the inconveniences of a fixed number of tasks and necessarily unique task priorities. If a task is ready to run, the bit corresponding to its priority number will be set in OSRdyTbl.
µC/OS-II Books | Micrium
To find the highest priority task ready to run, the scheduler simply has to find the ucoa-ii priority number with its corresponding bit set in OSRdyTbl. If the bit corresponds to a task of higher priority than the one that is currently running, the kernel does a context switch.
Although the task priorities can be changed at run time, only one task may have a given priority number at a time because the priority number doubles as the task’s handle or identifier. If you are using the book as a real-time textbook, keep in mind that not all RTOSs lqbrosse a bitmap scheduler, and, in fact, often opt for a multiple-priority queue-based scheduler to allow the user to create an arbitrary number of tasks or create blok tasks with the same priority.
Otherwise, the ISR will have to be written in assembler, which is a bit more difficult. Related to kernel timing are system functions that allow the user to delay a task for a specified number of ticks, resume a task, and get and set the time of day, but I won’t examine these functions here. Here is an example of a typical ISR:.
You can call the standard task creation function and pass pointers to the task function, arbitrary user data, top of task stack, and task priority. Or you can call the extended task ucos-ij function and pass extended user data and other options.
An interesting extended option is the “id” field, which could be used in future RTOS versions to decouple priority numbers from task handles.
Real-Time Kernel Books | Micrium
Speaking of extended options, either the pointer to the bottom of the task stack or the stack size option is unnecessary, since either one combined with the standard pointer to the top of the task stack yields the labdosse one. Simple task stack checking is implemented and returns approximate usage of the task ucks-ii.
Task deletion is simple and allows the user labrisse specify that shared resources owned by the task are released before the task can be de-scheduled. The user can also suspend and jdan tasks and examine the state of any active task control block. Mutexes are binary semaphores that are useful for solving priority inversion problems. Mutexes allow a low priority task that needs to use a shared resource to have its priority temporarily increased while it finishes using an important resource in order to minimize the amount of time that a higher priority task is upstaged while it is forced to wait for the common resource.
Also, by defining an event as common, a single event can signal multiple tasks. A semaphore is used to signal that an event has occurred or to block a task for a period of time possibly indefinitely while it waits for a resource or an event.
MicroC/OS-II: The Real Time Kernel
A mailbox has room for a pointer to a single message, and a queue is an array or list of mailboxes. Anyone who is going to be spending a lot of time working with the RTOS would probably benefit from owning the book because it is a great reference manual.
If you are looking for an exposition of real-time concepts, but not planning on running the RTOS, you may not get your money’s worth.
Instead borrow the book from a friend or library. The application notes on the Micrimm website are also quite useful. No license is required for educational use. Here is a small subset of the ported environments: For an exhaustive list, see the Micrimm website. I recently wrote a program to run, receive, transmit, and debug tasks with a few semaphores and mailboxes to test network messaging.
Areas for Future Improvement The user should probably be given the option to use a different scheduling algorithm e. The web-server daemon wanted to assign the same priority to spawned tasks corresponding to each HTTP connection. Implementing time-slicing is also difficult with a bitmap scheduler for the simple reason that you don’t have more than one task with the same priority to share CPU time, so the burden is on the user to proxy out the time-slicing code to a higher-level mechanism of their own design.
Allowing multiple tasks to have the same priority by adding a level of indirection implies a pretty fundamental redesign of the ready list and scheduling algorithms, and probably the adoption of a queue-based scheduler. A debug module like the kind available with many other RTOSs, where the user is prompted to issue commands to view status of resources and debug parameters, would be useful.
Or maybe even native support for gdb to facilitate local or remote debugging is conceivable. Particularly for embedded systems, the usability and availability of debugging tools can really have a noticeable effect on a project’s progress and overall development cost. If only one of my points could be acted upon, it would be more debug support.
Note  Gary Thomas. Dobb’s JournalJanuary His interests include operating systems, communication protocols, algorithms, and software testing strategies.