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.

CCS Debug Variables

The Variables view has real problems with displaying function values.  As the screen shot shows, setting int dx also changed int newX.  This becomes even more problematic with floats and doubles.  I can see the code changes register usage, and thus the variables assigned to those registers change, but this makes the debugger almost useless for my students.  Any thoughts??

Paul Roper

 

  • HI Paul,

    let me see what I can determine for you.  I think this is something we have just seen in another case.   I am going to discuss this with some development colleagues and get back to you as soon as I have feedback.

    I seems the variables view keeps the variable association with the register, even if the register moves on to hold the value for something else or some other variable.

    Best Regards,
    Lisa

  • Hi Paul,

    do you have a simple test case you could send me so I can try to verify and reproduce this?

    Best Regards,
    Lisa

  • Hi Paul,

    another thought I had you can check (sorry for yet another reply here).  What optimization settings are you using?  I am wondering whether the optimizer is using registers for these variables, optimizing them out to a sense and causing problems with the debug information.   Does the code run correctly?

    What if you turn optimization off.  Also try turning it off under Project->Properties->Build->MSP430 Compiler->Advanced Options->Advanced Optimizations

    Here you can disable all high level optimization.

    Best Regards,

    Lisa

  • Lisa,

    Thanks for getting back with me.   

    Assuming this reply gets thru, yes, the code works correctly.  Yes, the compiler optimizes to registers and since the variable is not used again, it went ahead
    and changed the register.  The debugger continued to show the register value (which is now changed.)

     I am using what I believe to be the latest CCS, Version 5.1.0.09000.  My Project->Build->MSP430 Compiler->???  does not have “Advanced Options”.  It must be here somewhere, but I haven’t located it yet.

     And finally, yes, I can send you the code - I'm trying to prune it down, but I'm fighting the compiler again as it throws away stuff that it determines is not used. 

    Thanks, Paul

     BTW: We really have a show stopper with running out of RAM when using <math.h>, sines, and cosines.  Do you know what I’m referring to??  I'll send some code as well...

  • Hi Paul,

    I will wait for the test code, but I suspect if you change these variables to volatile so that they don't get optimized out, this behaviour will go away.  Is this what you see?

    The latest version is actually 5.1.1 and is posted but will have the same project options and MSP compiler version included.   You may have to look on the bottom left and select to "Show Advanced Options".


    Please keep us informed.

    Best Regards,
    Lisa

  • Lisa,

    Is this the correct way to communicate with you?  I receive your email, but with a noreply from.

    Anyway, I'll try the volatile route, but that is a pretty lame restriction to put all my students when teaching them C.

    We have imaged all our machines here at BYU with 5.1.0.09000 - I can not force IT to re-image everything in the middle of the semester.  (And I have to get the site license updated...)

    There is a Show/Hide advanced settings and a Optimizations menu, but I find nothing suggesting to turn off all optimization - just size vs speed and 0-3 settings.  I teach about activation records.  Earlier versions of your compiler put variables on the stack.  Now it seems it uses registers instead.  That would be OK, but not having the correct variable values it a real bummer - makes the window virtually useless, agree??

    Here is code that demostrates the problem:

     

    #include "msp430x22x4.h"

    void drawLine(int oldX, int oldY, int newX, int newY);

    volatile int temp;

    void main(void)

    {

           drawLine(80,80,80,10);

    } // end main

     

    void drawLine(int oldX, int oldY, int newX, int newY)

    {

           // newX appears in the variable view with a value of 80 (newY = 10)

           int dx = newX - oldX;             // after this line, newX has the value of 0!

           int dy = newY - oldY;             // after this line newY has the value of -70

           float m = (float)dy/dx;

            temp = dx = dy * m;

    }

  • BTW: using volatile does not fix the problem!

  • Hi Paul,

    I can reproduce this, but also make it go away when high level optimizations are turned off.

    See the screen shot as you should have this as well.

    I may still file a bug against the view however.

    Best Regards,
    Lisa

  • Hi Paul,

    I filed this under  SDSCM00043584 and it can even be tracked here:

    https://cqweb.ext.ti.com/cqweb/main?command=GenerateMainFrame&service=CQ&schema=SDO-Web&contextid=SDOWP&username=readonly&password=readonly

    All the best.

    Best Regards,

    Lisa

  • Lisa,

    Sorry to keep bugging you, but I certainly don't seeme to get the same menu...  Is their something I'm missing???

    Thanks, Paul

  • Hi Paul,

    what code generation tool version is your project using?  I took that screen shot right from the same CCS version.  I did nothing special at all.

    Best Regards,

    Lisa

  • Lisa,

    I'm also sending you screen shots from v5.1.  Just a quick history, I'm frankly not sure of my configuration, but I've tried this on several machines.  We down loads from the TI website v51. and installed it on all our lab machines.  After installation on my machine, I discovered that I could not compile my demo program because of RAM errors.  (It complies and runs just fine under v4.0.)  I was instructed by TI to try earlier compiler tools.

    So, I installed v5 again from my CCS IDE UNIVERSITY CD w/Floating Site License.  It seems like I can't go back or forward.  You obviously have something different from me - I just don't have an advanced optimization menu.  Shouldn't there be something somewhere??

    I've taken my demo code and really isolated the problem to a small amount of code.  Here it is:

    main.c:

    #include "msp430x22x4.h"

    #include "RBX430_lcd.h"

    #include <stdlib.h>

    #include <math.h>

     

    #define PI 3.1415926

    void draw_line(int x0, int y0, int x1, int y1)

    {

           lcd_point(abs(x0), x0, 1);

    } // end lcd_draw_line

     

    void main(void)

    {

      
    float i;

      
    for (i = 0; i < PI*2;
    i += PI/16)

      
    {

         
    int x = cos(i) * 45;

         
    int y = sin(i) * 45;

         
    draw_line(80, 50, 80 + x, 50 + y);

      
    }

    }

     

    RBX430_lcd.h:

    #ifndef
    LCD_H_

    #define LCD_H_

     

    typedef char int8;

    typedef int int16;

    typedef unsigned char uint8;

    typedef unsigned int uint16;

     

    uint8 lcd_point(int16 x, int16 y, uint8 flag);

     

    #endif /*LCD_H_*/

     

     

    RBX430_lcd.c:

    #include "msp430x22x4.h"

    #include "RBX430_lcd.h"

     

    uint8 lcd_point(int16 x, int16 y, uint8 flag)

    {

           return 0;                                // return success

    } // end lcd_point

     Here is what I get:

     

     

  • Hi Paul,

    odd.  I took that capture directly from an installation of 5.1.09 .. the version you posted you were using.  I simply created a new CCS Project and opened a basic MSP blink the LED example.  I think went into project properties and I always get the advanced.

    I am using code generation tools version 4.0.0 which seems to have come with 5.1.09.

    As mentioned I have filed this and found it to be at least partially related to the optimization.

    Best Regards,
    Lisa