0%

Book Description

If you have programming experience and a familiarity with C--the dominant language in embedded systems--Programming Embedded Systems, Second Edition is exactly what you need to get started with embedded software. This software is ubiquitous, hidden away inside our watches, DVD players, mobile phones, anti-lock brakes, and even a few toasters. The military uses embedded software to guide missiles, detect enemy aircraft, and pilot UAVs. Communication satellites, deep-space probes, and many medical instruments would have been nearly impossible to create without embedded software.

The first edition of Programming Embedded Systems taught the subject to tens of thousands ofpeople around the world and is now considered the bible of embedded programming. This second edition has been updated to cover all the latest hardware designs and development methodologies.

The techniques and code examples presented here are directly applicable to real-world embedded software projects of all sorts. Examples use the free GNU software programming tools, the eCos and Linux operating systems, and a low-cost hardware platform specially developed for this book. If you obtain these tools along withProgramming Embedded Systems, Second Edition, you'll have a full environment for exploring embedded systems in depth. But even if you work with different hardware and software, the principles covered in this bookapply.

Whether you are new to embedded systems or have done embedded work before, you'll benefit from the topics in this book, which include:

  • How building and loading programs differ from desktop or servercomputers
  • Basic debugging techniques--a critical skill when working withminimally endowed embedded systems
  • Handling different types of memory
  • Interrupts, and the monitoring and control of on-chip and externalperipherals
  • Determining whether you have real-time requirements, and whetheryour operating system and application can meet those requirements
  • Task synchronization with real-time operating systems and embeddedLinux
  • Optimizing embedded software for size, speed, and power consumption
  • Working examples for eCos and embedded Linux

So whether you're writing your first embedded program, designing thelatest generation of hand-held whatchamacalits, or managing the peoplewho do, this book is for you. Programming EmbeddedSystems will help you develop the knowledge and skills youneed to achieve proficiency with embedded software.

Praise for the first edition:

"This lively and readable book is the perfect introduction for those venturing into embedded systems software development for the first time. It provides in one place all the important topics necessary to orient programmers to the embedded development process.

--Lindsey Vereen, Editor-in-Chief, Embedded Systems Programming

