console support for printf's

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

console support for printf's

2,277 Views
carlh
Contributor I

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.

Labels (1)
0 Kudos
11 Replies

1,642 Views
BlackNight
NXP Employee
NXP Employee

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.

0 Kudos

1,642 Views
carlh
Contributor I

Hi Erich,

Good info.

However I can’t find the ewl_hosted lib in CW. I noticed you referenced CW 10.3. I’m using 10.2. Is this lib not available in 10.2?

thanx

/carl

0 Kudos

1,641 Views
BlackNight
NXP Employee
NXP Employee

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?

0 Kudos

1,642 Views
carlh
Contributor I

Funny…I just created a bareboard project and enabled console i/o but when I looked at the libs there was still no ewl_hosted lib.

/carl

0 Kudos

1,642 Views
BlackNight
NXP Employee
NXP Employee

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

0 Kudos

1,642 Views
carlh
Contributor I

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

0 Kudos

1,642 Views
BlackNight
NXP Employee
NXP Employee

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.

0 Kudos

1,642 Views
carlh
Contributor I

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

0 Kudos

1,642 Views
BlackNight
NXP Employee
NXP Employee

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 ;-)

0 Kudos

1,642 Views
carlh
Contributor I

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.

0 Kudos

1,642 Views
carlh
Contributor I

Nope. Using Coldfire C/C++ Compiler.

‘mwccmcf.exe’

0 Kudos