Fundamentals of Embedded Software with the ARM Cortex-M3

  • ISBN13:


  • ISBN10:


  • Edition: 1st
  • Format: Hardcover
  • Copyright: 2012-02-02
  • Publisher: Pearson

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $172.60 Save up to $130.61
  • Rent Book $138.08
    Add to Cart Free Shipping


Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
  • The Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.


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 text is useful for Computer Scientists, Computer Engineers, and Electrical Engineers involved with embedded software applications. This book is intended to provide a highly motivating context in which to learn procedural programming languages. The ultimate goal of this text is to lay a foundation that supports the multi-threaded style of programming and high-reliability requirements of embedded software. It presents assembly the way it is most commonly used in practice - to implement small, fast, or special-purpose routines called from a main program written in a high-level language such as C. Students not only learn that assembly still has an important role to play, but their discovery of multi-threaded programming, preemptive and non-preemptive systems, shared resources, and scheduling helps sustain their interest, feeds their curiosity, and strengthens their preparation for subsequent courses on operating systems, real-time systems, networking, and microprocessor-based design.

Author Biography

Dr. Daniel W. Lewis' efforts led to the creation of Santa Clara University’s Computer Engineering department in 1988, providing its leadership for the first 18 years. During his tenure, Lewis established unique co-op and study abroad options that fit within the normal undergraduate four-year plan, the first graduate-level academic certificate programs for working professionals, a new interdisciplinary major in Web Design and Engineering, and a interdisciplinary minor in Information Technology and Society. Since 2004, Lewis has focused on K-12 outreach in engineering and computing, raising more than $1.7M from NSF and private sources, and providing professional development for more than 200 K-12 teachers and summer camps for more than 2,000 K-12 students.

Prior to joining the University in 1975, Lewis worked for six years at General Electric’s Aerospace Division where he designed a fault-tolerant clocking system for one of the first triple-redundant automatic landing systems for commercial aircraft. He has consulted for a number of Bay Area companies, including the Singer-Link Company, where his design of new algorithms and a corresponding modular array of VLSI circuits became the basis of a new product line of real-time computer graphics systems.

Table of Contents

