EmbDev.net

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


von Tony W. (tonywhitehall)


Rate this post
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.

Thank you in advance.

Best Regards to all
Tony

von Martin T. (mthomas) (Moderator)


Rate this post
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.

von Tony W. (tonywhitehall)


Rate this post
useful
not useful
Hi Martin,

Thank you for your response.

>> 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

von Tom (Guest)


Rate this post
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

von Tony W. (tonywhitehall)


Rate this post
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

von Oliver B. (irq)


Rate this post
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:
1
A_FLAGS = -mcpu=cortex-m3 -mthumb -Wa,-gdwarf-2
2
C_FLAGS = -mcpu=cortex-m3 -mthumb -O0 -gdwarf-2 \
3
          -mfpu=vfp -msoft-float \
4
          $(patsubst %,-I%,$(INC_DIRS)) -I. \
5
          -std=gnu99 \
6
          -ffunction-sections -fdata-sections \
7
          -Wall -Wextra -Wimplicit -Wcast-align -Wpointer-arith \
8
          -Wredundant-decls -Wshadow -Wcast-qual -Wcast-align -Wnested-externs \
9
          -Wno-cast-qual -Wno-missing-prototypes  -Wno-strict-prototypes -Wno-missing-declarations
10
L_FLAGS = -T stm32f10x_md.ld \
11
          -nostartfiles -Wl,--gc-sections \
12
          -lc -lm -lgcc \
13
          -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.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.