Programming Embedded Systems in C and C++

Book description

Embedded software is in almost every electronic device designed today. There is software hidden away inside our watches, microwaves, VCRs, cellular telephones, and pagers; the military uses embedded software to guide smart missiles and detect enemy aircraft; communications satellites, space probes, and modern medicine would be nearly impossible without it. Of course, someone has to write all that software, and there are thousands of computer scientists, electrical engineers, and other professionals who actually do.

Each embedded system is unique and highly customized to the application at hand. As a result, embedded systems programming is a widely varying field that can take years to master. However, if you have some programming experience and are familiar with C or C++, you're ready to learn how to write embedded software. The hands-on, no-nonsense style of this book will help you get started by offering practical advice from someone who's been in your shoes and wants to help you learn quickly.

The techniques and code examples presented here are directly applicable to real-world embedded software projects of all sorts. Even if you've done some embedded programming before, you'll still benefit from the topics in this book, which include:

  • Testing memory chips quickly and efficiently

  • Writing and erasing Flash memory

  • Verifying nonvolatile memory contents with CRCs

  • Interfacing to on-chip and external peripherals

  • Device driver design and implementation

  • Optimizing embedded software for size and speed

So whether you're writing your first embedded program, designing the latest generation of hand-held whatchamacalits, or simply managing the people who do, this book is for you.

Table of contents

  1. Table of Contents
  2. Preface
    1. Why I Wrote This Book
    2. Intended Audience
    3. Organization
    4. Conventions, Typographical and Otherwise
    5. Obtaining the Examples Online
    6. How to Contact Us
    7. Personal Comments and Acknowledgments
  3. Introduction
    1. What Is an Embedded System?
      1. History and Future
      2. Real-Time Systems
    2. Variations on the Theme
      1. Digital Watch
      2. Video Game Player
      3. Mars Explorer
    3. C: The Least Common Denominator
      1. Other Embedded Languages
      2. Choosing a Language for the Book
    4. A Few Words About Hardware
  4. Your First Embedded Program
    1. Hello, World!
    2. Das Blinkenlights
      1. toggleLed
      2. delay
    3. The Role of the Infinite Loop
  5. Compiling, Linking, and Locating
    1. The Build Process
    2. Compiling
    3. Linking
    4. Locating
    5. Building das Blinkenlights
  6. Downloading and Debugging
    1. When in ROM…
    2. Remote Debuggers
    3. Emulators
      1. ROM Emulators
    4. Simulators and Other Tools
  7. Getting to Know the Hardware
    1. Understand the Big Picture
    2. Examine the Landscape
      1. Memory Map
      2. I/O Map
    3. Learn How to Communicate
      1. Interrupt Map
    4. Get to Know the Processor
      1. Processors in General
      2. Intel’s 80188EB Processor
    5. Study the External Peripherals
    6. Initialize the Hardware
  8. Memory
    1. Types of Memory
      1. Types of RAM
      2. Types of ROM
      3. Hybrid Types
    2. Memory Testing
      1. Common Memory Problems
        1. Electrical wiring problems
        2. Missing memory chips
        3. Improperly inserted chips
      2. Developing a Test Strategy (1/2)
      3. Developing a Test Strategy (2/2)
        1. Data bus test
        2. Address bus test
        3. Device test
        4. Putting it all together
    3. Validating Memory Contents
      1. Checksums
      2. Cyclic Redundancy Codes
    4. Working with Flash Memory
      1. Flash Drivers
  9. Peripherals
    1. Control and Status Registers
    2. The Device Driver Philosophy
      1. 1. A data structure that overlays the memory-mapped control and status registers of the device
      2. 2. A set of variables to track the current state of the hardware and device driver
      3. 3. A routine to initialize the hardware to a known state
      4. 4. A set of routines that, taken together, provide an API for users of the device driver
      5. 5. One or more interrupt service routines
    3. A Simple Timer Driver (1/2)
    4. A Simple Timer Driver (2/2)
    5. Das Blinkenlights, Revisited
  10. Operating Systems
    1. History and Purpose
    2. A Decent Embedded Operating System
      1. Tasks
        1. Task states
        2. Task mechanics
      2. Scheduler (1/2)
      3. Scheduler (2/2)
        1. Scheduling points
        2. Ready list
        3. Idle task
        4. Scheduler
      4. Context Switch
      5. Task Synchronization
        1. Critical sections
    3. Real-Time Characteristics
    4. Selection Process
  11. Putting It All Together
    1. Application Overview
    2. Flashing the LED
    3. Printing “Hello, World!”
    4. Working with Serial Ports (1/2)
    5. Working with Serial Ports (2/2)
    6. The Zilog 85230 Serial Controller
  12. Optimizing Your Code
    1. Increasing Code Efficiency
    2. Decreasing Code Size
    3. Reducing Memory Usage
    4. Limiting the Impact of C++
  13. Arcom’s Target188EB
  14. Glossary (1/3)
  15. Glossary (2/3)
  16. Glossary (3/3)
  17. Bibliography
    1. Books
    2. Magazines and Conferences
    3. World Wide Web
  18. Index (1/2)
  19. Index (2/2)

Product information

  • Title: Programming Embedded Systems in C and C++
  • Author(s): Michael Barr
  • Release date: January 1999
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781565923546