Prefacep. xiii
Introductionp. 1
What is an Embedded System?p. 1
What Is Unique about the Design Goals for Embedded Software?p. 3
What Does "Real-Time" Mean?p. 5
What Does "Multithreading" Mean?p. 5
How Powerful are Embedded Processors?p. 6
What Programming Languages are Used?p. 6
How Is Building an Embedded Application Different?p. 7
How Big are Typical Embedded Programs?p. 9
Problemsp. 10
Data Representationp. 11
Fixed-Precision Binary Numbersp. 11
Positional Number Systemsp. 13
Binary-to-Decimal Conversionp. 14
Decimal-to-Binary Conversionp. 14
Hexadecimal: A Shorthand for Binaryp. 17
Fixed Precision, Rollover, and Overflowp. 18
Binary Representation of Integersp. 19
Signed Integersp. 20
Positive and Negative Representations of the Same Magnitudep. 20
Interpreting the Value of a 2's-Complement Numberp. 21
Changing the Sign of Numbers with Integer and Fractional Partsp. 22
Binary Addition and Subtractionp. 23
Range and Overflowp. 25
Binary Representation of Real Numbersp. 26
Floating-Point Real Numbersp. 26
Fixed-Point Real Numbersp. 28
ASCII Representation of Textp. 28
Binary-Coded Decimal (BCD)p. 31
Problemsp. 32
Implementing Arithmeticp. 35
2'S-Complement and Hardware Complexityp. 35
Multiplication and Divisionp. 38
Signed Versus Unsigned Multiplicationp. 38
Shifting Instead of Multiplying or Dividing by Powers of 2p. 38
Multiplying by an Arbitrary Constantp. 40
Dividing by an Arbitrary Constantp. 41
Arithmetic for Fixed-Point Realsp. 41
Fixed-Point Using a Universal 16.16 Formatp. 44
Fixed-Point Using a Universal 32.32 Formatp. 45
Multiplication of 32.32 Fixed-Point Realsp. 46
Example: Multiplying two 4.4 Fixed-Point Realsp. 49
Problemsp. 50
Getting the Most out of Cp. 52
Integer Data Typesp. 52
Integer Range and the Standard Header File LIMITS.Hp. 54
Boolean Data Typesp. 56
Mixing Data Typesp. 57
Manipulating Bits In Memoryp. 58
Testing Bitsp. 60
Setting, Clearing, and Inverting Bitsp. 61
Extracting Bitsp. 62
Inserting Bitsp. 62
Manipulating Bits In Input/Output Portsp. 63
Write-Only I/O Devicesp. 63
I/O Devices Differentiated by Reads Versus Writesp. 65
I/O Devices Differentiated by Sequential Accessp. 65
I/O Devices Differentiated by Bits in the Written Datap. 66
Accessing Memory-Mapped I/O Devicesp. 66
Accessing Data Using a Pointerp. 67
Arrays, Pointers, and the "Address of" Operatorp. 68
Structuresp. 69
Packed Structuresp. 70
Bit Fieldsp. 71
Variant Accessp. 72
Casting the Address of an Objectp. 73
Using Unionsp. 74
Problemsp. 75
Programming in Assembly Part 1: Computer Organizationp. 80
Memoryp. 82
Data Alignmentp. 83
The Central Processing Unit (CPU)p. 85
Other Registersp. 86
The Fetch-Execute Cyclep. 86
Input/Outputp. 89
Introduction to the ARMŽ Cortex™-M3 v7M Architecturep. 90
Internal Organizationp. 90
Instruction Pipeliningp. 91
Memory Modelp. 93
Bit-Bandingp. 93
ARM Assembly Languagep. 96
Instruction Formats and Operandsp. 96
Translating Assembly into Binaryp. 98
Problemsp. 98
Programming in Assembly Part 2: Data Manipulationp. 102
Loading Constants into Registersp. 102
Loading Memory Data into Registersp. 103
Storing Data from Registers to Memoryp. 105
Converting Simple C Assignment Statements into ARM Assemblyp. 106
Memory Address Calculationsp. 107
Memory Addressing Examplesp. 108
Translating C Pointer Expressions to Assemblyp. 109
Translating C Subscript Expressions to Assemblyp. 111
Translating Structure References to Assemblyp. 111
Stack Instructionsp. 112
Data Processing Instructionsp. 113
Updating the Flags in the APSRp. 113
Arithmetic Instructionsp. 114
Bit Manipulation Instructionsp. 115
Shift Instructionsp. 116
Bit Field Manipulation Instructionsp. 118
Miscellaneous Bit, Byte, and Half-Word Instructionsp. 119
Problemsp. 120
Programming in Assembly Part 3: Control Structuresp. 123
Instruction Sequencingp. 123
Implementing Decisionsp. 124
Conditional Branch Instructionsp. 124
If-Then and If-Then-Else Statementsp. 125
Compound Conditionalsp. 126
The "If-Then" (IT) Instructionp. 128
Implementing Loopsp. 129
Speeding Up Array Accessp. 131
Implementing Functionsp. 132
Function Call and Returnp. 132
Register Usagep. 133
Parameter Passingp. 134
Return Valuesp. 135
Temporary Variablesp. 135
Preserving Registersp. 136
Problemsp. 138
Programming in Assembly Part 4: I/O Programmingp. 140
The Cortex-M3 I/O Hardwarep. 141
Interrupts and Exceptionsp. 141
Thread and Handler Modesp. 142
Entering the Exception Handlerp. 142
Returning from the Exception Handlerp. 143
Latency Reductionp. 143
Priorities and Nested Exceptionsp. 145
Synchronization, Transfer Rate, and Latencyp. 146
Buffers and Queuesp. 147
Double Bufferingp. 149
Estimating I/O Performance Capabilityp. 150
Polled Waiting Loopsp. 150
Interrupt-Driven I/Op. 152
Direct Memory Accessp. 154
Comparison of Methodsp. 155
Problemsp. 156
Concurrent Softwarep. 159
Foreground/Background Systemsp. 159
Thread State and Serializationp. 159
Managing Latencyp. 160
Interrupt Overrunp. 163
Moving Work into the Backgroundp. 163
Multithreaded Programmingp. 164
Concurrent Execution of Independent Threadsp. 265
Context Switchingp. 165
Non-preemptive (Cooperative) Multithreadingp. 165
Preemptive Multithreadingp. 267
Shared Resources and Critical Sectionsp. 167
Disabling Interruptsp. 269
Disabling Task Switchingp. 169
Spin Locksp. 170
Mutex Objectsp. 270
Semaphoresp. 272
Problemsp. 272
Schedulingp. 174
Thread Statesp. 174
Pending Threadsp. 175
Context Switchingp. 176
Round-Robin Schedulingp. 178
Priority-Based Schedulingp. 178
Resource Starvationp. 178
Priority Inversionp. 179
The Priority Ceiling Protocolp. 180
The Priority Inheritance Protocolp. 180
Assigning Prioritiesp. 181
Deadline-Driven Schedulingp. 181
Rate-Monotonic Schedulingp. 182
Deadlockp. 183
Watchdog Timersp. 184
Problemsp. 186
Memory Managementp. 189
Objects in Cp. 189
Scopep. 190
Refining Local Scopep. 190
Refining Global Scopep. 191
Lifetimep. 192
Automatic Allocationp. 193
Storage Class "Register"p. 194
Static Allocationp. 195
Three Programs to Distinguish Static from Automaticp. 196
Object Creationp. 196
Object Initializationp. 196
Object Destructionp. 197
Dynamic Allocationp. 199
Fragmentationp. 199
Memory Allocation Poolsp. 200
Automatic Allocation with Variable Size (alloca)p. 200
Variable-Size Arraysp. 201
Recursive Functions and Memory Allocationp. 202
Problemsp. 203
Shared Memoryp. 209
Recognizing Shared Objectsp. 209
Shared Global Datap. 210
Shared Private Datap. 210
Shared Functionsp. 210
Reentrant Functionsp. 220
Read-Only Datap. 211
Type Qualifier "const"p. 211
Coding Practices to Avoidp. 212
Functions That Keep Internal State in Local Static Objectsp. 212
Functions That Return the Address of a Local Static Objectp. 214
Accessing Shared Memoryp. 215
The Effect of Processor Architecturep. 217
Read-Only and Write-Only Accessp. 218
Type Qualifier "volatile"p. 219
Problemsp. 221
System Initializationp. 224
Memory Layoutp. 224
The CPU and Vector Tablep. 225
C Run-Time Environmentp. 227
Copying Initial Values from Non-Volatile Memory into the Data Regionp. 227
Zeroing Uninitialized Staticsp. 227
Setting Up a Heapp. 228
System Timerp. 229
Other Peripheral Devicesp. 229
Answers to Selected Problemsp. 231
Indexp. 234
Table of Contents provided by Ingram. All Rights Reserved.

Rewards Program

Write a Review