Changing between ARM, Thumb, and ThumbEE state
The processor must be in the correct instruction set state for the instructions it is executing.
A processor that is executing ARM instructions is operating in ARM state. A processor that is executing Thumb instructions is operating in Thumb state. A processor that is executing ThumbEE instructions is operating in ThumbEE state. A processor can also operate in another state called the Jazelle® state. These are called instruction set states. The assembler cannot directly assemble code for the Jazelle state.
A processor in one instruction set state cannot execute instructions from another instruction set. For example, a processor in ARM state cannot execute Thumb instructions, and a processor in Thumb state cannot execute ARM instructions. You must ensure that the processor never receives instructions of the wrong instruction set for the current state.
The initial state after reset depends on the processor being used and its configuration.
To direct the assembler to generate ARM or Thumb instruction encodings, you must set
assembler mode using an
THUMB directive. To
generate ThumbEE code, use the
THUMBX directive. Assembly code using
CODE16 directives can still be assembled, but
ARM recommends using
THUMB for new code.
These directives do not change the instruction set state of the processor.
To do this, you must use an appropriate instruction, for example
BLX to change between ARM and Thumb
states when performing a branch.