Table of Contents

  1. Dedication
  2. A Note Regarding Supplemental Files
  3. Foreword
  4. Preface
    1. Why We Wrote This Book
    2. Intended Audience
    3. Organization
    4. Conventions, Typographical and Otherwise
    5. Obtaining the Examples Online
    6. Using Code Examples
    7. Comments and Questions
    8. SafariĀ® Enabled
    9. Personal Comments and Acknowledgments
      1. From Michael Barr
      2. From Anthony Massa
  5. 1. Introduction
    1. What Is an Embedded System?
      1. History and Future
      2. Real-Time Systems
    2. Variations on a Theme
      1. Common System Components
      2. Requirements That Affect Design Choices
    3. Embedded Design Examples
      1. Digital Watch
      2. Video Game Player
      3. Mars Rover
    4. Life As an Embedded Software Developer
    5. The C Language: The Lowest Common Denominator
      1. Other Embedded Languages
      2. Choosing a Language for the Book
      3. Consistent Coding Practices
    6. A Few Words About Hardware
  6. 2. Getting to Know the Hardware
    1. Understanding the Big Picture
    2. Hardware Basics
      1. Schematic Fundamentals
    3. Examine the Landscape
      1. Memory Map
    4. Learn How to Communicate
    5. Getting to Know the Processor
      1. Processors in General
      2. The PXA255 XScale Processor
    6. Study the External Peripherals
    7. Initialize the Hardware
  7. 3. Your First Embedded Program
    1. Hello, World!
    2. The Blinking LED Program
      1. The ledInit Function
      2. The ledToggle Function
      3. The delay_ms Function
    3. The Role of the Infinite Loop
  8. 4. Compiling, Linking, and Locating
    1. The Build Process
      1. Compiling
      2. Linking
        1. Startup code
      3. Locating
    2. Building the Blinking LED Program
      1. Compile
      2. Link and Locate
      3. Format the Output File
    3. A Quick Look at Makefiles
  9. 5. Downloading and Debugging
    1. Downloading the Blinking LED Program
      1. Debug Monitors
        1. RedBoot
        2. Downloading with RedBoot
        3. Running programs with RedBoot
      2. When in ROM...
        1. Managing ROM with RedBoot
    2. Remote Debuggers
      1. Debugging on the Arcom Board
    3. Emulators
    4. Other Useful Tools
      1. Simulators
      2. Hardware Tools
      3. Lint
      4. Version Control
    5. Dig into the Hardware
  10. 6. Memory
    1. Types of Memory
      1. Types of RAM
      2. Types of ROM
      3. Hybrid Types
    2. Direct Memory Access
    3. Endian Issues
      1. Endianness in Devices
      2. Endianness in Networking
    4. Memory Testing
      1. Common Memory Problems
        1. Electrical wiring problems
        2. Missing memory chips
        3. Improperly inserted chips
      2. Developing a Test Strategy
        1. Data bus test
        2. Address bus test
        3. Device test
        4. Putting it all together
    5. Validating Memory Contents
      1. Checksums
      2. Cyclic Redundancy Checks
    6. Using Flash Memory
      1. Working with Flash Memory
      2. Flash Drivers
  11. 7. Peripherals
    1. Control and Status Registers
      1. Bit Manipulation
        1. Testing bits
        2. Setting bits
        3. Clearing bits
        4. Toggling bits
        5. Shifting bits
        6. Bitmasks
        7. Bitfields
      2. Struct Overlays
    2. The Device Driver Philosophy
      1. A Serial Device Driver
        1. Register interface
        2. State variables
        3. Initialization routine
        4. Device driver API
      2. Testing the Serial Device Driver
      3. Extending the Functionality of the Serial Device Driver
    3. Device Driver Design
  12. 8. Interrupts
    1. Overview
      1. Priorities
      2. Levels and Edges
      3. Enabling and Disabling
    2. Interrupt Map
    3. Interrupt Service Routine
      1. Shared Data and Race Conditions
    4. The Improved Blinking LED Program
      1. How Timers Work
    5. Summary of Interrupt Issues
  13. 9. Putting It All Together
    1. Application Overview
    2. Working with Serial Ports
    3. Command-Line Interface Processing
  14. 10. Operating Systems
    1. History and Purpose
    2. The Scheduler
      1. Real-Time Scheduling
      2. Scheduling Points
      3. Locking and Unlocking
    3. Tasks
      1. Task States
        1. Context switch
        2. The idle task
      2. Task Context
      3. Task Priorities
        1. Rate monotonic scheduling
      4. Task Mechanics
    4. Task Synchronization
      1. Mutexes and Semaphores
        1. Deadlock and priority inversion
    5. Message Passing
    6. Other Functionality
    7. Interrupt Handling
    8. Real-Time Characteristics
    9. To Use or Not to Use an RTOS
      1. RTOS Selection Process
    10. Additional Resources
  15. 11. eCos Examples
    1. Introduction
    2. Task Mechanics
    3. Mutex Task Synchronization
    4. Semaphore Task Synchronization
    5. Message Passing
    6. eCos Interrupt Handling
  16. 12. Embedded Linux Examples
    1. Introduction
    2. Accessing Hardware in Linux
    3. Task Mechanics
    4. Mutex Task Synchronization
    5. Semaphore Task Synchronization
    6. Message Passing
  17. 13. Extending Functionality
    1. Common Peripherals
      1. Inter-Integrated Circuit Bus
      2. Serial Peripheral Interface
      3. Programmable Logic
        1. Programmable Logic Device
        2. Complex Programmable Logic Device
        3. Field Programmable Gate Array
      4. Pulse Width Modulation
        1. Analog circuits
        2. Digital control
    2. Networking for All Devices Great and Small
      1. Benefits of Network Support
      2. Networking Solutions for Embedded Systems
  18. 14. Optimization Techniques
    1. Increasing Code Efficiency
    2. Decreasing Code Size
    3. Problems with Optimizing Compilers
    4. Reducing Memory Usage
    5. Power-Saving Techniques
      1. Processor Modes
      2. Clock Frequency
      3. External Memory Access
    6. Limiting the Impact of C++
  19. 1. The Arcom VIPER-Lite Development Kit
  20. 2. Setting Up Your Software Development Environment
    1. Windows Host Installation
      1. Cygwin Installation
      2. GNU Software Tools Installation
    2. Linux Host Installation
      1. GNU Software Tools Installation
    3. Example Code Installation
  21. 3. Building the GNU Software Tools
    1. Extracting the Source Files
    2. Building the Toolchain
  22. 4. Setting Up the eCos Development Environment
    1. The eCos Build Environment
      1. eCos Source Code Installation
      2. Building the eCos Library
  23. 5. Setting Up the Embedded Linux Development Environment
    1. Linux Build Environment Setup
    2. Embedded Linux Examples
      1. Building the Linux Examples
      2. Downloading and Running the Linux Examples
      3. Debugging Embedded Linux Examples
  24. About the Authors
  25. Copyright