Skip to contentSkip to conversation

boot/zynqmp-firmware: new boot firmware

PATCH In review Neal Frager via buildroot 2 participants 10 messages Jun 7, 2024 – Jun 11, 2024 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH v12 1/3 boot/zynqmp-firmware: new boot firmware

This patch adds a new boot firmware to buildroot for building the zynqmp pmufw. It requires the toolchain-bare-metal package that includes a bare-metal binutils, gcc and newlib which can be built for the microblaze architecture.

---
V1->V2:
- builds a bare-metal gcc toolchain instead of requiring an external microblaze toolchain
V2->V3:
- corrected custom cflags option
- added support for xilinx_v2022.2 version
- added zynqmp-firmware.hash
V3->V4:
- no changes
V4->V5:
- reduced all lines to <80 chars
V5->V6:
- migrated to toolchain-bare-metal-buildroot
V6->V7:
- removed patch numbers
- changed dependency to toolchain-bare-metal-buildroot
- removed hash since version is configurable
V7->V9:
- no changes
V9->V10:
- removed patches for supporting versions older than xilinx_v2023.2
V10->V11:
- set default BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH to "microblazeel-xilinx-elf" to avoid stand-alone build failure
V11->V12:
- replace select BR2_TOOLCHAIN_BARE_METAL_BUILDROOT with depends
- change variable name for check-package warning

---
 DEVELOPERS                              |  1 +
 boot/Config.in                          |  1 +
 boot/zynqmp-firmware/Config.in          | 25 +++++++++++++++++++
 boot/zynqmp-firmware/zynqmp-firmware.mk | 33 +++++++++++++++++++++++++
 4 files changed, 60 insertions(+)
 create mode 100644 boot/zynqmp-firmware/Config.in
 create mode 100644 boot/zynqmp-firmware/zynqmp-firmware.mk
DEVELOPERS +1 -0
index cf48e01037..f3ff2cbbd5 100644
@@ -2337,6 +2337,7 @@ N:	Neal Frager <[email protected]>
 F:	board/versal/
 F:	board/zynq/
 F:	board/zynqmp/
+F:	boot/zynqmp-firmware/
 F:	configs/versal_vck190_defconfig
 F:	configs/zynq_zc702_defconfig
 F:	configs/zynq_zc706_defconfig
boot/Config.in +1 -0
index 87e1b7c00e..64b1c8c420 100644
@@ -23,5 +23,6 @@ source "boot/ti-k3-boot-firmware/Config.in"
 source "boot/ti-k3-r5-loader/Config.in"
 source "boot/uboot/Config.in"
 source "boot/vexpress-firmware/Config.in"
+source "boot/zynqmp-firmware/Config.in"
 
 endmenu
boot/zynqmp-firmware/Config.in new file +25 -0
new file mode 100644
index 0000000000..478d58d552
@@ -0,0 +1,25 @@
+config BR2_TARGET_ZYNQMP_FIRMWARE
+	bool "zynqmp-firmware"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
+	help
+	  This package builds the PMU Firmware application required
+	  to run U-Boot and Linux in the Zynq MPSoC devices.
+
+if BR2_TARGET_ZYNQMP_FIRMWARE
+
+comment "zynqmp-firmware needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"
+
+config BR2_TARGET_ZYNQMP_FIRMWARE_VERSION
+	string "firmware version"
+	default "xilinx_v2024.1"
+	help
+	  Release version of zynqmp firmware.
+	  Only versions xilinx_v2023.2 and newer are supported.
+
+config BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS
+	string "custom cflags"
+	help
+	  Adds additional CFLAGS for building zynqmp firmware.
+
+endif # BR2_TARGET_ZYNQMP_FIRMWARE
boot/zynqmp-firmware/zynqmp-firmware.mk new file +33 -0
new file mode 100644
index 0000000000..dafb2dbe55
@@ -0,0 +1,33 @@
+################################################################################
+#
+# zynqmp-firmware
+#
+################################################################################
+
+ZYNQMP_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_SITE = \
+	$(call github,Xilinx,embeddedsw,$(ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_LICENSE = MIT
+ZYNQMP_FIRMWARE_LICENSE_FILES = license.txt
+ZYNQMP_FIRMWARE_INSTALL_IMAGES = YES
+ZYNQMP_FIRMWARE_INSTALL_TARGET = NO
+ZYNQMP_FIRMWARE_DEPENDENCIES = toolchain-bare-metal-buildroot
+
+CUSTOM_CFLAGS = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS))
+ZYNQMP_FIRMWARE_CFLAGS = "-Os -flto -ffat-lto-objects $(CUSTOM_CFLAGS)"
+
+define ZYNQMP_FIRMWARE_BUILD_CMDS
+	$(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \
+		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
+		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		CFLAGS=$(ZYNQMP_FIRMWARE_CFLAGS)
+endef
+
+ZYNQMP_FIRMWARE = $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf
+
+define ZYNQMP_FIRMWARE_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0755 $(ZYNQMP_FIRMWARE) $(BINARIES_DIR)/pmufw.elf
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v12 2/3 boot/uboot.mk: new zynqmp pmufw build option

The new BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option will enable u-boot to use the zynqmp-firmware package for building a pmufw.elf that gets included in the generated boot.bin.

If the BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option is enabled, then the BR2_TARGET_UBOOT_ZYNQMP_PMUFW config for downloading a prebuilt pmufw will be ignored.

---
V1->V2:
- patch is now backwards compatible for users already using the BR2_TARGET_UBOOT_ZYNQMP_PMUFW config for downloading a prebuilt pmufw
V2->V3:
- no changes
V3->V4:
- BR2_TARGET_UBOOT_ZYNQMP_PMUFW removed when BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE selected
V4->V12:
- no changes

---
 boot/uboot/Config.in | 19 +++++++++++++++++--
 boot/uboot/uboot.mk  |  5 +++++
 2 files changed, 22 insertions(+), 2 deletions(-)
boot/uboot/Config.in +17 -2
index d0901edc9d..f0c26af25c 100644
@@ -512,11 +512,26 @@ config BR2_TARGET_UBOOT_ZYNQMP
 
 if BR2_TARGET_UBOOT_ZYNQMP
 
+config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
+	bool "Build zynqmp PMU firmware from source"
+	select BR2_TARGET_ZYNQMP_FIRMWARE
+	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+	help
+	  This option instructs u-boot to build the zynqmp pmufw using
+	  the zynqmp-firmware package.  u-boot will then include this
+	  pmufw.elf in the generated boot.bin.
+
+	  If this option is selected, the BR2_TARGET_UBOOT_ZYNQMP_PMUFW
+	  prebuilt option will be ignored.
+
+	  This feature requires U-Boot >= 2018.07.
+
 config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
-	string "PMU firmware location"
+	string "Pre-built zynqmp PMU firmware location"
 	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+	depends on !BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
 	help
-	  Location of a PMU firmware binary.
+	  Location of a pre-built PMU firmware binary.
 
 	  If not empty, instructs the U-Boot build process to generate
 	  a boot.bin (to be loaded by the ZynqMP boot ROM) containing
boot/uboot/uboot.mk +5 -0
index b9f165f041..18c02a4430 100644
@@ -436,7 +436,12 @@ endef
 
 ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y)
 
