Programming Embedded Systems with C and GNU Development Tools: Thinking Inside the Box

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

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 of people 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 with Programming 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 book apply.
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 server computers Basic debugging techniques--a critical skill when working with minimally endowed embedded systems Handling different types of memory Interrupts, and the monitoring and control of on-chip and external peripherals Determining whether you have real-time requirements, and whether your operating system and application can meet those requirements Task synchronization with real-time operating systems and embedded Linux 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 the latest generation of hand-held whatchamacalits, or managing the people who do, this book is for you. Programming Embedded Systems will help you develop the knowledge and skills you need 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

Author(s): Michael Barr; Anthony Massa
Edition: 2
Publisher: O'Reilly Media
Year: 2006

Language: English
Pages: 304

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