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.

Compiler/TMS320C5505: assembly in c

Part Number: TMS320C5505

Tool/software: TI C/C++ Compiler

hello,

i want to write hwafft code.

the file provided by TI are assmbly lang. hwafft.asm, hwafft_rom.asm

how to implement these files in c project. i have already implemented but giving error for run time model options..

is there any way to write the assembly functions directly in c code and what is the syntax..do u have any example for the same.

  • Hi Kanchan,

    The SPRABB6 zip file includes two asm files.
    hwafft_rom.asm - the hwafft C-callable assembly routines as they are in the ROM of the C55xx device. But the ROM code includes a bug - HWAFFT Data and Scratch Pointers Copied as 16-Bit Instead of 23-Bit. Refer to the errata for more details.
    There are two workarounds suggested.

    hwafft.asm - the hwafft C-callable assembly routines with the 16-bit pointer bug fixed by using 23-bit pointers (one of the proposed workarounds for the bug). Instead of residing in ROM, the code takes up RAM. You must also remove the function pointer addresses from the linker .cmd file to force the linker to use this assembly code from RAM instead of the assembly code stored in ROM.

    The hwafft routines in hwafft.asm and hwafft_rom.asm are all C-callable. They push onto the stack like any C function call, so you just call them like any function call from a C file with the below syntax:
    out_sel = hwafft_Npts(data, scratch, fft_flag, scale_flag);

    Refer to the HWAFFT appnote for more usage details.

    =-=-=-=-
    FYI - you can call assembly from C-code with the below syntax (algebraic and mnemonic assembly shown):

    asm(" bset xf"); // mnemonic assembly, Set XF ouput high
    asm(“ BCLR ST3_CLKOFF”); // mnemonic assembly, Set CLKOUT pin to toggle
    asm(“ BSET ST3_CLKOFF”); // mnemonic assembly, Disable CLKOUT pin

    asm(" bit(ST1, #ST1_XF) = #0"); //algebraic assembly, Set XF ouput low
    asm(" bit(ST1, #ST1_XF) = #1"); //algebraic assembly, Set XF ouput high

    You can change assembly style from algebraic to mnemonic in the project build settings, or for an individual file by right clicking it and going into the properties for that one file.

    Hope this helps,
    Mark

  • thats great...thanks a lot Mark for the deep and clear answer..thank u so much

  • hii mark,

    as per ur guidance i removed hwafft.asm and added the following addresses at the end of .cmd file..

    _hwafft_br = 0x00ff6cd6;
    _hwafft_8pts = 0x00ff6cea;
    _hwafft_16pts = 0x00ff6dd9;
    _hwafft_32pts = 0x00ff6f2f;
    _hwafft_64pts = 0x00ff7238;
    _hwafft_128pts = 0x00ff73cd;
    _hwafft_256pts = 0x00ff75de;
    _hwafft_512pts = 0x00ff77dc;
    _hwafft_1024pts = 0x00ff7a56;

    but when i debug the proram it doesnt go to the function's location it says  No source available for "0xff6cd6"

    why so..what the problem 

     

  • Hi Kanchan,

    When you execute the HWAFFT code from ROM (which is what those addresses in the .cmd file point to) the debugger does not know where to find the source code to step through that code.

    You can still follow along by looking at assembly by viewing the dissasembly. From CCS, in the Debug perspective, click on View --> Dissasembly. Now you can single step through the assembly code by clicking on the green arrows for "Assembly Single Step Into" and "Assembly Single Step Over".

    It is only recommended to switch from using the hwafft.asm file to using the HWAFFT code in ROM once the code is fully debugged and functional. Using the HWAFFT code from ROM frees up your RAM for other things like more program or more data.

    Make sure you are using the bugfixed hwafft.asm available from SPRABB6.zip. The details of the bug relate to 16-bit pointer addresses used instead of 23-bit pointer addresses. There are other workarounds described in the errata if you wish to use the HWAFFT code in ROM.

    Hope this helps,
    Mark