+ifeq ($(BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE),y)
+UBOOT_DEPENDENCIES += zynqmp-firmware
+UBOOT_ZYNQMP_PMUFW = $(BINARIES_DIR)/pmufw.elf
+else
 UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW))
+endif #BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
 
 ifneq ($(findstring ://,$(UBOOT_ZYNQMP_PMUFW)),)
 UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW)
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author Reviewed-by Brandon Maier on v12 2/3
#2 lore raw

Re: [Buildroot] [PATCH v12 2/3] boot/uboot.mk: new zynqmp pmufw build option

Hi Neal,

Quoted 82 lines · Neal Frager via buildroot

The new BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option will enable u-boot to use the zynqmp-firmware package for building a pmufw.elf that gets included in the generated boot.bin.

If the BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE option is enabled, then the BR2_TARGET_UBOOT_ZYNQMP_PMUFW config for downloading a prebuilt pmufw will be ignored.

---
V1->V2:
- patch is now backwards compatible for users already using the BR2_TARGET_UBOOT_ZYNQMP_PMUFW config for downloading a prebuilt pmufw
V2->V3:
- no changes
V3->V4:
- BR2_TARGET_UBOOT_ZYNQMP_PMUFW removed when BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE selected
V4->V12:
- no changes

---
 boot/uboot/Config.in | 19 +++++++++++++++++--
 boot/uboot/uboot.mk  |  5 +++++
 2 files changed, 22 insertions(+), 2 deletions(-)
boot/uboot/Config.in +17 -2
index d0901edc9d..f0c26af25c 100644
@@ -512,11 +512,26 @@ config BR2_TARGET_UBOOT_ZYNQMP
 
 if BR2_TARGET_UBOOT_ZYNQMP
 
+config BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
+	bool "Build zynqmp PMU firmware from source"
+	select BR2_TARGET_ZYNQMP_FIRMWARE
+	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+	help
+	  This option instructs u-boot to build the zynqmp pmufw using
+	  the zynqmp-firmware package.  u-boot will then include this
+	  pmufw.elf in the generated boot.bin.
+
+	  If this option is selected, the BR2_TARGET_UBOOT_ZYNQMP_PMUFW
+	  prebuilt option will be ignored.
+
+	  This feature requires U-Boot >= 2018.07.
+
 config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
-	string "PMU firmware location"
+	string "Pre-built zynqmp PMU firmware location"
 	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+	depends on !BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
 	help
-	  Location of a PMU firmware binary.
+	  Location of a pre-built PMU firmware binary.
 
 	  If not empty, instructs the U-Boot build process to generate
 	  a boot.bin (to be loaded by the ZynqMP boot ROM) containing
boot/uboot/uboot.mk +5 -0
index b9f165f041..18c02a4430 100644
@@ -436,7 +436,12 @@ endef
 
 ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y)
 
+ifeq ($(BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE),y)
+UBOOT_DEPENDENCIES += zynqmp-firmware
+UBOOT_ZYNQMP_PMUFW = $(BINARIES_DIR)/pmufw.elf
+else
 UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW))
