The STM32 Cortex-M4 instruction set
B cond label is the only conditional instruction that can be either inside or outside an IT
block. All other branch instructions must be conditional inside an IT block, and must be
unconditional outside the IT block, see
Table 33
B label
Bcond label (outside IT block)
Bcond label (inside IT block)
BL{cond} label
BX{cond} Rm
BLX{cond} Rm
You might have to use the .W suffix to get the maximum branch range. See
selection on page
Restrictions
The restrictions are:
•
Do not use PC in the BLX instruction
•
For BX and BLX, bit[0] of Rm must be 1 for correct execution but a branch occurs to the
target address created by changing bit[0] to 0
•
When any of these instructions is inside an IT block, it must be the last instruction of the
IT block.
Bcond is the only conditional instruction that is not required to be inside an IT block.
However, it has a longer branch range when it is inside an IT block.
Condition flags
These instructions do not change the flags.
Examples
B
BLE
B.W
BEQ
BEQ.W
BL
BX
BXNE
142/260
shows the ranges for the various branch instructions.
Instruction
67.
loopA
; Branch to loopA
ng
; Conditionally branch to label ng
target ; Branch to target within 16MB range
target ; Conditionally branch to target
target ; Conditionally branch to target within 1MB
funC
; Branch with link (Call) to function funC, return address
; stored in LR
LR
; Return from function call
R0
; Conditionally branch to address stored in R0
IT on page
144.
Table 33. Branch ranges
DocID022708 Rev 6
Branch range
− 16 MB to +16 MB
− 1 MB to +1 MB
− 16 MB to +16 MB
− 16 MB to +16 MB
Any value in register
Any value in register
Instruction width
PM0214
Need help?
Do you have a question about the STM32F4 Series and is the answer not in the manual?
Questions and answers