• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Development Tools » Code Composer Studio » Code Composer Forum » CCS Debug Variables
Share
Code Composer Studio
  • Forum
  • Announcements
Options
  • Subscribe via RSS
Common Questions
  • Code Composer Studio Forum Usage Guidelines

  • Resources
  • Code Composer Studio (CCStudio) Product Folder
  • Troubleshooting CCS
  • CCS Wiki
  • Download CCS
  • Order CCS
  • Tools Insider Blog
  • Bug Tracking
  • Forums

    CCS Debug Variables

    This question is answered
    Paul Roper
    Posted by Paul Roper
    on Mar 22 2012 21:36 PM
    Prodigy100 points

    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

     

    MSP430 CCS Debugger Variables
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Lisa TI
      Posted by Lisa TI
      on Mar 23 2012 07:58 AM
      Guru99725 points

      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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on Mar 23 2012 08:00 AM
      Guru99725 points

      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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on Mar 23 2012 08:37 AM
      Guru99725 points

      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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Paul Roper
      Posted by Paul Roper
      on Mar 23 2012 11:59 AM
      Prodigy100 points

      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...

      CCS5 CCS v5
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on Mar 23 2012 12:05 PM
      Guru99725 points

      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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Paul Roper
      Posted by Paul Roper
      on Mar 23 2012 12:20 PM
      Prodigy100 points

      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;

      }

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Paul Roper
      Posted by Paul Roper
      on Mar 23 2012 12:25 PM
      Verified Answer
      Verified by Paul Roper
      Prodigy100 points

      BTW: using volatile does not fix the problem!

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on Mar 23 2012 13:56 PM
      Verified Answer
      Verified by Lisa TI
      Guru99725 points

      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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on Mar 23 2012 14:17 PM
      Verified Answer
      Verified by Paul Roper
      Guru99725 points

      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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Paul Roper
      Posted by Paul Roper
      on Mar 23 2012 15:34 PM
      Verified Answer
      Verified by Paul Roper
      Prodigy100 points

      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

      CCS5 CCS v5
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on Mar 23 2012 15:52 PM
      Guru99725 points

      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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Paul Roper
      Posted by Paul Roper
      on Mar 23 2012 22:32 PM
      Prodigy100 points

      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:

       

       

      CCS5 CCS v5
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Lisa TI
      Posted by Lisa TI
      on Mar 26 2012 09:31 AM
      Guru99725 points

      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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use