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.

Call a C-callable assembly by assembly

Hello,

i am a beginner in DSP and i have to implement a FFT in assembly - i can't use C. I am working with the "TMS320C55x DSP Library" and trying to implement 55x_src/cfft_noscale.asm

These questions may be very basic, but i just started with DSP and assembly at all:

- What do i have to do exactly, to call the given c-callable assembly by assembly directly?
- I thought that calling an assembly routine by a C-function call, the parameters are pushed to stack. But in cfft_noscale.asm, i can't see an accordingly pop-command?

What i tried so far:


MOV #100h, T0 ;number of samples
MOV #in, AR0 ;sample vector address
CALL _cfft_NOSCALE

 

This doens't seem to work, because the output seems to be some random noise.

Thank you.

 

 

  • Florian,

    Details on C callable assembly routines are available in the TMS320C55x Optimizing C/C++ Compiler User's Guide (http://www-s.ti.com/sc/techlit/spru281), sec 6.3-6.5.  To reduce latency function parameters are passed through registers rather than the stack.

    Regards.

  • Thank you, very helpful information.

    But what i still don't know: Is it possible to call one of the C-callable assemblies from the C55x DSP Library Package by assembly?
    I mean, the examples show how they are called by C, but i need to call them by assembly. Do i have to make any modifications to the assembly functions? Can i simply call them with "CALL _cfft_NOSCALE" correctly?

    Thanks again, regards.

  • Florian,

    Yes it is possible to call DSP Lib functions from assembly language routines.  After all, the C source is converted to assembly by the compiler.  You can look at the source code for the particular routine you want to use to get the correct name, but I believe your example is correct in that the function name has leading underscore (_) when called from assembly.  The other thing you need to take care of is to put the parameters that are passed to the DSPLIB function in the correct registers.  This is described in the C Compiler document that I pointed you to earlier and also you can look at the source code for verification on where parameters are retrieved and where they return values are placed.

    Regards.