Floating problem in KDS3.0.0 with KL03.

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Floating problem in KDS3.0.0 with KL03.

ソリューションへジャンプ
1,263件の閲覧回数
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.

ラベル(1)
0 件の賞賛
返信
1 解決策
970件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Syed,

Please review following post: Re: Floating Point on KDS

Regards,

David

元の投稿で解決策を見る

8 返答(返信)
970件の閲覧回数
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 件の賞賛
返信
970件の閲覧回数
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 件の賞賛
返信
970件の閲覧回数
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 件の賞賛
返信
970件の閲覧回数
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 件の賞賛
返信
970件の閲覧回数
syedidris
Contributor III

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

0 件の賞賛
返信
970件の閲覧回数
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 件の賞賛
返信
970件の閲覧回数
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 件の賞賛
返信
971件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Syed,

Please review following post: Re: Floating Point on KDS

Regards,

David