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 call a extern function within embedded ASM ?

Note: This was originally posted on 4th June 2009 at http://forums.arm.com

is it possibe to get the embedded assembly to call my function1()?
How do I write this ?

Thanks!
Parents
  • Note: This was originally posted on 5th June 2009 at http://forums.arm.com

    #include <string.h>

    __asm int myasm(char *r0)
    {
      B __cpp(strlen);
    }

    int main(void)
    {
      return myasm("abcd");
    }


    Compiles and links quite happily.


    For C code, generally, __cpp isn't needed (but you'll need to do an IMPORT for the name) because the symbol name is same as the name in the source code.  This isn't the case for C++ code - in that case __cpp will mangle the name to the correct symbol name so that it links correctly.

    I think (well, above example proves it) __cpp also adds in the necessary IMPORT directives too, so generally it's good practice to use __cpp(x) when comunicating between the C/C++ and embedded asm code.
Reply
  • Note: This was originally posted on 5th June 2009 at http://forums.arm.com

    #include <string.h>

    __asm int myasm(char *r0)
    {
      B __cpp(strlen);
    }

    int main(void)
    {
      return myasm("abcd");
    }


    Compiles and links quite happily.


    For C code, generally, __cpp isn't needed (but you'll need to do an IMPORT for the name) because the symbol name is same as the name in the source code.  This isn't the case for C++ code - in that case __cpp will mangle the name to the correct symbol name so that it links correctly.

    I think (well, above example proves it) __cpp also adds in the necessary IMPORT directives too, so generally it's good practice to use __cpp(x) when comunicating between the C/C++ and embedded asm code.
Children
No data