MQX-Lite and printf

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

MQX-Lite and printf

749 Views
astdom01
Contributor III

Hi all ..

I have some troubles with printf and MQX-Lite. It works as long as I dont't use arguments:

printf( "Any text" );

The application breaks as soon as I use arguments:

uint8_t test;

test = 5;

printf( "Any test %i", test );

I had no problems without MQX-Lite but as I understand printf should work with MQX-Lite. I only found one indication for problems with printf here:

https://community.freescale.com/thread/311083

Does anyone know something about this?

Thank you, Dominic

0 Kudos
3 Replies

538 Views
astdom01
Contributor III

The problem seems to be a little be more complex then I described: It's not about the arguments - printf works somethimes and sometimes not independent of the arguments and the length of the text. If the constellation works it works all the time (in a loop).  But if I change the code a little bit it is very likely that  printf does not work anymore. In this case a wrong text will be displayed and I run in an unhandled inerrupt. For me it looks like a wrong memory area will be overwritten or like a synchronization problem - but I have only one task running. I can reproduce this with a new very simple project. I use the ConsoleIO component as described here: http://mcuoneclipse.com/2013/02/07/tutorial-printf-with-and-without-processor-expert/  Anyway ..

does printf together with MQX-Lite work for you without problem?

Thank you for you Input .. Dominic

0 Kudos

538 Views
astdom01
Contributor III

The problem seems to be the stack size of the task. Sounds easy to find but I really thought that a stack size of about 512 Byte is enough so I did not consider this. I can't give more space to my tasks therefore I will avoid printf.

Best regards, Dominic

0 Kudos

538 Views
Rick_Li
NXP Employee
NXP Employee

Hi Dominic Ast,

There are some examples of MQXLite in {CW v10.6}\MCU\CodeWarrior_Examples\Processor_Expert\MQXLite\Kinetis.

to output information, a console is needed in a MQXLite project.

these examples will help!

0 Kudos