Making Embedded Systems. 2nd Edition Kolonowskie

Interested in developing embedded systems? Since they dont tolerate inefficiency, these systems require a disciplined approach to programming. This easy-to-read guide helps you cultivate good development practices based on classic software design patterns and new patterns unique to embedded …

od 152,15 zł Najbliżej: 45 km

Liczba ofert: 1

Oferta sklepu

Opis

Interested in developing embedded systems? Since they dont tolerate inefficiency, these systems require a disciplined approach to programming. This easy-to-read guide helps you cultivate good development practices based on classic software design patterns and new patterns unique to embedded programming. Youll learn how to build system architecture for processors, not for operating systems, and youll discover techniques for dealing with hardware difficulties, changing designs, and manufacturing requirements. Written by an expert who has created systems ranging from DNA scanners to childrens toys, this book is ideal for intermediate and experienced programmers, no matter what platform you use. This expanded second edition includes new chapters on IoT and networked sensors, motors and movement, debugging, data handling strategies, and more. Optimize your system to reduce cost and increase performance Develop an architecture that makes your software robust in resource-constrained environments Explore sensors, displays, motors, and other I/O devices Reduce RAM and power consumption, code space, and processor cycles Learn how to interpret schematics, datasheets, and power requirements Discover how to implement complex mathematics and machine learning on small processors Design effective embedded systems for IoT and networked sensors Spis treści: Preface About This Book Who This Book Is For About the Author Organization of This Book Terminology Conventions Used in This Book Using Code Examples OReilly Online Learning How to Contact Us Acknowledgments 1. Introduction Embedded Systems Development Compilers and Languages Debugging Resource Constraints Principles to Confront Those Challenges Prototypes and Maker Boards Further Reading 2. Creating a System Architecture Getting Started Creating System Diagrams The Context Diagram The Block Diagram Organigram Layering Diagram Designing for Change Encapsulate Modules Delegation of Tasks Driver Interface: Open, Close, Read, Write, IOCTL Adapter Pattern Creating Interfaces Example: A Logging Interface From requirements to an interface State of logging Pattern: Singleton Sharing private globals A Sandbox to Play In Back to the Drawing Board Further Reading 3. Getting Your Hands on the Hardware Hardware/Software Integration Ideal Project Flow Hardware Design Board Bring-Up Reading a Datasheet Datasheet Sections You Need When Things Go Wrong Pinout for each type of package available Pin descriptions Performance characteristics Sample schematics Datasheet Sections for Software Developers Evaluating Components Using the Datasheet Your Processor Is a Language Reading a Schematic Practice Reading a Schematic: Arduino! Keep Your Board Safe Creating Your Own Debugging Toolbox Digital Multimeter Oscilloscopes and Logic Analyzers Setting Up a Scope Testing the Hardware (and Software) Building Tests Flash Test Example Test 1: Read existing data Test 2: Byte access Test 3: Block access Test wrap-up Command and Response Creating a command Invoking a command Command Pattern Dealing with Errors Consistent Methodology Error Checking Flow Error-Handling Library Debugging Timing Errors Further Reading 4. Inputs, Outputs, and Timers Handling Registers Binary and Hexadecimal Math Bitwise Operations Test, Set, Clear, and Toggle Toggling an Output Setting the Pin to Be an Output Turning 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 Momentary Button Press Interrupt on a Button Press Configuring the Interrupt Debouncing Switches Runtime Uncertainty Increasing Code Flexibility Dependency Injection Using a Timer Timer Pieces Doing the Math More Math: Difficult Goal Frequency A Long Wait Between Timer Ticks Using a Timer Using Pulse-Width Modulation Shipping the Product Further Reading 5. Interrupts A Chicken Presses a Button An IRQ Happens Nonmaskable Interrupts Interrupt Priority Nested Interrupts Save the Context Retrieve the ISR from the Vector Table Initializing the Vector Table Looking Up the ISR Call the ISR Multiple Sources for One Interrupt Disabling Interrupts Critical Sections Restore the Context Configuring Interrupts When and When Not to Use Interrupts How to Avoid Using Interrupts Polling System Tick Time-Based Events A Very Small Scheduler Further Reading 6. Managing the Flow of Activity Scheduling and Operating System Basics Tasks Communication 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 Watchdog Main Loops Polling and Waiting Timer Interrupt Interrupts Do Everything Interrupts Cause Events Very Small Scheduler Active Objects Further Reading 7. Communicating with Peripherals Serial Communication TTL Serial RS-232 Serial SPI I2C and TWI 1-Wire Parallel Dual and Quad SPI USB Considering Other Protocols Communications in Practice External ADC Example: Data Ready with SPI Use a FIFO If Available Direct Memory Access (DMA) Is Faster External ADC Example: SPI and DMA Circular Buffers Further Reading 8. Putting Together a System Key Matrices Segmented Displays Pixel Displays Display Assets Changeable Data? Flyweight and Factory Patterns External Flash Memory Display Assets Emulated EEPROMs and KV Stores Little File Systems Data Storage Analog Signals Digital Sensors Data Handling Changing Algorithms: Strategy Algorithm Stages: Pipelines and Filters Calculating Needs: Speeds and Feeds Data Bandwidth Memory Throughput and Buffering Further Reading 9. Getting into Trouble Fighting with the Compiler Optimizations Impossible Bugs Reproduce the Bug Explain the Bug Creating Chaos and Hard Faults Dividing by Zero Talking to Things That Arent There Running Undefined Instructions Incorrect Memory Access (Unaligned Access) Returning a Pointer to Stack Memory Stack Overflows and Buffer Overflows Debugging Hard Faults Processor Registers: What Went Wrong? Creating a Core Dump Using the Core Dump Merely Very Difficult Bugs Consequences of Being Clever Further Reading 10. Building Connected Devices Connecting Remotely Directly: Ethernet and WiFi Through a Gateway Via a Mesh Robust Communication Version! Checksums, CRCs, Hashes Encryption and Authentication Risk Analysis Updating Code Firmware Update Security Multiple Pieces of Code Fallback Lifeboat Staged Rollout Managing Large Systems Manufacturing Further Reading 11. Doing More with Less Need More Code Space Reading a Map File (Part 1) Process of Elimination Libraries Functions Versus Macros: Which Are Smaller? Constants and Strings Need More RAM Remove malloc Reading a Map File (Part 2) Registers and Local Variables Function parameters Minimize scope Look at the assembly Function Chains Pros and Cons of Globals: RAM Versus Stack Clever Memory Overlays Need More Speed Profiling I/O lines and an O-scope Timer profiler 1 (function timer) Timer profiler 2 (response timer) Sampling profiler Optimizing for Processor Cycles Memory timing Variable size One last look at function chains Consider the instructions Reduce math in loops Loop unrolling Lookup tables Coding in assembly language Summary Further Reading 12. Math Identifying Fast and Slow Operations Taking an Average Different Averages: Cumulative and Median Using an Existing Algorithm Designing and Modifying Algorithms Factor Polynomials Taylor Series Dividing by a Constant Scaling the Input Lookup Tables Implicit input Linear interpolation Explicit input in the table Fake Floating-Point Numbers Rational Numbers Precision Addition (and Subtraction) Multiplication (and Division) Machine Learning Look Up the Answer! Further Reading 13. Reducing Power Consumption Understanding Power Consumption Measuring Power Consumption Using a resistor in series and burden voltage Changing current and orders of magnitude problem Designing for Lower Power Consumption Turn Off the Light When You Leave the Room Turn Off Peripherals Turn Off Unused I/O Devices Turn Off Processor Subsystems Slow 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 14. Motors and Movement Creating Movement Position Encoding Driving a Simple DC Motor with PWM Motor Control PID Control Motion Profiles Ten Things I Hate About Motors Further Reading Index O autorze: Elecia White pracowała nad monitorami intensywnej terapii, systemami dla lotnictwa i samochodów wyścigowych, zabawkami edukacyjnymi i wieloma innymi urządzeniami. Obecnie pełni funkcję głównego inżyniera do spraw systemów wbudowanych. Współprowadzi Embedded.fm ... podcast poświęcony systemom wbudowanym i kreatywnym technologiom .

Specyfikacja

Podstawowe informacje

Autor
  • Elecia White
Wydawnictwo
  • O'Reilly Media
Format
  • MOBI
  • EPUB
Ilość stron
  • 428
Rok wydania
  • 2024