Unable To Print Float Values Using Kinetic Design Studio

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

Unable To Print Float Values Using Kinetic Design Studio

1,210 Views
micklexavier
Contributor I

I am using FRDM K64F board with the following combination:

KDS 3.0, KDSK 1.2.0, MQX 4.2,.

In my application I need to display float values.

When I try to print the float values, the character 'f' is printed instead of the actual values.

 

Thanks,

Mickle Xavier N.

Labels (1)
0 Kudos
Reply
3 Replies

812 Views
BlackNight
NXP Employee
NXP Employee

Hi Mickle,

are you using newlib-nano?

You need to turn on floating point support e.g. with

-u _printf_float

See "Newlib-nano and Floating Point" in printf() and scanf() with GNU ARM Libraries | MCU on Eclipse

I hope this helps,

Erich

0 Kudos
Reply

812 Views
micklexavier
Contributor I

Hi Erich,

Thanks for your reply.

I have enabled the option -u_printf_float with the following:

Cross ARM C Linker->Miscellaneous->Use float with nano printf

But, no change in the behavior of printf.

I have added the image for your reference.

pastedImage_2.png

Thanks,

Mickle Xavier N.

0 Kudos
Reply

812 Views
BlackNight
NXP Employee
NXP Employee

Hi Mickle Xavier,

I have attached you a project for KDS v3.0.0 which prints float/double on the FRDM-K64F board (with Segger J-Link firmware and semihosting). The output is like this

SEGGER J-Link GDB Server V5.02 - Terminal output channel

Hello world!013456

double: 0.649217

float: 12.345600

Hello world!013456

The project is on GitHub too (just in case):

mcuoneclipse/Examples/KDS/FRDM-K64F120M/Semihosting_K64F at master ·  GitHub

I hope this helps,

Erich

0 Kudos
Reply