Skip to contentSkip to conversation

Problem building U-Boot for ARM target

U-Boot-Users Paolo Broggini 2 participants 9 messages Oct 11, 2005

lore
Share & tools
lore
#0 lore raw

Dear all,

I'm using the GCC 3.2 toolchain for building U-Boot (current head of git) for an ARM target. I get the following error:
cc1: invalid option 'abi=apcs-gnu'

This option (correct me if I'm wrong) was introduced with a recent patch by Peter Pearse. Digging a bit in gcc.gnu.org it appears that this option comes only with GCC 4.0!

Is this a known behaviour?

BTW: removing this option from 'cpu/armxxx/config.mk' U-Boot builds fine!

Best regards

-P.Broggini

#1 lore raw
Quoted 7 lines · Paolo Broggini

I'm using the GCC 3.2 toolchain for building U-Boot (current head of git) for an ARM target. I get the following error:
cc1: invalid option 'abi=apcs-gnu'

This option (correct me if I'm wrong) was introduced with a recent patch by Peter Pearse. Digging a bit in gcc.gnu.org it appears that this option comes only with GCC 4.0!

That's true but the cc-option checker should use -mapcs-32 if it is available, otherwise it will fall back to -mabi=apcs-gnu. It looks like your compiler doesn't support the first option either. In this case, I'm not sure it worked before Peter's patch. What CPU is it?

You could try the following in your config.mk but you should investigate why -mapcs-32 doesn't work:

PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))

Signature · 1 line
Catalin
#2 lore raw

Catalin Marinas ha scritto:

Quoted 11 lines
Quoted 7 lines · Paolo Broggini

I'm using the GCC 3.2 toolchain for building U-Boot (current head of git) for an ARM target. I get the following error:
cc1: invalid option 'abi=apcs-gnu'

This option (correct me if I'm wrong) was introduced with a recent patch by Peter Pearse. Digging a bit in gcc.gnu.org it appears that this option comes only with GCC 4.0!

Quoted 4 lines

That's true but the cc-option checker should use -mapcs-32 if it is available, otherwise it will fall back to -mabi=apcs-gnu. It looks like your compiler doesn't support the first option either. In this case, I'm not sure it worked before Peter's patch.

Yes it did, I build U-Boot for quite a long time.

Quoted 1 line

What CPU is it?

Freescale MC9328MX1

Quoted 3 lines

You could try the following in your config.mk but you should investigate why -mapcs-32 doesn't work:

Yes it do work!

Quoted 2 lines

PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))

Great, with this it builds fine :-) but the statement contained in the head of git 'config.mk' is:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)

It also builds fine if I replace the above statement with:
PLATFORM_CPPFLAGS += -march=armv4, -mapcs-32
like it was before Peters's patch.

Thanks

-P.Broggini

#3 lore raw
Quoted 8 lines · Paolo Broggini

Catalin Marinas ha scritto:

Quoted 2 lines

PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))

Great, with this it builds fine :-) but the statement contained in the head of git 'config.mk' is:

  PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)

My proposals tries both -mapcs-32 and -mabi=apcs-gnu and if neither works it doesn't add anything.

In your config.mk file, can you change -mapcs-32 with -g (this one would never fail) just to make sure there isn't any problem with the option checker?

Thanks.

Signature · 1 line
Catalin
#4 lore raw

Catalin Marinas ha scritto:

Quoted 7 lines
Quoted 5 lines · Paolo Broggini

Catalin Marinas ha scritto:

Quoted 2 lines

PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))

Quoted 8 lines
Quoted 4 lines

Great, with this it builds fine :-) but the statement contained in the head of git 'config.mk' is:

PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)

My proposals tries both -mapcs-32 and -mabi=apcs-gnu and if neither works it doesn't add anything.

-mapcs-32 do work, -mabi=apcs-gnu doesn't!

Quoted 3 lines

