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

Carlos O'Donell carlos_odonell at mentor.com
Thu Jun 21 19:18:24 UTC 2012


On 6/21/2012 2:48 PM, Mark Mulrooney wrote:
> 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.

The `-mfix-cortex-m3-ldrd' is automatically enabled when you
specify -mcpu=cortex-m3.

You haven't provided a test case or linker map file so all we
can do is guess.

The Sourcery CodeBench bare-metal C library is ISO C compabitle
and therefore provides %f support.

Care to add `-Wl,-Map,linkermap.txt` to your final link with gcc
and look to see there where printf is coming from?

Some other options might be:

* You used macro tricks to call iprintf instead of printf
  to make the executable smaller, but forgot iprintf doesn't
  support %f?

* You aren't using the CodeBench printf, and the alternate
  printf doesn't support %f?

* And lastly... the CodeBench printf has a bug.

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