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/TMS320F28034: Compiler optimization issue

Part Number: TMS320F28034

Tool/software: TI C/C++ Compiler

Hi, 

Customer is using F28034 for motor control. Now they faced one issue about compiler optimization. Because of the optimization, the sequence of codes is changed, not the same as the sequence in the *.c file. We'd like to know why, and how to avoid. 

In details:

1) Compiler version: 4.1.3 and 6.2.x have the same issue;

2) Optimization level 2 and 3 have the same issue, as the code is in one function. 

3) Below is the code's dis-assembly, gBeforeRunPhaseLose.CurComperCoff = Data1; the sequence is changed, with optimization 2 or 3. It's executed after about 11 lines codes. 

4) Below is the dis-assembly without optimization. It's executed immediately. gBeforeRunPhaseLose.CurComperCoff  will be set the right value without any delay. 

5) In the function, gBeforeRunPhaseLose.CurComperCoff will be set other values in other TWO places. If these two places' codes are excluded from build, the result will be like point 4). CurComperCoff will be set the right value immediately. If these two places' codes are build, there will be the issue, like point 3). The optimization "combined" these codes and caused the new value setting delayed. 

Thanks a lot.

Br, Jordan

  • Unfortunately, I cannot tell what is going on.  For the source file which contains this code, please follow the directions in the article How to Submit a Compiler Test Case.  I'll build this file with different levels of optimization, then inspect the resulting assembly code. 

    Thanks and regards,

    -George

  • Hi, George
    Can we plan a conference call with CCS project remote control, ASAP? As:
    1) They can't provide the source code. It's not possible to submit a test case.
    2) Remote control was used with them before.
    3) This customer is one of Asia top ten industrial customers. The issue delayed the MP of several projects, even had the impact to the current mass production products.

    If OK, can we plan the call on this Friday morning, your time?
    Please reply me through: jordan-zhou@ti.com. We'll prepare well the code and tools. You can operate from your PC.
    Thanks a lot.
    Br, Jordan