This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I am trying to call C function from Assembly File. But couldnt find any document where function is actually called. Please provide syntax for the same.
Regards,
.cdecls C,LIST, "sense.h" .global Isense ;; Isense is afunction defined in sense.h ISR: ;;;some assembly code calling C function Isense ;;;some assembly code .end
By looking at your other posts, I can see that you use a C28x processor.
It appears you want to implement an interrupt service routine (ISR) in hand-coded assembly, and have it call a C function. Is that correct? Can this ISR presume the C environment (particularly the stack) has been established?
Hoping to find an example, I checked our manuals, wiki articles, and the like. I have not found anything yet.
Thanks and regards,
-George
I cannot find an example. I think I can come up with most of one. But I will not get to that today.
Thanks and regards,
-George
Shiv Aishwarya Singh said:What I am missing here?
I'm not sure. My guess is you are not returning from the interrupt with the instruction IRET. This quote is from the C28x CPU book ...
The IRET instruction restores the PC value and other register values that were automatically saved by an interrupt operation.
Recall I told you I would show an example to work with. I gave it a go. I now think I lack the expertise needed to do this reliably. I started by compiling this C routine ...
interrupt void isr() { Isense(); }
That's how you would do it in C. I built with the option --src_interlist. This option causes the compiler to not delete the resulting .asm file, and add some comments which make it easier to follow. I understand the resulting assembly at a high level. But I cannot explain it in close detail. I will ask other experts to comment on this thread.
Thanks and regards,
-George