Using Command Window to Debug

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Command Window to Debug

Jump to solution
1,383 Views
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

Labels (1)
Tags (1)
0 Kudos
1 Solution
26 Views
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

View solution in original post

0 Kudos
4 Replies
26 Views
Specialist I

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

 

---Tom

 

26 Views
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 Kudos
27 Views
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

View solution in original post

0 Kudos
26 Views
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