Programming_Embedded_Systems_2ed_2007_Barr_Massa.pdf
(
3299 KB
)
Pobierz
Programming Embedded Systems Second Edition
Programming Embedded Systems,
Second Edition with C and GNU Development
Tools
Foreword
If you mention the word embedded to most people, they'll assume you're talking about reporters in a war
zone. Few dictionaries—including the canonical Oxford English Dictionary—link embedded to
computer systems. Yet embedded systems underlie nearly all of the electronic devices used today, from
cell phones to garage door openers to medical instruments. By now, it's nearly impossible to build
anything electronic without adding at least a small microprocessor and associated software.
Vendors produce some nine billion microprocessors every year. Perhaps 100 or 150 million of those go
into PCs. That's only about one percent of the units shipped. The other 99 percent go into embedded
systems; clearly, this stealth business represents the very fabric of our highly technological society.
And use of these technologies will only increase. Solutions to looming environmental problems will
surely rest on the smarter use of resources enabled by embedded systems. One only has to look at the
network of 32-bit processors in Toyota's hybrid Prius to get a glimpse of the future.
Page 1
Programming Embedded Systems Second Edition
Though prognostications are difficult, it is absolutely clear that consumers will continue to demand ever-
brainier products requiring more microprocessors and huge increases in the corresponding software.
Estimates suggest that the firmware content of most products doubles every 10 to 24 months. While the
demand for more code is increasing, our productivity rates creep up only slowly. So it's also clear that
the industry will need more embedded systems people in order to meet the demand.
What skills will these people need? In the PC world, one must be a competent C/C++ programmer. But
embedded developers must have a deep understanding of both the programming languages and the
hardware itself; no one can design, code, and test an interrupt service routine, for instance, without
knowing where the interrupts come from, how the hardware prioritizes them, the tricks behind servicing
that hardware, and machine-level details about saving and preserving the system's context. A firmware
developer must have detailed insight into the hardware implementation of his system's peripherals
before he can write a single line of driver code.
In the PC world, the magic of the hardware is hidden behind an extensive API. In an embedded system,
that API is always written by the engineers that are developing the product.
In this book, Michael Barr and Anthony Massa show how the software and hardware form a synergistic
gestalt. They don't shy away from the intricacies of interrupts and I/O, or priority inversion and mutexes.
The authors appropriately demonstrate building embedded systems using a variety of open source tools,
including the GNU compiler suite, which is a standard tool widely used in this industry. eCos and Linux,
both free/open source products, are used to demonstrate small and large operating systems.
The original version of this book used an x86 target board, which has been replaced in this edition by an
ARM-based product. Coincidently, as this volume was in production, Intel made an end-of-life
announcement for all of its embedded x86 processors. Readers can be assured that the ARM will be
around for a very long time, as it's supported by an enormous infrastructure of vendors.
The hardware is inexpensive and easily available; the software is free. Together they represent the
mainstream of embedded systems development. Readers can be sure they'll use these tools in the future.
Buy the development kit, read the book, and execute the examples. You'll get the hands-on experience
that employers demand: building and working with real embedded applications.
Preface
First figure out why you want the students to learn the subject and what you want them to know, and the
method will result more or less by common sense.
Richard Feynman
Embedded software is in almost every electronic device in use today. There is software hidden away
inside our watches, DVD players, mobile phones, antilock brakes, and even a few toasters. The military
uses embedded software to guide missiles, detect enemy aircraft, and pilot UAVs. Communication
Page 2
Programming Embedded Systems Second Edition
satellites, deep-space probes, and many medical instruments would've been nearly impossible to create
without it.
Someone has to write all that software, and there are tens of thousands of electrical engineers, computer
scientists, and other professionals who actually do. We are two of them, and we know from our personal
experiences just how hard it can be to learn the craft.
Each embedded system is unique, and the hardware is highly specialized to the application domain. As a
result, embedded systems programming can be a widely varying experience and can take years to
master. However, one common denominator across almost all embedded software development is the
use of the C programming language. This book will teach you how to use C in any embedded system.
Even if you already know how to write embedded software, you can still learn a lot from this book. In
addition to learning how to use C more effectively, you'll also benefit from the detailed explanations and
source code associated with common embedded software problems. Among the advanced topics covered
in the book are memory testing and verification, device driver design and implementation, real-time
operating system internals, and code optimization techniques.
Why We Wrote This Book
Each year, globally, approximately one new processor is manufactured per person. That's more than six
billion new processors each year, fewer than two percent of which are the Pentiums and PowerPCs at the
heart of new personal computers. You may wonder whether there are really that many computers
surrounding us. But we bet that within five minutes you can probably spot dozens of products in your
own home that contain processors: televisions, stereos, MP3 players, coffee makers, alarm clocks,
VCRs, DVD players, microwaves, dishwashers, remote controls, bread machines, digital watches, and
so on. And those are just the personal possessions—many more such devices are used at work. The fact
that every one of those products contains not only a processor, but also software, is the impetus for this
book.
One of the hardest things about this subject is knowing when to stop writing. Each embedded system is
unique, and we have therefore learned that there is an exception to every rule. Nevertheless, we have
tried to boil the subject down to its essence and present the things that programmers definitely need to
know about embedded systems.
Intended Audience
This is a book about programming embedded systems in C. As such, it assumes that the reader already
has some programming experience and is at least familiar with the syntax of the C language. It also
helps if you have some familiarity with basic data structures, such as linked lists. The book does not
assume that you have a great deal of knowledge about computer hardware, but it does expect that you
are willing to learn a little bit about hardware along the way. This is, after all, a part of the job of an
embedded programmer.
While writing this book, we had two types of readers in mind. The first reader is a beginner—much as
we were once. He has a background in computer science or engineering and a few years of programming
Page 3
Programming Embedded Systems Second Edition
experience. The beginner is interested in writing embedded software for a living but is not sure just how
to get started. After reading the first several chapters, he will be able to put his programming skills to
work developing simple embedded programs. The rest of the book will act as a reference for the more
advanced topics encountered in the coming months and years of his career.
The second reader is already an embedded systems programmer. She is familiar with embedded
hardware and knows how to write software for it but is looking for a reference book that explains key
topics. Perhaps the embedded systems programmer has experience only with assembly language
programming and is relatively new to C. In that case, the book will teach her how to use the C language
effectively in an embedded system, and the later chapters will provide advanced material on real-time
operating systems, peripherals, and code optimizations.
Whether you fall into one of these categories or not, we hope this book provides the information you are
looking for in a format that is friendly and easily accessible.
Organization
The book contains 14 chapters and 5 appendixes. The chapters can be divided quite nicely into two
parts. The first part consists of Chapters 1 through 5 and is intended mainly for newcomers to embedded
systems. These chapters should be read in their entirety and in the order that they appear. This will bring
you up to speed quickly and introduce you to the basics of embedded software development. After
completing
Chapter 5,
you will be ready to develop small pieces of embedded software on your own.
The second part of the book consists of Chapters 6 through 14 and discusses advanced topics that are of
interest to inexperienced and experienced embedded programmers alike. These chapters are mostly self-
contained and can be read in any order. In addition, Chapters 6 through 12 contain example programs
that might be useful to you on a future embedded software project.
Chapter 1, Introduction
Explains the field of embedded programming and lays out the parameters of the book, including
the reference hardware used for examples
Chapter 2, Getting to Know the Hardware
Shows how to explore the documentation for your hardware and represent the components you
need to interact with in C
Chapter 3, Your First Embedded Program
Page 4
Programming Embedded Systems Second Edition
Creates a simple blinking light application that illustrates basic principles of embedded
programming
Chapter 4, Compiling, Linking, and Locating
Goes over the ways that embedded systems differ from conventional computer systems during
program building steps, covering such issues as cross-compilers
Chapter 5, Downloading and Debugging
Introduces the tools you'll need in order to iron out problems in both hardware and software
Chapter 6, Memory
Describes the different types of memory that developers choose for embedded systems and the
issues involved in using each type
Chapter 7, Peripherals
Introduces the notion of a device driver, along with other coding techniques for working with
devices
Chapter 8, Interrupts
Covers this central area of working with peripherals
Chapter 9, Putting It All Together
Combines the concepts and code from the previous chapter with convenience functions and a
main program, to create a loadable, testable application
Chapter 10, Operating Systems
Page 5
Plik z chomika:
sdfg_ds
Inne pliki z tego folderu:
Memory_Systems_2008_Jacob.pdf
(23668 KB)
From_MATLAB_and_Simulink_to_Real-Time_with_TI_DSPs_2009_Fainguelernt.pdf
(18549 KB)
A_practical_introduction_to_real-time_systems_for_undergraduate_engineering.pdf
(17824 KB)
Make_Electronics_2009_Platt.pdf
(17519 KB)
Practical_AVR_Microcontrollers_2012_Trevennor.pdf
(17794 KB)
Inne foldery tego chomika:
Algorithms
Artificial Intelligence
C
Compilers
Concurrency
Zgłoś jeśli
naruszono regulamin