+endif #BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE
 
 ifneq ($(findstring ://,$(UBOOT_ZYNQMP_PMUFW)),)
 UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW)
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Looks good, given Yann's fixups

Thanks,
Brandon Maier
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

PATCH v12 3/3 configs/zynqmp*: build pmufw source

In reply to Neal Frager via buildroot

This patch migrates the zynqmp config files to use the new zynqmp-firmware package for building the zynqmp pmufw from source.

---
V4->V7:
- no changes
V7->V8:
- bump to xilinx_v2023.2
V8->V9:
- add the new zynqmp defconfigs
- add BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH definition
V9->V10:
- no changes
V10->V11:
- BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH is set by zynqmp-firmware
V11->V12:
- BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH is set in each defconfig

---
 configs/zynqmp_kria_kr260_defconfig | 6 +++++-
 configs/zynqmp_kria_kv260_defconfig | 6 +++++-
 configs/zynqmp_zcu102_defconfig     | 5 ++++-
 configs/zynqmp_zcu104_defconfig     | 5 ++++-
 configs/zynqmp_zcu106_defconfig     | 5 ++++-
 5 files changed, 22 insertions(+), 5 deletions(-)
configs/zynqmp_kria_kr260_defconfig +5 -1
index 3bf269ab6b..3f475af882 100644
@@ -31,10 +31,14 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/kr260-kria/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/kria/kr260/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS="-DK26_SOM"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
configs/zynqmp_kria_kv260_defconfig +5 -1
index 7b402e032c..313b324a13 100644
@@ -31,10 +31,14 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/kv260-kria/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/kria/kv260/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS="-DK26_SOM"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
configs/zynqmp_zcu102_defconfig +4 -1
index f40002f6d9..302ad1394e 100644
@@ -30,10 +30,13 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/zcu102-zynqmp/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/zcu102/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
configs/zynqmp_zcu104_defconfig +4 -1
index ef9c9bad49..059858fff6 100644
@@ -30,10 +30,13 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/zcu104-zynqmp/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/zcu104/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
configs/zynqmp_zcu106_defconfig +4 -1
index 07c595436f..39dd5c8ab3 100644
@@ -30,10 +30,13 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/zcu106-zynqmp/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/zcu106/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author Reviewed-by Brandon Maier on v12 3/3
#4 lore raw

Re: [Buildroot] [PATCH v12 3/3] configs/zynqmp*: build pmufw source

Hi Neal,

Quoted 131 lines · Neal Frager via buildroot

This patch migrates the zynqmp config files to use the new zynqmp-firmware package for building the zynqmp pmufw from source.

---
V4->V7:
- no changes
V7->V8:
- bump to xilinx_v2023.2
V8->V9:
- add the new zynqmp defconfigs
- add BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH definition
V9->V10:
- no changes
V10->V11:
- BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH is set by zynqmp-firmware
V11->V12:
- BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH is set in each defconfig

---
 configs/zynqmp_kria_kr260_defconfig | 6 +++++-
 configs/zynqmp_kria_kv260_defconfig | 6 +++++-
 configs/zynqmp_zcu102_defconfig     | 5 ++++-
 configs/zynqmp_zcu104_defconfig     | 5 ++++-
 configs/zynqmp_zcu106_defconfig     | 5 ++++-
 5 files changed, 22 insertions(+), 5 deletions(-)
configs/zynqmp_kria_kr260_defconfig +5 -1
index 3bf269ab6b..3f475af882 100644
@@ -31,10 +31,14 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/kr260-kria/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/kria/kr260/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS="-DK26_SOM"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
configs/zynqmp_kria_kv260_defconfig +5 -1
index 7b402e032c..313b324a13 100644
@@ -31,10 +31,14 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/kv260-kria/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/kria/kv260/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS="-DK26_SOM"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
configs/zynqmp_zcu102_defconfig +4 -1
index f40002f6d9..302ad1394e 100644
@@ -30,10 +30,13 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/zcu102-zynqmp/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/zcu102/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
configs/zynqmp_zcu104_defconfig +4 -1
index ef9c9bad49..059858fff6 100644
@@ -30,10 +30,13 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/zcu104-zynqmp/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/zcu104/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
configs/zynqmp_zcu106_defconfig +4 -1
index 07c595436f..39dd5c8ab3 100644
@@ -30,10 +30,13 @@ BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin"
 BR2_TARGET_UBOOT_ZYNQMP=y
-BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/Xilinx/soc-prebuilt-firmware/raw/xilinx_v2024.1/zcu106-zynqmp/pmufw.elf"
 BR2_TARGET_UBOOT_ZYNQMP_PM_CFG="board/zynqmp/zcu106/pm_cfg_obj.c"
 BR2_TARGET_UBOOT_FORMAT_ITB=y
 BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
+BR2_TARGET_UBOOT_ZYNQMP_PMUFW_SOURCE=y
+BR2_TARGET_ZYNQMP_FIRMWARE_VERSION="xilinx_v2024.1"
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT=y
+BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH="microblazeel-xilinx-elf"
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Thanks,
Brandon Maier
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
In reply to Neal Frager via buildroot

Hi Yann, et all,

Quoted 5 lines

This patch adds a new boot firmware to buildroot for building the zynqmp pmufw. It requires the toolchain-bare-metal package that includes a bare-metal binutils, gcc and newlib which can be built for the microblaze architecture.

[--SNIP--]

Quoted 3 lines

V11->V12:
- replace select BR2_TOOLCHAIN_BARE_METAL_BUILDROOT with depends
- change variable name for check-package warning

I implemented the changes you requested and submitted a new v12 version.

I left out the following things from this patch set.

1. No forced hashing for zynqmp:
As we have not resolved how we will handle the hash for files downloaded with EXTRA_DOWNLOADS, I left the force hashing out of this patch set.

2. No versal-firmware patches:
Since BR2_DOWNLOAD_FORCE_CHECK_HASHES is already included in the versal_vck190_defconfig, the new versal-firmware will fail because it uses EXTRA_DOWNLOADS to download a PDI file which has no version in the filename.

3. zynqmp_kd240_defconfig:
I did not update this defconfig since it has not yet been bumped to 2024.1.

Please let me know if you think this zynqmp-firmware is ready to be applied, and if you have any additional feedback.

[--SNIP--]

boot/zynqmp-firmware/Config.in line 11

Quoted 13 lines

+++ b/boot/zynqmp-firmware/Config.in

boot/zynqmp-firmware/Config.in new file +11 -0
@@ -0,0 +1,25 @@
+config BR2_TARGET_ZYNQMP_FIRMWARE
+	bool "zynqmp-firmware"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
+	help
+	  This package builds the PMU Firmware application required
+	  to run U-Boot and Linux in the Zynq MPSoC devices.
+
+if BR2_TARGET_ZYNQMP_FIRMWARE
+
+comment "zynqmp-firmware needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"

Resolves issue of a user building a bare-metal toolchain for another tuple.

[--SNIP--]

boot/zynqmp-firmware/zynqmp-firmware.mk line 30

Quoted 4 lines
boot/zynqmp-firmware/zynqmp-firmware.mk new file +4 -0
+ZYNQMP_FIRMWARE = $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf
+
+define ZYNQMP_FIRMWARE_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0755 $(ZYNQMP_FIRMWARE) $(BINARIES_DIR)/pmufw.elf

Changed variable name to resolve check-package warning.

[--SNIP--]

Best regards,
Neal Frager
AMD
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw
In reply to Neal Frager via buildroot

Neal, All,

On 2024-06-07 10:47 +0100, Neal Frager via buildroot spake thusly:

Quoted 6 lines

This patch adds a new boot firmware to buildroot for building the zynqmp pmufw. It requires the toolchain-bare-metal package that includes a bare-metal binutils, gcc and newlib which can be built for the microblaze architecture.

---

[--SNIP--]

Quoted 7 lines
boot/zynqmp-firmware/Config.in new file +1 -0
new file mode 100644
index 0000000000..478d58d552
@@ -0,0 +1,25 @@
+config BR2_TARGET_ZYNQMP_FIRMWARE

boot/zynqmp-firmware/Config.in line 11

Quoted 10 lines
boot/zynqmp-firmware/Config.in new file +10 -0
+	bool "zynqmp-firmware"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
+	help
+	  This package builds the PMU Firmware application required
+	  to run U-Boot and Linux in the Zynq MPSoC devices.
+
+if BR2_TARGET_ZYNQMP_FIRMWARE
+
+comment "zynqmp-firmware needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"

The comment is in the if-endif block, so it will only show when BR2_TARGET_ZYNQMP_FIRMWARE, but the conditions to show the comment are the opposite of those to show BR2_TARGET_ZYNQMP_FIRMWARE in the first place, so the comment will not be visible when BR2_TARGET_ZYNQMP_FIRMWARE is not already available.

So the comment will never be visible.

So, either place it before the main symnbol, or after the if-endif block (but not in-between the two).

No need to respin just for that, it can be fixed when applying.

boot/zynqmp-firmware/Config.in line 23

Quoted 4 lines
boot/zynqmp-firmware/Config.in new file +4 -0
+config BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS
+	string "custom cflags"
+	help
+	  Adds additional CFLAGS for building zynqmp firmware.

What kind of specific CFLAGS would one have to pass?

I see in patch 3 that you are passing -DK26_SOM, so presumably that's about the CPU or board variant. Shouldn't we have a choice for that:

In the Config.in:

choice
bool "Board/CPU variant"

config BR2_TARGET_ZYNQMP_FIRMWARE_DEFAULT
bool "default"

config BR2_TARGET_ZYNQMP_FIRMWARE_K26_SOM
bool "K26 SOM"

endchoice

config BR2_TARGET_ZYNQMP_FIRMWARE_VARIANT
string
default "K26_SOM" if BR2_TARGET_ZYNQMP_FIRMWARE_K26_SOM

In the .mk:

    ZYNQMP_FIRMWARE_VARIANT = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VARIANT))
    ifneq ($(ZYNQMP_FIRMWARE_VARIANT),)
    ZYNQMP_FIRMWARE_CFLAGS += -D$(ZYNQMP_FIRMWARE_VARIANT)
    endif
