Calling c functions from assembly file in codewarrior for MCF5485 Coldfire

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calling c functions from assembly file in codewarrior for MCF5485 Coldfire

1,127 Views
preetuabraham
Contributor III

Hi,

 

 

I am working with "CodeWarrior for MCU Version: 10.6" for MCF5485 coldfire .

I have some functions in my C-File. I have to call those function in the .s file.

 

Could you please give me the procedure to call the functions and to pass the parameters.

Labels (1)
0 Kudos
2 Replies

607 Views
miduo
NXP Employee
NXP Employee

Hi,

Assembly language programs can call the functions written in either C or assembly language. From within the assembly language instructions, you can call the C functions. For example, if the C function definition is:

int  my_c_func ( int  i)

{

 return  i++;

}

the assembly language calling statement should be:

jsr _my_c_func

0 Kudos

607 Views
TomE
Specialist II

Search this forum for "calling c from assembly" and see if any of them help.I gave up counting at ONE HUNDRED. You should search before posting (and if you have searched and found nothing, say so, and detail why your problem is different from the previous ones).

Watch out that the ABI changed after CW 7.2, so any examples prior to that (MOST examples are prior to that) won't work on later CW versions.

I only know the ABI for gcc, and that's different to CW.

Why do you need to call C from Assembly? It is usually always better to get from Assembly into C ASAP and then stay there.

Tom

0 Kudos