mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] Toolchain for STM32MP15x
@ 2019-11-25 12:33 Guillermo Rodriguez Garcia
  2019-11-25 16:43 ` Guillermo Rodriguez Garcia
  0 siblings, 1 reply; 4+ messages in thread
From: Guillermo Rodriguez Garcia @ 2019-11-25 12:33 UTC (permalink / raw)
  To: ptxdist

Hi all,

I am trying to setup a toolchain for the STM32MP15x. The main CPU is a
single or dual (depending on p/n) Cortex-A7, supporting NEON and
VFPv4.

I'm using the OSELAS arm-v7a-linux-gnueabihf toolchain. As for the
extra flags I believe I should use -mcpu=cortex-a7 -mfpu=neon-vfpv4.

Does this look correct? Any comments / hints?

BR,

Guillermo Rodriguez Garcia
guille.rodriguez@gmail.com

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] Toolchain for STM32MP15x
  2019-11-25 12:33 [ptxdist] Toolchain for STM32MP15x Guillermo Rodriguez Garcia
@ 2019-11-25 16:43 ` Guillermo Rodriguez Garcia
  2019-11-26  7:24   ` Michael Olbrich
  0 siblings, 1 reply; 4+ messages in thread
From: Guillermo Rodriguez Garcia @ 2019-11-25 16:43 UTC (permalink / raw)
  To: ptxdist

Hi all,

I have setup the toolchain with the settings from my previous email
(-mcpu=cortex-a7 -mfpu=neon-vfpv4)

When I try to build the Linux kernel I get lots of warnings about
conflicting toolchain options:

arch/arm/kernel/elf.c:1:0: warning: switch -mcpu=cortex-a7 conflicts
with -march=armv5t switch

This is with OSELAS.Toolchain-2016.06.1, using arm-v7a-linux-gnueabihf.

I am not sure where the -march=armv5t is coming from, since this is an
arm-v7a toolchain.

Also if I use -mcpu=cortex-a9 instead of cortex-a7, there are no warnings :-?

Can anyone sehd some light ?

Thank you,

Guillermo

El lun., 25 nov. 2019 a las 13:33, Guillermo Rodriguez Garcia
(<guille.rodriguez@gmail.com>) escribió:
>
> Hi all,
>
> I am trying to setup a toolchain for the STM32MP15x. The main CPU is a
> single or dual (depending on p/n) Cortex-A7, supporting NEON and
> VFPv4.
>
> I'm using the OSELAS arm-v7a-linux-gnueabihf toolchain. As for the
> extra flags I believe I should use -mcpu=cortex-a7 -mfpu=neon-vfpv4.
>
> Does this look correct? Any comments / hints?
>
> BR,
>
> Guillermo Rodriguez Garcia
> guille.rodriguez@gmail.com



-- 
Guillermo Rodriguez Garcia
guille.rodriguez@gmail.com

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] Toolchain for STM32MP15x
  2019-11-25 16:43 ` Guillermo Rodriguez Garcia
@ 2019-11-26  7:24   ` Michael Olbrich
  2019-11-26  9:27     ` Guillermo Rodriguez Garcia
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Olbrich @ 2019-11-26  7:24 UTC (permalink / raw)
  To: ptxdist

On Mon, Nov 25, 2019 at 05:43:01PM +0100, Guillermo Rodriguez Garcia wrote:
> Hi all,
> 
> I have setup the toolchain with the settings from my previous email
> (-mcpu=cortex-a7 -mfpu=neon-vfpv4)
> 
> When I try to build the Linux kernel I get lots of warnings about
> conflicting toolchain options:
> 
> arch/arm/kernel/elf.c:1:0: warning: switch -mcpu=cortex-a7 conflicts
> with -march=armv5t switch

The problem is, that the kernel tries to add it's own -march=armv7-a and I
guess that causes warnings in combination with -mcpu=cortex-a7 (at least
with some gcc versions). This is tested with -Werror, so it fails. The
fallback is -march=armv5t ... (see arch/arm/Makefile in the kernel).

You cannot use -mcpu= in the extra cflags like this.

> This is with OSELAS.Toolchain-2016.06.1, using arm-v7a-linux-gnueabihf.
> 
> I am not sure where the -march=armv5t is coming from, since this is an
> arm-v7a toolchain.
> 
> Also if I use -mcpu=cortex-a9 instead of cortex-a7, there are no warnings :-?

This will have the same problem with gcc 9.x.

> Can anyone sehd some light ?