Quoted 13 lines
boot/zynqmp-firmware/Config.in new file +1 -0
+endif # BR2_TARGET_ZYNQMP_FIRMWARE
boot/zynqmp-firmware/zynqmp-firmware.mk new file +6 -0
new file mode 100644
index 0000000000..dafb2dbe55
@@ -0,0 +1,33 @@
+################################################################################
+#
+# zynqmp-firmware
+#
+################################################################################
+

boot/zynqmp-firmware/zynqmp-firmware.mk line 16

Quoted 10 lines
boot/zynqmp-firmware/zynqmp-firmware.mk new file +10 -0
+ZYNQMP_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_SITE = \
+	$(call github,Xilinx,embeddedsw,$(ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_LICENSE = MIT
+ZYNQMP_FIRMWARE_LICENSE_FILES = license.txt
+ZYNQMP_FIRMWARE_INSTALL_IMAGES = YES
+ZYNQMP_FIRMWARE_INSTALL_TARGET = NO
+ZYNQMP_FIRMWARE_DEPENDENCIES = toolchain-bare-metal-buildroot
+
+CUSTOM_CFLAGS = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS))

All variables must be scopped in the current package "namespace" [0]:

ZYNQMP_FIRMWARE_CUSTOM_CFLAGS = ...

No need to respin just for that, it can be fixed when applying...

