The Definitive Guide to the ARM Cortex-M3

Chapter 4: Instruction Sets

This chapter provides some insight into the instruction set in the Cortex-M3 and examples for a number of instructions. You'll also find a quick reference of the support instructions in Appendix A of this book. For complete details of each instruction, refer to the ARM v7-M Architecture Application Level Reference Manual (Ref 2).

Assembly Basics

Here we introduce some basic syntax of ARM assembly to make it easier to understand the rest of the code examples in this book. Most of the assembly code examples in this book are based on the ARM assembler tools, with the exception of those in Chapter 19, which focus on the GNU tool chain.

Assembler Language: Basic Syntax

In assembler code, the following instruction formatting is commonly used:

label        opcode operand1, operand2,... ; Comments

The label is optional. Some of the instructions might have a label in front of them so that the address of the instructions can be determined using the label. Then you will find the opcode (the instruction), followed by a number of operands. Normally, the first operand is the destination of the operation. The number of operands in an instruction depends on the type of instruction, and the syntax format of the operand can also be different. For example, immediate data are usually in the form # number, as here:

    MOV R0, #0x12 ; Set R0 = 0x12 (hexadecimal)    MOV R1, #'A'  ;

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Label and Nameplate Services
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.