Using Command Window to Debug

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

Using Command Window to Debug

跳至解决方案
2,363 次查看
sebasira
Senior Contributor I

Hello everybody!

 

I was wondering if there's any way to display debug information in the command window. I mean, to help debugging, I want to print a string in the command window when a specific action has been done, for example, when a button is pressed I want the command window to show "BUTTON PRESSED".

I'm programming in C, using Codewarrior for the mc9s12a128 y mc9s12a256.

 

The code will look something like this:

 

if (button_port == 1) {

 /* ACTIONS WHEN BUTTON PRESSED */

 

 write_in_cmd_window("BUTTON PRESSED")    <--- This will be the command or instruction I'm looking for in order to "comunicate" with the command window, if possible.

}

 

 

Thanks in advance, I hope this can be done!

 

SebaS

标签 (1)
标记 (1)
0 项奖励
1 解答
1,006 次查看
CrasyCat
Specialist III

Hello

 

   HI-WAVE does not allow you to send messages from the application to the

   command window.

 

   When debugging on your hardware stdout should be redirected to some peripheral.

   Modifying TermIO.c you can send the data to any peripheral available (SCI, LCD, ...).

   But you need to get one free resource dedicated to that.

 

CrasyCat

在原帖中查看解决方案

0 项奖励
4 回复数
1,006 次查看
J2MEJediMaster
Specialist I

See this thread for some information.You might also do a search on the forums.

 

---Tom

 

1,006 次查看
sebasira
Senior Contributor I

Thanks, Tom! I read that thread and I've been searching on the forums, but I couldn't find the solution to my problem. Every thread I found (also the one you suggested) are about printf, it uses a serial port for the communication and requieres the initialization and implementation of some TERMIO functions. The actual project I'm working on uses ALL the avaible serial ports so I can't use one of them for the printf.

 

Let me explain a little more what I want to do: In the command window of the CodeWarrior Debugger (HiWave) one can input some "code" in order to inspect the value of the variables. This can be done, for example, like this: (">>" is the command window input line)

 

>>e VAR1

 

An it "prints" the value or VAR1. It could also be done with a printf.

 

What I want is the MCU (actually, code inside it) to communicate with the HiWave command windows and execute, for example, "e VAR1" so in the command window I can see the value of VAR1.

Later, what I'll do is NOT to execute commands, but to print comments, so I can trace and follow the behavior of the code I'm debugging.

 

I hope that can be done, and thanks to all!

0 项奖励
1,007 次查看
CrasyCat
Specialist III

Hello

 

   HI-WAVE does not allow you to send messages from the application to the

   command window.

 

   When debugging on your hardware stdout should be redirected to some peripheral.

   Modifying TermIO.c you can send the data to any peripheral available (SCI, LCD, ...).

   But you need to get one free resource dedicated to that.

 

CrasyCat

0 项奖励
1,006 次查看
kef
Specialist I

Sebastian,

 

I don't know how to printf from target to Hiwave windows, but I know how to do that with NoICE debugger (http://www.noicedebugger.com). Feature is called Virtual UART. Here's their help system

 

http://www.noicedebugger.com/help/help.htm

 

and here's direct url to how it may work

 

http://www.noicedebugger.com/help/bdm12.htm#VIRTUAL_UART