boot/zynqmp-firmware/zynqmp-firmware.mk line 27

Quoted 11 lines
boot/zynqmp-firmware/zynqmp-firmware.mk new file +11 -0
+ZYNQMP_FIRMWARE_CFLAGS = "-Os -flto -ffat-lto-objects $(CUSTOM_CFLAGS)"
+
+define ZYNQMP_FIRMWARE_BUILD_CMDS
+	$(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \
+		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
+		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		CFLAGS=$(ZYNQMP_FIRMWARE_CFLAGS)
+endef
+
+ZYNQMP_FIRMWARE = $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf

Ah, I see that the check-package hint is not very explicit. All it says is that the variable is not properly scopped, and what it reports is the prefix all variables should have:

ZYNQMP_FIRMWARE_PMUFW = ...

ZYNQMP_FIRMWARE is the stem all variables should have. Sorry, it was not clear enough in my previous reply, and the check-package hint is a bit misleading... I'll send a patch to make it clearer.

[0] https://buildroot.org/downloads/manual/manual.html#_tips_and_tricks

Since ZYNQMP_FIRMWARE_PMUFW is used only once, is there really a need for an intermediate variable to begin with?

No need to respin just for that, it can be fixed when applying...

Regards,
Yann E. MORIN.

Quoted 12 lines
boot/zynqmp-firmware/zynqmp-firmware.mk new file +5 -0
+define ZYNQMP_FIRMWARE_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0755 $(ZYNQMP_FIRMWARE) $(BINARIES_DIR)/pmufw.elf
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Yann, all,

Quoted 31 lines

This patch adds a new boot firmware to buildroot for building the zynqmp pmufw. It requires the toolchain-bare-metal package that includes a bare-metal binutils, gcc and newlib which can be built for the microblaze architecture.

---
[--SNIP--]

boot/zynqmp-firmware/Config.in new file +11 -0
new file mode 100644
index 0000000000..478d58d552
@@ -0,0 +1,25 @@
+config BR2_TARGET_ZYNQMP_FIRMWARE
+	bool "zynqmp-firmware"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
+	help
+	  This package builds the PMU Firmware application required
+	  to run U-Boot and Linux in the Zynq MPSoC devices.
+
+if BR2_TARGET_ZYNQMP_FIRMWARE
+
+comment "zynqmp-firmware needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"

The comment is in the if-endif block, so it will only show when BR2_TARGET_ZYNQMP_FIRMWARE, but the conditions to show the comment are the opposite of those to show BR2_TARGET_ZYNQMP_FIRMWARE in the first place, so the comment will not be visible when BR2_TARGET_ZYNQMP_FIRMWARE is not already available.

Quoted 6 lines

So the comment will never be visible.

So, either place it before the main symnbol, or after the if-endif block (but not in-between the two).

No need to respin just for that, it can be fixed when applying.

Ok, thank you.

Quoted 27 lines
boot/zynqmp-firmware/Config.in new file +4 -0
+config BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS
+	string "custom cflags"
+	help
+	  Adds additional CFLAGS for building zynqmp firmware.

What kind of specific CFLAGS would one have to pass?

I see in patch 3 that you are passing -DK26_SOM, so presumably that's about the CPU or board variant. Shouldn't we have a choice for that:

In the Config.in:

choice
bool "Board/CPU variant"

config BR2_TARGET_ZYNQMP_FIRMWARE_DEFAULT
bool "default"

config BR2_TARGET_ZYNQMP_FIRMWARE_K26_SOM

       bool "K26 SOM"

endchoice

config BR2_TARGET_ZYNQMP_FIRMWARE_VARIANT
string
default "K26_SOM" if BR2_TARGET_ZYNQMP_FIRMWARE_K26_SOM

Quoted 6 lines

In the .mk:

   ZYNQMP_FIRMWARE_VARIANT = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VARIANT))
   ifneq ($(ZYNQMP_FIRMWARE_VARIANT),)
   ZYNQMP_FIRMWARE_CFLAGS += -D$(ZYNQMP_FIRMWARE_VARIANT)
   endif

