9.97 #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.

Usage

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();
}
Related reference
7.7 --arm
7.160 --thumb
9.74 #pragma arm
9.94 #pragma pop
9.95 #pragma push
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.