andes_ae350_45: Fix build issues of AE350
PATCH 1/1 andes_ae350_45: Fix build issues of AE350
- 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
--- configs/andes_ae350_45_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
configs/andes_ae350_45_defconfig +2 -1
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Yu Chien Peter,
Quoted 2 lines
- 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 ...
Quoted 26 lines
Fixes:
- https://gitlab.com/buildroot.org/buildroot/-/jobs/4839059655Signed-off-by Yu Chien Peter Lin <[email protected]>--- configs/andes_ae350_45_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)(quoted diff) +0
-0b/configs/andes_ae350_45_defconfig index
998276635b..faf29b8b6b100644configs/andes_ae350_45_defconfig +2
-1@@ -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
Quoted 3 lines
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:
Quoted 5 lines
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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 3 lines · On Sat, 12 Aug 2023 14:00:00 +0200 Kilian Zinnecker <[email protected]>…
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
endifSo 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
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 24 lines · Thomas Petazzoni
Quoted 3 lines · On Sat, 12 Aug 2023 14:00:00 +0200 Kilian Zinnecker <[email protected]>…
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_45defconfig 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 endifSo 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"
Quoted 11 lines
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
Signature · 3 lines
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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 2 lines · On Sat, 12 Aug 2023 19:03:59 +0800 Yu Chien Peter Lin <[email protected]>…
- 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
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot