Hi,
I am new to ARM.
I have an assembler function (declared in assembler RealView) that is invoked in a C file by the C language convention.
How can I pass arguments from this function invokation in C to the assembler. Do I have to use any registers for it? Or can I simply reserve a memory area? -> This is possible for 8051 but how looks it for the ARM architecture using RealView?
Thanks in advance!
Yes, of course it is possible: the whole point of assembler is that you can generate the precise sequence of instructions that you require - and that includes generating a sequence of instructions that is compatible with any compiler's calling convention.
The difficulty here is finding what calling convention the RealView compiler uses!
I've noted here before that the RealView documentaion seems to be particularly poor in terms of being able to actually find information like this!
:-(
The C51 manuals provide it in a clearly-titled chapter, "interfacing 'C' to assembler" As it is such a common requirement - especially in embedded systems - the RealView documentation really ought to have an equally easy-to-find section.
Anyhow, I think ARM themselves define a standard calling convention; the ABI (ARM Binay Interface?) - so it's probably worth searching on the ARM site for that...
Actually, it's "Application Binary Interface"
A search on this site for "ABI" gives: http://www.keil.com/support/man/docs/armlib/armlib_cjaifjga.htm
Which is in the "RealView Libraries and Floating Point Support Guide" - and not in any of the actual compiler manuals!
HI.
you {normally} pass parameters in registers and not in fixed locations.
neil is right. the abi has details. u can see here
infocenter.arm.com/.../IHI0042C_aapcs.pdf
plz look at page 15 and 16 for important imformation with register use.
u can learn what is used and what needs preserving. v important for reliable systems.
always yo're freind.
Zeusti.
But still unable to spell "your"
Another alternative is to write a C function and use the generated asssembler code as skelleton for your assembler file.
"...asssembler code as skelleton..."
Starting to wonder whether this mis-spelling is catching ;)
Yep, Zeusti's infection with Mispeling Vyrus seems to be on the verge of an outbreak. Somebody alert Jurisfiction!
(Kudos to Jasper Fforde)
Well, I could blame my keyboard, but the truth is that I'm not better than that. Had to let Google confirm the correct spelling of skeleton.
And did you google asssembler ;) ;)
No. That one was just a case of too thick fingers :)
If you do google asssembler, it says, "Did you mean: assembler" - and shows the 1st 2 hits that match "assembler".
It then goes on to show you about 2,730 hits for "asssembler"!!
www.google.co.uk/search
We apparently have a whole lot more asssembling going on over here across the pond. google.com (i.e., not '.co.uk) shows 13,800 hits! No, it's not a competition for who has the most asssemblers.
Or the worst spellers...?
Indeed. I was shocked to see that the majority of what Google offered were links to those advertising a job or those seeking a job.
Maybe asssembler is related to ass semblance?