ARM Instruction Reference
ARM DUI 0068B
Copyright © 2000, 2001 ARM Limited. All rights reserved.
4-83
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 range of the
MOV
and
MVN
instructions
•
To load a program-relative or external address into a register. The address remains
valid regardless of where the linker places the ELF section containing the
LDR
.
Note
An address loaded in this way is fixed at link time, so the code is
not
position-independent.
The offset from the PC to the value in the literal pool must be less than 4KB. You are
responsible for ensuring that there is a literal pool within range. See
LTORG
on
page 7-14 for more information.
See
Loading constants into registers
on page 2-25 for a more detailed explanation of
how to use
LDR
, and for more information on
MOV
and
MVN
.
Example
LDR r3,=0xff0 ; loads 0xff0 into r3
; => MOV r3,#0xff0
LDR r1,=0xfff ; loads 0xfff into r1
; => LDR r1,[pc,offset_to_litpool]
; ...
; litpool DCD 0xfff
LDR r2,=place ; loads the address of
; place into r2
; => LDR r2,[pc,offset_to_litpool]
; ...
; litpool DCD place
Содержание Developer Suite
Страница 10: ...Preface x Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...
Страница 110: ...Assembler Reference 3 32 Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...
Страница 185: ...ARM Instruction Reference ARM DUI 0068B Copyright 2000 2001 ARM Limited All rights reserved 4 75 Example MSR CPSR_f r5 ...
Страница 238: ...Thumb Instruction Reference 5 44 Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...
Страница 282: ...Vector Floating point Programming 6 44 Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...
Страница 360: ...Index Index 6 Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...