Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] andes_ae350_45: Fix build issues of AE350
@ 2023-08-12 11:03 Yu Chien Peter Lin
  2023-08-12 12:00 ` Kilian Zinnecker via buildroot
  2023-08-12 12:25 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 5+ messages in thread
From: Yu Chien Peter Lin @ 2023-08-12 11:03 UTC (permalink / raw)
  To: buildroot; +Cc: Yu Chien Peter Lin, ycliang, thomas.petazzoni

- Select RVA extension so the toolchain uses glibc by default
- Enable Zifencei and Zicsr for gcc-12 to fix U-Boot build failure

Fixes:
- https://gitlab.com/buildroot.org/buildroot/-/jobs/4839059655

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 configs/andes_ae350_45_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configs/andes_ae350_45_defconfig b/configs/andes_ae350_45_defconfig
index 998276635b..faf29b8b6b 100644
--- a/configs/andes_ae350_45_defconfig
+++ b/configs/andes_ae350_45_defconfig
@@ -1,6 +1,7 @@
 BR2_riscv=y
 BR2_riscv_custom=y
 BR2_RISCV_ISA_CUSTOM_RVM=y
+BR2_RISCV_ISA_CUSTOM_RVA=y
 BR2_RISCV_ISA_CUSTOM_RVF=y
 BR2_RISCV_ISA_CUSTOM_RVD=y
 BR2_RISCV_ISA_CUSTOM_RVC=y
@@ -38,7 +39,7 @@ BR2_TARGET_UBOOT_NEEDS_OPENSBI=y
 BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
 BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"
 BR2_TARGET_UBOOT_SPL=y
-BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ARCH_FLAGS=-march=rv64imafdc"
+BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ARCH_FLAGS=-march=rv64imafdc_zifencei_zicsr"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] andes_ae350_45: Fix build issues of AE350
  2023-08-12 11:03 [Buildroot] [PATCH] andes_ae350_45: Fix build issues of AE350 Yu Chien Peter Lin
@ 2023-08-12 12:00 ` Kilian Zinnecker via buildroot
  2023-08-12 12:27   ` Thomas Petazzoni via buildroot
  2023-08-12 12:25 ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 5+ messages in thread
From: Kilian Zinnecker via buildroot @ 2023-08-12 12:00 UTC (permalink / raw)
  To: buildroot; +Cc: Yu Chien Peter Lin, ycliang, thomas.petazzoni

Hello Yu Chien Peter,

> - Select RVA extension so the toolchain uses glibc by default
> - Enable Zifencei and Zicsr for gcc-12 to fix U-Boot build failure

Yeah, this zifencei_zicsr extension flag thing is annoying ...

> Fixes:
> - https://gitlab.com/buildroot.org/buildroot/-/jobs/4839059655
> 
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
>  configs/andes_ae350_45_defconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/andes_ae350_45_defconfig
> b/configs/andes_ae350_45_defconfig index 998276635b..faf29b8b6b 100644
> --- a/configs/andes_ae350_45_defconfig
> +++ b/configs/andes_ae350_45_defconfig
> @@ -1,6 +1,7 @@
>  BR2_riscv=y
>  BR2_riscv_custom=y
>  BR2_RISCV_ISA_CUSTOM_RVM=y
> +BR2_RISCV_ISA_CUSTOM_RVA=y
>  BR2_RISCV_ISA_CUSTOM_RVF=y
>  BR2_RISCV_ISA_CUSTOM_RVD=y
>  BR2_RISCV_ISA_CUSTOM_RVC=y
> @@ -38,7 +39,7 @@ BR2_TARGET_UBOOT_NEEDS_OPENSBI=y
>  BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
>  BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"
>  BR2_TARGET_UBOOT_SPL=y
> -BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ARCH_FLAGS=-march=rv64imafdc"
> +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ARCH_FLAGS=-march=rv64imafdc_zifencei_zic
> sr" BR2_PACKAGE_HOST_DOSFSTOOLS=y
>  BR2_PACKAGE_HOST_GENIMAGE=y
>  BR2_PACKAGE_HOST_MTOOLS=y

I am not sure, whether you need to specify custom makeopts for uboot after 
all: Looking at the current andes_ae350_45_defconfig (https://gitlab.com/
buildroot.org/buildroot/-/blob/4de60e41c3487946712da6d889ef89d325c2032a/
configs/andes_ae350_45_defconfig), it seems, that there is no special/custom gcc 
version defined. Hence the gcc version should be buildroot's current default 
version, i.e., v12.3.0. For this version, buildroot already adds the flags for 
zifencei and zicsr extension, see here:

https://gitlab.com/buildroot.org/buildroot/-/blob/
4de60e41c3487946712da6d889ef89d325c2032a/arch/arch.mk.riscv#L38-39

And I also believe, that these defines should be sufficient to set the rv64imafdc 
flags:

>  BR2_RISCV_ISA_CUSTOM_RVM=y
> +BR2_RISCV_ISA_CUSTOM_RVA=y
>  BR2_RISCV_ISA_CUSTOM_RVF=y
>  BR2_RISCV_ISA_CUSTOM_RVD=y
>  BR2_RISCV_ISA_CUSTOM_RVC=y

So I think setting BR2_RISCV_ISA_CUSTOM_RVA=y is correct. However, you could 
try whether it works, if you then completely remove the 
BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS?

Best regards,
Kilian



_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] andes_ae350_45: Fix build issues of AE350
  2023-08-12 11:03 [Buildroot] [PATCH] andes_ae350_45: Fix build issues of AE350 Yu Chien Peter Lin
  2023-08-12 12:00 ` Kilian Zinnecker via buildroot