In your config.mk file, can you change -mapcs-32 with -g (this one would never fail) just to make sure there isn't any problem with the option checker?

Ok, see below:
1) PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)

     -> gcc complains about '-mabi=apcs-gnu' (see my original mail)

2) PLATFORM_CPPFLAGS +=$(call cc-option,-g,-mabi=apcs-gnu)

     -> everything compiles fine, the option used is '-g'

3) PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-g)

     -> everything compiles fine, the option used is '-mapcs-32'

Thanks

-P.Broggini

#5 lore raw
Quoted 8 lines · Paolo Broggini

1) PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)

     -> gcc complains about '-mabi=apcs-gnu' (see my original mail)

2) PLATFORM_CPPFLAGS +=$(call cc-option,-g,-mabi=apcs-gnu)

     -> everything compiles fine, the option used is '-g'

3) PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-g)

     -> everything compiles fine, the option used is '-mapcs-32'

Very weird. A 'make' bug maybe? I don't see why 1 and 3 checks return different options. If you write a shorter version in 1 like -mapbi=a, would it make any difference?

Signature · 1 line
Catalin
#6 lore raw

Catalin Marinas ha scritto:

Quoted 8 lines
Quoted 6 lines · Paolo Broggini

1) PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)

    -> gcc complains about '-mabi=apcs-gnu' (see my original mail)

2) PLATFORM_CPPFLAGS +=$(call cc-option,-g,-mabi=apcs-gnu)

    -> everything compiles fine, the option used is '-g'
Quoted 6 lines
Quoted 2 lines

3) PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-g)

    -> everything compiles fine, the option used is '-mapcs-32'

I don't see why 1 and 3 checks return
different options.

Indeed!

Well may be it starts to become out-of-topics here in U-Boot list, but just one more thing:
I tried the macro cc-option "by hand" (so without $CFLAGS) in a bash shell and I got the same results as above, i.e. the check for option -mapcs-32 fails but the compiler support it and indeed the compilation works fine! May be a bug?

Thanks

-P.Broggini

#7 lore raw
Quoted 2 lines · Paolo Broggini

Well may be it starts to become out-of-topics here in U-Boot list, but just one more thing:

I don't think it is OT as long as the config.mk files are part of U-Boot and they don't work as expected (unless the bug is definitely in a different tool).

Quoted 4 lines

I tried the macro cc-option "by hand" (so without $CFLAGS) in a bash shell and I got the same results as above, i.e. the check for option -mapcs-32 fails but the compiler support it and indeed the compilation works fine! May be a bug?

I tried the below file (with CC set to your compiler) and it works as expected for me (called with the two options as arguments), choosing -mapcs-32 (but it's a 3.4.0 compiler):

#!/bin/sh

CC=arm-linux-gcc

  if $CC $1 -S -o /dev/null -xc /dev/null \
        > /dev/null 2>&1; then echo "$1"; else echo "$2"; fi;

You could look for bug in the shell as well

Signature · 1 line
Catalin
#8 lore raw

Catalin Marinas ha scritto:

Quoted 6 lines

Paolo Broggini <[email protected]> wrote:

I don't think it is OT as long as the config.mk files are part of U-Boot and they don't work as expected (unless the bug is definitely in a different tool).

Ok

Quoted 7 lines

I tried the below file (with CC set to your compiler) and it works as expected for me (called with the two options as arguments), choosing -mapcs-32 (but it's a 3.4.0 compiler):

Quoted 9 lines

#!/bin/sh

CC=arm-linux-gcc

  if $CC $1 -S -o /dev/null -xc /dev/null \
        > /dev/null 2>&1; then echo "$1"; else echo "$2"; fi;

You could look for bug in the shell as well

I start to be a litle bit confused.
I tried what you suggested above and it works as expected here to i.e. it chooses -mapcs-32!!!!!!!! But if I build U-Boot it still fails, it takes the wrong option!

What about if you tried to buid U-Boot ?

Best regards
-P.Broggini