This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to set the compiler to generate ARM code of a function?

Hello
There's one source file which contais several functions. Some of functions should be generated ARM mode code and the other functions should be generated thumb code. I read the examples of interworking in the Keil MDK and I found that it is easy to set all the functions in one file to generate ARM code. But I didn't found how to set part of the functions to generate ARM code. In IAR, there's a keyword named __arm which sets the function to generate ARM code. Is there a similar keyword in Keil MDK? Who can tell me how to do it? Thanks.

Parents
  • //...
    #pragma push   // save current mode
    
    #pragma arm    // use arm mmode
    int iAdd_A (int i1, int i2, int i3, int i4)  {
      return (i1 + i2 + i3 + i4);
    }
    
    #pragma thumb  // use thumb mode
    int iAdd_T (int i1, int i2, int i3, int i4)  {
      return (i1 + i2 + i3 + i4);
    }
    
    #pragma pop    // restore previous mode
    
    int main (void)  {
    //...
    }
    

Reply
  • //...
    #pragma push   // save current mode
    
    #pragma arm    // use arm mmode
    int iAdd_A (int i1, int i2, int i3, int i4)  {
      return (i1 + i2 + i3 + i4);
    }
    
    #pragma thumb  // use thumb mode
    int iAdd_T (int i1, int i2, int i3, int i4)  {
      return (i1 + i2 + i3 + i4);
    }
    
    #pragma pop    // restore previous mode
    
    int main (void)  {
    //...
    }
    

Children
No data