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.

Code gen tools v5.2.2 possible serious bug

I've got C code running on a 2808 board that works fine when built with 4.1.3 tools. Since I've upgraded to 5.2.2, it appears a bug has developed related to the SP getting trashed in an ISR. I can re-build with 4.1.3 and the SAME exact code works fine.I can go back and forth between build versions, and the 5.2.2. build consistently fails.

Ti, please respond to this as I've seen another thread related to bugs in 5.2.2. I don't have any other versions installed between 4.1.3 and 5.2.2, so I don't know at which build it was introduced.

 

  • Further update: I checked some of the Code Gen versions and the problem appears to have been introduced between 4.1.4 and 5.0.2. (5.0.0 won't even build my cmd file that works fine for all other versions, so I assume that 5.0.0 is no good).

     

  • Further update: The problem appears to be in the sprintf() routine. There are a number of changes in this routine between versions 4.1.4 and 5.0.2 in the way it handles the SP register.

    Enough debugging on my part, now it's Ti's turn to fix the problem.

     

  • Bob

    If you would please send a small test case with all the details (compiler versions, options, etc) to support@ti.com.   This way it will get into the tracking system and someone from the compiler group will take a look.

    Regards

    Lori

  • I was able to duplicate the bug using your 2808 cpu timer example code by adding a small routine that calls sprintf() in the main loop. I also added a small for() loop in the ISR to simulate what my code is doing. With 4.1.4 tools, the code runs fine. With 5.x tools, the ISR hangs every time in the for() loop since the SP is trashed.

    Here's the last few lines of Example_280xCpuTimer.c code along with the code I added. Note that this must be run from flash since the library routines won't fit in RAM.

    // Step 6. IDLE loop. Just sit and loop forever (optional):
       for(;;)
       {
           test_function(); //added this test call
       }   

    }

    void test_function(void)
    {
    float temp=12345;

        //comment this next line out to see the code run without lockup using 5.x tools, uncomment to cause lockup
        sprintf(tx_buffer, "%5.0f", temp); //This call screws up SP with 5.x tools. Build with 4.1.4 and it consistently runs fine to the breakpoint below.
    }

    interrupt void cpu_timer0_isr(void)
    {
    int i;
       CpuTimer0.InterruptCount++;
       
       for (i=0;i<=10;i++);  //waste some time, when the SP gets trashed, code will hang in this loop


       PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;   //set a breakpoint here to test the crash condition. With 5.x build tools, this will not get hit.
    }

     

    I've emailed this code to support@ti.com.

    Please respond ASAP!

     

  • Bob,

    We'll try out this code and get back to you.