10.101 #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();
}
Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.