Printing Floats

Discussion around product based on ARM Cortex M3 core.

Moderators: nferre, ncollot

mookiedog
Posts: 14
Joined: Mon Mar 11, 2013 12:48 am

Printing Floats

Sun Mar 31, 2013 1:12 am

I am using a Sam3S. I can declare floats, do math on them, see them in the watch window as floats, but I can't print them. I just get a blank followed by the 'f' I was trying to use as %f.

I can't find any option under the linker to specify a floating point library.

Anyone done this successfully?
CptTitanic
Posts: 871
Joined: Sat Oct 30, 2010 6:04 pm

Re: Printing Floats

Sun Mar 31, 2013 4:39 am

For what tool chain? ASF

Look under Properties -> Toolchain -> ARM/GNU C Compiler -> Miscellaneous

Then scroll to the end of the text box and find "-Dprintf=iprintf", remove it.
mookiedog
Posts: 14
Joined: Mon Mar 11, 2013 12:48 am

Re: Printing Floats

Sun Mar 31, 2013 5:24 am

I'm not sure what you mean about ASF. If I click on the ASF tab, it says 3.5.0.

As far as the toolchain goes, this is Studio 6 using GCC. If I look at Properties -> Toolchain -> ARM/GNU C Compiler -> Miscellaneous, I see a single checkbox that says "verbose". The "other flags" box is blank. I tried uploading a screenshot, but it says "board attachment quota exceeded".
mookiedog
Posts: 14
Joined: Mon Mar 11, 2013 12:48 am

Re: Printing Floats

Sat Apr 20, 2013 11:09 pm

I filed a ticket with Atmel support. They agree that floating point works, but apparently can't be printed in ARM/Studio 6.

I will update this when I hear about a solution.
Chuck99
Posts: 1
Joined: Wed May 22, 2013 8:59 am

Re: Printing Floats

Wed May 22, 2013 9:12 am

mookiedog wrote:I filed a ticket with Atmel support. ... I will update this when I hear about a solution.
Any word back yet?
mookiedog
Posts: 14
Joined: Mon Mar 11, 2013 12:48 am

Re: Printing Floats

Wed May 22, 2013 3:23 pm

As of April 21, 2013:

"The bug is confirmed and work is on progress to integrate the fix.
It will be available in a future update.

Please check the Atmel Gallery in future for updates in the toolchain."
mookiedog
Posts: 14
Joined: Mon Mar 11, 2013 12:48 am

Re: Printing Floats

Sat Nov 16, 2013 7:04 pm

As of Nov 16, 2013, still no obvious fix.

The latest version 6.1.2730 SP2 has no floating point support that I can find.

Atmel support closed my ticket.

Does anyone know of a workaround that I am not aware of?
prabhu.yu
Posts: 1
Joined: Thu Jan 24, 2013 12:58 pm

Re: Printing Floats

Mon Nov 18, 2013 9:39 am

hi, there is a simple way. you need to use gcvtf function. It converts float to human readable string. google for gcvtf.
I have been using it on sam3n4c for my complex float calculation. It should work for any other sam series uC.

float latitude = 12.5687;
char str[25]
gcvtf(latitude, 10, str); printf("my float is =%s \n", str );
Let me know if this helps you.
---
Prabhu.
prabhu<D0T > yu [@] gmail <D0T>com
mookiedog
Posts: 14
Joined: Mon Mar 11, 2013 12:48 am

Re: Printing Floats

Sat Oct 25, 2014 11:47 pm

I have found that with release 6.2.1502 SP1, I can finally printf() floats.

Joy!

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 1 guest