Preface

Twenty-three years ago (1992), I wrote my first book called µC/OS, The Real-Time Kernel.  Towards the end of 1998, it was replaced by MicroC/OS-II, The Real-Time Kernel.  The word Micro now replaces the Greek letter µ on the book cover because bookstores didn’t know how to properly file µC/OS.  However, for all intents and purposes, MicroC/OS and µC/OS are synonymous and in this book, I will mostly use µC/OS-II.   

Meets the requirements of Safety Critical Systems

In July of 2000, MicroC/OS-II was certified in an avionics product by the Federal Aviation Administration (i.e. the FAA) for use in commercial aircraft by meeting the demanding requirements of the RTCA DO-178B standard for software used in avionics equipment.  In order to meet the requirements of this standard it must be possible to demonstrate through documentation and testing that the software is both robust and safe.  This is particularly important for an operating system as it demonstrates that it has the proven quality to be usable in any application.  Every feature, function and line of code of MicroC/OS-II has been examined and tested to demonstrate that it is safe and robust enough to be used in Safety Critical Systems where human life is on the line.

µC/OS-II Goals

My most important goal is to demystify real-time kernel internals.  By understanding how a kernel works, you are in a better position to determine whether you need a kernel for your own products.  Most of the concepts presented in this book are applicable to a large number of commercial kernels.  My next most important goal is to provide you with a quality product that you can potentially use in your own products.  µC/OS-II is not freeware nor is it open source code.  If you use µC/OS-II in a commercial product, you need to license its use (see Appendix B, Licensing Policy for µC/OS-II).

Intended Audience

This book is intended for embedded system programmers, consultants, and students interested in real-time operating systems.  µC/OS-II is a high performance, deterministic real-time kernel and can be (and has been) used in commercial embedded products (see Appendix B, Licensing Policy for µC/OS-II). 

Instead of writing your own kernel, you should consider µC/OS-II.  You will find, as I did, that writing a kernel is not as easy as it first looks.

I’m assuming that you know C and have a minimum knowledge of assembly language.  You should also understand microprocessor architectures.

What You Need to Use µC/OS-II

The code supplied with this book assumes that you will be using an IBM-PC/AT or compatible (80386 Minimum) computer running under DOS 4.x or higher.  The code was compiled with the Borland C++ V4.51.  You should have about 10 MBytes of free disk space on your hard drive.  I actually compiled and executed the sample code provided in this book on a 300 MHz Pentium II computer running Microsoft’s Windows 2000.  I have successfully compiled and ran the code on Windows 95, 98 and NT based machines.

To use µC/OS-II on a different target processor (other than a PC), you will need to either port µC/OS-II to that processor yourself or, obtain such a port from official µC/OS-II WEB site at http://www.micrium.com.  You will also need appropriate software development tools such as an ANSI C compiler, an assembler, linker/locator and some way of debugging your application.

The µC/OS Story

Many years ago, I designed a product based on an Intel 80C188 at Dynalco Controls, and I needed a real-time kernel. I had been using a well-known kernel (I’ll call it kernel A) in my work for a previous employer, but it was too expensive for the application I was designing. I found a lower cost kernel ($1,000 at the time), I’ll call it kernel B, and started the design. I spent about two months trying to get a couple of very simple tasks to run. I was calling the vendor almost on a daily basis for help to make it work. The vendor claimed that kernel B was written in C (the language); however, I had to initialize every single object using assembly language code. Although the vendor was very patient, I decided that I had enough. The product was falling behind schedule, and I really didn’t want to spend my time debugging this low-cost kernel. It turns out that I was one of the vendor’s first customers, and the kernel really was not fully tested and debugged.

To get back on track, I decided to go back and use kernel A. The cost was about $5,000 for five development seats, and I had to pay a per-usage fee of about $200 for each unit that was shipped. This was a lot of money at the time, but it bought some peace of mind. I got the kernel up and running in about two days. Three months into the project, one of my engineers discovered what looked like a bug in the kernel. I sent the code to the vendor, and sure enough, the bug was confirmed as being in the kernel. The vendor provided a 90-day warranty, but that had expired, so in order to get support, I had to pay an additional $500 per year for maintenance. I argued with the salesperson for a few months that they should fix the bug since I was actually doing them a favor. They wouldn’t budge. Finally, I gave in and bought the maintenance contract, and the vendor fixed the bug six months later. Yes, six months later! I was furious and, most importantly, late delivering the product. In all, it took close to a year to get the product to work reliably with kernel A. I must admit, however, that I have had no problems with it since.

As this was going on, I naively thought that it couldn’t be that difficult to write a kernel. All it needs to do is save and restore processor registers. That’s when I decided to try to write my own kernel (part-time, nights and weekends). It took me about a year to get the kernel to work as well, and in some ways better, than kernel A. I didn’t want to start a company and sell it because there were already about 50 kernels out there, so why have another one?

Then I thought of writing a paper for a magazine. First I went to C User’s Journal (CUJ) because the kernel was written in C. I had heard CUJ was offering $100 per published page when other magazines were only paying $75 per page. My paper had 70 or so pages, so that would be nice compensation for all the time I spent working on my kernel. Unfortunately, the article was rejected for two reasons. First, the article was too long, and the magazine didn’t want to publish a series. Second, they didn’t want “another kernel article.”

