
DR
AFT
DR
AFT
DRAFT
DR
D
RAFT
DRAFT
DRA
FT DRAF
D
RAFT DRAFT DRAFT DRAFT DRAFT D
DRAFT
D
RAFT DRA
FT DRAFT DRAFT DRAFT DRA
UM10360_0
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 00.06 — 5 June 2009
644 of 808
NXP Semiconductors
UM10360
Chapter 34: Appendix: Cortex-M3 User Guide
•
do not use PC
•
do not use SP for
Rd
and
Rt
•
for
STREX
,
Rd
must be different from both
Rt
and
Rn
•
the value of
offset
must be a multiple of four in the range 0-1020.
2.4.8.4
Condition flags
These instructions do not change the flags.
2.4.8.5
Examples
MOV
R1, #0x1
; Initialize the ‘lock taken’ value
try
LDREX
R0, [LockAddr]
; Load the lock value
CMP
R0, #0
; Is the lock free?
ITT EQ
; IT instruction for STREXEQ and CMPEQ
STREXEQ R0, R1, [LockAddr]
; Try and claim the lock
CMPEQ
R0, #0
; Did this succeed?
BNE
try
; No – try again
....
; Yes – we have the lock