Non-Confidential |
![]() |
ARM DUI0472J | ||
|
||||
Home > Compiler-specific Features > #pragma thumb |
This pragma switches code generation to the Thumb instruction set. It overrides the --arm
compiler option.
If you are compiling code for a Thumb processor without Thumb-2 technology and using VFP, any function containing floating-point operations is compiled for ARM.
Use #pragma push
and #pragma pop
on #pragma
arm
or #pragma thumb
outside of functions, but not inside of
them, to change state. This is because #pragma arm
and #pragma
thumb
only apply at the function level. Instead, put them around the function
definition.
#pragma push // in arm state, save current pragma state #pragma thumb // change to thumb state void bar(void) { __asm { NOP } } #pragma pop // restore saved pragma state, back to arm state int main(void) { bar(); }