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

Carlos O'Donell carlos_odonell at mentor.com
Thu Jun 21 17:21:32 UTC 2012


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