Skip to contentSkip to conversation

printf in u-boot cannot support %f

U-Boot ITechnology 2 participants 2 messages Jan 11, 2011

lore
Share & tools
lore
#0 lore raw

Hi,
The codes below:
...

  	double result1 =  3.14;
	printf("result1:%f\n", result1);// error 
 .... 
  turn out:
	result1:%f
    How can I  get the correct result? Thanks a lot!

The U-boot version is:
=> ver
U-Boot 2008.10 (Jul 15 2009 - 21:56:05) MPC512X
I wan to a little more complex program in standalone mode in u-boot. Is it possilbe to port g-libc to u-boot standalone mode?
Tanks.
Best regards,
Michael Franklin

#1 lore raw

Dear "ITechnology",

Quoted 8 lines · In message <[email protected]> you wrote:

The codes below:

   ...
  	double result1 =  3.14;
	printf("result1:%f\n", result1);// error 
 .... 
  turn out:
	result1:%f

Yes, this is to be expected.

Quoted 1 line

How can I get the correct result? Thanks a lot!

Youcannot. We do not use nor support any FP operations in U-Boot.

Quoted 1 line

I wan to a little more complex program in standalone mode in u-boot. Is it possilbe to port g-libc to u-boot standalone mode?

Everything is possible, assuming you throw enough manpower at it.

The real question however is if this makes sense. Usually, in such situations it does not. You might find it more efficient to boot into some OS instead.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
NOTE: The  Most  Fundamental  Particles  in  This  Product  Are  Held
Together  by  a  "Gluing" Force About Which Little is Currently Known
and Whose Adhesive Power Can Therefore Not Be Permanently Guaranteed.