See above. Combining -march= with -mcpu= is not really supported and the
result is undefined. I'd say, just use -mfpu=neon-vfpv4. Have you tested if
-mcpu=cortex-a7 actually makes a difference?
I've done some tests with some other -mcpu= values and I've not seen any
real difference.

Michael

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] Toolchain for STM32MP15x
  2019-11-26  7:24   ` Michael Olbrich
@ 2019-11-26  9:27     ` Guillermo Rodriguez Garcia
  0 siblings, 0 replies; 4+ messages in thread
From: Guillermo Rodriguez Garcia @ 2019-11-26  9:27 UTC (permalink / raw)
  To: ptxdist

Hi Michael,

El mar., 26 nov. 2019 a las 8:24, Michael Olbrich
(<m.olbrich@pengutronix.de>) escribió:
>
> On Mon, Nov 25, 2019 at 05:43:01PM +0100, Guillermo Rodriguez Garcia wrote:
> > Hi all,
> >
> > I have setup the toolchain with the settings from my previous email
> > (-mcpu=cortex-a7 -mfpu=neon-vfpv4)
> >
> > When I try to build the Linux kernel I get lots of warnings about
> > conflicting toolchain options:
> >
> > arch/arm/kernel/elf.c:1:0: warning: switch -mcpu=cortex-a7 conflicts
> > with -march=armv5t switch
>
> The problem is, that the kernel tries to add it's own -march=armv7-a and I
> guess that causes warnings in combination with -mcpu=cortex-a7 (at least
> with some gcc versions). This is tested with -Werror, so it fails. The

You are right, this causes a warning:

$ /opt/OSELAS.Toolchain-2016.06.1/arm-v7a-linux-gnueabihf/gcc-5.4.0-glibc-2.23-binutils-2.26-kernel-4.6-sanitized/bin/arm-v7a-linux-gnueabihf-gcc
-march=armv7-a -mcpu=cortex-a7 -o hello hello.c
hello.c:1:0: warning: switch -mcpu=cortex-a7 conflicts with
-march=armv7-a switch

I didn't understand why the conflict happens with -mcpu=cortex-a7 but
not with -mcpu=cortex-a9 (as both of which are ARMv7-A). But the I
found that Cortex A7 actually implements the ARMv7ve variant of ARMv7.
Indeed the following does not result in warnings:

$ /opt/OSELAS.Toolchain-2016.06.1/arm-v7a-linux-gnueabihf/gcc-5.4.0-glibc-2.23-binutils-2.26-kernel-4.6-sanitized/bin/arm-v7a-linux-gnueabihf-gcc
-march=armv7ve -mcpu=cortex-a7 -o hello hello.c

> fallback is -march=armv5t ... (see arch/arm/Makefile in the kernel).
>
> You cannot use -mcpu= in the extra cflags like this.
>
> > This is with OSELAS.Toolchain-2016.06.1, using arm-v7a-linux-gnueabihf.
> >
> > I am not sure where the -march=armv5t is coming from, since this is an
> > arm-v7a toolchain.
> >
> > Also if I use -mcpu=cortex-a9 instead of cortex-a7, there are no warnings :-?
>
> This will have the same problem with gcc 9.x.
>
> > Can anyone sehd some light ?
>
> See above. Combining -march= with -mcpu= is not really supported and the
> result is undefined.

According to the gcc docs this should be supported:

-march=name[+extension…]
    [...] This option can be used in conjunction with or instead of
the -mcpu= option

-mcpu=name[+extension…]
    [...] Where this option is used in conjunction with -march or
-mtune, those options take precedence over the appropriate part of
this option.

The problem seems to be that although this is supported, there is a
warning because the explicit -march (armv7-a) does not match the
architecture derived from -mcpu (armv7ve). And as you said,
specifically for the kernel build, this is tested with -Werror, so the
test fails and the armv5t fallback is used instead (which also fails).


> I'd say, just use -mfpu=neon-vfpv4. Have you tested if
> -mcpu=cortex-a7 actually makes a difference?

No, didn't get that far (the build failed..)

But I guess I can replace -mcpu=cortex-a7 with -mtune=cortex-a7 (that
does not result in any errors)

Thank you! This was helpful.

BR,

Guillermo Rodriguez Garcia
guille.rodriguez@gmail.com

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-26  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 12:33 [ptxdist] Toolchain for STM32MP15x Guillermo Rodriguez Garcia
2019-11-25 16:43 ` Guillermo Rodriguez Garcia
2019-11-26  7:24   ` Michael Olbrich
2019-11-26  9:27     ` Guillermo Rodriguez Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox