[arm-gnu] Cortex-M3 and Floating Point Problems

Mark Mulrooney mmulrooney at teledyne.com
Thu Jun 21 18:48:51 UTC 2012


It appears you are correct, good catch! Now my next question would be why. I'm using the standard libraries provided by CodeSourcery. I did notice while stepping through the code that the last assembly instruction before branching to printf is a ldrd call and I also noticed there is a compiler option for -mfix-cortex-m3-ldrd. I added that in but it still doesn't seem to work correctly. 

Thanks,
Mark


-----Original Message-----
From: Carlos O'Donell [mailto:carlos_odonell at mentor.com] 
Sent: Thursday, June 21, 2012 13:22
To: Mark Mulrooney
Cc: arm-gnu at codesourcery.com
Subject: Re: [arm-gnu] Cortex-M3 and Floating Point Problems

On 6/21/2012 9:06 AM, Mark Mulrooney wrote:
> Were using the arm-none-eabi to compile for an STM32F103ZG and we seem 
> to be having trouble with floating point operations. The code compiles 
> fine and when I look at the list file I see the calls to the float 
> library functions. We are compiling with the following options -mthumb 
> -mcpu=cortex-m3 -msoft-float.
> 
> The problem is no floating point operations seem to work on the 
> system. As a simple test I tried the following:
> 
> float test1 = 10.1234;
> 
> float test2 = .5678
> 
> float answer = test1 * test2
> 
> printf("Answer: %f\r\n", answer);
> 
> 
> 
> It printed out Answer: 0.000000.
> 
> 
> 
> I was wondering if it may be pulling in arm libraries instead of thumb 
> or something like that. Any help would be greatly appreciated.

If I had to guess...

You are using an alternate printf implementation that has buggy %f support?

What does the *debugger* actually say is the value of answer?

Cheers,
Carlos.
--
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos_odonell at mentor.com
carlos at codesourcery.com
+1 (613) 963 1026





More information about the arm-gnu mailing list