Yagarto GCC and Cortex M3

OP #1442005
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
Moderator #1443787
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.
OP #1445127
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
OP #1446306
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
#1644725
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.

Reply

A question of your own? This thread is over 17 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.