DSPRelated.com
Forums

Re: Interfacing C & Assembly

Started by Andrew V. Nesterov August 20, 2001

Passing parameters to an assembly function is described in
the SPRU187 C6x Optimizing C Compiler:
Chapter Runtime Environment:
C System Stack,
Register Conventions,
Function Structure and Calling Conventions,
Interfacing C with Assembly Language

All that is required is to conform to C calling conventions,
and save a part of the register file on the stack. The procedure
is fairly simple and well described in the above sections.

For example, parameters, or at least 10 of them are passed in
registers A4, B4, A6, B6, A8, B8, A10, B10, A12, B12,
the rest of parameters is passed on the stack. Result is returned
in A4, or in A3 if a pointer is returned. A parameter that
is longer than a word is passed in a pair of registers A5:A4,
B5:B4, ..., B13:B12.

Regards,
Andrew

On 20 Aug 2001 "Nikhil S. Parvatikar" <> wrote:

> Hi !
>
> I need a help.
> I have worked earlier on C54x CCS Simulator
> I am trying to Interface C & assembly ( basically trying to pass
> parameters from C to Assembly ).
> My problem is I am not able to pass parameters from C to Assembly for
> C67xx Simulator Mode :
>
> I have also gone through the C67xx Optimizer C users guide from TI.
> Is there any Compiler/Assembler options to be set..........
>
> Kindly suggest a solution for the above problem .
> I would be grateful to u if u can suggest some worked examples regd
> passing parameters fron C to C6x Assembly.
>
> thanks,
> nikhil
>
> This is what i am trying to do .........
>
> Example C File
>
> main()
> {
> extern int nikhil();
> ............
> .........
> ....
> nikhil();
> }
>
> Assembly File
>
> .def _nikhil:
> _nikhil: Function in assembly. >
>
> [This message contained attachments] >
> ________________________________________________________________________
> ________________________________________________________________________ >
> ">http://docs.yahoo.com/info/terms/


Hi !
 
I need a help.
I have worked earlier on C54x CCS Simulator
I am trying to Interface C & assembly ( basically trying to pass parameters from C to Assembly ).
My problem is I am not able to pass parameters from C to Assembly for C67xx Simulator Mode  :
 
I have also gone through  the C67xx Optimizer C users guide from TI.
Is there any Compiler/Assembler options to be set..........
 
Kindly suggest a solution for the above problem .
I would be grateful to u if u can suggest some worked examples regd passing parameters fron C to C6x Assembly.
 
thanks,
nikhil
 
This is what i am trying to do .........
 
Example C File  
                                                         
main()                                                                       
{                                                                       
extern int nikhil();
............
.........
....
nikhil();
}
 
Assembly File
 
.def  _nikhil: 
_nikhil:    Function in assembly.