Preface |
|
xv | |
Authors |
|
xxi | |
|
Chapter 1 An Overview of Computing Systems |
|
|
1 | (32) |
|
|
1 | (2) |
|
|
3 | (9) |
|
|
5 | (2) |
|
1.2.2 The Creation of ARM Ltd |
|
|
7 | (2) |
|
|
9 | (1) |
|
|
10 | (1) |
|
1.2.4.1 The Cortex-A and Cortex-R Families |
|
|
10 | (1) |
|
1.2.4.2 The Cortex-M Family |
|
|
11 | (1) |
|
|
12 | (3) |
|
|
15 | (3) |
|
1.5 Representations of Numbers and Characters |
|
|
18 | (6) |
|
1.5.1 Integer Representations |
|
|
18 | (3) |
|
1.5.2 Floating-Point Representations |
|
|
21 | (2) |
|
1.5.3 Character Representations |
|
|
23 | (1) |
|
1.6 Translating Bits to Commands |
|
|
24 | (1) |
|
|
25 | (5) |
|
|
27 | (1) |
|
|
27 | (1) |
|
1.7.3 Code Composer Studio |
|
|
28 | (2) |
|
1.7.4 Useful Documentation |
|
|
30 | (1) |
|
|
30 | (3) |
|
Chapter 2 The Programmer's Model |
|
|
33 | (12) |
|
|
33 | (1) |
|
|
33 | (1) |
|
|
34 | (5) |
|
|
34 | (1) |
|
|
35 | (3) |
|
|
38 | (1) |
|
|
39 | (4) |
|
|
40 | (1) |
|
|
40 | (2) |
|
|
42 | (1) |
|
|
43 | (2) |
|
Chapter 3 Introduction to Instruction Sets: v4T and v7-M |
|
|
45 | (14) |
|
|
45 | (1) |
|
3.2 ARM, Thumb, and Thumb-2 Instructions |
|
|
46 | (1) |
|
3.3 Program 1: Shifting Data |
|
|
46 | (5) |
|
|
47 | (2) |
|
3.3.2 Examining Register and Memory Contents |
|
|
49 | (2) |
|
3.4 Program 2: Factorial Calculation |
|
|
51 | (2) |
|
3.5 Program 3: Swapping Register Contents |
|
|
53 | (1) |
|
3.6 Program 4: Playing with Floating-Point Numbers |
|
|
54 | (1) |
|
3.7 Program 5: Moving Values between Integer and Floating-Point Registers |
|
|
55 | (1) |
|
3.8 Programming Guidelines |
|
|
56 | (1) |
|
|
57 | (2) |
|
Chapter 4 Assembler Rules and Directives |
|
|
59 | (20) |
|
|
59 | (1) |
|
4.2 Structure of Assembly Language Modules |
|
|
59 | (4) |
|
4.3 Predefined Register Names |
|
|
63 | (1) |
|
4.4 Frequently Used Directives |
|
|
63 | (10) |
|
4.4.1 Defining a Block of Data or Code |
|
|
63 | (1) |
|
|
64 | (1) |
|
4.4.1.2 Code Composer Studio Tools |
|
|
65 | (1) |
|
4.4.2 Register Name Definition |
|
|
66 | (1) |
|
|
66 | (1) |
|
4.4.2.2 Code Composer Studio |
|
|
66 | (1) |
|
4.4.3 Equating a Symbol to a Numeric Constant |
|
|
66 | (1) |
|
|
67 | (1) |
|
4.4.3.2 Code Composer Studio |
|
|
67 | (1) |
|
4.4.4 Declaring an Entry Point |
|
|
67 | (1) |
|
4.4.5 Allocating Memory and Specifying Contents |
|
|
68 | (1) |
|
|
68 | (1) |
|
4.4.5.2 Code Composer Studio |
|
|
69 | (1) |
|
4.4.6 Aligning Data or Code to Appropriate Boundaries |
|
|
70 | (1) |
|
|
70 | (1) |
|
4.4.6.2 Code Composer Studio |
|
|
71 | (1) |
|
4.4.7 Reserving a Block of Memory |
|
|
71 | (1) |
|
|
71 | (1) |
|
4.4.7.2 Code Composer Studio |
|
|
71 | (1) |
|
4.4.8 Assigning Literal Pool Origins |
|
|
72 | (1) |
|
4.4.9 Ending a Source File |
|
|
72 | (1) |
|
|
73 | (1) |
|
4.6 Miscellaneous Assembler Features |
|
|
74 | (3) |
|
4.6.1 Assembler Operators |
|
|
74 | (2) |
|
4.6.2 Math Functions in CCS |
|
|
76 | (1) |
|
|
77 | (2) |
|
Chapter 5 Loads, Stores, and Addressing |
|
|
79 | (24) |
|
|
79 | (1) |
|
|
79 | (4) |
|
5.3 Loads and Stores: The Instructions |
|
|
83 | (5) |
|
|
88 | (3) |
|
5.4.1 Pre-Indexed Addressing |
|
|
88 | (1) |
|
5.4.2 Post-Indexed Addressing |
|
|
89 | (2) |
|
|
91 | (4) |
|
5.5.1 Changing Endianness |
|
|
93 | (1) |
|
5.5.2 Defining Memory Areas |
|
|
94 | (1) |
|
|
95 | (1) |
|
5.7 Memory Considerations |
|
|
96 | (3) |
|
|
99 | (4) |
|
Chapter 6 Constants and Literal Pools |
|
|
103 | (16) |
|
|
103 | (1) |
|
6.2 The ARM Rotation Scheme |
|
|
103 | (4) |
|
6.3 Loading Constants into Registers |
|
|
107 | (5) |
|
6.4 Loading Constants with MOVW, MOVT |
|
|
112 | (1) |
|
6.5 Loading Addresses into Registers |
|
|
113 | (3) |
|
|
116 | (3) |
|
Chapter 7 Integer Logic and Arithmetic |
|
|
119 | (36) |
|
|
119 | (1) |
|
|
119 | (5) |
|
|
120 | (1) |
|
|
121 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
7.3 Comparison Instructions |
|
|
124 | (1) |
|
7.4 Data Processing Operations |
|
|
125 | (16) |
|
|
126 | (1) |
|
|
127 | (6) |
|
7.4.3 Addition/Subtraction |
|
|
133 | (2) |
|
7.4.4 Saturated Math Operations |
|
|
135 | (2) |
|
|
137 | (2) |
|
7.4.6 Multiplication by a Constant |
|
|
139 | (1) |
|
|
140 | (1) |
|
|
141 | (2) |
|
7.6 Bit Manipulation Instructions |
|
|
143 | (2) |
|
|
145 | (5) |
|
|
150 | (5) |
|
Chapter 8 Branches and Loops |
|
|
155 | (20) |
|
|
155 | (1) |
|
|
155 | (7) |
|
8.2.1 Branching (ARM7TDMI) |
|
|
156 | (4) |
|
8.2.2 Version 7-M Branches |
|
|
160 | (2) |
|
|
162 | (5) |
|
|
162 | (1) |
|
|
163 | (3) |
|
|
166 | (1) |
|
8.4 Conditional Execution |
|
|
167 | (3) |
|
8.4.1 v4T Conditional Execution |
|
|
167 | (2) |
|
8.4.2 v7-M Conditional Execution: The IT Block |
|
|
169 | (1) |
|
|
170 | (2) |
|
|
172 | (3) |
|
Chapter 9 Introduction to Floating-Point: Basics, Data Types, and Data Transfer |
|
|
175 | (34) |
|
|
175 | (1) |
|
9.2 A Brief History of Floating-Point in Computing |
|
|
175 | (3) |
|
9.3 The Contribution of Floating-Point to the Embedded Processor |
|
|
178 | (2) |
|
9.4 Floating-Point Data Types |
|
|
180 | (3) |
|
9.5 The Space of Floating-Point Representable Values |
|
|
183 | (2) |
|
9.6 Floating-Point Representable Values |
|
|
185 | (7) |
|
|
185 | (1) |
|
|
186 | (2) |
|
|
188 | (1) |
|
|
189 | (1) |
|
9.6.5 Not-a-Numbers (NaNs) |
|
|
190 | (2) |
|
9.7 The Floating-Point Register File of the Cortex-M4 |
|
|
192 | (1) |
|
9.8 FPU Control Registers |
|
|
193 | (4) |
|
9.8.1 The Floating-Point Status and Control Register, FPSCR |
|
|
193 | (1) |
|
9.8.1.1 The Control and Mode Bits |
|
|
194 | (1) |
|
9.8.1.2 The Exception Bits |
|
|
195 | (1) |
|
9.8.2 The Coprocessor Access Control Register, CPACR |
|
|
196 | (1) |
|
9.9 Loading Data into Floating-Point Registers |
|
|
197 | (4) |
|
9.9.1 Floating-Point Loads and Stores: The Instructions |
|
|
197 | (2) |
|
9.9.2 The VMOV instruction |
|
|
199 | (2) |
|
9.10 Conversions between Half-Precision and Single-Precision |
|
|
201 | (1) |
|
9.11 Conversions to Non-Floating-Point Formats |
|
|
202 | (4) |
|
9.11.1 Conversions between Integer and Floating-Point |
|
|
203 | (1) |
|
9.11.2 Conversions between Fixed-Point and Floating-Point |
|
|
203 | (3) |
|
|
206 | (3) |
|
Chapter 10 Introduction to Floating-Point: Rounding and Exceptions |
|
|
209 | (26) |
|
|
209 | (1) |
|
|
209 | (10) |
|
10.2.1 Introduction to Rounding Modes in the IEEE 754-2008 Specification |
|
|
211 | (1) |
|
10.2.2 The roundTiesToEven (RNE) Rounding Mode |
|
|
212 | (2) |
|
10.2.3 The Directed Rounding Modes |
|
|
214 | (1) |
|
10.2.3.1 The roundTowardPositive (RP) Rounding Mode |
|
|
215 | (1) |
|
10.2.3.2 The roundTowardNegative (RM) Rounding Mode |
|
|
215 | (1) |
|
10.2.3.3 The roundTowardZero (RZ) Rounding Mode |
|
|
215 | (1) |
|
10.2.4 Rounding Mode Summary |
|
|
216 | (3) |
|
|
219 | (7) |
|
10.3.1 Introduction to Floating-Point Exceptions |
|
|
219 | (1) |
|
10.3.2 Exception Handling |
|
|
220 | (1) |
|
|
220 | (2) |
|
|
222 | (1) |
|
|
223 | (2) |
|
|
225 | (1) |
|
|
226 | (1) |
|
10.4 Algebraic Laws and Floating-Point |
|
|
226 | (2) |
|
10.5 Normalization and Cancelation |
|
|
228 | (4) |
|
|
232 | (3) |
|
Chapter 11 Floating-Point Data-Processing Instructions |
|
|
235 | (24) |
|
|
235 | (1) |
|
11.2 Floating-Point Data-Processing Instruction Syntax |
|
|
235 | (1) |
|
|
236 | (1) |
|
|
237 | (5) |
|
11.4.1 Comparison Instructions |
|
|
237 | (1) |
|
|
237 | (1) |
|
|
238 | (1) |
|
|
238 | (1) |
|
|
238 | (1) |
|
11.4.6 Predicated Instructions, or the Use of the Flags |
|
|
239 | (2) |
|
11.4.7 A Word about the IT Instruction |
|
|
241 | (1) |
|
|
242 | (1) |
|
11.5.1 Flush-to-Zero Mode |
|
|
242 | (1) |
|
|
243 | (1) |
|
11.6 Non-Arithmetic Instructions |
|
|
243 | (1) |
|
|
243 | (1) |
|
|
243 | (1) |
|
11.7 Arithmetic Instructions |
|
|
244 | (10) |
|
11.7.1 Addition/Subtraction |
|
|
244 | (2) |
|
11.7.2 Multiplication and Multiply-Accumulate |
|
|
246 | (1) |
|
11.7.2.1 Multiplication and Negate Multiplication |
|
|
247 | (1) |
|
11.7.2.2 Chained Multiply-Accumulate |
|
|
247 | (3) |
|
11.7.2.3 Fused Multiply-Accumulate |
|
|
250 | (2) |
|
11.7.3 Division and Square Root |
|
|
252 | (2) |
|
11.8 Putting It All Together: A Coding Example |
|
|
254 | (3) |
|
|
257 | (2) |
|
|
259 | (16) |
|
|
259 | (1) |
|
12.2 Integer Lookup Tables |
|
|
259 | (5) |
|
12.3 Floating-Point Lookup Tables |
|
|
264 | (4) |
|
|
268 | (4) |
|
|
272 | (3) |
|
Chapter 13 Subroutines and Stacks |
|
|
275 | (22) |
|
|
275 | (1) |
|
|
275 | (7) |
|
13.2.1 LDM/STM Instructions |
|
|
276 | (3) |
|
|
279 | (1) |
|
13.2.3 Full/Empty Ascending/Descending Stacks |
|
|
280 | (2) |
|
|
282 | (1) |
|
13.4 Passing Parameters to Subroutines |
|
|
283 | (6) |
|
13.4.1 Passing Parameters in Registers |
|
|
283 | (2) |
|
13.4.2 Passing Parameters by Reference |
|
|
285 | (1) |
|
13.4.3 Passing Parameters on the Stack |
|
|
286 | (3) |
|
|
289 | (3) |
|
|
292 | (5) |
|
Chapter 14 Exception Handling: ARM7TDMI |
|
|
297 | (28) |
|
|
297 | (1) |
|
|
297 | (1) |
|
|
298 | (1) |
|
14.4 Processor Exception Sequence |
|
|
299 | (2) |
|
|
301 | (2) |
|
|
303 | (1) |
|
14.7 Exception Priorities |
|
|
304 | (1) |
|
14.8 Procedures for Handling Exceptions |
|
|
305 | (17) |
|
|
305 | (1) |
|
14.8.2 Undefined Instructions |
|
|
306 | (5) |
|
|
311 | (1) |
|
14.8.3.1 Vectored Interrupt Controllers |
|
|
312 | (7) |
|
14.8.3.2 More Advanced VICs |
|
|
319 | (1) |
|
|
319 | (1) |
|
|
320 | (1) |
|
|
320 | (1) |
|
|
321 | (1) |
|
|
322 | (3) |
|
Chapter 15 Exception Handling: v7-M |
|
|
325 | (16) |
|
|
325 | (1) |
|
15.2 Operation Modes and Privilege Levels |
|
|
325 | (5) |
|
|
330 | (1) |
|
|
331 | (1) |
|
15.5 Processor Exception Sequence |
|
|
331 | (2) |
|
|
331 | (2) |
|
|
333 | (1) |
|
|
333 | (4) |
|
|
337 | (3) |
|
|
340 | (1) |
|
Chapter 16 Memory-Mapped Peripherals |
|
|
341 | (24) |
|
|
341 | (1) |
|
|
341 | (8) |
|
|
342 | (1) |
|
|
343 | (2) |
|
16.2.3 Configuring the UART |
|
|
345 | (2) |
|
16.2.4 Writing the Data to the UART |
|
|
347 | (1) |
|
16.2.5 Putting the Code Together |
|
|
348 | (1) |
|
|
349 | (1) |
|
|
349 | (7) |
|
|
350 | (2) |
|
|
352 | (1) |
|
16.3.3 Configuring the D/A Converter |
|
|
353 | (1) |
|
16.3.4 Generating a Sine Wave |
|
|
353 | (1) |
|
16.3.5 Putting the Code Together |
|
|
354 | (2) |
|
|
356 | (1) |
|
|
356 | (7) |
|
16.4.1 General-Purpose I/O |
|
|
359 | (1) |
|
|
359 | (1) |
|
16.4.3 Configuring the GPIO Pins |
|
|
359 | (1) |
|
16.4.4 Turning on the LEDs |
|
|
360 | (2) |
|
16.4.5 Putting the Code Together |
|
|
362 | (1) |
|
|
363 | (1) |
|
|
363 | (2) |
|
Chapter 17 ARM, Thumb and Thumb-2 Instructions |
|
|
365 | (14) |
|
|
365 | (1) |
|
17.2 ARM and 16-Bit Thumb Instructions |
|
|
365 | (6) |
|
17.2.1 Differences between ARM and 16-Bit Thumb |
|
|
369 | (1) |
|
17.2.2 Thumb Implementation |
|
|
370 | (1) |
|
17.3 32-Bit Thumb Instructions |
|
|
371 | (2) |
|
17.4 Switching between ARM and Thumb States |
|
|
373 | (2) |
|
17.5 How to Compile for Thumb |
|
|
375 | (2) |
|
|
377 | (2) |
|
Chapter 18 Mixing C and Assembly |
|
|
379 | (14) |
|
|
379 | (1) |
|
|
379 | (5) |
|
18.2.1 Inline Assembly Syntax |
|
|
382 | (2) |
|
18.2.2 Restrictions on Inline Assembly Operations |
|
|
384 | (1) |
|
|
384 | (3) |
|
18.3.1 Embedded Assembly Syntax |
|
|
386 | (1) |
|
18.3.2 Restrictions on Embedded Assembly Operations |
|
|
387 | (1) |
|
18.4 Calling between C and Assembly |
|
|
387 | (3) |
|
|
390 | (3) |
Appendix A Running Code Composer Studio |
|
393 | (6) |
Appendix B Running Keil Tools |
|
399 | (8) |
Appendix C ASCII Character Codes |
|
407 | (2) |
Appendix D |
|
409 | (6) |
Glossary |
|
415 | (4) |
References |
|
419 | (2) |
Index |
|
421 | |