Can I use the CW IDE Console to print debug messages?

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

Can I use the CW IDE Console to print debug messages?

Jump to solution
845 Views
bpaehr
Contributor IV

I'm using CW 10.6.4, and would like to output messages "somewhere" to help debug the code. Device is MC9S08QB8.

Can the IDE Console window be used?  If so, how do I specify the messages in my C-Code to be printed?

Labels (1)
1 Solution
620 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi Bod

the MC9S08QB8 only has 8 K of flash, I am not sure if you can set the console for an 8 bit device, but if this is possible you will use a lot of the memory for it.

Also you can use one of the SCI port (or the OSBDM port ) to send information to the terminal like teraterm, but in this case you needs to set the SCI port.

Regards

Vicente

View solution in original post

5 Replies
621 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi Bod

the MC9S08QB8 only has 8 K of flash, I am not sure if you can set the console for an 8 bit device, but if this is possible you will use a lot of the memory for it.

Also you can use one of the SCI port (or the OSBDM port ) to send information to the terminal like teraterm, but in this case you needs to set the SCI port.

Regards

Vicente

620 Views
bpaehr
Contributor IV

Vicente.

On the side I have been using Basic4Android to develop Apps for Android devices, and it has a "Log" feature that lets you log anything in a log window for debugging purposes. I was hoping that the CodeWarrior IDE might have a similar capability for the Micro Applications.

The device I have has limited I/O (only 16 pins) and I am using the TxD and RxD pins for other signals, so I guess I won't be able to use the SCI port in this case.  Will keep that in mind, though, to maybe use a slightly larger device in the future to keep the SCI port open for debugging/messages.

Thank you.

Bob

0 Kudos
620 Views
scottm
Senior Contributor II

Hi Bob,

Regardless of how the console messages get sent, they're going to take up a lot of code space.  On the Kinetis devices at least (I haven't seen an equivalent on HCS08) you have the option of using semihosting, which will let you pass messages through the debug interface.

On an 8k part, though, there's not much room for log messages.  If you use the printf() command, that's going to take up easily half of your available memory.  Usually when I'm working with devices that small I'm not emitting more than one or two character signals on a serial port.

As attached as I am to the HCS08 architecture (I grew up with the 6800 and the 6502) I have to say that if you're just getting into it, you might want to go with Kinetis.

Scott

0 Kudos
620 Views
bpaehr
Contributor IV

Scott:

Sorry. Only just checked back to see if there were any other additions to my original inquiry...

Wow! printf() takes up 4K or more of space?!!  That may not be an issue for me, as my current code only occupies 2125 bytes of Flash.  I'll give it a go, as I've ordered a slightly larger version of the HC08 that has 4 more pins, which would free-up my TXD/RXD pins for use as a communications capability to a terminal.  If the printf() doesn't quite work out, I'm sure I can write a few simple routines to send a buffer of data out of the serial port (that would occupy less than 4K of memory!).

Thanks for the response.

Bob

0 Kudos
620 Views
scottm
Senior Contributor II

I think the full implementation of printf() on an HC08 adds closer to 8K.  I always rebuild the library to exclude floating point support at least, and that drops it down to more like 4K.  I'm looking at a linker map file now and printf.o alone without floating point is 1677 bytes.  The rest is other library functions that printf() depends on so the additional footprint depends on what library functions you're already linking in.  You'll also need a lot of stack space for printf().

I usually have a simple utility library with serial output routines for strings and hex numbers, and that's probably not more than 100 bytes of code.

Scott

0 Kudos