From 1218bcaa30ba5f00cab789be898fd821d9ee2255 Mon Sep 17 00:00:00 2001 From: Moritz Imfeld Date: Tue, 17 Sep 2024 13:32:30 +0200 Subject: [PATCH 1/3] Fix march string when compiling with a newer compiler The issue was that when compiling u-boot from the cva6-sdk for Cheshire + Ara we used a newer compiler (GCC 13.2.0). This compiler complies with a newer version of the RISC-V specifications, where some instruction where removed from the base integer instruction set and moved into dedicated extensions (zicsr and zifence). In the cva6-sdk, when we compile for Cheshire + Ara, the RVV variable has to be defined, for this reason we check here if this variable is defined an change the march accordingly Signed-off-by: Moritz Imfeld --- arch/riscv/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 0b80eb8d864..e72cf2b55f5 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -24,8 +24,12 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) CMODEL = medany endif -ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \ - -mcmodel=$(CMODEL) +# hacky fix, to make the image for Cheshire + Ara +ifdef RVV + ARCH_FLAGS=-march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C)_zicsr_zifencei -mabi=$(ABI) -mcmodel=$(CMODEL) +else + ARCH_FLAGS=-march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) -mcmodel=$(CMODEL) +endif PLATFORM_CPPFLAGS += $(ARCH_FLAGS) CFLAGS_EFI += $(ARCH_FLAGS) From f9a4ad416dffe2429da83c978deba2c267edaaeb Mon Sep 17 00:00:00 2001 From: Moritz Imfeld Date: Tue, 17 Sep 2024 13:33:19 +0200 Subject: [PATCH 2/3] TODO: Check if this change is necessary Signed-off-by: Moritz Imfeld --- configs/pulp-platform_cheshire_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/pulp-platform_cheshire_defconfig b/configs/pulp-platform_cheshire_defconfig index 152f1c61c86..313937b2ea5 100644 --- a/configs/pulp-platform_cheshire_defconfig +++ b/configs/pulp-platform_cheshire_defconfig @@ -10,7 +10,8 @@ CONFIG_BOOTDELAY=5 CONFIG_HUSH_PARSER=y CONFIG_USE_BOOTCOMMAND=y # Boot with mmc if mmc probes normally, else boot with spi (get CS from "boot-with" in device tree) -CONFIG_BOOTCOMMAND="fdt addr ${fdtcontroladdr}; if mmc info; then mmc read 90000000 2000 5000; else fdt get value boot-with /soc/spi boot-with; if sf probe 0:${boot-with}; then sf read 90000000 400000 800000; fi; fi; bootm 90000000 - ${fdtcontroladdr};" +# CONFIG_BOOTCOMMAND="fdt addr ${fdtcontroladdr}; if mmc info; then mmc read 90000000 2000 5000; else fdt get value boot-with /soc/spi boot-with; if sf probe 0:${boot-with}; then sf read 90000000 400000 800000; fi; fi; bootm 90000000 - ${fdtcontroladdr};" +CONFIG_BOOTCOMMAND="sf probe 0:1; sf read 90000000 400000 2000000; bootm 90000000 - ${fdtcontroladdr};" CONFIG_DISPLAY_CPUINFO=y CONFIG_SPL_SPI_FLASH_MTD=y CONFIG_CMD_GPT=y From 8e3226fe6751b07e76eca51c544c214b811e4f00 Mon Sep 17 00:00:00 2001 From: Moritz Imfeld Date: Tue, 17 Sep 2024 22:57:56 +0200 Subject: [PATCH 3/3] Switch from ifdef to ifeq 1 Signed-off-by: Moritz Imfeld --- arch/riscv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index e72cf2b55f5..af99da9fa0e 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -25,7 +25,7 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) endif # hacky fix, to make the image for Cheshire + Ara -ifdef RVV +ifeq ($(RVV), 1) ARCH_FLAGS=-march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C)_zicsr_zifencei -mabi=$(ABI) -mcmodel=$(CMODEL) else ARCH_FLAGS=-march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) -mcmodel=$(CMODEL)