Microc-os-iii-the-real-time-kernel User Manual.pdf
For novel ideas about building embedded systems (both hardware and firmware), join the 35,000 engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype and no vendor PR. Click here to subscribe.
|
Aug 19, 2005.:Digital Book Store. Quality ebooks for sale via email/CD†/DVD†† Topics are ranged from-Economics-Electronics-Engineering-Medical-Mathematics, etc. Khamis Mushayt, Saudi Arabia. Nzerekore, Guinea. Ha Noi, Viet Nam. How to Become an Embedded Systems Geek - Free download as PDF File (.pdf), Text File (.txt) or read online for free. Embedded systems and become an embedded system geek. ΜC/OS-II, The Real-Time Kernel - Welcome to ESCA. Posted on 22-Nov-2017. 2 Introduction This document describes all the features and services added to µC/OS-II since the introduction of the hard cover book MicroC/OS-II, The Real-Time. User’s Manual Weston, FL 33326. Micriμm Press 1290 Weston Road, Suite 306 Weston, FL 33326 USA www.micrium.com Designations used by companies to distinguish their products are often claimed as trademarks. In all instances where Micriμm Press is aware of a trademark claim, the product name appears in.
Want to become an embedded developer? Salaries are good, and the work is a ton of fun. Here's how.
- Version 17 - Apr 2018 - Added more about the ARM Cortex-M series
- Version 16 - Sep 2017 - Added reference to Embedded Systems Fundamentals book
- Version 15 - May 2017 - Added college resources near the beginning of this article.
- Version 14 - May, 2016 - Added Imagecraft's book and Jumpstart API
- Version 13 - April, 2015 - Added links to Embedded Muse discussion about hiring newbies.
- Version 12 - June, 2014 - Added information about Miro Samek's video class. Also, numerous small changes.
- Version 11 - February 2014 - Added U Texas on-line class.
- Version 10 - November, 2013 - Updated links, added Digilent.
- Version 9 - August, 2013 - Removed Freescale dual-CPU board. Added Frescale FRDM-KL25Z mbed board.
- Version 8 - Jan, 2013 - Added mbed info
- Version 7 - Dec, 2012 - Removed broken links
- Version 6 - Feb, 2007 - Added info on Freescale kit
- Version 5 - Oct, 2006 - Added info about new Edition of Programming Embedded Systems
- Version 4 - Feb, 2006 - Added info about Zilog's Z8 board and project ideas link
- Version 3 - Oct, 2005 - Added info on Computer Science Lab
- Version 2 - Dec, 2004 - Added many links to resources
- Version 1 - Initial release
Disclaimer: I love this field. It's a ton of fun. But jobs can be hard to find. Don't take the following as advice to toss your current career to the four winds and jump into the embedded industry unless you do such from love, for unhappily, long periods of unemployment are far from unknown in this industry.
Related content includes the results of the 2014 Embedded Salary Survey, thoughts on crafting a great resume here, and Reviews of Embedded Books.
Update: This issue of The Embedded Muse has an article where readers offer ideas to new graduates on how to get a job in this field.
Update: Here are some resources:
- Online Degree Programs in Engineering: http://www.affordablecollegesonline.org/degrees/engineering-programs/
I'm writing this while at anchor in Bermuda. There's no net access aboard, so once or twice a week I head for an Internet cafe ashore and dig through the email avalanche. For some reason lately I've been drowning in emails from embedded system wannabees. 'Dear Jack: I lately learned Visual C++ and now want to start a career in firmware. But no one wants to hire me as I have no experience. What do I do? How to I learn about firmware?'
Perhaps my experience was atypical. I helped midwife the embedded business, learning while building products using the very first microprocessors. Like mastering the mysteries of the birds and the bees, I ran experiments, checked the results, talked to friends, and iterated till achieving some level of mastery.
Times are different now. Then, we were all amateurs. Today expectations are higher, competition for available positions brutal. Lately the staggering economy spawns few new job opportunities; those that surface are more often taken by experienced engineers than newbies.
Too many of my email correspondents are looking for shortcuts. 'How do I convince a potential boss to hire me?' 'What book can I read to teach me firmware?' Sorry - there's no easy path, no way to pass Go and collect $200. Though the bookstores have plenty of titles like 'Learn to Program in 21 days,' don't expect to see an equivalent book for embedded systems.
Perhaps there is one easy way: get an EE degree. All other approaches will be harder. The degree gives you instant credibility in the marketplace, and today few companies want to hire non-degreed engineers.
I wonder if this search for shortcuts is a quintessentially American characteristic. We're so anxious to do things today! As a parent I'm constantly astonished to find how kids need to go through so many experiences themselves. They can't learn from my hard-won insights. There's something intrinsic to humans about learning by doing.
Maybe you're a master of C++, a whiz at programming in Windows and the wealth of tools we expect of any desktop computer. That's a fantastic, valuable skill. It does not translate to an 'in' into this field. C or C++ are base level skills for any firmware developer, but are merely a subset of the required expertise.
For there's a huge gulf between the resource-rich environment of a desktop machine and a typical embedded system. It's tough to generalize about firmware, because some projects run on 4 bit micros in 100 words of code, while others boot complete Windows or Linux operating systems. But I believe there are some skills shared by all of the best firmware developers.
For novel ideas about building embedded systems (both hardware and firmware), join the 35,000 engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype and no vendor PR. Click here to subscribe.
|
First is the ability to work with limited resources. ROM and RAM may be very costly in high volume or low power products. Where on a desktop heaps and stacks are seemingly infinite, we firmware folks sometimes trim each to a razor's edge, too often with catastrophic results. The Windows developer knows how to speed transcendental math using lookup tables, but his embedded counterpart looks askance at the sometimes staggering memory requirements. We use C subsets on minimal processors, where sometimes the pseudo-C is just a cut above assembly. Processors with poor stack architectures invariably spawn compilers that play complex games with automatic variables, games that can and will bite back when used by the unwary developer.
It's not uncommon for time to be in short supply as well. There are limits to how fast a small processor can move data around; Moore's Law does not bring the embedded developer a faster CPU every few months. When the system is performance-bound, embedded engineers re-design code, tune routines, and even at times change the hardware design.
So the accomplished firmware developer is a master of cramming more into less: more features into less memory, more performance into fewer CPU cycles. Assembly language always lurks, if only to understand what the compiler generates.
Embedded systems interact in complex and strange ways with the system's peripherals. We're not downloading drivers from some vendor's web site, or relying on a vast infrastructure of OS support. Design a simple data acquisition system and odds are you'll have to initiate A/D conversions, suck in data, and scale and normalize it. Working with a serial channel expect to write your own circular queue handlers.
We firmware folks are responsible for even the most basic of all functions. On most processors we must set up chip select pseudo-peripherals to determine the location and extent of all memory devices, as well as the number of wait states required.
Peculiar devices challenge even the most experience of developers. Pulse width modulated outputs aren't uncommon yet defy many people's understanding. Log amp compression circuits scale inputs in confusing ways. Even the straightforward switch behaves very strangely, it's output bouncing for many milliseconds after it's depressed.
Beyond simple I/O, though, the realities of our systems means we must be masters of interrupts and DMA transfers. Data arrives from a plethora of asynchronous sources and must get routed out as needed. Embedded systems people are expected to be competent at writing ISRs, and must understand how to create reentrant code.
Many firmware applications multitask, generally employing some sort of a real time OS. None of these offer the depth of support common to desktop systems; though some of the commercial OSes give a very complete framework for embedded work, they all look remarkably austere compared to Unix or Windows. Even today many embedded apps don't and can't use an RTOS, but the well-rounded developer must be versed at multitasking.
Debugging is especially difficult in the embedded world. If you've been spoiled by Microsoft's debugger, expect culture shock when trying to peer into the workings of your firmware. In the best of cases there's darn little visibility into the workings of our code. Sometimes we're required to amend the hardware and software design just to make some sort of debugging possible - even be it so humble as wiggling pins and monitoring their states on an oscilloscope. If you can't debug, you can't make your stuff work, so plan to understand JTAG, scopes and logic analyzers.
Embedded apps are - or should be - much more reliable than their desktop counterparts. A Word or Excel crash doesn't compare in litigation possibilities to an avionics problem that kills hundreds. Less dramatic failures are just as serious. Having to stop every 20 miles to reboot your car controller is simply unacceptable. Few PC applications run for more than a few hours at a time, so memory leaks can often go undetected by the average user who turns the machine off each night. By contrast, an embedded product might have to run for years without cycling power.
To build reliable code we must understand and practice more extensive design than is common in other software projects. Failure Mode Analysis is required for some products. Extensive exception handling is a must. Code coverage tests are mandated for high-rel projects.
Become an expert C/C++ programmer. Gain competency at assembly language. Master all of the above. That gives you the basic skills needed for firmware development.
An embedded occupation can be lots of fun, personally satisfying, a creative outlet, and reasonably financially rewarding. A lot of folks see these desirable traits after embarking on other vocations and search for ways to make a mid-life change. For most of these people, various family responsibilities make going back to college for an EE or CE degree impossible. In this case you have to design your own curriculum and advance your own career strategy.
First, sign up for my free Embedded Muse newsletter. It comes out twice a month and is free. Many managers tell me they quiz prospective candidates about Muse content to see if they are really engaged with the field.
Uc/os-iii The Real-time Kernel Pdf
Get familiar with uniquely-embedded issues like debouncing contacts, instrumenting code, watchdog timers, properly using scopes, and approximations.
Read as much as you can. Here's a few suggestions.
Bebop to the Boolean Boogie, Clive Maxfield - A fun and interesting digital design book aimed at folks wanting to understand the hardware.
Today the ARM Cortex-M series of processors is the rage. I'd strongly recommend Embedded Systems Fundamentals with ARM Cortex-M based Microcontrollers, Alex Dean - An excellent introduction to the field. It covers both hardware and software issues. Very practical. And The Definitive Guide to the ARM Cortex-M3 by Joseph Yiu.
C Programming for Embedded Systems, Kirk Zurell - A good introduction to working with small systems like the 6805, 6508 and PIC.
Embedded Systems Building Blocks, Jean LaBrosse - a great into to writing peripheral handlers. It also includes his firmware standard, a wonderful model for writing code in a consistent manner.
An Embedded Software Primer, David Simon - This is the best introductory book available. Highly recommended.
Guidelines for the Use of the C Language in Vehicle Based Software, by MISRA - This is a list of dos and don't dos for writing reliable C code. Not a book per se, but a hundred page list of rules. All will make you think.
High Speed Digital Design, Howard Johnson and Martin Graham - The best book available about high-speed issues. The focus is entirely on hardware issues in fast systems. This is for hard-core EE types; expect to do some math.
MicroC/OS-III, The Real Time Kernel - Jean LaBrosse. The best book on real time operating systems. A must-read.
Reviews of these books, plus many others, are at http://www.ganssle.com/bkreviews.htm.
Broke? Download Freescale's introduction to microprocessors. It's a fabulous 300+ page book that gives basic insight into many aspects of working with microprocessors. It addresses the pretty-much-obsolete 6805, but all of the principles discussed are relevant.
Read embedded.com and eetimes.com regularly.
Read code, too, to see how experienced developers actually make things work. I especially recommend reading the source to ecos, an open-source RTOS. Or look at FreeRTOS.
Another resource is the free on-line class that the University of Texas has, which looks pretty great. More here.
If you're anxious to learn the elements of 8051 programming, basic C, and basic C++, check out John Koplin's Computer Science Lab (http://www.computersciencelab.com), a free CD for Windows that contains three separate courses that take the newbie from no real knowledge of programming to a working knowledge of assembly, C and C++.
The Lab comes with a 8051 simulation environment and IDE for assembly language. A hyperlinked lesson plan implemented in Microsoft Help files instructs the student in both the use of the simulator and in the nature of the 8051. A page or two of very basic electronics sets the stage, followed by a very high level tour of machine and assembly, addressing modes and hex. The detail is just enough to give a non-technical manager a sense of our world.
From there the course dive into the processor's architecture and a basic assembly language. Each lesson is short and revolves around an example program. Each introduces a few more instructions and programming concepts. Students use the simulator to run the supplied examples, and to extend these small programs.
Figure 1 shows the simulator's IDE. A user can step into, step over, set and remove breakpoints, right click to change a register or data item. It's quite conventional and reasonably complete.
The first program is a simple infinite loop. Then a counter, then another that computes factorials. In many cases the programs mirror those implemented with the RPN calculator, showing clearly the difference between building code in different languages.
But he quickly gets to fun, more engaging programs, such as one that uses PIO bits to 'draw' a moving train on the output window (bottom window of Figure 1). Fun is important to keep interest levels high, especially in attention-starved adolescents.
The course goes deep and doesn't neglect uniquely embedded issues like working with the 8051's internal peripherals. Simulated timers, UARTs and the like interact with the programs just as they would on a real chip. It even covers interrupts; the simulator provides periodic interrupts which the code can capture and process.
While the RPN calculator section ends with a nice summary, the 8051 segment does not. That's a shame. We learn best when you tell them what you're going to tell them, tell them, and then summarize what you just told them. Instead this part ends somewhat abruptly after describing the final interrupt program.
From there we leave the truly embedded world behind and move to another IDE, one running C/C++ under Windows. Though this IDE looks something like that offered by Microsoft's Visual Studio it's really a shell around GNU C++ compiler and GDB. The interface prettifies the raw GNU tools, but doesn't completely isolate you from the very powerful but maddeningly complex command set. Buttons control most common functions like single stepping, but for many other operations (like to view a variable) you must issue a GDB command in the scrolling text window.
John's approach to teaching C and C++ is much like that for 8051 assembly language. A series of graduated lessons with examples, all of which run on the IDE, takes the student from no C/C++ knowledge at all to that of an apprentice programmer. Mastery will take more practice, more trial programs, and a bit more depth than provided. But you will be writing real, useful programs by the end of the course.
John writes conversationally and engagingly. He doesn't resist the chance to editorialize, bashing Microsoft, Sun, Apple, Java slightly to the course's detriment. He detests iostreams, operator overloading, and exceptions. Don't expect to learn about these concepts. You won't deal with RTOSes, reentrancy, and other advanced concepts, but will master a lot using examples that are much more appealing to engineers than the contrived ones always found in C/C++ books.
Book knowledge is crucial but complement it with practical experience. Do projects. Build things. Make them work. Expect problems, but find solutions. Don't abandon a project because it's too hard or you're confused. Most real development efforts are plagued by what initially appears as insurmountable problems, that the boss demands we overcome.
Miro Samek has a free set of videos on YouTube which explain the basics (and more) of writing in C for the ARM Cortex-M series of parts. This is one of the more important microprocessor families around today. If you buy the suggested $12.95 board, you can use IAR's free IDE (Miro shows exactly how to obtain and configure it) and work in parallel with the lessons. Unlike other C classes, in this series you'll get exposed to both the C code and what the processor is really doing behind the scenes. That's critical info for any embedded developer. Highly recommended.
Remember your first crystal radio? Those were indeed the olden days so the only 'active' element was a galena crystal grazed by a wire whisker. The thrill of picking up an AM station in the earpiece is something I still remember. Today you can get a kit for this sort of radio for only $11 from http://www.elenco.com/. Fortunately galena is out and a diode is in, so the device performs a bit better and is much easier to use and construct. They also offer simple but cool $20-$35 robot kits, and a wealth of other projects. Definitely check out this site.
Digilent (http://www.digilentinc.com/) has a lot of training resources. Their Analog Discovery and Analog Parts Kit are a great way to learn about analog design. In the embedded world we're always interfacing to analog circuits.
Parallax, home of the ever-popular Basic Stamp, offers a variety of kits aimed squarely at the education market (www.parallax.com). Their Understanding Signals kit, for instance, includes a simple oscilloscope, a bag of parts, and an excellent manual guiding one through the mysteries of signals. You will need a Basic Stamp computer module to run all of the experiments. The entire manual is free at http://www.parallax.com/search?search_api_views_fulltext=understanding+signals.
The company's $169 Basic Stamp Discovery kit includes everything needed to learn about building simple embedded systems, with parts and instructions for some 40 projects. Yes, the language is Basic. But that's a lot more accessible to teens than assembly or C, especially since Basic is interpreted. There's no compile/link/download cycle to interfere with the fun of building and testing. Think Doom rather than chess.
Do check out their PING))) ultrasonic sensor - a $25 sonar module that ranges at distances up to 11 feet and requires only a single I/O pin. And there's the $30 Compass Module, a dual-axis unit that can be the start of a replacement for the standard-issue Boy Scout compass. I can think of a million projects based on these sensors and hope to find time to play with them in the future.
http://www.avrfreaks.net offers several hundred projects, all free, all on-line, ranging from the deadly dull innards of filesystems to robotics, MP3 players, telescope controllers and much more. This very deep site devoted entirely to the AVR line of processors also lists tools, free and otherwise. Read the 'Newbie's Guide to AVR Development' and pass the wisdom on to an interested kid.
Check out the inexpensive PIC and AVR boards at www.dontronics.com.
Want ideas for a project to build? Check out http://instruct1.cit.cornell.edu/courses/ee476/ideas/EE476.project.ideas.html.
For parts and supplies it's hard to beat Digikey (http://www.digikey.com), which has everything electronic, from resistors to complete development platforms. The mother of all sites for anything mechanical is McMaster-Carr (http://www.mcmaster.com/), whose service is astonishing (I get my orders the next day without paying for expedited shipments). They have everything. Need a bit of stainless angle iron? No problem. Fasteners? You'll find all sorts on-line. Tools, plastic, rubber, gears, handles - it's all there. The printed catalog, which isn't needed as the site is so good, runs over 4000 pages, so you get the idea of the extent of their products.
You'll be on the way to mastery when the programs become large, not from lousy implementations, but due to the demanding nature of the project. I figure that a 1000 line project will teach a lot, but by the time the code reaches 5-10,000 lines of code it starts to resemble a simple but real-world app.
mbed is an ARM-sponsored outfit that sells a couple of low-cost development boards based on ARM cores from NXP. One uses a Cortex-M3; the other an M0, and they cost $45 to $60 or so. As is common today these cores have gobs of I/O ranging from simple analog to USB and Ethernet (depending on the board).
Both are the size of a 40 pin DIP and have a DIP pinout, which makes it easy to use these on solderless breadboards. And they'll connect to the development host via a USB cable which also provides power.
But they won't sell you an IDE.
Instead, the compiler et al are web-hosted and access to the environment is free.
Unpack the board and connect it to your computer. The thing looks just like a USB flash drive; click on the file named MBED.HTM and it will take your browser to their site. You'll have to register, but this gives you your own sandbox for storing code. Go to the compiler window, cut and paste one of their many examples and press 'compile.' Save the binary to the mbed board pseudo-drive and hit the reset on the board.
That's it. Your program is now running on the Cortex CPU.
Figure on ten minutes, tops, to get your first program going. I have never experienced such an easy-to-use development environment.
Being web-hosted the tools don't care what sort of host computer you're using. PC, Linux, Mac, heck, I imagine they'd run fine on a VAX if it had a web browser.
The tools aren't toys; that web interface is connected to the full suite of ARM tools.
Debugging resources are just about non-existent. Don't count on trace or complex breakpoints. Your code can toggle the board's LEDs to provide some debugging feedback, or you can use printfs. Formatted output goes back up the USB link to a terminal window, and works surprisingly well.
Microc/os-iii The Real-time Kernel Pdf
I don't know about you, but I hate digging through the CPU's manual to figure out how to configure all of the peripheral's registers. Sure, some vendors have tools that will automatically generate the interface code, but that's never a painless process. On the mbed board all of that goes away. They have resources predefined to drive devices. So, to toggle a pin one might write:
That's it - the tools will do all of the work to properly multiplex and configure the pin.
All of the headaches of doing embedded work disappear. There's no obvious link process, no memory maps to puzzle out, and no I/O configuration. Interrupts are supported but you don't have to set up the vectors, NVIC, and all of that.
There's the old joke that one wants to avoid writing comments because if they can understand how the system works, they won't need you any more. Well, the mbed board's automation of all of the usual embedded problems almost makes me fear that they won't need us deeply embedded people any more.
This is a fantastic resource for kids and others who want to get acquainted with embedded programming. I plan to keep the board around for those times when I want to quickly play with a little embedded problem and don't want to relearn and struggle with a big, complex IDE.
mbed's web site is mbed.org. There you'll also find a ton of code, all ready to go.
August, 2013 update: mbed now supports Freescale's FRDM-KL25Z board. Get it! $12.95 from Digikey. Couple that to mbed's web-based compiler and you get quite a bit of capability for little money.
Imagecraft has a new (as of May 2016) learning tool that I recommend. For $99 you get a Cortex-M development board, a complete toolchain, and the excellent eBook C for Everyone.
While I like mbed's offering, it really isn't suited for professional work as the debug capabilities are almost nil, and the web-hosted environment, while great for small projects, just doesn't scale.
Imagecraft's product has the same sort of ultra-simple access to Cortex-M peripherals as does mbed while also offering a conventional IDE. And the book is a great intro to C for people wanting to get into firmware development.
Without an appropriate degree, expect to work for a time as an intern or apprentice. Your salary will drop till you can acquire and demonstrate your competence. I suspect few people can avoid this painful reality.
Don't be afraid to ask lots of questions. . . . and be determined to move ahead.
Don't be afraid to advertise your career dreams; let your current boss know you want to get into the embedded side of the business (if there is one). These days few companies are hiring, so it's easier to make a lateral move from within the organization.
This sounds like a huge amount of work, and it is. If it's too much, maybe you're not cut out for the embedded industry. I suspect that most great developers succeed because they love doing the work. Indeed, various salary surveys show that, for engineers, money is one of the least important motivating factors. Doing cool projects inevitably ranks first.
Is it fun all of the time? Of course not. We pay for the thrills by wading through mind-numbing technical articles and putting up with unenlightened bosses. But if you love technical challenges, fighting really tough problems that span the range from hardware to software to even the basic science of some devices, embedded is the field for you. Be tough, be determined, think long-term . . . and have fun.
Oh - and sign up for The Embedded Muse newsletter. Many engineering managers tell me they ask all job applicants if they read it. Those that don't face an uphill battle. Sign up here.