I don't really like changing this to a CPU variant because it is not an accurate portrayal of what we are doing here. All of the zynqmp devices can run with a default build of the pmufw, regardless of device variant. This is why the zcu102, zcu104 and zcu106 all use the default build, even though they do not have the same variant of the zynqmp on each board. For example, the zcu102 has a zu9 and the zcu106 has a zu7.

However, there are a ton of configuration defines that users can configure to customize their build options which are defined in the xpfw_config.h header file. This is what we are exposing by allowing users to enter their own CFLAGS to configure these options.

https://github.com/Xilinx/embeddedsw/blob/master/lib/sw_apps/zynqmp_pmufw/src/xpfw_config.h

The Kria SOMs are a special case as we enabled some of these specific defines which are needed for all Kria SOM based products. If you look at the v11 version of this patch set, you will see a long string of config defines.

Since these defines are needed for all Kria SOMs, I upstreamed a solution within AMD, so that users only need to define K26_SOM or K24_SOM, in case they are working with a Kria SOM, and they will get all of the defines that are required. This is newly included with the 2024.1 release.

By having a CFLAGS option, users can then add additional configs regardless of whether they are using a standard zynqmp or a Kria SOM. It would work the same in either case.

Quoted 24 lines
boot/zynqmp-firmware/Config.in new file +1 -0
+endif # BR2_TARGET_ZYNQMP_FIRMWARE
boot/zynqmp-firmware/zynqmp-firmware.mk new file +16 -0
new file mode 100644
index 0000000000..dafb2dbe55
@@ -0,0 +1,33 @@
+################################################################################
+#
+# zynqmp-firmware
+#
+################################################################################
+
+ZYNQMP_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_SITE = \
+	$(call github,Xilinx,embeddedsw,$(ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_LICENSE = MIT
+ZYNQMP_FIRMWARE_LICENSE_FILES = license.txt
+ZYNQMP_FIRMWARE_INSTALL_IMAGES = YES
+ZYNQMP_FIRMWARE_INSTALL_TARGET = NO
+ZYNQMP_FIRMWARE_DEPENDENCIES = toolchain-bare-metal-buildroot
+
+CUSTOM_CFLAGS = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS))
Quoted 5 lines

All variables must be scopped in the current package "namespace" [0]:

ZYNQMP_FIRMWARE_CUSTOM_CFLAGS = ...

No need to respin just for that, it can be fixed when applying...

Ok, thanks.

