What options needed to link to correct library

Asked by Gary Fuehrer

When I compile and link with:
-mcpu=cortex-m4 -mfloat-abi=softfp

The map file indicates that memset comes from here:
<toolpath>/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib\libc_s.a

and my app crashes at the first call to memset.

I found that adding -mfpu=fpv4-sp-d16 results in my app working great. In this case memset comes from here:
<toolpath>/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7e-m/softfp\libc_s.a

But that 'trick' doesn't work for -mfloat-abi=soft, in which case I found I must instead use -march=armv7e-m (and this trick doesn't work for the softfp case above) to get:
<toolpath>/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7e-m\libc_s.a

I've found this behavior with:
gcc-arm-none-eabi-4_7-2013q1-20130313-win32
gcc-arm-none-eabi-4_7-2013q2-20130614-win32
gcc-arm-none-eabi-4_7-2013q3-20130916-win32

My question: What am I doing wrong? Knowing either -mcpu=cortex-m4 or -march=armv7e-m, I think, would be enough that it wouldn't link to a library with an, apparently, incompatible memset. What's the 'canonical' set of compiler flags to get the right library for each case of float-abi?

-Gary

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Gary Fuehrer (gfuehrer) said :
#1

BTW, I'm using gcc-arm-none-eabi-4_7-2013q3-20130916-win32.zip

Revision history for this message
Terry Guo (terry.guo) said :
#2

It's true that several target-related compiler options are critical for tool chain to decide which library should be linked. It's a little bit complicated for user to find out those relationships at the very beginning, so we explicitly list them in file https://launchpadlibrarian.net/151487295/readme.txt. Hope it can help you.

Can you help with this problem?

Provide an answer of your own, or ask Gary Fuehrer for more information if necessary.

To post a message you must log in.