NewLib semihost printf

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

NewLib semihost printf

1,389 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by guillaumeL on Fri Jan 13 07:48:41 MST 2012
Hello,

  In my project, I had printf function to add display in the console. I had all instructions decribe here http://support.code-red-tech.com/CodeRedWiki/UsingPrintf   (MCU Linker - Target "Newlib (semihost)) but it still not work do you have an idea?
0 Kudos
Reply
5 Replies

1,289 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Tue Jul 31 00:20:28 MST 2012

Quote: guillaumeL
I'm currently working on LPC1769  using RED suite 4 with newlib + semihost options. I found the solution. I have added the function fflush(stdout) after each printf to display each string I want.



I suspect that you aren't terminating the string being printed with a newline then (the text to be displayed gets buffered).

ie use [FONT=Courier New][SIZE=2]printf ("Hello World\n");[/SIZE][/FONT] rather than [FONT=Courier New][SIZE=2]printf ("Hello World");[/SIZE][/FONT]

Regards,
CodeRedSupport
0 Kudos
Reply

1,289 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by franku on Mon Jul 30 13:11:57 MST 2012
Thanks for the tip. :) Now it printfs.
0 Kudos
Reply

1,289 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by guillaumeL on Sat Jan 14 10:24:32 MST 2012
I'm currently working on LPC1769  using RED suite 4 with newlib + semihost options. I found the solution. I have added the function fflush(stdout) after each printf to display each string I want.
0 Kudos
Reply

1,289 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by whitecoe on Fri Jan 13 09:12:50 MST 2012
If you are trying to convert an existing example project to add in a printf, then this previous post might help...

http://knowledgebase.nxp.com/showpost.php?p=11501&postcount=5

HTH!
0 Kudos
Reply

1,289 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Jan 13 08:38:50 MST 2012
#1 Which MCU are we talking about?

#2 Did you create this project with project wizard and semihosting?

#3 Did you change SYMBOL settings?

#4 Did you try to create a new semihosting project and change it to NEWLIB?
0 Kudos
Reply