DSPRelated.com
Forums

Assembly Program

Started by Manish Ranade May 20, 2003
Hi,

I am using TMS320C6711.

I am writing assembly code for Haar wavelet and I am calling that funtion from C
code. When I run that program CPU keeps running and hangs in the end.

when i saw the values of registers by using watch window, values are correct.

can anybody help me in this problem?

one more thing, in linear assembly(*sa) we use ".return" statement for returning
the result from the function to C code. for assembly(*.asm) how we return the
value from funtion?

Thank You
Manish



> I am writing assembly code for Haar wavelet and I am calling that
funtion from C code. When I run that program CPU keeps running and
hangs in the end.
>
> when i saw the values of registers by using watch window, values
are correct.
>
> can anybody help me in this problem?

When you write assembly routines, you have to take care of
preserving some registers (A10..A15, B10..B15) by pushing them
on the stack before changing their value, and popping them back
before returning.
The other registers have to be preserved by the calling entity.

> one more thing, in linear assembly(*sa) we use ".return" statement
for returning the result from the function to C code. for assembly
(*.asm) how we return the value from funtion?

For this and for the topic above, may I suggest you to read the
spru187k document (C Compiler User's Guide).

You will find register conventions in paragraph 8.3 page 244.
You can see there what registers have to be preserved, and
what registers are used for passing parameters and returning
a value.

In summary, A5:A4, B5:B4, A7:A6,... are used for passing params.
You have to place the return value in A5:A4 before returning
(by performing a branch on B3 address)

I hope this helps

Regards,

J-F