can we output variable values in command window?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

can we output variable values in command window?

跳至解决方案
3,682 次查看
urlreader
Contributor I
I'm working on a firmware for a wireless chip. QG8 is being used for control the communication. Now, I believe the channel setup part is ok. If I step by step to debug the receiver/transmitter, then it will generate time-out on both sides (because of my firmware).

Once start send/receive data, is it possible to output varaible values in command window in debugger? So, I can see the value changes without pause the firmware?

I know in Command window we can use printf command. Is there a similar function that I can use in C in codewarrior, so that it can output to the command window? seems printf won't work.


thanks

Tan
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
2,493 次查看
CrasyCat
Specialist III
Hello
 
It is not possible to redirect stdout (output from printf) from the application to the command window.
You should be able to redirect stdout to any SCI or LCD device.
 
Unfortunately, as far as I can see there is no such peripheral available on the HCS08QG8.
 
Only solution would be to run a command file, which periodically prints whatever you are looking for in the command window.
 
Alternatively you can set a breakpoint and associate it with a command file, which will perform the printf each time the corresponding instruction is reached.
When defining such a breakpoint you can also tell you do not want to stop the application when the BP is reached.
This way when the instruction is reached, the application will shortly pause, debugger will execute the command file and application will continue execution.
 
The application is not running in real time any more, but this could give you some indication on what is going on while the application is running.
 
Finally you can also use either the data window or the visualization tool window, put them in periodical refresh mode and look at the way the variable is changing while the application is running. Here again the application will not run in real time any more, but you should be able to look at the way the variable is changing while application is running.
 
FAQ-27481 on Freescale web page explains how to look at a variable value in the debugger.
 
I hope this helps.
 
CrasyCat

在原帖中查看解决方案

0 项奖励
回复
4 回复数
2,494 次查看
CrasyCat
Specialist III
Hello
 
It is not possible to redirect stdout (output from printf) from the application to the command window.
You should be able to redirect stdout to any SCI or LCD device.
 
Unfortunately, as far as I can see there is no such peripheral available on the HCS08QG8.
 
Only solution would be to run a command file, which periodically prints whatever you are looking for in the command window.
 
Alternatively you can set a breakpoint and associate it with a command file, which will perform the printf each time the corresponding instruction is reached.
When defining such a breakpoint you can also tell you do not want to stop the application when the BP is reached.
This way when the instruction is reached, the application will shortly pause, debugger will execute the command file and application will continue execution.
 
The application is not running in real time any more, but this could give you some indication on what is going on while the application is running.
 
Finally you can also use either the data window or the visualization tool window, put them in periodical refresh mode and look at the way the variable is changing while the application is running. Here again the application will not run in real time any more, but you should be able to look at the way the variable is changing while application is running.
 
FAQ-27481 on Freescale web page explains how to look at a variable value in the debugger.
 
I hope this helps.
 
CrasyCat
0 项奖励
回复
2,493 次查看
donny
Contributor I
Hello
 
Is is possible to extract the data from the visualization tool or even the debugger data window into a text file or any other format for further processing?
 
I looked through the manuals for the debugger but wasn't able to find anything.
 
Donny
0 项奖励
回复
2,493 次查看
CompilerGuru
NXP Employee
NXP Employee
In the initial posting you did mention the printf commad, so you are aware of that.
Do you want to print from the target, from the code running on the QG8 (as I was interpreting the initial post) or from the host side?
From the host side, what's the problem with the command line printf (or the command line e command)?

Daniel
0 项奖励
回复
2,493 次查看
donny
Contributor I
Hey
 
Sorry to confuse you, but i did not post the first message. I was posting an extension to the first question.
Currently i am using the graphing visualization tool in the debugger and the plots look very nice. However they would be a lot more useful if i can take that data which i collected with the visualization tool and transfer it into MATLAB or other software for processing. Is this possible? all i would need is a way to save the data from the graphs.
I hope that further explains my questions.
 
Thanks
Donny
0 项奖励
回复