Floating problem in KDS3.0.0 with KL03.

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

Floating problem in KDS3.0.0 with KL03.

Jump to solution
961 Views
syedidris
Contributor III

I am a beginner using KL03 processor trying to learn with demo codes provided with KDS3.0.0 IDE.

when I am printing the float value like,

 

float a=2.4;

PRINTF("%f",a);

 

I am getting output as ' f ' only.

How to overcome with this floating problem.

Labels (1)
0 Kudos
1 Solution
668 Views
DavidS
NXP Employee
NXP Employee

Hi Syed,

Please review following post: Re: Floating Point on KDS

Regards,

David

View solution in original post

8 Replies
668 Views
syedidris
Contributor III

Hi,

As a beginner I am just trying to understand the basic examples provided with the KDS 3.0.0 (with KL03 processor).

I was going through the  "adc_lptmr_trigger" code. I just tried float value printing in this program but it is not printing, I followed the steps given by DavidS it was working good in hello_world example but not working here.

1. what should I do to get float value result?

2. Is there any way by which I can print float value in any code?

0 Kudos
668 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

The support of float numbers in printf can be enabled by using linker options. For example, when you create a new Kinetis Project in KDS 3.0.0 (with KSDK 1.3.0 and Processor Expert) you can find the option in the Properties of the project, see the following screenshot:

pastedImage_0.png

Please note that when this options is enabled the target code (memory footprint) is significantly increased.

Best Regards,

Marek Neuzil

0 Kudos
668 Views
syedidris
Contributor III

Hi Marek,

Thanks for your reply,

I am not using processor expert, I am just editing in the Hello_world demo example with this float print.

I tried as per your suggestion, but I am not getting "Cross ARM C++ linker" option, I did in "Cross ARM C linker" but problem is not solved, Capture.PNG

can you please do something.

0 Kudos
668 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

hello,

please refer this article for how to use printf to print floating value in KDS3.0

Semihosting for Kinetis Design Studio V3.0.0 and GNU ARM Embedded (launchpad) | MCU on Eclipse

I also made a demo code on this related. see attached video, can this help you?


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
668 Views
syedidris
Contributor III

I am not getting "Cross ARM C++ linker" option.:smileyconfused:

0 Kudos
668 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

are you sure you use KDS3.0?

please send me:

1. your KDS build ID.

2. your demo project

3. your KDS properties' screenshot.

thanks!


Have a great day,

Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
668 Views
syedidris
Contributor III

Yes, I am using KDS 3.0.0.

In sample code of Hello_world example I just commented the statement

PRINTF("\r\nHello World!\n");

and replaced with statement

PRINTF("%f",1.23);

I am attaching my project file and also screenshot of my KDS properties.screenshot.PNG

0 Kudos
669 Views
DavidS
NXP Employee
NXP Employee

Hi Syed,

Please review following post: Re: Floating Point on KDS

Regards,

David