Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 1 | #@TYPE: Machine |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 2 | #@NAME: Generic zynqmp |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 3 | #@DESCRIPTION: zynqmp devices |
| 4 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 5 | # CG is the lowest common demoninator, so use this by default |
| 6 | SOC_VARIANT ?= "cg" |
| 7 | |
| 8 | require conf/machine/include/soc-zynqmp.inc |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 9 | require conf/machine/include/machine-xilinx-default.inc |
| 10 | require conf/machine/include/machine-xilinx-qemu.inc |
Andrew Geissler | c60845c | 2021-01-29 15:55:05 -0600 | [diff] [blame] | 11 | require conf/machine/include/xilinx-board.inc |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 12 | |
| 13 | MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost" |
| 14 | |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 15 | EXTRA_IMAGEDEPENDS += "libyaml-native python3-cython-native python3-pyyaml-native" |
| 16 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 17 | UBOOT_MACHINE = "xilinx_zynqmp_virt_defconfig" |
| 18 | SPL_BINARY ?= "spl/boot.bin" |
| 19 | |
| 20 | # Default SD image build onfiguration, use qemu-sd to pad |
| 21 | IMAGE_CLASSES += "image-types-xilinx-qemu" |
| 22 | IMAGE_FSTYPES += "wic.qemu-sd" |
| 23 | WKS_FILES ?= "sdimage-bootpart.wks" |
| 24 | |
| 25 | SERIAL_CONSOLES ?= "115200;ttyPS0" |
| 26 | |
Andrew Geissler | 7eb438a | 2020-11-30 19:53:16 -0600 | [diff] [blame] | 27 | MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" |
| 28 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 29 | # We need a generic one that works with QEMU... |
| 30 | HDF_MACHINE = "zcu102-zynqmp" |
| 31 | KERNEL_DEVICETREE = "xilinx/zynqmp-zcu102-rev1.0.dtb" |
| 32 | |
| 33 | EXTRA_IMAGEDEPENDS += " \ |
| 34 | u-boot-zynq-uenv \ |
| 35 | arm-trusted-firmware \ |
| 36 | qemu-devicetrees \ |
| 37 | virtual/boot-bin \ |
| 38 | virtual/bootloader \ |
| 39 | u-boot-zynq-scr \ |
| 40 | " |
| 41 | |
| 42 | IMAGE_BOOT_FILES += " \ |
| 43 | uEnv.txt \ |
| 44 | atf-uboot.ub \ |
| 45 | ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 'device-tree', 'system.dtb', '', d)} \ |
| 46 | boot.scr \ |
| 47 | " |
| 48 | |
| 49 | # This machine has a QEMU model, runqemu setup: |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 50 | QB_MEM = "-m 4096" |
| 51 | QB_OPT_APPEND ?= "-nographic -serial mon:stdio -serial null" |
| 52 | QB_NETWORK_DEVICE = "-net nic -net nic -net nic -net nic,netdev=net0,macaddr=@MAC@" |
| 53 | |
| 54 | # Replicate BootROM like behaviour, having loaded SPL and PMU(ROM+FW) |
| 55 | QB_OPT_APPEND_append_qemuboot-xilinx = " \ |
| 56 | -hw-dtb ${DEPLOY_DIR_IMAGE}/qemu-hw-devicetrees/multiarch/zcu102-arm.dtb \ |
| 57 | ${@qemu_zynqmp_unhalt(d, True)} \ |
| 58 | -device loader,file=${DEPLOY_DIR_IMAGE}/arm-trusted-firmware.elf,cpu-num=0 \ |
| 59 | -device loader,file=${DEPLOY_DIR_IMAGE}/u-boot.elf \ |
| 60 | -device loader,file=${DEPLOY_DIR_IMAGE}/system.dtb,addr=0x100000 \ |
| 61 | " |
| 62 | |
| 63 | # Attach the rootfs disk image to the second SD interface of QEMU (which is SD0) |
| 64 | QB_DEFAULT_FSTYPE_qemuboot-xilinx = "wic.qemu-sd" |
| 65 | QB_OPT_APPEND_append_qemuboot-xilinx = " -boot mode=5" |
| 66 | QB_ROOTFS_OPT_qemuboot-xilinx = " -drive if=sd,index=1,file=@ROOTFS@,format=raw" |
| 67 | |
| 68 | # PMU instance args |
| 69 | PMU_ROM ?= "${DEPLOY_DIR_IMAGE}/pmu-rom.elf" |
| 70 | PMU_FIRMWARE_DEPLOY_DIR ?= "${@ '${TOPDIR}/pmutmp/deploy/images/zynqmp-pmu' if d.getVar('BMULTICONFIG') == 'pmu' else '${TOPDIR}/tmp/deploy/images/${MACHINE}'}" |
| 71 | PMU_FIRMWARE_IMAGE_NAME ?= "${@ 'pmu-firmware-zynqmp-pmu' if d.getVar('BBMULTICONFIG') == 'pmu' else 'pmu-${MACHINE}'}" |
| 72 | |
| 73 | QB_PMU_OPT = " \ |
| 74 | -M microblaze-fdt \ |
| 75 | -display none \ |
| 76 | -hw-dtb ${DEPLOY_DIR_IMAGE}/qemu-hw-devicetrees/multiarch/zynqmp-pmu.dtb \ |
| 77 | -kernel ${PMU_ROM} \ |
| 78 | -device loader,file=${PMU_FIRMWARE_DEPLOY_DIR}/${PMU_FIRMWARE_IMAGE_NAME}.elf \ |
| 79 | -device loader,addr=0xfd1a0074,data=0x1011003,data-len=4 \ |
| 80 | -device loader,addr=0xfd1a007C,data=0x1010f03,data-len=4 \ |
| 81 | " |
| 82 | QB_OPT_APPEND_append_qemuboot-xilinx = " -pmu-args '${QB_PMU_OPT}'" |
| 83 | |
| 84 | do_write_qemuboot_conf[depends] += "u-boot-zynq-uenv:do_deploy" |