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??
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.
do you have a simple test case you could send me so I can try to verify and reproduce this?
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.
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 aheadand 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.
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...
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.
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:
void drawLine(int oldX, int oldY, int newX, int newY);
volatile int temp;
} // 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!
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.
I filed this under SDSCM00043584 and it can even be tracked here:
All the best.
Sorry to keep bugging you, but I certainly don't seeme to get the same menu... Is their something I'm missing???
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.
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:
#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
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);
typedef char int8;
typedef int int16;
typedef unsigned char uint8;
typedef unsigned int uint16;
uint8 lcd_point(int16 x, int16 y, uint8 flag);
uint8 lcd_point(int16 x, int16 y, uint8 flag)
return 0; // return success
} // end lcd_point
Here is what I get:
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.
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.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.