displaying variables in debugger

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

displaying variables in debugger

Jump to solution
2,844 Views
dashz84
Contributor I
Hi,

i'm running codewarrior v4.7 on vista and i have a question regarding the variables that are displayed when i run the debugger.

for instance, the following code
  dx=calc_x (delta_dist, desired_theta_deg);
  dy=calc_y (delta_dist, desired_theta_deg);
  cur_x += dx;
  cur_y += dy;
 
  x_diff=cur_x-goal_x;
  y_diff=cur_y-goal_y;
  x_diff_sq=pow(x_diff,2);
  y_diff_sq=pow(y_diff,2);

xy_diff_sq=x_diff_sq+y_diff_sq;  <----- breakpoint

i'm trying to see the values of x_diff_sq and y_diff_sq, however i only see x_diff_sq when i set a break point on xy_diff_sq. what is the problem here?
thanks in advance
Labels (1)
Tags (1)
0 Kudos
1 Solution
1,074 Views
stanish
NXP Employee
NXP Employee
Hi dashz84,

I suspect this issue may be caused by compiler optimalization. The various optimalizations are turned on in CodeWarrior for HC12 projects by default.

I'd suggest you to try to turn the optimalization off.
You can use "Debugger Complexity" slider within the Project settings (ALT+F7) ->"Compiler for HC12" -> "Smart Sliders" button to adjust the optimalization settings.

Stanish

View solution in original post

0 Kudos
6 Replies
1,074 Views
dashz84
Contributor I
also, i don't see a displayed value for x_diff, and there's no value for dy either.

it seems that the values are still being added correctly but are just not being displayed.
0 Kudos
1,075 Views
stanish
NXP Employee
NXP Employee
Hi dashz84,

I suspect this issue may be caused by compiler optimalization. The various optimalizations are turned on in CodeWarrior for HC12 projects by default.

I'd suggest you to try to turn the optimalization off.
You can use "Debugger Complexity" slider within the Project settings (ALT+F7) ->"Compiler for HC12" -> "Smart Sliders" button to adjust the optimalization settings.

Stanish
0 Kudos
463 Views
siddhant67
Contributor I

Hello I am facing similar problem. I am using  - CodeWarrior for MCU
Version: 11.1

I dont have "Smart Sliders" button for optimization.

 

0 Kudos
1,074 Views
dashz84
Contributor I
thanks stanish, i adjusted the code density slider and set it to low, and now the variable values are being displayed.

however, i got a c54 warning, Option -Oc: This CSE is not supported for the current target, therefor this switch has no effect on the generated code.

will this affect my code in any way?

thanks!
0 Kudos
1,074 Views
stanish
NXP Employee
NXP Employee
dashz84,

According to the compiler manual this option is present only for compatibility reasons for HC(s)08.
Anyway if you want to get rid of this warning I'd suggest you to remove option "-Oc" from the "Command Line Arguments" editbox in the "Compiler for HC08" settings.

Stanish
1,074 Views
Lundin
Senior Contributor IV
That's because the variables are optimized and the program never puts them on the stack, but keeps them in CPU registers. The CW debugger is too dumb to understand such and therefore the variables won't appear.

If you wish to see the variables during debugging, either disable optimization or make the variables volatile. You can then change back once you are building for release.
0 Kudos