10.99 #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)
#pragma pop         // restore saved pragma state, back to arm state
int main(void)
Related reference
8.7 --arm
8.177 --thumb
10.76 #pragma arm
10.96 #pragma pop
10.97 #pragma push
Non-Confidential PDF file icon PDF version ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.