Table of Contents for
ARM Assembly Language, 2nd Edition
Close
Version ebook
/
Retour
ARM Assembly Language, 2nd Edition
by Christopher Hinds
Published by Chapman and Hall/CRC, 2016
Contents
ARM Assembly Language: Fundamentals and Techniques, Second Edition
Preliminaries
To our families
Preface
Acknowledgments
Authors
Chapter 1 - An Overview of Computing Systems
Chapter 2 - The Programmer’s Model
Chapter 3 - Introduction to Instruction Sets: v4T and v7-M
Chapter 4 - Assembler Rules and Directives
Chapter 5 - Loads, Stores, and Addressing
Chapter 6 - Constants and Literal Pools
Chapter 7 - Integer Logic and Arithmetic
Chapter 8 - Branches and Loops
Chapter 9 - Introduction to Floating-Point: Basics, Data Types, and Data Transfer
Chapter 10 - Introduction to Floating-Point: Rounding and Exceptions
Chapter 11 - Floating-Point Data-Processing Instructions
Chapter 12 - Tables
Chapter 13 - Subroutines and Stacks
Chapter 14 - Exception Handling: ARM7TDMI
Chapter 15 - Exception Handling: v7-M
Chapter 16 - Memory-Mapped Peripherals
Chapter 17 - ARM, Thumb and Thumb-2 Instructions
Chapter 18 - Mixing C and Assembly
Appendix A: Running Code Composer Studio
Appendix B: Running Keil Tools
Appendix C: ASCII Character Codes
Appendix D
Glossary
References
Contents
Preface
Acknowledgments
Authors
Chapter 1 - An Overview of Computing Systems
1.1 Introduction
1.2 History of RISC
1.2.1 ARM Begins
1.2.2 The Creation of ARM Ltd.
1.2.3 ARM Today
1.2.4 The Cortex Family
1.2.4.1 The Cortex-A and Cortex-R Families
1.2.4.2 The Cortex-M Family
1.3 The Computing Device
1.4 Number Systems
1.5 Representations of Numbers and Characters
1.5.1 Integer Representations
1.5.2 Floating-Point Representations
1.5.3 Character Representations
1.6 Translating Bits to Commands
1.7 The Tools
1.7.1 Open Source Tools
1.7.2 Keil (ARM)
1.7.3 Code Composer Studio
1.7.4 Useful Documentation
1.8 Exercises
Chapter 2 - The Programmer’s Model
2.1 Introduction
2.2 Data Types
2.3 ARM7TDMI
2.3.1 Processor Modes
2.3.2 Registers
2.3.3 The Vector Table
2.4 Cortex-M4
2.4.1 Processor Modes
2.4.2 Registers
2.4.3 The Vector Table
2.5 Exercises
Chapter 3 - Introduction to Instruction Sets: v4T and v7-M
3.1 Introduction
3.2 ARM, Thumb, and Thumb-2 Instructions
3.3 Program 1: Shifting Data
3.3.1 Running the Code
3.3.2 Examining Register and Memory Contents
3.4 Program 2: Factorial Calculation
3.5 Program 3: Swapping Register Contents
3.6 Program 4: Playing with Floating-Point Numbers
3.7 Program 5: Moving Values between Integer and Floating-Point Registers
3.8 Programming Guidelines
3.9 Exercises
Chapter 4 - Assembler Rules and Directives
4.1 Introduction
4.2 Structure of Assembly Language Modules
4.3 Predefined Register Names
4.4 Frequently Used Directives
4.4.1 Defining a Block of Data or Code
4.4.1.1 Keil Tools
4.4.1.2 Code Composer Studio Tools
4.4.2 Register Name Definition
4.4.2.1 Keil Tools
4.4.2.2 Code Composer Studio
4.4.3 Equating a Symbol to a Numeric Constant
4.4.3.1 Keil Tools
4.4.3.2 Code Composer Studio
4.4.4 Declaring an Entry Point
4.4.5 Allocating Memory and Specifying Contents
4.4.5.1 Keil Tools
4.4.5.2 Code Composer Studio
4.4.6 Aligning Data or Code to Appropriate Boundaries
4.4.6.1 Keil Tools
4.4.6.2 Code Composer Studio
4.4.7 Reserving a Block of Memory
4.4.7.1 Keil Tools
4.4.7.2 Code Composer Studio
4.4.8 Assigning Literal Pool Origins
4.4.9 Ending a Source File
4.5 Macros
4.6 Miscellaneous Assembler Features
4.6.1 Assembler Operators
4.6.2 Math Functions in CCS
4.7 Exercises
Chapter 5 - Loads, Stores, and Addressing
5.1 Introduction
5.2 Memory
5.3 Loads and Stores: The Instructions
5.4 Operand Addressing
5.4.1 Pre-Indexed Addressing
5.4.2 Post-Indexed Addressing
5.5 Endianness
5.5.1 Changing Endianness
5.5.2 Defining Memory Areas
5.6 Bit-Banded Memory
5.7 Memory Considerations
5.8 Exercises
Chapter 6 - Constants and Literal Pools
6.1 Introduction
6.2 The ARM Rotation Scheme
6.3 Loading Constants into Registers
6.4 Loading Constants with MOVW, MOVT
6.5 Loading Addresses into Registers
6.6 Exercises
Chapter 7 - Integer Logic and Arithmetic
7.1 Introduction
7.2 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 C Flag
7.3 Comparison Instructions
7.4 Data Processing Operations
7.4.1 Boolean Operations
7.4.2 Shifts and Rotates
7.4.3 Addition/Subtraction
7.4.4 Saturated Math Operations
7.4.5 Multiplication
7.4.6 Multiplication by a Constant
7.4.7 Division
7.5 DSP Extensions
7.6 Bit Manipulation Instructions
7.7 Fractional Notation
7.8 Exercises
Chapter 8 - Branches and Loops
8.1 Introduction
8.2 Branching
8.2.1 Branching (ARM7TDMI)
8.2.2 Version 7-M Branches
8.3 Looping
8.3.1 While Loops
8.3.2 For Loops
8.3.3 Do-While Loops
8.4 Conditional Execution
8.4.1 v4T Conditional Execution
8.4.2 v7-M Conditional Execution: The IT Block
8.5 Straight-Line Coding
8.6 Exercises
Chapter 9 - Introduction to Floating-Point: Basics, Data Types, and Data Transfer
9.1 Introduction
9.2 A Brief History of Floating-Point in Computing
9.3 The Contribution of Floating-Point to the Embedded Processor
9.4 Floating-Point Data Types
9.5 The Space of Floating-Point Representable Values
9.6 Floating-Point Representable Values
9.6.1 Normal Values
9.6.2 Subnormal Values
9.6.3 Zeros
9.6.4 Infinities
9.6.5 Not-a-Numbers (NaNs)
9.7 The Floating-Point Register File of the Cortex-M4
9.8 FPU Control Registers
9.8.1 The Floating-Point Status and Control Register, FPSCR
9.8.1.1 The Control and Mode Bits
9.8.1.2 The Exception Bits
9.8.2 The Coprocessor Access Control Register, CPACR
9.9 Loading Data into Floating-Point Registers
9.9.1 Floating-Point Loads and Stores: The Instructions
9.9.2 The VMOV instruction
9.10 Conversions between Half-Precision and Single-Precision
9.11 Conversions to Non-Floating-Point Formats
9.11.1 Conversions between Integer and Floating-Point
9.11.2 Conversions between Fixed-Point and Floating-Point
9.12 Exercises
Chapter 10 - Introduction to Floating-Point: Rounding and Exceptions
10.1 Introduction
10.2 Rounding
10.2.1 Introduction to Rounding Modes in the IEEE 754-2008 Specification
10.2.2 The roundTiesToEven (RNE) Rounding Mode
10.2.3 The Directed Rounding Modes
10.2.3.1 The roundTowardPositive (RP) Rounding Mode
10.2.3.2 The roundTowardNegative (RM) Rounding Mode
10.2.3.3 The roundTowardZero (RZ) Rounding Mode
10.2.4 Rounding Mode Summary
10.3 Exceptions
10.3.1 Introduction to Floating-Point Exceptions
10.3.2 Exception Handling
10.3.3 Division by Zero
10.3.4 Invalid Operation
10.3.5 Overflow
10.3.6 Underflow
10.3.7 Inexact Result
10.4 Algebraic Laws and Floating-Point
10.5 Normalization and Cancelation
10.6 Exercises
Chapter 11 - Floating-Point Data-Processing Instructions
11.1 Introduction
11.2 Floating-Point Data-Processing Instruction Syntax
11.3 Instruction Summary
11.4 Flags and Their Use
11.4.1 Comparison Instructions
11.4.2 The N Flag
11.4.3 The Z Flag
11.4.4 The C Flag
11.4.5 The V Flag
11.4.6 Predicated Instructions, or the Use of the Flags
11.4.7 A Word about the IT Instruction
11.5 Two Special Modes
11.5.1 Flush-to-Zero Mode
11.5.2 Default NaN
11.6 Non-Arithmetic Instructions
11.6.1 Absolute Value
11.6.2 Negate
11.7 Arithmetic Instructions
11.7.1 Addition/Subtraction
11.7.2 Multiplication and Multiply–Accumulate
11.7.2.1 Multiplication and Negate Multiplication
11.7.2.2 Chained Multiply–Accumulate
11.7.2.3 Fused Multiply–Accumulate
11.7.3 Division and Square Root
11.8 Putting It All Together: A Coding Example
11.9 Exercises
Chapter 12 - Tables
12.1 Introduction
12.2 Integer Lookup Tables
12.3 Floating-Point Lookup Tables
12.4 Binary Searches
12.5 Exercises
Chapter 13 - Subroutines and Stacks
13.1 Introduction
13.2 The Stack
13.2.1 LDM/STM Instructions
13.2.2 PUSH and POP
13.2.3 Full/Empty Ascending/Descending Stacks
13.3 Subroutines
13.4 Passing Parameters to Subroutines
13.4.1 Passing Parameters in Registers
13.4.2 Passing Parameters by Reference
13.4.3 Passing Parameters on the Stack
13.5 The ARM APCS
13.6 Exercises
Chapter 14 - Exception Handling: ARM7TDMI
14.1 Introduction
14.2 Interrupts
14.3 Error Conditions
14.4 Processor Exception Sequence
14.5 The Vector Table
14.6 Exception Handlers
14.7 Exception Priorities
14.8 Procedures for Handling Exceptions
14.8.1 Reset Exceptions
14.8.2 Undefined Instructions
14.8.3 Interrupts
14.8.3.1 Vectored Interrupt Controllers
14.8.3.2 More Advanced VICs
14.8.4 Aborts
14.8.4.1 Prefetch Aborts
14.8.4.2 Data Aborts
14.8.5 SVCs
14.9 Exercises
Chapter 15 - Exception Handling: v7-M
15.1 Introduction
15.2 Operation Modes and Privilege Levels
15.3 The Vector Table
15.4 Stack Pointers
15.5 Processor Exception Sequence
15.5.1 Entry
15.5.2 Exit
15.6 Exception Types
15.7 Interrupts
15.8 Exercises
Chapter 16 - Memory-Mapped Peripherals
16.1 Introduction
16.2 The LPC2104
16.2.1 The UART
16.2.2 The Memory Map
16.2.3 Configuring the UART
16.2.4 Writing the Data to the UART
16.2.5 Putting the Code Together
16.2.6 Running the Code
16.3 The LPC2132
16.3.1 The D/A Converter
16.3.2 The Memory Map
16.3.3 Configuring the D/A Converter
16.3.4 Generating a Sine Wave
16.3.5 Putting the Code Together
16.3.6 Running the Code
16.4 The Tiva Launchpad
16.4.1 General-Purpose I/O
16.4.2 The Memory Map
16.4.3 Configuring the GPIO Pins
16.4.4 Turning on the LEDs
16.4.5 Putting the Code Together
16.4.6 Running the Code
16.5 Exercises
Chapter 17 - ARM, Thumb and Thumb-2 Instructions
17.1 Introduction
17.2 ARM and 16-Bit Thumb Instructions
17.2.1 Differences between ARM and 16-Bit Thumb
17.2.2 Thumb Implementation
17.3 32-Bit Thumb Instructions
17.4 Switching Between ARM and Thumb States
17.5 How to Compile for Thumb
17.6 Exercises
Chapter 18 - Mixing C and Assembly
18.1 Introduction
18.2 Inline Assembler
18.2.1 Inline Assembly Syntax
18.2.2 Restrictions on Inline Assembly Operations
18.3 Embedded Assembler
18.3.1 Embedded Assembly Syntax
18.3.2 Restrictions on Embedded Assembly Operations
18.4 Calling between C and Assembly
18.5 Exercises
Appendix A: Running Code Composer Studio
A.1 Introduction
A.2 Running Code on the Cortex-M4
A.2.1 Creating a Cortex-M4 Project and Selecting a Device
A.2.2 Creating Application Code
A.2.3 Building the Project and Running Code
Appendix B: Running Keil Tools
B.1 Introduction
B.2 Working with an ARM7TDMI
B.2.1 Creating an ARM7TDMI Project and Selecting a Device
B.2.2 Creating Application Code
B.2.3 Building the Project and Running Code
B.3 Working with a Cortex-M4
B.3.1 Creating a Cortex-M4 Project and Selecting a Device
B.3.2 Creating Application Code
B.3.3 Building the Project and Running Code
Appendix C: ASCII Character Codes
Appendix D
Glossary
References
Internet
Landmarks
Cover