Home > Store

Real-Time Programming: A Guide to 32-bit Embedded Development

Register your product to gain access to bonus material or receive a coupon.

Real-Time Programming: A Guide to 32-bit Embedded Development


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 1999
  • Dimensions: 7-3/8" x 9-1/4"
  • Pages: 728
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-48540-0
  • ISBN-13: 978-0-201-48540-0

Real-time embedded systems have rigid requirements and must conform to strict size, cost, weight, power, operation, and response-time specifications. They must be crash-proof and must operate under a wide range of conditions. Add to these requirements the ever-increasing competitive pressures to bring products to market faster and at a lower cost, and it is easy to see why building such systems is difficult. Real-time programmers must write software that meets unforgiving objectives under numerous constraints. Teaching you how is the goal of this book.

Real-Time Programming is a comprehensive guide that

  • Covers 32-bit real-time embedded programming topics, including debugging, timers, interrupts, multitasking, serial I/O, TCP/IP networking, and ROMing an application
  • Explores implementing new technologies, such as flash storage and Web-enabled applications
  • Emphasizes a practical, hands-on approach, drawing on code examples from real-world projects constructed during the course of the book
  • Provides complete coverage of the embedded development cycle, from design through implementation
  • Lets developers start building real-time embedded systems immediately using commercial, off-the-shelf hardware and software.

No matter what hardware and software platforms you will ultimately use, this book lays the groundwork and gets you up-to-speed on the unique requirements of real-time embedded programming.



CD Contents

Untitled Document This file contains the CD Contents from the book Adapting PCs for Disabilities

Sample Content

Table of Contents

(Each chapter concludes with a Summary.)



1. An Introduction to Embedded Systems.

Real-Time Systems.

Hard Real-Time.

Soft Real-Time.

Real-Time Embedded Systems.

Embedded Processors.

The Advent of PC Embedded Systems.

PC Hardware Components.

The Advantages of the PC Architecture.

Does an Embeddable PC Suit Your Application?

2. Designing and Developing Your Real-Time System.

A Practical Approach.

The Iterative Approach.

The Analysis Phase.

Stating the Problem.

Specifying Project Constraints.

Listing Customer Requirements.

Specifying Hardware and Software.

Verifying Your Analysis.

An Example.

The Design Phase.

Reviewing the Analysis.

Specifying Hardware Components.

Defining Hardware Interfaces.

Specifying Software Subsystems.

Defining Software Interfaces.

Specifying the Start-up and Shutdown Processes.

Specifying Error Handling.

Verifying Your Design.

An Example.

Some Decisions.

Choosing a Processor.

Choosing Hardware Components.

Choosing an Operating System.

Choosing a Programming Language.

Choosing Software Development Tools.

Choosing Hardware Debugging Tools.

Choosing Software Components.

The Implementation Phase.

Planning the Implementation.

Implementing the Design.

3. Chapter 3 Software Installation and Setup.

Choosing a Platform and Tools.

ToolSuite Lite Components.

Embedded StudioExpress.


Real-Time ETS Kernel.

What’s Lite About ToolSuite Lite?

ETS Kernel Application Environment.

Segment Selectors.

Null Pointer Detection.

The Stack and the Heap.

The Command Line and the Environment.


Hardware Setup.

Software Installation and Setup.

Installing ToolSuite Lite.

Configuring Visual C++ and Developer Studio.

Setting Up the Host Environment.

Building a Boot Disk.

Testing the Host-Target Connection.

Programming Projects.

Opening a Workspace.

Running a Program.

Building a Program.

Creating New Programming Projects.

4. Debugging.

Software Debuggers.

Hardware Debuggers.

In-Circuit Emulators.

ROM Emulators.

Software Simulators.

Debugging with ToolSuite.

A Buggy Calculation.

Debugging the Application.

Embedded StudioExpress Extensions.

Target Port Input/Output.

Target System Information.

5. A Point-of-Sale Terminal.

How the POS Project Works.

Designing the Simulation.

Software Subsystems.

Software Interfaces.

Start-up and Shutdown Processes.

Error Handling.

Building the POS Project.

Running the POS Project.

A Quick Tour of the Source.

6. Keyboard and Screen I/O.

Buttons, Keypads, and Keyboards.

LEDs, LCDs, and Displays.

ETS Kernel Support of Keyboard and Screen I/O.

Host Console I/O.

ETS Kernel Keyboard Driver.

ETS Kernel Screen Driver.

Code from the POS Project.

Keyboard Input.

Screen Output.

7. File Systems.

Choosing a File System.



Multitasking and Multiuser Capabilities.

Choosing a Storage Device.

RAM Disks.

Flash Disks.

ROM Disks.

Hard Disk Drives.

Floppy Disk Drives.

CD-ROM Drives.

Magnetic Tape.

ETS Kernel File System.

Local File System.

Remote File System.

File I/O in the POS Project.

8. A Simple UPS.

How the UPS Project Works.

Designing the Simulation.

Software Subsystems.

Software Interfaces.

Start-up and Shutdown Processes.

Error Handling.

Building the UPS Project.

Running the UPS Project.

A Quick Tour of the Source.

9. Interrupts.

How Interrupts Work.

Hardware Interrupts.

Software Interrupts.


ISR Fundamentals.

Using High-Level Languages.


Interrupt Latency.

Chaining ISRs.

Multitasking Considerations.

Interrupts on the PC Architecture.

Interrupt Handling Under ETS Kernel.

C Interrupt Handlers.

IDT Interrupt Handlers.

Timer and Keyboard Callbacks.

Interrupts in the UPS Project.

Keyboard Callbacks.

Timer Callbacks.

10. Timers.

Timer Applications.

Selecting Timer Hardware.

Software Considerations.

ETS Kernel Timers.

Timers in the UPS Project.

11. A Smart UPS.

How the Smart UPS Project Works.

Designing the Simulation.

Software Subsystems.

Software Interfaces.

Start-up and Shutdown Processes.

Error Handling.

Building the Smart UPS Project.

Running the Smart UPS Project.

A Quick Tour of the Source.

12. Multitasking.

Processes and Multiprocessing.

Threads and Multithreading.

Processes versus Threads.


Round-Robin Scheduling.

Task Priorities.

vPriority Inversion.




Mutex Objects.

Semaphore Objects.

Event Objects.

Interlocked Variable Access.

Intertask Communication.


Message Queues.

Shared Memory.

Remote Procedure Calls.

Interrupt Handling.

Choosing an RTOS.


Threads in the Smart UPS Project.

Starting a Thread.

Controlling Thread Priority.

Terminating a Thread.

Writing ISRs.

The Smart UPS Code.

13. Serial I/O.

Fundamentals of Serial I/O.

Baud Rate versus Bits Per Second.

Asynchronous versus Synchronous Communications.

Error Detection.

Flow Control.

Electrical Standards and Communication Protocols.


Writing Serial Port ISRs.

The RS-232C Serial Standard.

Mechanical Specification.

Electrical Specification.

Functional Specification.

Procedural Specification.

Peripheral Serial Buses.

Chip-to-Chip Serial Buses.

Serial I/O in the Smart UPS.

The 8250/16x50 UART Family.

Initializing the Serial I/O Subsystem.

Cleaning Up.

The Serial I/O Thread.

14. A Network-Aware UPS.

How the Network-Aware UPS Project Works.

Designing the Simulation.

Software Subsystems.

Software Interfaces.

Start-up and Shutdown Processes.

Error Handling.

Building the Network-Aware UPS Project.

Running the Network-Aware UPS Project.

A Quick Tour of the Source.

15. Networking.

Networking Concepts.

What Is a Network?

Internetworks and the Internet.

Network Technologies.


The ISO/OSI Network Design Model.

Repeaters, Bridges, and Routers.

Virtual Communication.

Comparing Connection-Oriented and Connectionless Protocols.

Comparing Reliable and Unreliable Protocols.

The Client/Server Model.

Networking in Embedded Systems.

Selecting the Protocol Stack.

Selecting a Network Technology.

Selecting an Existing Implementation.

Using Standard Application Protocols.

Popular Network Architectures.

Advantages of the TCP/IP Protocol Stack.

The TCP/IP Network Implementation.

Network Interface Layer.

Internet Layer.

Transport Layer.

Application Layer.

Network Programming for ETS Kernel.

WinSock API.

Building the Finger Server Project.

Running the Finger Server Project.

The Finger Server Code.

16. Connecting to the Web.

HTTP In Embedded Applications.

The HTTP Protocol.

Web Browsers.

Web Servers.

URLs and URIs.

HTTP Messages.

Persistent Connections.


Secure HTTP.

HTML in Embedded Applications.

Dynamic HTML.

ETS Kernel HTTP Server.

HTML-On-The-Fly in the Network-Aware UPS.

17. Java.

A Language and a Platform.

Platform Alternatives.

Compiler Alternatives.

Advantages for Embedded Development.

Processor Independence.

Object-Oriented Programming.

Security and Secure Operations.

Memory Management.

Garbage Collection.


Dynamic Configuration.

Exception Handling.



Limitations of Java.


Garbage Collection Overhead.

JVM Overhead.

Hardware Access.

Language Immaturity.

The Java-Enabled UPS.

Building the Java-Enabled UPS Project.

Running the Java-Enabled UPS Project.

A Quick Tour of the Source.

18. Floating-Point Programming.

Scientific Notation Terminology.

Floating-Point Support on Embedded Systems.

Floating-Point Data Formats.

Exponent Format.

Mantissa Format.

Number Holes.

Special Numbers.

Floating-Point Hardware and Software.



Why Use Floating-Point Emulation Software?

A Bitmap Filter.

How the Bitmap Filter Project Works.

Building the Bitmap Filter Project.

Running the Bitmap Filter Project.

A Quick Tour of the Source.

19. Dynamic Link Libraries.

What Is a DLL?

Advantages of Using DLLs.

Memory Requirements.

System Upgrades.

System Configuration and Customization.

Disadvantages of Using DLLs.

Using DLLs with ETS Kernel.

The ENCDEC Project.

Building the ENCDEC Project.

Running the ENCDEC Project.

A Quick Tour of the Source.

20. C++ Exceptions and Structured Exceptions.

Benefits of Exception Handling.

Exception Handling in Embedded Systems.

Robust Code.

Clean Code.

C++ Exception Handling.

Structured Exception Handling.

Structured Exceptions in C.

Structured Exceptions in C++.

A Restartable UPS.

Building the Restartable UPS Project.

Running the Restartable UPS Project.

A Quick Tour of the Source.

21. ROMing an Application.

Using ROM in Embedded Systems.

Types of ROM.

Mask-Programmed and Fusible-Link ROMs.



Flash Memory.

Programming PROMs.

Device Programmers.

Input Files for Device Programmers.

In-Circuit Programmers.

In-the-Field Software Updates.

Debugging Programs in ROM.

PC Boot Methods.

Boot Jump ROM.

BIOS Extension Boot.

ROM-based File System Boot.

ToolSuite Support for ROM.

Appendix A. A Hardware Resource Guide.

Appendix B. APIs.

Appendix C. Configuring Serial Networking Connections for Windows.

Appendix D. Development Methodologies for Real-Time and Embedded Systems.




This is a practical, hands-on guide to building real-time embedded software. You read right. Plenty of books take a high-level, theoretical approach to real-time embedded systems development; other texts take a hardware-specific approach, emphasizing building applications for atypical hardware. Few books, however, focus on developing real-time embedded software.

We understand why authors have gravitated to one of these two extremes. The absence of standard hardware, standard development tools, and a standard operating system virtually demanded that authors pursue either a theoretical or hardware-specific approach.

The world is changing, however. As time to market becomes ever more important, developers of embedded systems are starting to turn more to off-the-shelf boards and components. In particular, the PC architecture, with its high-volume cost advantages, standardized interfaces, and plethora of suppliers, is an attractive choice for systems produced in low to medium quantities.

This shift--that is, the emergence of a standard platform that is also already widely used and understood by developers--enabled us to carve out a middle ground: a book that focuses on software issues surrounding real-time embedded application development. From the beginning, we cover everyday programming topics such as designing, developing, and debugging real-time embedded applications. We show you how to implement interrupts, timers, threads, and more in real-time embedded programs. And we illustrate all topics with code examples. Because you're probably already familiar with the PC architecture, and because it's been exhaustively explored and documented, we don't spend time on hardware details--and neither do you. Both the host and target development platforms are PC-based, so you should have all the hardware you need to get started; you don't have to spend time or money building custom hardware.

At least half the value of using standard hardware is using standard software. This is where Phar Lap Software's ToolSuite Lite comes in. Included on the CD-ROM, ToolSuite Lite is a limited version of Phar Lap's TNT Embedded ToolSuite, Realtime Edition. TNT Embedded ToolSuite supports off-the-shelf compilers and tools, and enables you to build and deploy real-time embedded applications that use the PC architecture.

ToolSuite Lite includes a real-time embedded operating system (ETS Kernel) that supports a subset of Microsoft's Win32 API--the same API used for Windows 95, 98, and NT. (ETS Kernel is not Microsoft Windows. The kernel looks and acts like Windows, but that's as far as the similarity goes. Phar Lap's ETS Kernel is compact, scalable, and optimized for real-time embedded systems.) ToolSuite Lite also includes support for the Microsoft Visual C++ compiler and run-time libraries, Microsoft Developer Studio Integrated Developer Environment (IDE), and the use of the Developer Studio debugger as a cross-debugger for real-time embedded programs.

Note: According to Microsoft Visual C++ 6.0 Programmer's Guide (Microsoft Press, 1998), with the release of Visual C++ 6.0, Microsoft no longer distinguishes between Visual C++ the product and Developer Studio the IDE, and uses Visual C++ to refer to both. For the purposes of our discussion, however, we continue to refer to the IDE in Visual C++ 6.0 as Developer Studio.

We included ToolSuite Lite because the best way to learn how to write programs is to, well, write them. With the software on the CD-ROM, a copy of Microsoft Visual C++, two PC-compatible computers, and a LapLink-compatible cable, you can build, run, and debug all the programming projects in this book.

Is This Book for You?

Does this book target only PC and Win32 developers? Not at all. We had to choose specific hardware and software platforms so that you could actually build and run the real-time embedded programs in this book. But you can apply the principles of embedded systems development described here to the design and development of any embedded product, regardless of which specific processor, real-time operating system, and software tools you use.

You'll find this book worthwhile if you are one of the following:

  • A programmer who is new to or had limited exposure to embedded systems and wants to acquire a good, overall understanding of embedded systems programming.
  • A programmer who is familiar with at least one of the Windows operating systems, has never explored real-time embedded systems programming, and wants to experience it firsthand.
  • A programmer who has worked on non-Intel hardware and wants some hands-on experience with the kind of embeddable PC systems supported by ToolSuite.
  • A programmer with a hardware/software project you've been toying with. You suspect the implementation solution to this project is some sort of embedded system, but you don't know how to go about turning your idea into a reality.
  • A student or a teacher in the engineering or scientific disciplines who anticipates building projects that will require computer control.
  • Someone who is already familiar with ToolSuite and wants an adjunct to the examples given in the ToolSuite documentation.
  • An inquisitive person who wants to explore embedded systems just because you find them interesting.

We have only one prerequisite. You should be conversant in the C programming language so that you can read the source code (most examples are in C) and understand what's going on. A few projects are written partially in C++, and one of the programming projects includes a Java applet. Nevertheless, C is the only requirement. Knowledge of C++, the Win32 API, and Java, however, would provide a headstart.

Embedded Systems: Wave? You Mean Tsunami

The number and types of embedded systems available make it almost impossible to miss the trend toward embedded systems. Your programmable microwave is an embedded system. Your VCR is an embedded system. Your TV remote is an embedded system. And if your TV is programmable, it's embedded, too.

You can expect the embedded systems trend to continue. In the September 1996 issue of Computer Design magazine, Ray Weiss wrote an article titled, "Embedded Advances in Auto, Communications, Office, Industry, and Consumer Markets." Based on information released by Motorola, Weiss wrote that the average 1990 car contained about 14 microprocessors; by the year 2000, that number is expected to reach 35.

Now combine this with another trend that's even more difficult to miss: that wildfire called the Internet. The same Computer Design article mentioned earlier continues:

Home set-top-box and Internet connections via ISDN or higher home-connection technologies like 8-Mbit ADSL (Asymmetric Digital Subscriber Line) have the potential to feed huge communications growth as homes tie into advanced digital services for set-top or cable boxes. And expect these boxes to become integrated into TV sets soon...VMEbus and PC-based systems are expected to play a major role as system bases for these applications.

Set-top boxes, routers, modems--in short, the infrastructure of the Internet--are embedded systems, a fact that further supports the expectation that embedded systems will become increasingly prevalent.

Although the growth of the embedded market is largely due to new uses and applications for embedded systems, it's also been fueled by advancements in microprocessors. Increases in processor speed, bus width, and the number of peripherals that manufacturers can squeeze on a chip have increased the variety of chips available for embedded systems and their suitability to a wider variety of tasks. RISC chips are now common in high-end embedded applications and even in not so high-end applications, if you loo


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership