Introduction History of RISC 1.2.1 ARM Begins 1.2.2 The Creation of ARM Ltd 1.2.3 ARM Today The Computing Device Number Systems Representations of Numbers and Characters 1.5.1 Integer Representations 1.5.2 Floating-Point Representations 1.5.3 Character Representations Translating Bits to Commands The Tools Exercises
1 1 2 5 6 9 10 11 14 15 18 20 21 22 25
The ARM7TDMI Programmer's Model
29
2.1 2.2 2.3 2.4 2.5
29 29 30 31 33 34 34 34 35
2.6 2.7 Chapter 3
xiii xvii xix xxi
Introduction Data Types Processor Modes Registers Program Status Registers 2.5.1 The Control Bits 2.5.2 The Mode Bits The Vector Table Exercises
First Programs
37
3.1 3.2
37 38 39 40 41 43
3.3 3.4
Introduction Program 1: Shifting Data 3.2.1 Running the Code 3.2.2 Examining Register and Memory Contents Program 2: Factorial Calculation Program 3: Swapping Register Contents
vii
Contents
VIII
3.5 3.6 Chapter 4
Programming Guidelines Exercises
44 45
Assembler Rules and Directives
47
4.1 4.2 4.3 4.4
47 47 50 51 51 52
4.5 4.6
4.7 Chapter 5
53 54 54 55 56 56 57 57 59 59 61 61
Loads, Stores, and Addressing
63
5.1 5.2 5.3 5.4
63 63 66 69 69 71 72 74 75 76
5.5
5.6 Chapter 6
Introduction Structure of Assembly Language Modules Predefined Register Names Frequently Used Directives 4.4.1 AREA—Define a Block of Data or Code 4.4.2 RN—Register Name Definition 4.4.3 EQU—Equate a Symbol to a Numeric Constant 4.4.4 ENTRY—Declare an Entry Point 4.4.5 DCB, DCW, and DCD—Allocate Memory and Specify Contents 4.4.6 ALIGN—Align Data or Code to Appropriate Boundaries 4.4.7 SPACE—Reserve a Block of Memory 4.4.8 LTORG—Assign Literal Pool Origins 4.4.9 END—End of a Source File Macros Miscellaneous Assembler Features 4.6.1 Assembler Operators 4.6.2 Literals Exercises
Introduction Flags and Their Use 7.2.1 The N Flag 7.2.2 The V Flag 7.2.3 The Z Flag 7.2.4 The С Flag Comparison Instructions Data Processing Operations 7.4.1 Boolean Operations 7.4.2 Shifts and Rotates 7.4.3 Addition/Subtraction 7.4.4 Multiplication 7.4.5 Multiplication by a Constant 7.4.6 Division Fractional Notation Exercises
93
Introduction Branching Looping 8.3.1 While Loops 8.3.2 For Loops 8.3.3 Do ... While Loops More on Flags Conditional Execution Straight-Line Coding Exercises
Chapter 12 Memory-Mapped Peripherals 12.1 Introduction 12.2 The LPC2104 12.2.1 The UART 12.2.2 The Memory Map 12.2.3 Configuring the UART 12.2.4 Writing the Data to the UART 12.2.5 Putting the Code Together 12.2.6 Running the Code 12.3 TheLPC2132 12.3.1 The D/A Converter 12.3.2 The Memory Map 12.3.3 Configuring the D/A Converter 12.3.4 Generating a Sine Wave 12.3.5 Putting the Code Together 12.3.6 Running the Code 12.4 Exercises Chapter 13 THUMB 13.1 Introduction 13.2 THUMB Instructions
13.3 Differences Between ARM and THUMB 13.4 THUMB Implementation and Use 13.4.1 Processor Hardware 13.4.2 Switching Between ARM and THUMB States 13.5 How to Compile for THUMB 13.6 Exercises Chapter 14 Mixing С and Assembly
213 215 215 216 218 220 223
14.1 Introduction 223 14.2 Inline Assembler 223 14.2.1 Inline Assembly Syntax 226 14.2.2 Restrictions on Inline Assembly Operations 228 14.3 Embedded Assembler 228 14.3.1 Embedded Assembly Syntax 230 14.3.2 Restrictions on Embedded Assembly Operations.... 231 14.4 Calling Between С and Assembly 231 14.5 Exercises 233 Appendix A The ARM V4T Instruction Set
235
Appendix В Running Keil Tools B.l Introduction B.2 Creating a Project and Selecting a Device B.3 Creating Application Code B.4 Building the Project and Running Code
333 333 333 335 336
Appendix С ASCII Character Codes
339
Glossary
341
References
343
Index
345
ARM Assembly Language - GBV
ARM Assembly Language Fundamentals and Techniques
William Hohl ARM Incorporated, Austin, Texas
CRC Press Taylor & Francis Group Boca Raton London
N...