Quoted 22 lines
boot/zynqmp-firmware/zynqmp-firmware.mk new file +11 -0
+ZYNQMP_FIRMWARE_CFLAGS = "-Os -flto -ffat-lto-objects $(CUSTOM_CFLAGS)"
+
+define ZYNQMP_FIRMWARE_BUILD_CMDS
+	$(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \
+		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
+		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		CFLAGS=$(ZYNQMP_FIRMWARE_CFLAGS)
+endef
+
+ZYNQMP_FIRMWARE = $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf

Ah, I see that the check-package hint is not very explicit. All it says is that the variable is not properly scopped, and what it reports is the prefix all variables should have:

ZYNQMP_FIRMWARE_PMUFW = ...

ZYNQMP_FIRMWARE is the stem all variables should have. Sorry, it was not clear enough in my previous reply, and the check-package hint is a bit misleading... I'll send a patch to make it clearer.

Quoted 6 lines

[0] https://buildroot.org/downloads/manual/manual.html#_tips_and_tricks

Since ZYNQMP_FIRMWARE_PMUFW is used only once, is there really a need for an intermediate variable to begin with?

No need to respin just for that, it can be fixed when applying...

You are right that the variable is not really needed. I did it originally just to keep within the 80 character line budget and look nice.

Best regards,
Neal Frager
AMD
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw
In reply to Neal Frager via buildroot

Hi Neal,

Quoted 102 lines · Neal Frager via buildroot

This patch adds a new boot firmware to buildroot for building the zynqmp pmufw. It requires the toolchain-bare-metal package that includes a bare-metal binutils, gcc and newlib which can be built for the microblaze architecture.

---
V1->V2:
- builds a bare-metal gcc toolchain instead of requiring an external microblaze toolchain
V2->V3:
- corrected custom cflags option
- added support for xilinx_v2022.2 version
- added zynqmp-firmware.hash
V3->V4:
- no changes
V4->V5:
- reduced all lines to <80 chars
V5->V6:
- migrated to toolchain-bare-metal-buildroot
V6->V7:
- removed patch numbers
- changed dependency to toolchain-bare-metal-buildroot
- removed hash since version is configurable
V7->V9:
- no changes
V9->V10:
- removed patches for supporting versions older than xilinx_v2023.2
V10->V11:
- set default BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH to "microblazeel-xilinx-elf" to avoid stand-alone build failure
V11->V12:
- replace select BR2_TOOLCHAIN_BARE_METAL_BUILDROOT with depends
- change variable name for check-package warning

---
 DEVELOPERS                              |  1 +
 boot/Config.in                          |  1 +
 boot/zynqmp-firmware/Config.in          | 25 +++++++++++++++++++
 boot/zynqmp-firmware/zynqmp-firmware.mk | 33 +++++++++++++++++++++++++
 4 files changed, 60 insertions(+)
 create mode 100644 boot/zynqmp-firmware/Config.in
 create mode 100644 boot/zynqmp-firmware/zynqmp-firmware.mk
DEVELOPERS +1 -0
index cf48e01037..f3ff2cbbd5 100644
@@ -2337,6 +2337,7 @@ N:	Neal Frager <[email protected]>
 F:	board/versal/
 F:	board/zynq/
 F:	board/zynqmp/
+F:	boot/zynqmp-firmware/
 F:	configs/versal_vck190_defconfig
 F:	configs/zynq_zc702_defconfig
 F:	configs/zynq_zc706_defconfig
boot/Config.in +1 -0
index 87e1b7c00e..64b1c8c420 100644
@@ -23,5 +23,6 @@ source "boot/ti-k3-boot-firmware/Config.in"
 source "boot/ti-k3-r5-loader/Config.in"
 source "boot/uboot/Config.in"
 source "boot/vexpress-firmware/Config.in"
+source "boot/zynqmp-firmware/Config.in"
 
 endmenu
boot/zynqmp-firmware/Config.in new file +25 -0
new file mode 100644
index 0000000000..478d58d552
@@ -0,0 +1,25 @@
+config BR2_TARGET_ZYNQMP_FIRMWARE
+	bool "zynqmp-firmware"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
+	help
+	  This package builds the PMU Firmware application required
+	  to run U-Boot and Linux in the Zynq MPSoC devices.
+
+if BR2_TARGET_ZYNQMP_FIRMWARE
+
+comment "zynqmp-firmware needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"
+
+config BR2_TARGET_ZYNQMP_FIRMWARE_VERSION
+	string "firmware version"
+	default "xilinx_v2024.1"
+	help
+	  Release version of zynqmp firmware.
+	  Only versions xilinx_v2023.2 and newer are supported.
+
+config BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS
+	string "custom cflags"
+	help
+	  Adds additional CFLAGS for building zynqmp firmware.
+
+endif # BR2_TARGET_ZYNQMP_FIRMWARE
boot/zynqmp-firmware/zynqmp-firmware.mk new file +0 -0
new file mode 100644
index 0000000000..dafb2dbe55

boot/zynqmp-firmware/zynqmp-firmware.mk line 10

Quoted 10 lines
boot/zynqmp-firmware/zynqmp-firmware.mk new file +10 -0
@@ -0,0 +1,33 @@
+################################################################################
+#
+# zynqmp-firmware
+#
+################################################################################
+
+ZYNQMP_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_SITE = \
+	$(call github,Xilinx,embeddedsw,$(ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_LICENSE = MIT

In the license.txt there are other SPDX licenses types.

  $ grep SPDX license.txt | awk '{print $1 " " $2}' | sort | uniq
  SPDX-License-Identifier: BSD-2-Clause
  SPDX-License-Identifier: BSD-3-Clause
  SPDX-License-Identifier: GPL-2.0
  SPDX-License-Identifier: MIT

Should these be added?

From https://github.com/Xilinx/embeddedsw/blob/master/license.txt

Quoted 31 lines
boot/zynqmp-firmware/zynqmp-firmware.mk new file +23 -0
+ZYNQMP_FIRMWARE_LICENSE_FILES = license.txt
+ZYNQMP_FIRMWARE_INSTALL_IMAGES = YES
+ZYNQMP_FIRMWARE_INSTALL_TARGET = NO
+ZYNQMP_FIRMWARE_DEPENDENCIES = toolchain-bare-metal-buildroot
+
+CUSTOM_CFLAGS = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS))
+ZYNQMP_FIRMWARE_CFLAGS = "-Os -flto -ffat-lto-objects $(CUSTOM_CFLAGS)"
+
+define ZYNQMP_FIRMWARE_BUILD_CMDS
+	$(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \
+		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
+		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		CFLAGS=$(ZYNQMP_FIRMWARE_CFLAGS)
+endef
+
+ZYNQMP_FIRMWARE = $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf
+
+define ZYNQMP_FIRMWARE_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0755 $(ZYNQMP_FIRMWARE) $(BINARIES_DIR)/pmufw.elf
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Thanks,
Brandon Maier
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw

Hi Brandon,

Quoted 121 lines

This patch adds a new boot firmware to buildroot for building the zynqmp pmufw. It requires the toolchain-bare-metal package that includes a bare-metal binutils, gcc and newlib which can be built for the microblaze architecture.

---
V1->V2:
- builds a bare-metal gcc toolchain instead of requiring an external microblaze toolchain
V2->V3:
- corrected custom cflags option
- added support for xilinx_v2022.2 version
- added zynqmp-firmware.hash
V3->V4:
- no changes
V4->V5:
- reduced all lines to <80 chars
V5->V6:
- migrated to toolchain-bare-metal-buildroot
V6->V7:
- removed patch numbers
- changed dependency to toolchain-bare-metal-buildroot
- removed hash since version is configurable
V7->V9:
- no changes
V9->V10:
- removed patches for supporting versions older than xilinx_v2023.2
V10->V11:
- set default BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH to "microblazeel-xilinx-elf" to avoid stand-alone build failure
V11->V12:
- replace select BR2_TOOLCHAIN_BARE_METAL_BUILDROOT with depends
- change variable name for check-package warning

---
 DEVELOPERS                              |  1 +
 boot/Config.in                          |  1 +
 boot/zynqmp-firmware/Config.in          | 25 +++++++++++++++++++
 boot/zynqmp-firmware/zynqmp-firmware.mk | 33 +++++++++++++++++++++++++
 4 files changed, 60 insertions(+)
 create mode 100644 boot/zynqmp-firmware/Config.in
 create mode 100644 boot/zynqmp-firmware/zynqmp-firmware.mk
DEVELOPERS +1 -0
index cf48e01037..f3ff2cbbd5 100644
@@ -2337,6 +2337,7 @@ N:	Neal Frager <[email protected]>
 F:	board/versal/
 F:	board/zynq/
 F:	board/zynqmp/
+F:	boot/zynqmp-firmware/
 F:	configs/versal_vck190_defconfig
 F:	configs/zynq_zc702_defconfig
 F:	configs/zynq_zc706_defconfig
boot/Config.in +1 -0
index 87e1b7c00e..64b1c8c420 100644
@@ -23,5 +23,6 @@ source "boot/ti-k3-boot-firmware/Config.in"
 source "boot/ti-k3-r5-loader/Config.in"
 source "boot/uboot/Config.in"
 source "boot/vexpress-firmware/Config.in"
+source "boot/zynqmp-firmware/Config.in"
 
 endmenu
boot/zynqmp-firmware/Config.in new file +25 -0
new file mode 100644
index 0000000000..478d58d552
@@ -0,0 +1,25 @@
+config BR2_TARGET_ZYNQMP_FIRMWARE
+	bool "zynqmp-firmware"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
+	help
+	  This package builds the PMU Firmware application required
+	  to run U-Boot and Linux in the Zynq MPSoC devices.
+
+if BR2_TARGET_ZYNQMP_FIRMWARE
+
+comment "zynqmp-firmware needs a bare metal toolchain for tuple microblazeel-xilinx-elf"
+	depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH != "microblazeel-xilinx-elf"
+
+config BR2_TARGET_ZYNQMP_FIRMWARE_VERSION
+	string "firmware version"
+	default "xilinx_v2024.1"
+	help
+	  Release version of zynqmp firmware.
+	  Only versions xilinx_v2023.2 and newer are supported.
+
+config BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS
+	string "custom cflags"
+	help
+	  Adds additional CFLAGS for building zynqmp firmware.
+
+endif # BR2_TARGET_ZYNQMP_FIRMWARE
boot/zynqmp-firmware/zynqmp-firmware.mk new file +10 -0
new file mode 100644
index 0000000000..dafb2dbe55
@@ -0,0 +1,33 @@
+################################################################################
+#
+# zynqmp-firmware
+#
+################################################################################
+
+ZYNQMP_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_SITE = \
+	$(call github,Xilinx,embeddedsw,$(ZYNQMP_FIRMWARE_VERSION))
+ZYNQMP_FIRMWARE_LICENSE = MIT

In the license.txt there are other SPDX licenses types.

 $ grep SPDX license.txt | awk '{print $1 " " $2}' | sort | uniq
 SPDX-License-Identifier: BSD-2-Clause
 SPDX-License-Identifier: BSD-3-Clause
 SPDX-License-Identifier: GPL-2.0
 SPDX-License-Identifier: MIT
Quoted 3 lines

Should these be added?

From https://github.com/Xilinx/embeddedsw/blob/master/license.txt

I am not sure. While the Xilinx/embeddedsw repo contains code under all of these licenses, all of the code used by the zynqmp_pmufw application is under MIT license. Do we need to include the other licenses because we are downloading software covered by these licenses even if we are not actually using it?

Perhaps someone more knowledgable about software licensing can advise?

Quoted 31 lines
boot/zynqmp-firmware/zynqmp-firmware.mk new file +23 -0
+ZYNQMP_FIRMWARE_LICENSE_FILES = license.txt
+ZYNQMP_FIRMWARE_INSTALL_IMAGES = YES
+ZYNQMP_FIRMWARE_INSTALL_TARGET = NO
+ZYNQMP_FIRMWARE_DEPENDENCIES = toolchain-bare-metal-buildroot
+
+CUSTOM_CFLAGS = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS))
+ZYNQMP_FIRMWARE_CFLAGS = "-Os -flto -ffat-lto-objects $(CUSTOM_CFLAGS)"
+
+define ZYNQMP_FIRMWARE_BUILD_CMDS
+	$(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \
+		COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \
+		CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \
+		CFLAGS=$(ZYNQMP_FIRMWARE_CFLAGS)
+endef
+
+ZYNQMP_FIRMWARE = $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf
+
+define ZYNQMP_FIRMWARE_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0755 $(ZYNQMP_FIRMWARE) $(BINARIES_DIR)/pmufw.elf
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Best regards,
Neal Frager
AMD
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot