Fundamentals of Embedded Software : Where C and Assembly Meet
For sophomore-level courses in Assembly Language Programming in Computer Science, Embedded Systems Design, Real-Time Analysis, Computer Engineering, or Electrical Engineering curricula. Requires prior knowledge of C, C++, or Java.This book is intended to provide a highly motivating context in which to learn procedural programming language. Using a non-product specific approach and a programming (versus hardware) perspective, this text lays a foundation that supports the multi-threaded style of programming and high-reliability requirements of embedded software. Reflecting current industrial applications and programming practice, it focuses on the more modern 32-bit protected mode processors and on C as the dominant programming language-with coverage of assembly and how it can be used in conjunction with, and support of, C.
- Paperback | 266 pages
- 175.26 x 231.14 x 17.78mm | 476.27g
- 13 Nov 2001
- Pearson Education (US)
- Upper Saddle River, NJ, United States
Back cover copy
"Fundamentals of Embedded Software: Where C and Assembly Meet" is a refreshing alternative to the traditional sophomore text on computer organization and assembly language programming. The text approaches assembly the way it is commonly used in practice3/4to implement small, fast, or special-purpose routines called from a main program written in a high-level language such as C. By using an embedded software context, the text introduces multi-threaded programming, preemptive and non-preemptive systems, shared resources, and scheduling, thus providing a solid foundation for subsequent courses on operating systems, real-time systems, networking, and microprocessor-based design.The text will help you: appreciate the often overlooked consequences and limitations of binary representation.implement fast real-number arithmetic using fixed-point reals instead of floating-point.reinforce your comprehension of scope, parameter passing, recursion, and memory allocation.employ features of C (such as bit-manipulation and variant access) commonly used in embedded software.write functions in Intel x86 protected mode assembly to be called from C.estimate maximum data rate and latency for various styles of I/O programming.manage multiple threads, shared resources, and critical sections.develop programming practices that avoid priority inversions, deadlocks, and shared memory problems."Fundamentals of Embedded Software: Where C and Assembly Meet" comes with a CD-ROM containing all the software tools needed to build simple stand-alone embedded applications on an ordinary Pentium-class PC: a C compiler, assembler, linker, boot loader, library, and both preemptive and non-preemptive real-time kernels. Also included are major portions of the source code for a number of programming assignments found in an appendix of the text.
Table of contents
1. Introduction. What is an Embedded System? What's Unique About the Design Goals for Embedded Software? What Does "Real-Time" Mean? What Does "Multitasking" Mean? How Powerful Are Embedded Processors? What Programming Languages Are Used? What Is a "Real-Time Kernel"? How Is Building an Embedded Application Unique? How Big Are Typical Embedded Programs? The Software Used in This Book.2. Data Representation. Fixed-Precision Binary Numbers. Binary Representation of Integers. Binary Representation of Real Numbers. ASCII Representation of Text. Binary-Coded Decimal (BCD).3. Getting the Most Out of C. Integer Data Types. Mixing Data Types. Useful Typedefs and Defines. Manipulating Bits in Memory. Manipulating Bits in 1/O Ports. Accessing Memory-Mapped I/O Devices. Structures. Variant Access.4. A Programmer's View of Computer Organization. Memory. The Central Processing Unit (CPU). Input/Output (I/O). Introduction to the Intel Architecture. The Intel Real Mode Architecture. The Intel Protected Mode Architecture. Operand and Address-Size Override Prefixes. The Intel Data Manipulation Instructions.5. Mixing C and Assembly. Programming in Assembly. Register Usage Conventions. Typical Use of Addressing Options. Instruction Sequencing. Procedure Call and Return. Parameter Passing. Retrieving Parameters. Everything is Pass by Value. Temporary Variables.6. Input/Output Programming. The Intel I/O Instructions. Synchronization, Transfer Rate, and Latency. Polled Waiting Loops. Interrupt-Driven I/O. Direct Memory Access. Comparison of Methods.7. Concurrent Software. Foreground/Background Systems. Multithreaded Programming. Shared Resources and Critical Sections.8. Scheduling. Thread States. Pending Threads. Context Switching. Round-Robin Scheduling. Priority-Based Scheduling. Assigning Priorities. Deadlock. Watchdog Timers.9. Memory Management. Objects in C. Scope. Lifetime. Automatic Allocation. Static Allocation. Three Programs to Distinguish Static from Automatic. Dynamic Allocation. Automatic Allocation with Variable Size (alloca). Recursive Functions and Memory Allocation.10. Shared Memory. Recognizing Shared Objects. Reentrant Functions. Read-Only Data. Coding Practices to Avoid. Accessing Shared Memory.11. System Initialization. Memory Layout. The CPU. C Run-Time Environment. System Timer. Interrupt System.Appendix A: Contents of the CD-ROM. Appendix B: The DJGPP C/C++ Compiler. Installation. Compilation. On-Line Documentation (Info).Appendix C: The NASM Assembler. Installation. Running NASM.Appendix D: Programming Projects. Files Required from the CD-ROM for All Applications. Files Required for Nonpreemptive Multithreaded Applications. Files Required for Preemptive Multithreaded Applications. Compiling and Assembling Your Embedded Application. Linking Your Embedded Application. Preparing the Boot Diskette. Running Your Embedded Application.Appendix E: The LIBEPC Library. Memory Layout and Initialization. Display Functions (display.c). Window Functions (window.c). Keyboard Functions (keyboard.c). Speaker Functions (speaker.c). Timer Functions (timer.c, cycles.asm). Interrupt Vector Access Functions (init-idt.c). Dyamic Memory Allocation Functions (heap.c). Fixed Point (fixedpt.asm). Interfunction Jumps (setjmp.asm). Miscellaneous Functions (init-crt.c).Appendix F: The Boot Loader.