# Forum: ARM programming with GCC/GNU tools Yagarto GCC and Cortex M3

Rate this post
 0 ▲ useful ▼ not useful
I am sorry, I am a newbie in GCC and ARM. I am trying to use LPC17xx
series of CPU and I am using the latest Yagarto build 4.4.1.

I search the internet and in this forum, and I don't seem to be able to
solve problem. I have read a few comment from Clifford Slocombe about
this subjects, and I have followed his suggestion, I still can't fixed
my problem.

I am writing a program that need floating point maths. So I have
included libgcc in my build. I keep  on receiving the following Error
message from the linker,"libgcc.a uses VFP whereas xxx.elf does not".

Clifford Slocombe said that in default GCC compile the code with
-mhard-float. Yet when I compile the code without -msoft-float , I still
receive the above message. If I compile with -mHard-float, I get
hard-float conflict with specified fpu.

My question is do I have to rebuild libgcc.a ? Clifford Slocombe seem to
suggest it is not necessary.

If I need to build libgcc.a, how do I do it ? I have installed minGW and
MSYS but I don't know how to use it with Yagarto.

Best Regards to all
Tony

Rate this post
 0 ▲ useful ▼ not useful
Tony Whitehall wrote:
> I am writing a program that need floating point maths. So I have
> included libgcc in my build.
I suggest to "include" libm too (option -lm)

>I keep  on receiving the following Error
> message from the linker,"libgcc.a uses VFP whereas xxx.elf does not".
Verify that the target-options are also given for linking (-mthumb
-mcpu-cortex-m3), don't call the linker (*-ld) directly but use
compiler-frontend (*-gcc).

> Clifford Slocombe said that in default GCC compile the code with
> -mhard-float. Yet when I compile the code without -msoft-float , I still
> receive the above message. If I compile with -mHard-float, I get
> hard-float conflict with specified fpu.
Should not be needed for your target.

> My question is do I have to rebuild libgcc.a ? Clifford Slocombe seem to
> suggest it is not necessary.
I don't think so.

> If I need to build libgcc.a, how do I do it ? I have installed minGW and
> MSYS but I don't know how to use it with Yagarto.
AFAIK Michael Fischer provides buildscripts. Cygwin might be a better
environment to build a toolchain. With the -nocygwin compiler-option
binaries can be generated which can work without cygwin-DLLs on any
MS-Windows system. But I expect building/updating the toolchain is not
needed.

Rate this post
 0 ▲ useful ▼ not useful
Hi Martin,

>> I am writing a program that need floating point maths. So I have
>> included libgcc in my build.
>I suggest to "include" libm too (option -lm)
I am Sorry I didn't mention that I also include libc and Libm.

>>I keep  on receiving the following Error
>> message from the linker,"libgcc.a uses VFP whereas xxx.elf does not".
>Verify that the target-options are also given for linking (-mthumb
>-mcpu-cortex-m3), don't call the linker (*-ld) directly but use
>compiler-frontend (*-gcc).

I am using  LD = $(GNUTOOLS)/arm-elf-gcc, I believe that is using the compiler front. After your response I include -mthumb and mcpu-cortex-m3 as part of the linking option. Unfortunately, it make no difference. It seem my best solution is to avoid using int64_t variables or make use my own int64_t divide and mod , as the compiler uses link in libgcc for these functions. Is this correct ? >> Clifford Slocombe said that in default GCC compile the code with >> -mhard-float. Yet when I compile the code without -msoft-float , I still >> receive the above message. If I compile with -mHard-float, I get >> hard-float conflict with specified fpu. >Should not be needed for your target. >> My question is do I have to rebuild libgcc.a ? Clifford Slocombe seem to >> suggest it is not necessary. >I don't think so. >> If I need to build libgcc.a, how do I do it ? I have installed minGW and >> MSYS but I don't know how to use it with Yagarto. >AFAIK Michael Fischer provides buildscripts. Cygwin might be a better >environment to build a toolchain. With the -nocygwin compiler-option >binaries can be generated which can work without cygwin-DLLs on any >MS-Windows system. But I expect building/updating the toolchain is not >needed. I have no experience in using cygwin. I am chicken out, so for the moment I will try to avoid using libgcc or implement 64 bits divide and mod. Best Regards Tony Rate this post  0 ▲ useful ▼ not useful Hi Toni, I'm using yagarto too. I compile my program with options: -mfpu=vfp -msoft-float You should set the optimizing level to 0. (With level s I had no floating point support: Beitrag "Yagarto printf und float funktioniert nicht richtig" ) Best Regards Tom Rate this post  0 ▲ useful ▼ not useful Hi Tom, You response hit the nail right on the head. The only option I didn't try was -mfpu=vfp. When I compiled with -mfpu=vfp, I can now link with libgcc.a Thank you, Tom and Martin for your help. Best Regard, Tony Rate this post  0 ▲ useful ▼ not useful Hallo, I'm having the same problem. Up to now I used a custom build gcc toolchain, but maintaining it is too much an efford, so I decided to switch to Yagarto. My Makefile looks like this:  A_FLAGS = -mcpu=cortex-m3 -mthumb -Wa,-gdwarf-2 C_FLAGS = -mcpu=cortex-m3 -mthumb -O0 -gdwarf-2 \ -mfpu=vfp -msoft-float \$(patsubst %,-I%,\$(INC_DIRS)) -I. \ -std=gnu99 \ -ffunction-sections -fdata-sections \ -Wall -Wextra -Wimplicit -Wcast-align -Wpointer-arith \ -Wredundant-decls -Wshadow -Wcast-qual -Wcast-align -Wnested-externs \ -Wno-cast-qual -Wno-missing-prototypes -Wno-strict-prototypes -Wno-missing-declarations L_FLAGS = -T stm32f10x_md.ld \ -nostartfiles -Wl,--gc-sections \ -lc -lm -lgcc \ -mfpu=vfp -msoft-float 

As you can see, I tried -mfpu=vfp -msoft-float, but it did not work for
me. Maybe there is still something wrong.

Current Yagartos arm-elf-gcc was build without the configure option
"-with-float=soft", maybe that has something to do with it.

Is there anybody, who uses Yagarto for Cortex-M3 an can provide me his
Makefile?

Any other suggestions?

Kind regards, Oliver.

• $formula (LaTeX syntax)$