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.

TMS320F280025: Code optimizations and TMU instructions in assembly listing

Part Number: TMS320F280025

We are working on code optimizations due to processor bandwidth limitations. We have done the following settings for processor settings and optimizations:

Please let us know if the above settings are good or we can further improve execution speed of the code?.

We expect that TMU instructions should be used for trigonometric functions such as Sin etc. For confirming that our settings are correct, we were looking at the assembly listing of our code to see if TMU instructions are there. Following is one listing:

270 Ts= sin(Fs);
08467e: 764886DF LCR __relaxed_sinf
084680: E2030052 MOV32 *-SP[18], R0H

Ts and Fs are both floating point numbers. The compiler is using __relaxed_sinf instruction. We were expecting SINPUF32. Please explain this difference.

  • Which version of the compiler are you using, and can you post the complete command line?

    Looking at ti-cgt-arm_20.2.5.LTS/lib/src/math.h there is the following which has macros which re-define sinf() and cosf() to inline functions  __relaxed_sinf() and __relaxed_cosf():

    #define sinf   __relaxed_sinf
    __inline float __relaxed_sinf(float x)
    {
        return __sin(x);
    }
    #define cosf   __relaxed_cosf
    __inline float __relaxed_cosf(float x)
    {
        return __cos(x);
    }

    Using the V20.2.5.LTS compiler if select --disable_inlining then the compiler calls  __relaxed_sinf() rather than using a pair of DIV2PIF32 / SINPUF32 instructions:

    Therefore, think your issue is caused by function inlining not being performed by the compiler for some reason.

  • I am unable to reproduce this result ...

    The compiler is using __relaxed_sinf instruction.

    For the source file being built when you see this result, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Thank you very much for replying before the next year Slight smile. I have checked the compiler version. It was 20.2.4.LTS. I have now changed it to 21.12.0.STS. Do you mean the following listing by command line?

    Its my bad for missing an important piece of information. I had disabled optimization for debugging purpose so that the assembler listing corresponds to my source code line numbering. So the assembly listing shared earlier was with optimizations turned off. With optimizations turned ON again the assembly listing appears as below:

    The new listing now contains the TMU instructions. I think optimizations being turned off was the reason for missing TMU instructions. 

  • Hi George,

         I think that my response to Chester Gillon explains why you were unable to produce the issue at your end. It will be really nice if you can advise me on the best optimizations settings that I should use for achieving fastest code execution time. We are basically running control algorithm for power converter and the code is being generated with Matlab embedded code generation tool. Can you refer me to suitable technical reference that explains any settings that we should be using with Matlab code generation such that the generated code makes best use of FPU and TMU features of our TI controller. We understand that our code generation is not optimal for our controller capabilities.

  • All of the compiler options you show in your first post look fine.  That said, feel free to experiment with the setting of --opt_for_speed.  That controls the trade off between code size and speed.

    refer me to suitable technical reference

    Please see the C28x compiler manual.

    Thanks and regards,

    -George

  • Kindly let me know if there is any documentation relating to MATLAB embedded code generation settings as relating C28x controller series. The aim is to generate code that makes use of hardware features such as FPU and TMU for optimal processing speed.

  • if there is any documentation relating to MATLAB embedded code generation settings as relating C28x controller series

    I'm not aware of any such documentation.

    Thanks and regareds,

    -George