Inline assembly for arm-linux-gcc(ARM926EJ-S)

anandkulkarni anandkulkarni@tataelxsi.co.in
Mon May 9 05:56:00 GMT 2005


Hi gcc gurus,

	  I want to convert the ALREADY EXISTING INLINE ASSEMBLY CODE DEVELOPED IN
ADS to arm-linux-gcc.
        And, I am not getting any concrete info related to: INLINE ASSEMBLY
IN ARM-LINUX-GCC.
        The gcc manual doesnt say much about the constraints and modifiers
that are SPECIFIC TO ARM.
        For illustration I am listing few of the problems I am facing:

        In continuation to our discussion, I am sending the listing the
difficulties I am facing
        in using Inline assembly in gcc(arm-linux-gcc):

                /* ADS code */
                int *temp = (data + j);
                        __asm__ {
                                          LDRD R0,[temp]
                                          MOV data1rd,R0
                                          MOV data1id,R1
                                     }  /* ADS code */



     1. When the first instruction is translated as:
                //  LDRD R0,[temp]
                        __asm__ ( "LDRD r0, (%0)"
                                         :
                                         :"g"(temp)
                                         );

I am getting following error:
[anand@dd2testing2 HE-AAC]$ make
/tmp/cci4CSSE.s: Assembler messages:
/tmp/cci4CSSE.s:188: Error: missing ']'
/tmp/cci4CSSE.s:188: Error: missing ')'
/tmp/cci4CSSE.s:188: Error: garbage following instruction -- `ldrd
r0,([fp,#-80])'

                Further, when the parenthesis around %0 are removed, the
instruction is assembled without any concern.
                But, that may not serve the purpose as 'temp' is a pointer.
And, the operand ordering is not
                in aaccordance with gcc.

        Can I get more info on the order of operands and the constraints
that apply in case of ARM(ARM926EJ-S, to be specific).
        How can I differentiate a ordinary variable and a pointer derefrence
in inline assembly.



        For the second instruction has been translated as:

                        __asm__ ( "MOV r0, %0"
                                         :"+g"(data1rd)
                                         :
                                        );

        and this givesthe following error:

[anand@dd2testing2 HE-AAC]$ make
/tmp/cc0xa7Fh.s: Assembler messages:
/tmp/cc0xa7Fh.s:190: Error: register or shift expression expected -- `mov
r0,[fp
,#-72]'


        Please can soemone suggest a better source in this regard(Inline
assemly in C source files in arm-linux-gcc)

                Regards,
                        Anand Kulkarni
                        +91 9880781187



More information about the Gcc-help mailing list