When you create a CW project you are given the opportunity to add console support for printf's.
However when you import a project into CW you are not given the same opportunity. I searched through project properties and I can't find the magic place to enable it.
Does anyone how to enable this feature if possible with an existing project??
thanx
/carl h.
Hi Carl,
it affects which library gets used.
Have a look here: Tutorial: Printf() with (and without) Processor Expert | MCU on Eclipse
I hope this helps.
Hi Carl,
I'm using MCU10.3 with gcc. With gcc it is really easy. I quickly checked creating a project for K60 and FSL compiler, and I do not see an option to select the hosted/UART mode?
I tried with ColdFire V1. I just compared the projects.
The one with console I/O has this source file added:
Sources/console_io_cf.c
It looks that's the only real difference?
Erich
I created a new CF project and enabled console support and I found the same file (…/Sources/console_io_cf.c) .
But when I opened it everything was #ifdef’d out.
#if EWLCONSOLE_SUPPORT
where EWLCONSOLE_SUPPORT = 0 in ‘ansi_parms.h’
What’s my option? Copy these files into my project and set EWLCONSOLE_SUPPORT to 1 ?
Seems kludgy!
thanx
/carl
I missed something: For the console project, there is a compiler define present:
Check project properties > C/C++ Build > Settings > ColdFire Compiler > Language Settings > Other flags:
-define CONSOLE_IO_SUPPORT=1
For the 'no I/O' that setting is empty.
Erich,
I created 2 new CW Bareboard projects…1 with i/o console support and one without. I can see the define as per your email in the project I enabled console i/o.
I compiled both projects and did a diff between the 2 project folders. The only difference is in the .cproject files where I can see CONSOLE_IO_SUPPORT= 1 defined in 1 project but not the other. Nothing else is different!!
Is that all that has to be done? I can’t test if printf’s work because I don’t have hardware yet.
I appreciate your help on this.
/carl
Hi Carl,
yes, I believe this is what you need. However, I need to admit that I usually avoid to use the console I/O and printf(), for the reasons listed here. I always use normal SendString() routines to write to the UART.
Additionally, using semi-hosting (using the debugger connection) is something I avoid whenever possible, as it is very slow, and even might block the microprocessor if no debugger is attached.
Just my 5 cents ;-)
I hear ya. I read your article. ☺
Unfortunately the platform we are using (custom) uses the UART (only 1) for connecting accessories. Although I am considering using the UART for debugging without accessories, or simply limiting printf() chattiness through the console. Print only catastrophic issues.
I like your web site BTW. Thanks for the help.
/carl h.