I love embedded systems. The first time a motor turned because I told it to, I was hooked. I quickly moved away from pure software and into a field where I can touch the world. Just as I was leaving software, the seminal work was done on design patterns.[] My team went through the book, discussing the patterns and where wed consider using them. As I got more into embedded systems, I found compilers that couldnt handle C++ inheritance, processors with absurdly small amounts of memory in which to implement the patterns, and a whole new set of problems where design patterns didnt seem applicable. But I never forgot the idea that there are patterns to the way we do engineering. By learning to recognize the patterns, we can use the robust solutions over and over. So much of this book looks at standard patterns and offers some new ones for embedded system development. Ive also filled in a number of chapters with other useful information not found in most books.
About This Book
After seeing embedded systems in medical devices, race cars, airplanes, childrens toys, and gunshot location systems, Ive found a lot of commonalities. There are a lot of things I wish I knew then on how to go about designing and implementing software for an embedded system. This book contains some of what Ive learned. It is a book about good software design in resource-constrained environments.
It is also a book about understanding what interviewers look for when you apply for an embedded systems job. Each section ends with an interview question. These are generally not language specific; instead, they attempt to divine how you think. Good interview questions dont have a single correct answer. Instead of trying to document all the paths, the notes after each question provide hints about what an interviewer might look for in your response. Youll have to get the job (and the answers) on your own merits.
One note, though: my embedded systems dont have operating systems. The software runs on the bare metal. When the software says turn that light on, it says it to the processor without an intermediary. This isnt a book about an embedded operating system (OS). But the concepts translate to processors running OSs, so if you stick around, you may learn about the undersides of OSs too. Working without one helps you really appreciate what an OS does.
This book describes the archetypes and principles that are commonly used in creating embedded system software. I dont cover any particular platform, processor, compiler, or language, because if you get a good foundation from this book, specifics can come later.
About the Author
In the field of embedded systems, I have worked on DNA scanners, inertial measurement units for airplanes and race cars, toys for preschoolers, a gunshot location system for catching criminals, and assorted medical and consumer devices.
I have specialized in signal processing, hardware integration, complex system design, and performance. Having been through FAA and FDA certification processes, I understand the importance of producing high-quality designs and how they lead to high-quality implementations.
Ive spent several years in management roles, but I enjoy hands-on engineering and the thrill of delivering excellent products. Im happy to say that leaving management has not decreased my opportunities to provide leadership and mentoring.
Acknowledgments
This book didnt happen in a vacuum. It started with a colleague who said, Hey, do you know a book I can give to one of my junior engineers? From that planted seed came months of writing; I learned to really appreciate understanding (and encouraging) friends. Then there were the engineers who gave their time to look at the technical material (any remaining issues are my fault, not theirs, of course). Finally, OReilly provided tremendous support through the whole process.
Thanking each person as they properly deserve would take pages and pages, so I will just go through them all in one breath, in no particular order: Phillip King, Ken Brown, Jerry Ryle, Matthew Hughes, Eric Angell, Scott Fitzgerald, John Catsoulis, Robert P. J. Day, Rebecca Demarest, and Jen Costillo. These folks made a difference in the flavor of this book. There are additional thank-yous spread throughout the book, where I got help from a particular person on a particular area, so you may see these names again (or a few different ones).
Two people are left out of that list. Andy Oram is an excellent editor at OReilly, and I was lucky to get him. Hes made a big difference to this book and to my writing. Finally, authors always give gushing thanks to their spouses; it is a clich. However, having written a book, I see why. Christopher White, my favorite drummer, physicist, and embedded systems engineer, thank you most of all. For everything.
[] Gamma, Erich, Richard Helm, Ralph Johnson, and John Vlissides, 1995. Design Patterns: Elements of Reusable Object-Oriented Software . Boston: Addison-Wesley.
Organization of This Book
I read nonfiction for amusement. I read a lot more fiction than nonfiction, but still, I like any good book. I wrote this book to be read almost as a story, from cover to cover. The information is technical (extremely so in spots), but the presentation is casual. You dont need to program along with it to get the material (though trying out the examples and applying the recommendations to your code will give you a deeper understanding).
This isnt intended to be a technical manual where you can skip into the middle and read only what you want. I mean, you can do that, but youll miss a lot of information with the search-and-destroy method. Youll also miss the jokes, which is what I really would feel bad about. I hope that you go through the book in order. Then, when you are hip-deep in alligators and need to implement a function fast, pick up the book, flip to the right chapter, and, like a wizard, whip up a command table or fixed point implementation of variance.
Or you can skip around, reading about solutions to your crisis of the week. I understand. Sometimes you just have to solve the problem. If that is the case, I hope you find the chapter interesting enough to come back when you are done fighting that fire.
The order of chapters is:
, Introduction
What is an embedded system? How is development different from traditional software ?