UM10462
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2016. All rights reserved.
User manual
Rev. 5.5 — 21 December 2016
462 of 523
NXP Semiconductors
UM10462
Chapter 24: LPC11U3x/2x/1x Appendix ARM Cortex-M0
ADR facilitates the generation of position-independent code, because the address is
PC-relative.
If you use ADR to generate a target address for a BX or BLX instruction, you must ensure
that bit[0] of the address you generate is set to 1 for correct execution.
24.4.4.1.3
Restrictions
In this instruction
Rd
must specify R0-R7. The data-value addressed must be word
aligned and within 1020 bytes of the current PC.
24.4.4.1.4
Condition flags
This instruction does not change the flags.
24.4.4.1.5
Examples
ADR
R1, TextMessage ; Write address value of a location labelled as
; TextMessage to R1
ADR R3, [PC,#996]
; Set R3 to value of PC + 996.
24.4.4.2 LDR and STR, immediate offset
Load and Store with immediate offset.
24.4.4.2.1
Syntax
LDR
Rt
, [<
Rn
| SP> {, #
imm
}]
LDR<B|H>
Rt
, [
Rn
{, #
imm
}]
STR
Rt
, [<
Rn
| SP>, {,#
imm
}]
STR<B|H>
Rt
, [
Rn
{,#
imm
}]
where:
Rt is the register to load or store.
Rn is the register on which the memory address is based.
imm
is an offset from
Rn
. If
imm
is omitted, it is assumed to be zero.
24.4.4.2.2
Operation
LDR, LDRB and LDRH instructions load the register specified by
Rt
with either a word,
byte or halfword data value from memory. Sizes less than word are zero extended to
32-bits before being written to the register specified by
Rt
.
STR, STRB and STRH instructions store the word, least-significant byte or lower halfword
contained in the single register specified by
Rt
in to memory. The memory address to load
from or store to is the sum of the value in the register specified by either
Rn
or SP and the
immediate value
imm
.
24.4.4.2.3
Restrictions
In these instructions:
•
Rt
and
Rn
must only specify R0-R7.