|Non-Confidential||PDF version||ARM DUI0472J|
|Home > Using the Inline and Embedded Assemblers of the ARM Compiler > Effect of compiler ARM and Thumb states on embedded assembler|
The initial state of the embedded assembler, ARM or Thumb state, is determined by the initial state of the compiler, as specified on the command line.
This means that:
If the compiler starts in ARM state, the embedded assembler uses
If the compiler starts in Thumb state, the embedded assembler uses
The embedded assembler state at the start of each function is as set by the invocation of
the compiler, as modified by
#pragma arm and
You can change the state of the embedded assembler within a function by using explicit
CODE16 directives in the
embedded assembler function. Such a directive within an
__asm function does
not affect the ARM or Thumb state of subsequent
If you are compiling for a 32-bit Thumb capable processor, you can use both 32-bit encoded Thumb instructions and 16-bit encoded Thumb instructions when in Thumb state.
If you are compiling for a 16-bit Thumb capable processor, you can only use 16-bit encoded Thumb instructions when in Thumb state.