Thumb Instruction Reference
ARM DUI 0068B Copyright © 2000, 2001 ARM Limited. All r ights reserved. 5-41
5.6.2 LDR Thumb pseudo-instruct ion
The
LDR
pseudo-instruction loads a low register with either:
a 32-bit constant value
an address.
Note
This section describes the
LDR
pseudo-instruction only. See Thumb memory access
instructions on page 5-4 for information on the
LDR
instruction.
Syntax
LDR register, =[expr | label-exp]
where:
register
is the register to be loaded.
LDR
can access the low registers (r0-r7) only.
expr
evaluates to a numeric constant:
if the value of
expr
is within range of a
MOV
instruction, the
assembler generates the instruction
if the value of
expr
is not within range of a
MOV
instruction, the
assembler places the constant in a literal pool and generates a
program-relative
LDR
instruction that reads the constant from the
literal pool.
label-exp
is a program-relative or external expression. The assembler places the
value of
label-exp
in a literal pool and generates a program-relative
LDR
instruction that loads the value from the literal pool.
If
label-exp
is an external expression, or is not contained in the current
section, the assembler places a linker relocation directive in the object
file. The linker ensures that the correct address is generated at link time.
The offset from the pc to the value in the literal pool must be positive and less than 1KB.
You are responsible for ensuring that there is a literal pool within range. See LTORG on
page7-14 for more information.
Usage
The
LDR
pseudo-instruction is used for two main purposes:
To generate literal constants when an immediate value cannot be moved into a
register because it is out of ra nge of the
MOV
instruction.