displaying variables in debugger

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

displaying variables in debugger

ソリューションへジャンプ
2,932件の閲覧回数
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
ラベル(1)
タグ(1)
0 件の賞賛
1 解決策
1,162件の閲覧回数
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 件の賞賛
6 返答(返信)
1,162件の閲覧回数
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 件の賞賛
1,163件の閲覧回数
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 件の賞賛
551件の閲覧回数
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 件の賞賛
1,162件の閲覧回数
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 件の賞賛
1,162件の閲覧回数
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,162件の閲覧回数
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 件の賞賛