是否有興趣開發嵌入式繫統?這些繫統無法容忍低下的效率,它們需要遵循嚴格的方式進行編程。《嵌入式繫統開發(影印版)》這本易於閱讀的指南通過經典的軟件設計模式和嵌入式編程的全新模式來幫助你培養許多良好的開發習慣。你會學習到如何為處理器而不是操作繫統來搭建繫統架構,並且了解到處理硬件問題和制造工藝所需的特殊技術。
這本書的作者創建過各種各樣的嵌入式繫統,從城市監控和DNA掃描儀到兒童玩具。本書適合於中等和有經驗的編程人員,無論你使用的是什麼平臺。本書由懷特(White, E.)著。
●Preface
1. Introduction
Compilers, Languages, and Object-Oriented Programming
Embedded System Development
Debugging
More Challenges
Principles to Confront Those Challenges
Further Reading
2. Creating a System Architecture
Creating System Diagrams
The Block Diagram
Hierarchy of Control
Layered View
From Diagram to Architecture
Encapsulate Modules
Delegation of Tasks
Driver Interface: Open, Close, Read, Write, IOCTL
Adapter Pattern
Getting Started with Other Interfaces
Example: A Logging Interface
A Sandbox to Play In
Further Reading
3. Getting Your Hands on the Hardware
Hardware/Software Integration
Ideal Project Flow
Board Bring-Up
Reading a Datasheet
Datasheet Sections You Need When Things'Go Wrong
Important Text for Software Developers
Evaluating Components Using the Datasheet
Your Processor Is a Language
Reading a Schematic
Having a Debugging Toolbox (and a Fire Extinguisher)
Keep Your Board Safe
Toolbox
Digital ltimeter
Oscilloscopes and Logic Analyzers
Testing the Hardware (and Software)
Building Tests
Flash Test Example
Command and Response
Command Pattern
Dealing with Errors
Consistent Methodology
Error-Handling Library
Debugging Timing Errors
Further Reading
4. Outputs, Inputs, and Timers
Toggling an Output
Starting with Registers
Set the Pin to Be an Output
Turn On the LED
Blinking the LED
Troubleshooting
Separating the Hardware from the Action
Board-Specific Header File
I/O-Handling Code
Main Loop
Facade Pattern
The Input in I/O
A Simple Interface to a Button
Momentary Button Press
Interrupt on a Button Press
Configuring the Interrupt
Debouncing Switches
Runtime Uncertainty
Dependency Injection
Using a Timer
Timer Pieces
Doing the Math
A Long Wait Between Timer Ticks
Using the Timer
Using Pulse-Width Modulation
Shipping the Product
Further Reading
5. Managing the FIow 0fActiviB~
Scheduling and Operating System Basics
Tasks
Comnication Between Tasks
Avoiding Race Conditions
Priority Inversion
State Machines
State Machine Example: Stoplight Controller
State-Centric State Machine
State-Centric State Machine with Hidden Transitions
Event-Centric State Machine
State Pattern
Table-Driven State Machine
Choosing a State Machine Implementation
Interrupts
An IRQ Happens
Save the Context
Get the ISR from the Vector Table
Calling the ISR
Restore the Context
When to Use Interrupts
How Not to Use Interrupts
Polling
System Tick
Time-Based Events
A Very Small Scheduler
Watchdog
Further Reading
6. Comnicating with Peripherals
The Wide Reach of Peripherals
External Memory
Buttons and Key Matrices
Sensors
Actuators
Displays
So Many Ways of Comnicating
Serial
Parallel
Ethernet and WiFi
Putting Peripherals and Comnication Together
Data Handling
Adding Robustness to the Comnication
Changing Data
Changing Algorithms
Further Reading
7. Updating Code
Onboard Bootloader
Build Your Own Updater
Modifying the Resident Updater
Brick Loader
Copy Loader to RAM
Run the Loader
Copy New Code to Scratch
Dangerous Time: Erase and Program
Reset to New Code
Security
Linker Scripts
Summary
8. Doing More with Less
Code Space
Reading a Map File (Part 1)
Process of Elimination
Libraries
Functions and Macros
Constants and Strings
RAM
Remove malloc
Reading a Map File (Part 2)
Registers and Local Variables
Function Chains
Pros and Cons of Globals
Memory Overlays
Speed
Profiling
Optimizing
Summary
Further Reading
9. Math
Identifying Fast and Slow Operations
Taking an Average
Use an Esting Algorithm
Designing and Modifying Algorithms
Factor Polynomials
Taylor Series
Dividing by a Constant
Scaling the Input
Lookup Tables
Fake Floating-Point Numbers
Rational Numbers
Precision
Addition (and Subtraction)
ltiplication (and Division)
Determining the Error
Further Reading
10. Reducing Power Consumption
Understanding Power Consumption
Turn Off the Light When You Leave the Room
Turn Off Peripherals
Turn Oft" Unused I/O devices
Turn Off Processor Subsystems
Slowing Down to Conserve Energy
Putting the Processor to Sleep
Interrupt-Based Code Flow Model
A Closer Look at the Main Loop
Processor Watchdog
Avoid Frequent Wake-Ups
Chained Processors
Further Reading
Index