@ 2023-08-12 12:25 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-12 12:25 UTC (permalink / raw)
  To: Yu Chien Peter Lin; +Cc: ycliang, buildroot

On Sat, 12 Aug 2023 19:03:59 +0800
Yu Chien Peter Lin <peterlin@andestech.com> wrote:

> - Select RVA extension so the toolchain uses glibc by default
> - Enable Zifencei and Zicsr for gcc-12 to fix U-Boot build failure

I think these should be two separate patches. Indeed, only the second
part is needed to fix the build failure. Could you check this, and if
it's the case, split into two patches?

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] andes_ae350_45: Fix build issues of AE350
  2023-08-12 12:00 ` Kilian Zinnecker via buildroot
@ 2023-08-12 12:27   ` Thomas Petazzoni via buildroot
  2023-08-14  2:19     ` Yu-Chien Peter Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-12 12:27 UTC (permalink / raw)
  To: Kilian Zinnecker; +Cc: Yu Chien Peter Lin, ycliang, buildroot

On Sat, 12 Aug 2023 14:00:00 +0200
Kilian Zinnecker <kilian.zinnecker@mail.de> wrote:

> So I think setting BR2_RISCV_ISA_CUSTOM_RVA=y is correct. However, you could 
> try whether it works, if you then completely remove the 
> BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS?

The U-Boot version used by the andes_ae350_45 defconfig indeed includes:

# Newer binutils versions default to ISA spec version 20191213 which moves some
# instructions from the I extension to the Zicsr and Zifencei extensions.
toolchain-need-zicsr-zifencei := $(call cc-option-yn, -mabi=$(ABI) -march=$(RISCV_MARCH)_zicsr_zifencei)
ifeq ($(toolchain-need-zicsr-zifencei),y)
        RISCV_MARCH := $(RISCV_MARCH)_zicsr_zifencei
endif

So it should already be doing the right thing automatically. However,
the fact that the defconfig forces its own ARCH_FLAGS=-march=rv64imafdc
is probably what breaks the build.

So I agree with Kilian here: please try without any:

BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ARCH_FLAGS=-march=rv64imafdc"

and see if that helps. However in that case, you might need indeed to
keep the addition of BR2_RISCV_ISA_CUSTOM_RVA=y as part of the fix:
please double check that.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] andes_ae350_45: Fix build issues of AE350
  2023-08-12 12:27   ` Thomas Petazzoni via buildroot
@ 2023-08-14  2:19     ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Yu-Chien Peter Lin @ 2023-08-14  2:19 UTC (permalink / raw)
  To: Thomas Petazzoni, kilian.zinnecker, buildroot; +Cc: ycliang

On Sat, Aug 12, 2023 at 02:27:59PM +0200, Thomas Petazzoni wrote:
> On Sat, 12 Aug 2023 14:00:00 +0200
> Kilian Zinnecker <kilian.zinnecker@mail.de> wrote:
> 
> > So I think setting BR2_RISCV_ISA_CUSTOM_RVA=y is correct. However, you could 
> > try whether it works, if you then completely remove the 
> > BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS?
> 
> The U-Boot version used by the andes_ae350_45 defconfig indeed includes:
> 
> # Newer binutils versions default to ISA spec version 20191213 which moves some
> # instructions from the I extension to the Zicsr and Zifencei extensions.
> toolchain-need-zicsr-zifencei := $(call cc-option-yn, -mabi=$(ABI) -march=$(RISCV_MARCH)_zicsr_zifencei)
> ifeq ($(toolchain-need-zicsr-zifencei),y)
>         RISCV_MARCH := $(RISCV_MARCH)_zicsr_zifencei
> endif
> 
> So it should already be doing the right thing automatically. However,
> the fact that the defconfig forces its own ARCH_FLAGS=-march=rv64imafdc
> is probably what breaks the build.
> 
> So I agree with Kilian here: please try without any:
> 
> BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ARCH_FLAGS=-march=rv64imafdc"
> 
> and see if that helps. However in that case, you might need indeed to
> keep the addition of BR2_RISCV_ISA_CUSTOM_RVA=y as part of the fix:
> please double check that.
> 
> Thanks!
> 
> Thomas
> -- 
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com

Hi Thomas, Kilian,

Yeah, I should not override the ARCH_FLAGS with BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS.
I've rebuilt it without any problems, so I will remove the configuration and
add a patch to set R2_RISCV_ISA_CUSTOM_RVA.

Thanks for your review!

Best regards,
Peter Lin
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-08-14  2:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-12 11:03 [Buildroot] [PATCH] andes_ae350_45: Fix build issues of AE350 Yu Chien Peter Lin
2023-08-12 12:00 ` Kilian Zinnecker via buildroot
2023-08-12 12:27   ` Thomas Petazzoni via buildroot
2023-08-14  2:19     ` Yu-Chien Peter Lin
2023-08-12 12:25 ` Thomas Petazzoni via buildroot

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