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.

TMS320F28069: Different execution time between two compiles of the same source code

Part Number: TMS320F28069


I have one project (two different versions) and both are compiled with the same compiler (22.6.0.0.LTS) and in both projects, the ADC interrupt, I have a line of code that generates different results between the two projects.  This problem is not isolated to this line of code, we just chose this line of code as an example of the problem.   The line of code is as follows:

mult = 1 - (abs(gMotorVars.Speed_Hz) / (gUserParams.motor_baseFreq/2));

// mult is a local variable and the location of gMotorVars and gUserParams and the mainISR are exactly the same between the two versions.

We have compared the compiler/linker settings and have even looked at the generated assembler (which is different between the two versions). We used the clock cycles evaluation from the breakpoint count event and the clock cycles were 313 versus 1378.  We also used a GPIO and oscilloscope to evaluate the execution time and we were able to see the execution time was 4 times the execution time between the two projects.

We are using Code Composer 11.2.0.00007.

We are not sure where to look next to figure out why the difference in versions.

We would appreciate your help and thanks for your time.

Sandy

  • Which loop is the code executed in? In background loop? Or in a ISR loop?

  • In the ISR loop

    Sandy

  • What output format are you using for these two project? COFF or EABI? Do you have a chance to check if the disassembly codes within CCS by clicking "View->Disassembly" to see what's difference?

  • I am using COFF output format for both projects.  We did see different assembly code when we viewed the assembly while at a breakpoint on the line in question

  • One additional observation is that the principle areas of concern with the increased timing seem to all involve some level of floating point.  Much of the project uses the IQ math library but not all of the code.  Both versions of the project use the Float Support option SoftLib.

    Thank you for your help!

  • For the source file that contains this line ...

    mult = 1 - (abs(gMotorVars.Speed_Hz) / (gUserParams.motor_baseFreq/2));

    ... please follow the directions in the article How to Submit a Compiler Test Case.  But do it two times.  Once for each project.

    Thanks and regards,

    -George

  • George,

    Sent data to your private email.

    Thank You!

    Sandy

  • Somehow, you created a very large message that I cannot access.  I managed to copy out this much ...

    I am attaching the files requested. Both versions, 1.03 and 1.11 are using the TI V22.6.0LTS compiler. As described above, even though this seems to be a general problem around areas with floating point, we picked one line of code that is exactly the same between the two versions and then looked at the timing as follows.
    mult = 1 - (abs(gMotorVars.Speed_Hz) / (gUserParams.motor_baseFreq/2));
    // mult is a local variable and the location of gMotorVars and gUserParams and the mainISR are exactly the same between the two versions.
    Version 1.03 line # 20457
    Version 1.11 line # 1867
    GPIO timing of the line in question
    Version 1.03 3.8 us Version 1.11 15.6 us
    Clock Cycles of the line in question
    Version 1.03 324 Version 1.11 1384
    Version 1.03 Console

    I can see you use compiler version 22.6.0.LTS.  I don't understand the references to version 1.03 and 1.11.  Please explain that.

    Please send each test case again.  Please do not send the entire build log.  Only copy and paste the one line from the build log that invokes cl2000 on the source file that contains the problem source line you show in the first post.  I still need the preprocessed file for each test case.  If those files are large, then please zip them up and attach that zip file.

    Thanks and regards,

    -George

  • George,

    I believe that I answered your requests in a private email this morning.

    Thanks,

    Sandy

  • Thank you for the test cases.  I can build them down to assembly code.  The assembly code for the two builds contains very few differences.  There is certainly not enough difference to explain ...

    we were able to see the execution time was 4 times the execution time between the two projects

    Thus the code generated by the compiler is not the root cause of the difference.

    the location of gMotorVars and gUserParams and the mainISR are exactly the same between the two versions.

    I take that to mean the memory location of these two global variables, and the memory location of the function mainISR (which contains the example line of code) is the same.  But this code spends most of its time in floating point functions like FS$$TOI (converts a floating point value to integer) or FS$$DIV (divides two 32-bit floating point numbers).  These functions come from the compiler RTS library.  Are they located in the same memory?  Is all of the memory configured the same way?

    Thanks and regards,

    -George

  • George,

    Thank you for your help!   I have played around some more with the memory locations and even though the RTS library appeared to be setup the same, through other changes, I have seen a significant improvement in the speed of execution.  I haven't had time to verify the particular line brought to your attention, but I am confident that the problem has been solved.  Thank you very much for your help!  I am marking the issue resolved.

    Thanks again!

    Sandy