Re: ARM Assembler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I finally figured it out (see code segment below) and, of course, it makes
sense after the fact.  I had read the GCC manual on this topic, searched
the internet, and looked at sample code but nothing was explicit for this
particular form.  I guess the key is to write the complete assembly
instruction with a dummy parameter (%0) where you want the variable to
reside and then define the variable at the end of the expression.  Sort of
postfix notation versus the ARM compiler infix notation.

unsigned int T32_TsMon_SendStatus(void)
{
    int             status;

    __asm ("MRC             p14, 0, %0, c0, c1, 0" : "=r" (status));

    return (status & 0x20000000);
}


Tom Lillevig
Rockwell Collins
319-295-1747



                                                                           
             Richard Earnshaw                                              
             <Richard.Earnshaw                                             
             @buzzard.freeserv                                          To 
             e.co.uk>                  jtlillev@xxxxxxxxxxxxxxxxxxx        
             Sent by:                                                   cc 
             rearnsha@buzzard.         gcc-help@xxxxxxxxxxx,               
             freeserve.co.uk           Richard.Earnshaw@xxxxxxxxxxxxxxxxxx 
                                       co.uk                               
                                                                   Subject 
             07/22/2006 10:25          Re: ARM Assembler                   
             AM                                                            
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




On Fri, 21 Jul 2006 10:28:46 CDT, jtlillev@xxxxxxxxxxxxxxxxxxx wrote:
> I have installed the GCC toolset for the ARM processor and have tried
test
> compiling a few files.  One of the files uses the debug co-processor port
> (CP14) assembly instructions and I am having difficulty getting the
syntax
> correct for use with the GCC ARM Assembler.  The line of code is:
>
>      __asm ("MRC             p14, 0, status, c0, c1, 0");
>
> This is just a slightly modified syntax from what works with the ARM RVDS
> toolset (these files are examples from ARM).  The assembler error is that
> it expects an ARM register to be specified in the command.  I'm assuming
> that it is complaining about "c0" and "c1" which are registers associated
> with the debug port.  The target processor is the 1136JF-S but I have not
> been able to find a register definition file for it anywhere.  Even if I
> did, I'm not sure that the assembler would know anything about it when
> parsing this command.  I would appreciate any help you can provide.

You'll need to read the gcc manual to see how to invoke the gnu inline
assembler.  In particular, unlike armcc, you can't just substitute in your
source code variables.  Instead you need to describe the type of register
that is used and the variable that it needs to contain.

R.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux