Preface |
|
xiii | |
Acknowledgments |
|
xvii | |
Software Notice |
|
xix | |
Author |
|
xxi | |
Chapter 1 An Overview of Computing Systems |
|
1 | |
|
|
1 | |
|
|
2 | |
|
|
5 | |
|
1.2.2 The Creation of ARM Ltd. |
|
|
6 | |
|
|
9 | |
|
|
10 | |
|
|
11 | |
|
1.5 Representations of Numbers and Characters |
|
|
14 | |
|
1.5.1 Integer Representations |
|
|
15 | |
|
1.5.2 Floating-Point Representations |
|
|
18 | |
|
1.5.3 Character Representations |
|
|
20 | |
|
1.6 Translating Bits to Commands |
|
|
21 | |
|
|
22 | |
|
|
25 | |
Chapter 2 The ARM7TDMI Programmer's Model |
|
29 | |
|
|
29 | |
|
|
29 | |
|
|
30 | |
|
|
31 | |
|
2.5 Program Status Registers |
|
|
33 | |
|
|
34 | |
|
|
34 | |
|
|
34 | |
|
|
35 | |
Chapter 3 First Programs |
|
37 | |
|
|
37 | |
|
3.2 Program 1: Shifting Data |
|
|
38 | |
|
|
39 | |
|
3.2.2 Examining Register and Memory Contents |
|
|
40 | |
|
3.3 Program 2: Factorial Calculation |
|
|
41 | |
|
3.4 Program 3: Swapping Register Contents |
|
|
43 | |
|
3.5 Programming Guidelines |
|
|
44 | |
|
|
45 | |
Chapter 4 Assembler Rules and Directives |
|
47 | |
|
|
47 | |
|
4.2 Structure of Assembly Language Modules |
|
|
47 | |
|
4.3 Predefined Register Names |
|
|
50 | |
|
4.4 Frequently Used Directives |
|
|
51 | |
|
4.4.1 AREA—Define a Block of Data or Code |
|
|
51 | |
|
4.4.2 RN—Register Name Definition |
|
|
52 | |
|
4.4.3 EQU—Equate a Symbol to a Numeric Constant |
|
|
53 | |
|
4.4.4 ENTRY—Declare an Entry Point |
|
|
54 | |
|
4.4.5 DCB, DCW, and DCD—Allocate Memory and Specify Contents |
|
|
54 | |
|
4.4.6 ALIGN—Align Data or Code to Appropriate Boundaries |
|
|
55 | |
|
4.4.7 SPACE—Reserve a Block of Memory |
|
|
56 | |
|
4.4.8 LTORG—Assign Literal Pool Origins |
|
|
56 | |
|
4.4.9 END—End of a Source File |
|
|
57 | |
|
|
57 | |
|
4.6 Miscellaneous Assembler Features |
|
|
59 | |
|
4.6.1 Assembler Operators |
|
|
59 | |
|
|
61 | |
|
|
61 | |
Chapter 5 Loads, Stores, and Addressing |
|
63 | |
|
|
63 | |
|
|
63 | |
|
5.3 Loads and Stores—The Instructions |
|
|
66 | |
|
|
69 | |
|
5.4.1 Pre-Indexed Addressing |
|
|
69 | |
|
5.4.2 Post-Indexed Addressing |
|
|
71 | |
|
|
72 | |
|
5.5.1 Changing Endianness |
|
|
74 | |
|
5.5.2 Defining Memory Areas |
|
|
75 | |
|
|
76 | |
Chapter 6 Constants and Literal Pools |
|
79 | |
|
|
79 | |
|
6.2 The ARM Rotation Scheme |
|
|
79 | |
|
6.3 Loading Constants into Registers |
|
|
82 | |
|
6.4 Loading Addresses into Registers |
|
|
86 | |
|
|
91 | |
Chapter 7 Logic and Arithmetic |
|
93 | |
|
|
93 | |
|
|
93 | |
|
|
93 | |
|
|
94 | |
|
|
95 | |
|
|
95 | |
|
7.3 Comparison Instructions |
|
|
95 | |
|
7.4 Data Processing Operations |
|
|
97 | |
|
|
97 | |
|
|
98 | |
|
7.4.3 Addition/Subtraction |
|
|
104 | |
|
|
106 | |
|
7.4.5 Multiplication by a Constant |
|
|
107 | |
|
|
108 | |
|
|
111 | |
|
|
115 | |
Chapter 8 Loops and Branches |
|
119 | |
|
|
119 | |
|
|
120 | |
|
|
123 | |
|
|
124 | |
|
|
124 | |
|
|
128 | |
|
|
128 | |
|
8.5 Conditional Execution |
|
|
128 | |
|
|
131 | |
|
|
132 | |
Chapter 9 Tables |
|
135 | |
|
|
135 | |
|
|
135 | |
|
|
139 | |
|
|
140 | |
|
|
143 | |
Chapter 10 Subroutines and Stacks |
|
147 | |
|
|
147 | |
|
|
147 | |
|
10.2.1 LDM/STM Instructions |
|
|
148 | |
|
10.2.2 Full/Empty Ascending/Descending Stacks |
|
|
150 | |
|
|
152 | |
|
10.4 Passing Parameters to Subroutines |
|
|
153 | |
|
10.4.1 Passing Parameters in Registers |
|
|
154 | |
|
10.4.2 Passing Parameters by Reference |
|
|
156 | |
|
10.4.3 Passing Parameters on the Stack |
|
|
158 | |
|
|
160 | |
|
|
161 | |
Chapter 11 Exception Handling |
|
165 | |
|
|
165 | |
|
|
165 | |
|
|
166 | |
|
11.4 Processor Exception Sequence |
|
|
167 | |
|
|
169 | |
|
|
171 | |
|
11.7 Exception Priorities |
|
|
172 | |
|
11.8 Procedures for Handling Exceptions |
|
|
173 | |
|
|
173 | |
|
11.8.2 Undefined Instructions |
|
|
174 | |
|
|
178 | |
|
|
187 | |
|
|
190 | |
|
|
191 | |
Chapter 12 Memory-Mapped Peripherals |
|
193 | |
|
|
193 | |
|
|
194 | |
|
|
195 | |
|
|
195 | |
|
12.2.3 Configuring the UART |
|
|
197 | |
|
12.2.4 Writing the Data to the UART |
|
|
199 | |
|
12.2.5 Putting the Code Together |
|
|
199 | |
|
|
201 | |
|
|
202 | |
|
|
203 | |
|
|
204 | |
|
12.3.3 Configuring the D/A Converter |
|
|
204 | |
|
12.3.4 Generating a Sine Wave |
|
|
205 | |
|
12.3.5 Putting the Code Together |
|
|
206 | |
|
|
208 | |
|
|
209 | |
Chapter 13 THUMB |
|
211 | |
|
|
211 | |
|
|
212 | |
|
13.3 Differences Between ARM and THUMB |
|
|
213 | |
|
13.4 THUMB Implementation and Use |
|
|
215 | |
|
13.4.1 Processor Hardware |
|
|
215 | |
|
13.4.2 Switching Between ARM and THUMB States |
|
|
216 | |
|
13.5 How to Compile for THUMB |
|
|
218 | |
|
|
220 | |
Chapter 14 Mixing C and Assembly |
|
223 | |
|
|
223 | |
|
|
223 | |
|
14.2.1 Inline Assembly Syntax |
|
|
226 | |
|
14.2.2 Restrictions on Inline Assembly Operations |
|
|
228 | |
|
|
228 | |
|
14.3.1 Embedded Assembly Syntax |
|
|
230 | |
|
14.3.2 Restrictions on Embedded Assembly Operations |
|
|
231 | |
|
14.4 Calling Between C and Assembly |
|
|
231 | |
|
|
233 | |
Appendix A The ARM V4T Instruction Set |
|
235 | |
Appendix B Running Keil Tools |
|
333 | |
|
|
333 | |
|
B.2 Creating a Project and Selecting a Device |
|
|
333 | |
|
B.3 Creating Application Code |
|
|
335 | |
|
B.4 Building the Project and Running Code |
|
|
336 | |
Appendix C ASCII Character Codes |
|
339 | |
Glossary |
|
341 | |
References |
|
343 | |
Index |
|
345 | |