I decided to turn to Embedded Systems Programming (ESP) magazine because my kernel was designed for embedded systems. I contacted the editor of ESP (Mr. Tyler Sperry) and told him that I had a kernel I wanted to publish in his magazine. I got the same response from Tyler that I did from CUJ: “Not another kernel article?” I told him that this kernel was different — it was preemptive, it was comparable to many commercial kernels, and the source code could be posted on the ESP BBS (Bulletin Board Service). I was calling Tyler two or three times a week, basically begging him to publish my article. He finally gave in, probably because he was tired of my calls. My article was edited down from 70 pages to about 30 pages and was published in two consecutive months (May and June 1992). The article was probably the most popular article in 1992. ESP had over 500 downloads of the code from the BBS in the first month. Tyler may have feared for his life because kernel vendors were upset that he published a kernel in his magazine. I guess that these vendors must have recognized the quality and capabilities of µC/OS (called µCOS then). The article was really the first that exposed the internal workings of a real-time kernel, so some of the secrets were out.

About the time the article came out in ESP, I got a call from Dr. Bernard (Berney) Williams at CMP Books, CMP Media, Inc. (publisher of CUJ) six months after the initial contact with CUJ. He had left a message with my wife and told her that he was interested in the article. I called him back and said, “Don’t you think you are a little bit late with this? The article is being published in ESP.” Berney said, “No, No, you don’t understand. Because the article is so long, I want to make a book out of it.” Initially, Berney simply wanted to publish what I had (as is), so the book would only have 80 pages or so. I told him that if I was going to write a book, I wanted to do it right. I then spent about six months adding content to what is now known as the first edition. In all, the book published at about 250 pages. I changed the name from µCOS to µC/OS because ESP readers had been calling it “mucus,” which didn’t sound too healthy. Come to think of it, maybe it was a kernel vendor that first came up with the name. Anyway, µC/OS, The Real-Time Kernel was born. Sales were somewhat slow to start. Berney and I had projected about 4,000 to 5,000 copies would be sold in the life of the book, but at the rate it was selling, I thought we’d be lucky if it sold 2,000 copies. Berney insisted that these things take time to get known, so he continued advertising in CUJ for about a year.

A month or so before the book came out, I went to my first Embedded Systems Conference (ESC) in Santa Clara, California (September 1992). I met Tyler Sperry for the first time, and I showed him a copy of the first draft of my book. He very quickly glanced at it and asked if I would like to speak at the next Embedded Systems Conference in Atlanta. Not knowing any better, I said I would and asked him what I should talk about. He suggested “Using Small Real-Time Kernels.” On the trip back from California, I was thinking, “What did I get myself into? I’ve never spoken in front of a bunch of people before. What if I make a fool of myself? What if what I speak about is common knowledge? People pay good money to attend this conference.” For the next six months, I prepared my lecture. At the conference, I had more than 70 attendees. In the first twenty minutes, I must have lost one pound of sweat. After my lecture, about 15 people or so came up to me to say that they were very pleased with the lecture and liked my book. I was invited back to the conference but could not attend the one in Santa Clara that year (1993) since my wife was due to have our second child, Sabrina. I was able to attend the next conference in Boston (1994), and I have been a regular speaker at ESC ever since. For the past couple of years, I’ve been on the conference Advisory Committee. I now do at least three lectures at every conference and each has attendance between 100 and 300 people. My lectures are almost always ranked among the top 10% at the conference.

To date, well over 25,000 copies of my µC/OS and µC/OS-II books have been sold around the world. I have received and answered thousands of e-mails from over 44 countries. I still try to answer every single one. I believe that if you take the time to write me, I owe you a response. In 1995, µC/OS, The Real-Time Kernel was translated into Japanese and published in Japan in a magazine called Interface. In 2001, µC/OS-II was translated to Chinese.  A Korean translation came out in early 2002.  A Japanese translation is in the works and should be available in 2002. 

µC/OS and µC/OS-II have been ported to over 40 different processor architectures and the number of ports is increasing.  You should consult the Micrium website to see if the processor you intend to use is available.

Back in 1992, I never imagined that writing an article would change my life as it has. I met a lot of very interesting people and made a number of good friends in the process.

Thanks for choosing this book and I hope you enjoy it!

Jean J. Labrosse.

Acknowledgments

First and foremost, I would like to thank my wife for her support, encouragement, understanding, and especially patience. Once again, I underestimated the amount of work for this edition – it was supposed to take just a few weeks and be out by January 2002.  I would also like to thank my children James (age 11) and Sabrina (age 8) for putting up with the long hours I had to spend in front of the computer.

A very special thanks to Mr. Gino Vannelli (my favorite musician) for creating such wonderful music.  As far as I’m concerned, Gino redefines the word ‘perfection’. Thanks Gino for being with me (in music) for almost 40 years.

I would also like to thank all the fine people at CMP Books for their help in making this book a reality and for putting up with my insistence on having things done my way.

Finally, I would like to thank all the people who have purchased my µC/OS, µC/OS-II and Embedded Systems Building Blocks books over the years.

   

 

Related pages