diff options
1037 files changed, 55352 insertions, 6845 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..5e671383 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "gen-machine-conf"] + path = meta-xilinx-core/gen-machine-conf + url = https://github.com/Xilinx/gen-machine-conf.git + branch = xlnx_rel_v2023.2 diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 00000000..d9067769 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,45 @@ +# Maintainers, Mailing list, Patches + +Please send any patches, pull requests, comments or questions for this layer to +the [meta-xilinx mailing list](https://lists.yoctoproject.org/g/meta-xilinx): + + meta-xilinx@lists.yoctoproject.org + +When sending patches, please make sure the email subject line includes +`[meta-xilinx][<BRANCH_NAME>][PATCH]` and cc'ing the maintainers. + +For more details follow the OE community patch submission guidelines, as described in: + +https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines +https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded + +`git send-email --to meta-xilinx@lists.yoctoproject.org *.patch` + +> **Note:** When creating patches, please use below format. To follow best practice, +> if you have more than one patch use `--cover-letter` option while generating the +> patches. Edit the 0000-cover-letter.patch and change the title and top of the +> body as appropriate. + +**Syntax:** +`git format-patch -s --subject-prefix="meta-xilinx][<BRANCH_NAME>][PATCH" -1` + +**Example:** +`git format-patch -s --subject-prefix="meta-xilinx][langdale][PATCH" -1` + +**Maintainers:** + + Mark Hatle <mark.hatle@amd.com> + Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com> + John Toomey <john.toomey@amd.com> + +> **Note:** + +* meta-xilinx-contrib layer: + * We don't have any maintainers when user submit a patch to this layer + email meta-xilinx@yoctoproject.org and cc'ing below reviewers. + +**Reviewers:** + + Mark Hatle <mark.hatle@xilinx.com> + Sandeep Gundlupet Raju <sandeep.gundlupet-raju@xilinx.com> + John Toomey <john.toomey@xilinx.com> diff --git a/README.booting.md b/README.booting.md new file mode 100644 index 00000000..0f96a138 --- /dev/null +++ b/README.booting.md @@ -0,0 +1,14 @@ +# Booting OS Images onto AMD Xilinx target devices + +AMD Xilinx Devices support different boot modes such as JTAG, SD, eMMC, QSPI etc. + +## Booting Images with QEMU + +Once images are built, you can simulate the image using QEMU emulator. +``` +$ MACHINE=<target_mahcine_name> runqemu nographic +``` + +## Booting Images with Hardware + +Follow booting instructions [README](docs) for more details. diff --git a/README.building.md b/README.building.md new file mode 100644 index 00000000..45deadb9 --- /dev/null +++ b/README.building.md @@ -0,0 +1,99 @@ +# Build Instructions + +This section describes how to get your build host ready to work with meta-xilinx +layers. + +The following instructions require OE-Core meta and BitBake. Poky provides these +components, however they can be acquired separately. + +> **Pre-requisites:** Refer [Preparing Build Host](https://docs.yoctoproject.org/4.1.2/singleindex.html#preparing-the-build-host) documentation. + +1. Create a project directory. +``` +$ mkdir sources +$ cd sources +``` +2. Clone the poky, openembedded and amd xilinx repository. +> **Note:** +> * *release_branch:* refers to upstream stable release branch. +> * *rel-version:* refers to amd xilinx release version. +``` +$ mkdir sources +$ git clone -b <release-branch> https://git.yoctoproject.org/poky.git +$ git clone -b <release-branch> https://git.openembedded.org/meta-openembedded.git +$ git clone -b <rel-version> https://github.com/Xilinx/meta-xilinx.git +$ git clone -b <rel-version> https://github.com/Xilinx/meta-xilinx-tools.git +``` +3. Initialize a build environment using the `oe-init-build-env` script. +``` +$ source poky/oe-init-build-env +``` +4. Once initialized configure `bblayers.conf` by adding dependency layers as shown + below using `bitbake-layers` command. +> **Note:** From step 3 by default `meta-yocto-bsp` will be included in bblayers.conf +> file and this can be removed using `$ bitbake-layers remove-layer meta-yocto-bsp` +> command. + +``` +$ bitbake-layers add-layer ./<path-to-layer>/meta-openembedded/meta-oe +$ bitbake-layers add-layer ./<path-to-layer>/meta-openembedded/meta-python +$ bitbake-layers add-layer ./<path-to-layer>/meta-openembedded/meta-filesystems +$ bitbake-layers add-layer ./<path-to-layer>/meta-openembedded/meta-networking +$ bitbake-layers add-layer ./<path-to-layer>/meta-xilinx/meta-microblaze +$ bitbake-layers add-layer ./<path-to-layer>/meta-xilinx/meta-xilinx-core +$ bitbake-layers add-layer ./<path-to-layer>/meta-xilinx/meta-xilinx-standalone +$ bitbake-layers add-layer ./<path-to-layer>/meta-xilinx/meta-xilinx-bsp +$ bitbake-layers add-layer ./<path-to-layer>/meta-xilinx/meta-xilinx-vendor +$ bitbake-layers add-layer ./<path-to-layer>/meta-xilinx/meta-xilinx-contrib +$ bitbake-layers add-layer ./<path-to-layer>/meta-xilinx-tools +``` +> **Note:** We recommend using meta-xilinx-tools, the version that is built as +> standalone may not work on many boards as it does not know the board configuration. + +5. Set hardware `MACHINE` configuration variable in <proj-dir>/build/conf/local.conf + file for a specific target which can boot and run the in the board or QEMU. +``` +MACHINE = "<target_machine_name>" +``` +Available target machines are: + +| Device | target machines | +|------------|---------------------| +| MicroBlaze | microblaze-generic | +| | ac701-microblazeel | +| | kc705-microblazeel | +| | kcu105-microblazeel | +| | vcu118-microblazeel | +| Zynq-7000 | zynq-generic | +| | zc702-zynq7 | +| | zc706-zynq7 | +| ZynqMP | zynqmp-generic | +| | zcu102-zynqmp | +| | zcu104-zynqmp | +| | zcu106-zynqmp | +| | zcu111-zynqmp | +| | zcu208-zynqmp | +| | zcu216-zynqmp | +| | zcu670-zynqmp | +| | zcu1275-zynqmp | +| | zcu1285-zynqmp | +| | ultra96-zynqmp | +| Versal | versal-generic | +| | versal-net-generic | +| | vck190-versal | +| | vmk180-versal | +| | vek280-versal | +| | vpk120-versal | +| | vpk180-versal | +| | vhk158-versal | + +6. Build an OS image for the target using `bitbake` command. +> **Note:** Refer ./<path-to-distro-layer>/conf/templates/default/conf-notes.txt +> for available target image-name. e.g. core-image-minimal + +``` +$ bitbake <image-name> +``` + +7. Once complete the images for the target machine will be available in the output + directory `${TMPDIR}/deploy/images/${MACHINE}/`. @@ -1,4 +1,47 @@ -Collection of layers to support Xilinx products +# meta-xilinx -Please see the respective READMEs in the layer subdirectories +Collection of layers to enable AMD Xilinx products. +* **meta-microblaze**: layer containing the AMD Xilinx MicroBlaze architecture +specific implementation, such as microblaze gcc tool and other tools. + +* **meta-xilinx-bsp**: layer containing the AMD Xilinx evaluation boards metadata +such as eval boards machine configurations files, kernel configuration fragments, +series configuration compiler(.scc) files etc. + +* **meta-xilinx-contrib**: layer containing contribution from open source developers +for vendor specific boards which has AMD Xilinx devices or SoM's. + +* **meta-xilinx-core**: layer containing the AMD Xilinx hardware devices metadata +such as tune files, generic, soc variant machine configurations, boot firmware +components, kernel etc. + +* **meta-xilinx-standalone**: layer containing the AMD Xilinx Baremetal or +Standalone Toolchains metadata to build baremetal firmware and applications. + +* **meta-xilinx-standalone-experimental**: layer containing metadata to build +all the boot images using lopper and system device tree without using the +meta-xilinx-tools layer. + +* **meta-xilinx-vendor**: layer containing 3rd party vendor boards machine +configurations files, boot firmware, kernel configuration fragments, .scc files, +device tree etc. + +> **See:** AMD Xilinx devices: + https://www.xilinx.com/products/silicon-devices.html + +> **Note:** For AMD Ryzen, EPYC and Opteron A1100 architectures see: + https://git.yoctoproject.org/meta-amd/tree/ + +Please see the respective READMEs and docs in the layer subdirectories + +## Release Information + +Refer [AMD Xilinx Yocto wiki](https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2613018625) +page for release features, known issue and limitations. + +## Additional Documentation + +For more information about [Yocto Project](https://www.yoctoproject.org) see Yocto Project docs which can be found at: + + * https://docs.yoctoproject.org/singleindex.html diff --git a/docs/README.booting.flash.md b/docs/README.booting.flash.md new file mode 100644 index 00000000..3bc39882 --- /dev/null +++ b/docs/README.booting.flash.md @@ -0,0 +1,133 @@ +# Booting OS Images from Flash Device + +Booting OS Images from flash devices such as QSPI/NOR/NAND/OSPI. + +* [U-boot boot scripts configurations](#u-boot-boot-scripts-configurations) +* [Booting from QSPI or NOR or OSPI](#booting-from-qspi-or-nor-or-ospi) + +## U-boot boot scripts configurations + +1. In QSPI/OSPI/NAND boot modes the boot.scr partition offset is fixed for all the + platforms by default in u-boot, and you can change by updating + CONFIG_BOOT_SCRIPT_OFFSET in u-boot config. Default boot script size is + 512KB(script_size_f=0x80000). +2. Below table describes boot.scr partition offset and load address for all the + platforms. + +| Device | Partition Offset address for boot.scr | Load address of boot.scr in DDR | +|------------|---------------------------------------|----------------------------------------| +| MicroBlaze | 0x1F00000 | DDR base address + DDR Size - 0xe00000 | +| Zynq-7000 | 0xFC0000 | DDR base address + 0x3000000 | +| ZynqMP | 0x3E80000 | DDR base address + 0x20000000 | +| Versal | 0x7F80000 | DDR base address + 0x20000000 | + +## Booting from QSPI or NOR or OSPI + +This section demonstrates the booting OS images from QSPI boot mode. For this, +you need to make sure you have QSPI interface on board or a QSPI daughter card. + +> **Note:** Instructions are same for QSPI or NOR and OSPI flash. + +1. For example we'll assume QSPI flash size is 128MB and default CONFIG_BOOT_SCRIPT_OFFSET + defined in u-boot. + +| Flash Partition Name | Partition Offset | Partition Size | +|----------------------|------------------|----------------| +| boot.bin | 0x0 | 30MB | +| bootenv | 0x1E00000 | 256Kb | +| kernel | 0x1E40000 | 33MB | +| bootscr | 0x3E80000 | 1.5MB | +| rootfs | 0x4000000 | 64MB | + +2. Create a flash partition device-tree nodes depending on your flash size. ex: +``` +&qspi { + #address-cells = <1>; + #size-cells = <0>; + flash0: flash@0 { + spi-tx-bus-width=<4>; + spi-rx-bus-width=<4>; + partition@0 { + label = "boot"; + reg = <0x00000000 0x01e00000>; + }; + partition@1 { + label = "bootenv"; + reg = <0x01e00000 0x00040000>; + }; + partition@2 { + label = "kernel"; + reg = <0x01e40000 0x02040000>; + }; + partition@3 { + label = "bootscr"; + reg = <0x03e80000 0x01800000>; + }; + partition@4 { + label = "rootfs"; + reg = <0x04000000 0x04000000>; + }; + }; +}; +``` +3. Set the U-boot boot script variables to match the flash partition offsets in + local.conf +``` +QSPI_KERNEL_OFFSET = "0x1E40000" +QSPI_KERNEL_SIZE = "0x2040000" +QSPI_RAMDISK_OFFSET = "0x4000000" +QSPI_RAMDISK_SIZE = "0x4000000" +``` +4. Build the images and make sure images are copied to tftp directory. +5. Once images are built, to ensure taget is booted using JTAG or SD boot modes. +6. Also have boot.bin copied to DDR location using XSCT `dow` or `tftpboot` or + `fatload` command. +7. Halt at U-Boot then run the following commands to flash the images on the + QSPI flash. +``` +# check QSPI is available or not +U-Boot> sf probe 0 0 0 + +# Erase the boot partition +U-Boot> sf erase 0x0 0x1E00000 + +# Copy the boot.bin to DDR location using tftpboot +U-Boot> tftpboot 0x10000000 ${TFTPDIR}/boot.bin + +# Write boot.bin file image to flash partition +U-Boot> sf write 0x10000000 0x0 ${filesize} + +# Erase the bootenv partition for env storage (saveenv). +U-Boot> sf erase 0x1E00000 0x1E40000 + +# Erase the kernel partition +U-Boot> sf erase 0x1E40000 0x2040000 + +# Copy the Image file to DDR location using tftpboot +U-Boot> tftpboot 0x10000000 ${TFTPDIR}/Image + +# Write kernel image to flash partition +U-Boot> sf write 0x10000000 0x1E40000 ${filesize} + +# Erase the bootscr partition +U-Boot> sf erase 0x3E80000 0x1800000 + +# Copy the boot.scr file to DDR location using tftpboot +U-Boot> tftpboot 0x10000000 ${TFTPDIR}/boot.scr + +# Write boot.scr file to flash partition +U-Boot> sf write 0x10000000 0x3E80000 ${filesize} + +# Erase the rootfs partition +U-Boot> sf erase 0x4000000 0x4000000 + +# Copy the rootfs.cpio.gz.u-boot file to DDR location using tftpboot +U-Boot> tftpboot 0x10000000 ${TFTPDIR}/rootfs.cpio.gz.u-boot + +# Write rootfs image to flash partition +U-Boot> sf write 0x10000000 0x4000000 ${filesize} +``` +8. After flashing the images, turn off the board and change the boot mode pin + settings to QSPI boot mode. +9. Power cycle the board. The board now boots up using the images in the QSPI + flash. diff --git a/docs/README.booting.microblaze.md b/docs/README.booting.microblaze.md new file mode 100644 index 00000000..1ffcc3c8 --- /dev/null +++ b/docs/README.booting.microblaze.md @@ -0,0 +1,170 @@ +# Booting OS Images on MicroBlaze target boards + +Booting OS images on MicroBlaze target boards can be done using JTAG and QSPI boot modes. + +* [Setting Up the Target](#setting-up-the-target) +* [Booting from JTAG](#booting-from-jtag) + * [Loading Bitstream using XSCT](#loading-bitstream-using-xsct) + * [Loading U-boot using XSCT](#loading-u-boot-using-xsct) + * [Loading Kernel, Device tree, Root Filesystem and U-boot boot script](#loading-kernel-device-tree-root-filesystem-and-u-boot-boot-script) + * [Using XSCT](#using-xsct) + * [Using TFTP](#using-tftp) + +## Setting Up the Target + +> **Note:** For microblaze-generic machine configuration file KCU105 evaluation +> board is used as reference. + +1. Connect a USB cable between the USB-JTAG, USB-UART connector on the target + and the USB port on the host machine. +2. Connect 12V power to the KCU105 6-Pin power supply to J15 and turn on the board + power with the SW1 switch. +3. Default UART terminal (serial port) settings is Speed `115200`, Data `8 bit`, + Parity `None`, Stop bits ` 1 bit` and Flow control `None`. +4. Set the board to JTAG and other boot modes by setting the boot mode switch by + referring to board user guide. For KCU105 board below is the configuration + boot mode settings (SW15). + +> **Note:** Switch OFF = 1 = High; ON = 0 = Low + +| Boot Mode | Mode Pins M[2:0] | +|------------|------------------| +| JTAG | 101 | +| QSPI | 001 | + +## Booting from JTAG + +This boot flow requires the use of the AMD Xilinx tools, specifically XSCT and +the associated JTAG device drivers. This also requires access to the JTAG interface +on the board, a number of AMD Xilinx and third-party boards come with on-board JTAG +modules. + +1. Source the Vivado or Vitis tools `settings.sh` scripts. +2. Power on the board, Open the XSCT console in the Vitis IDE by clicking the + XSCT button. Alternatively, you can also open the XSCT console by selecting + Xilinx -> XSCT Console. +``` +$ xsct +``` +3. In the XSCT console, connect to the target over JTAG using the connect command. + Optionally user can use `-url` to specify the local/remote hw_server. The + connect command returns the channel ID of the connection. +``` +xsct% connect +``` +4. The targets command lists the available targets and allows you to select a + target using its ID. The targets are assigned IDs as they are discovered on + the JTAG chain, so the IDs can change from session to session. +``` +xsct% targets +``` + +> **Note:** For non-interactive usage such as scripting, you can use the `-filter` + option to select a target instead of selecting the target using its ID. + +### Loading Bitstream using XSCT + +* Download the bitstream for the target using XSCT with the `fpga` command. Microblaze +bitstream will be located in the `${DEPLOY_DIR_IMAGE}` directory. Optionally user +can use `fpga -no-revision-check` to skip FPGA silicon revision. + +``` +xsct% fpga -no-revision-check ${DEPLOY_DIR_IMAGE}/system-${MACHINE}.bit +xsct% after 2000 +xsct% targets -set -nocase -filter {name =~ "microblaze*#0"} +xsct% catch {stop} +xsct% after 1000 +``` +### Loading U-boot using XSCT + +1. Download `u-boot.elf` to the target CPU using XSCT. Microblaze u-boot.elf will be +located in the `${DEPLOY_DIR_IMAGE}` directory. Before u-boot.elf is loaded suspend +the execution of active target using `stop` command. +``` +xsct% dow ${DEPLOY_DIR_IMAGE}/u-boot.elf +``` +2. After loading u-boot.elf resume the execution of active target using the `con` +command in XSCT shell. +``` +xsct% con +``` +3. In the target Serial Terminal, press any key to stop the U-Boot auto-boot. +``` +... +Hit any key to stop autoboot: 0 +U-Boot> +``` + +### Loading Kernel, Device tree, Root Filesystem and U-boot boot script + +Load the images into the target DDR/MIG load address i.e., +`DDR base address + <image_offset>`. MicroBlaze U-boot boot script(boot.scr) +load address is calculated as `DDR base address + DDR Size - 0xe00000` + +Below example uses base DDR address as 0x80000000 and DDR size as 0x80000000 +which matches in vivado address editor. + +| Image Type | Base DDR Address | Image Offset | Load Address in DDR | +|--------------------|------------------|--------------|---------------------| +| Kernel | 0x80000000 | 0x0 | 0x80000000 | +| Device Tree | 0x80000000 | 0x1e00000 | 0x81e00000 | +| Rootfs | 0x80000000 | 0x2e00000 | 0x82e00000 | +| U-boot boot script | 0x80000000 | 0xe00000 | 0xff200000 | + +> **Note:** +> 1. `<target-image>` refers to core-image-minimal or petalinux-image-minimal +> 2. For pxeboot boot create a symlink for `<target-image>-${MACHINE}-${DATETIME}.cpio.gz.u-boot` +> as shown `$ ln -sf ${DEPLOY_DIR_IMAGE}/<target-image>-${MACHINE}-${DATETIME}.cpio.gz.u-boot ${DEPLOY_DIR_IMAGE}/rootfs.cpio.gz.u-boot` +> to ensure the INITRD name in pxeboot.cfg matches with image name. +> 3. Whilst it is possible to load the images via JTAG this connection is slow and +this process can take a long time to execute (more than 10 minutes). If your +system has ethernet it is recommended that you use TFTP to load these images +using U-Boot. + +#### Using XSCT + +1. Suspend the execution of active target using `stop` command in XSCT. +``` +xsct% stop +``` +2. Using the `dow` command to load the images into the target DDR/MIG +load address. +``` +xsct% dow -data ${DEPLOY_DIR_IMAGE}/linux.bin.ub 0x80000000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/system.dtb 0x81e00000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/core-image-minimal-${MACHINE}.cpio.gz.u-boot 0x82e00000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/boot.scr 0xff200000 +``` + +#### Using TFTP + +1. Configure the `ipaddr` and `serverip` of the U-Boot environment. +``` +U-Boot> set serverip <server ip> +U-Boot> set ipaddr <board ip> +``` +2. Load the images to DDR address. Make sure images are copied to tftp directory. +``` +U-Boot> tftpboot 0x80000000 ${TFTPDIR}/linux.bin.ub +U-Boot> tftpboot 0x81e00000 ${TFTPDIR}/system.dtb +U-Boot> tftpboot 0x82e00000 ${TFTPDIR}/core-image-minimal-${MACHINE}.cpio.gz.u-boot +U-Boot> tftpboot 0xff200000 ${TFTPDIR}/boot.scr +``` + +### Booting Linux + +Once the images are loaded continue the execution. + +1. After loading images resume the execution of active target using the `con` +command in XSCT shell, Skip step 1 for if you have used TFTP to load images. +``` +xsct% con +``` +2. Terminate xsct shell. +``` +xsct% exit +``` +3. In the target Serial Terminal, from U-Boot prompt run `boot` command. +``` +U-Boot> boot +``` diff --git a/docs/README.booting.storage.md b/docs/README.booting.storage.md new file mode 100644 index 00000000..4d33600d --- /dev/null +++ b/docs/README.booting.storage.md @@ -0,0 +1,118 @@ +# Booting OS Images from Storage Device + +Booting OS Images from storage devices such as SD Card, eMMC, USB and SATA devices. + +* [Booting from SD or eMMC](#booting-from-sd-or-emmc) +* [Writing wic image to SD or eMMC device](#writing-image-to-sd-or-emmc-device) + * [Using Wic file](#using-wic-file) + * [Using Yocto images](#using-yocto-images) +* [Secondary boot from USB or SATA device](#secondary-boot-from-usb-or-sata-device) + +## Booting from SD or eMMC + +Setup the card with the first partition formatted as FAT16/32. If you intend to +boot with the root filesystem located on the SD card, also create a second +partition formatted as EXT4. + +It is recommended that the first partition be at least 512MB in size, however +this value will depend on whether using a ramdisk for the root filesystem and +how large the ramdisk is. + +This section describes how to manually prepare and populate an SD card image. +There are automation tools in OpenEmbedded that can generate disk images already +formatted and prepared such that they can be written directly to a disk. Refer +to the Yocto Project Manual for more details: +https://docs.yoctoproject.org/4.1.2/singleindex.html#creating-partitioned-images-using-wic + +## Writing image to SD or eMMC device + +There are two ways to write the images to SD card or eMMC device. + +1. Find the device name of SD or eMMC device and make sure it is unmounted. In + this example we'll assume it is /dev/mmcblk<devnum><partnum>. +2. To write image to eMMC device make sure you need to boot Linux from JTAG or + SD or QSPI first, then copy the wic image to `<target_rootfs>/tmp` directory. + +### Using Wic file + +Write wic image file to the SD card or eMMC device. +``` +$ sudo dd if=xilinx-default-sd-${DATETIME}-sda.direct of=/dev/mmcblk<devnum> bs=4M +``` + +### Using Yocto images + +> **Note:** Use actual files to copy and don't use symlink files. + +1. Create a FAT32 and EXT4 partition on SD card or eMMC device. +``` +$ sudo parted -s /dev/mmcblk<devnum> mklabel gpt mkpart primary fat32 1MiB 512MiB mkpart ext4 512MiB 8GiB name 1 boot name 2 root +$ sudo mkfs.fat -n boot /dev/mmcblk<devnum>1 && sudo mkfs.ext4 -L root /dev/mmcblk<devnum>2 +$ sudo lsblk /dev/mmcblk<devnum> -o NAME,FSTYPE,LABEL,PARTLABEL +``` +2. Mount the FAT32 and EXT4 partition. +``` +$ sudo mount -L boot /mnt/boot; sudo mount -L root /mnt/rootfs` +``` +3. Copy the boot images to the SD card or eMMC device FAT32 partition. + * boot.bin + * boot.scr + * Image or uImage (For Zynq7000 only) + * system.dtb + * rootfs.cpio.gz.u-boot (If using a ramdisk) +``` +$ cp ${DEPLOY_DIR_IMAGE}/boot.bin /mnt/boot/boot.bin +$ cp ${DEPLOY_DIR_IMAGE}/boot.scr /mnt/boot/boot.scr +$ cp ${DEPLOY_DIR_IMAGE}/Image /mnt/boot/Image +$ cp ${DEPLOY_DIR_IMAGE}/system.dtb /mnt/boot/system.dtb +$ cp ${DEPLOY_DIR_IMAGE}/core-image-minimal-${MACHINE}.cpio.gz.u-boot /mnt/boot/rootfs.cpio.gz.u-boot +``` +4. Extract `core-image-minimal-${MACHINE}-${DATETIME}.rootfs.tar.gz` file content to the SD + card or eMMC device EXT4 partition. +``` +$ sudo tar -xf ${DEPLOY_DIR_IMAGE}/core-image-minimal-${MACHINE}-${DATETIME}.rootfs.tar.gz -C /mnt/rootfs +$ sync +``` +5. Unmount the SD Card or eMMC device and boot from SD or eMMC boot modes. +``` +$ umount /mnt/boot +$ umount /mnt/rootfs +``` + +## Secondary boot from USB or SATA device + +On Zynq, ZynqMP and Versal devices supports secondary boot medium such as USB or +SATA external storage devices. This means target soc primary boot medium should +be either JATG or SD/eMMC or QSPI/NOR/NAND boot modes. + +> **Note:** Use actual files to copy and don't use symlink files. + +1. Create a FAT32 and EXT4 partition on SD card or eMMC device. +``` +$ sudo parted -s /dev/sd<X> mklabel gpt mkpart primary mkpart ext4 512MiB 8GiB name 1 root +$ sudo sudo mkfs.ext4 -L root /dev/sd<X>1 +$ sudo lsblk /dev/sd<X> -o NAME,FSTYPE,LABEL,PARTLABEL +``` +2. Mount the FAT32 and EXT4 partition. +``` +$ sudo mount -L root /mnt/rootfs` +``` +3. Extract `core-image-minimal-${MACHINE}-${DATETIME}.rootfs.tar.gz` file content + to the USB or SATA device EXT4 partition. +``` +$ sudo tar -xf ${DEPLOY_DIR_IMAGE}/core-image-minimal-${MACHINE}-${DATETIME}.rootfs.tar.gz -C /mnt/rootfs +$ sync +``` +4. Unmount the USB or SATA device. +``` +$ umount /mnt/rootfs +``` +5. Boot from JATG or SD/eMMC or QSPI/NOR/NAND boot modes and halt at u-boot. +6. Set U-boot bootargs for USB or SATA rootfs and boot from run secondary boot + from USB or SATA device +``` +U-Boot> setenv sata_root 'setenv bootargs ${bootargs} root=/dev/sd<X>1 rw rootfstype=ext4 rootwait' +U-Boot> setenv sataboot 'run sata_root; run default_bootcmd' +U-Boot> saveenv +U-Boot> run sataboot +``` diff --git a/docs/README.booting.versal.md b/docs/README.booting.versal.md new file mode 100644 index 00000000..afdeba2b --- /dev/null +++ b/docs/README.booting.versal.md @@ -0,0 +1,189 @@ +# Booting OS Images on Versal target boards + +Booting OS images on Versal boards can be done using JTAG, SD, eMMC and QSPI boot +modes. + +* [Setting Up the Target](#setting-up-the-target) +* [Booting from JTAG](#booting-from-jtag) + * [Loading boot.bin using XSCT](#loading-bootbin-using-xsct) + * [Loading Kernel, Root Filesystem and U-boot boot script](#loading-kernel-root-filesystem-and-u-boot-boot-script) + * [Using XSCT](#using-xsct) + * [Using TFTP](#using-tftp) +* [Booting from SD](#booting-from-sd) +* [Booting from QSPI](#booting-from-qspi) + +## Setting Up the Target + +> **Note:** For versal-generic machine configuration file VCK190 evaluation +> board is used as reference. + +1. Connect a USB cable between the FTDI FT4232HL U20 USB-to-Quad-UART bridge USB + Type-C connector on the target and the USB port on the host machine. +2. Connect 12V power to the VCK190 6-Pin Molex connector and turn on the board + power with the SW13 switch. +3. Default UART terminal (serial port) settings is Speed `115200`, Data `8 bit`, + Parity `None`, Stop bits ` 1 bit` and Flow control `None`. +4. Set the board to JTAG and other boot modes by setting the boot mode switch by + referring to board user guide. For VCK190 board Below is the configuration + boot mode settings (SW1). + +> **Note:** Switch OFF = 1 = High; ON = 0 = Low + +| Boot Mode | Mode Pins [3:0] | Mode SW1 [4:1] | Comments | +|-----------|-----------------|-------------------|---------------------------------------------------| +| JTAG | 0000 | ON, ON, ON, ON | Supported with or without boot module attached | +| QSPI | 0010 | ON, ON, OFF, ON | Supported only with boot module X-EBM-01 attached | +| SD | 1110 | OFF, OFF, OFF, ON | Supported with or without boot module attached | + +## Booting from JTAG + +This boot flow requires the use of the AMD Xilinx tools, specifically XSCT and +the associated JTAG device drivers. This also requires access to the JTAG interface +on the board, a number of AMD Xilinx and third-party boards come with on-board JTAG +modules. + +1. Source the Vivado or Vitis tools `settings.sh` scripts. +2. Power on the board, Open the XSCT console in the Vitis IDE by clicking the + XSCT button. Alternatively, you can also open the XSCT console by selecting + Xilinx -> XSCT Console. +``` +$ xsct +``` +3. In the XSCT console, connect to the target over JTAG using the connect command. + Optionally user can use `-url` to specify the local/remote hw_server. The + connect command returns the channel ID of the connection. +``` +xsct% connect +``` +4. The targets command lists the available targets and allows you to select a + target using its ID. The targets are assigned IDs as they are discovered on + the JTAG chain, so the IDs can change from session to session. +``` +xsct% targets +``` + +> **Note:** For non-interactive usage such as scripting, you can use the `-filter` + option to select a target instead of selecting the target using its ID. + +### Loading boot.bin using XSCT + +1. Download the boot.bin for the target using XSCT with the `device program` command. +Versal boot.bin will be located in the `${DEPLOY_DIR_IMAGE}` directory. Default +boot.bin consists of boot pdi, plm.elf, psm.elf, bl31.elf, u-boot.elf and +system.dtb. This boot.bin is generated using bootgen tool by passing a .bif file. + +> **Note:** In yocto by default, ${DEPLOY_DIR_IMAGE}/system.dtb is used for both +> u-boot and kernel. + +``` +xsct% targets -set -nocase -filter {name =~ "*PMC*"} +xsct% device program ${DEPLOY_DIR_IMAGE}/boot.bin +xsct% targets -set -nocase -filter {name =~ "*A72*#0"} +xsct% stop +``` +2. After loading boot.bin resume the execution of active target using the `con` +command in XSCT shell. +``` +xsct% con +``` +3. In the target Serial Terminal, press any key to stop the U-Boot auto-boot. +``` +... +Hit any key to stop autoboot: 0 +U-Boot> +``` + +### Loading Kernel, Root Filesystem and U-boot boot script + +Load the images into the target DDR/PL DRR load address i.e., +`DDR base address + <image_offset>`. + +Below example uses base DDR address as 0x0 which matches in vivado address editor. + +| Image Type | Base DDR Address | Image Offset | Load Address in DDR | +|--------------------|------------------|--------------|---------------------| +| Kernel | 0x0 | 0x200000 | 0x200000 | +| Device Tree | 0x0 | 0x1000 | 0x1000 | +| Rootfs | 0x0 | 0x4000000 | 0x4000000 | +| U-boot boot script | 0x0 | 0x20000000 | 0x20000000 | + +> **Note:** +> 1. `<target-image>` refers to core-image-minimal or petalinux-image-minimal +> 2. For pxeboot boot create a symlink for `<target-image>-${MACHINE}-${DATETIME}.cpio.gz.u-boot` +> as shown `$ ln -sf ${DEPLOY_DIR_IMAGE}/<target-image>-${MACHINE}-${DATETIME}.cpio.gz.u-boot ${DEPLOY_DIR_IMAGE}/rootfs.cpio.gz.u-boot` +> to ensure the INITRD name in pxeboot.cfg matches with image name. +> 3. Whilst it is possible to load the images via JTAG this connection is slow and +this process can take a long time to execute (more than 10 minutes). If your +system has ethernet it is recommended that you use TFTP to load these images +using U-Boot. +> 4. If common ${DEPLOY_DIR_IMAGE}/system.dtb is used by u-boot and kernel, this +> is already part of boot.bin we can skip loading dtb, else load kernel dtb. + +#### Using XSCT + +1. Suspend the execution of active target using `stop` command in XSCT. +``` +xsct% stop +``` +2. Using the `dow` command to load the images into the target DDR/PL DDR load + address. +``` +xsct% dow -data ${DEPLOY_DIR_IMAGE}/Image 0x200000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/system.dtb 0x1000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/core-image-minimal-${MACHINE}.cpio.gz.u-boot 0x4000000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/boot.scr 0x20000000 +xsct% targets -set -nocase -filter {name =~ "*A72*#0"} +``` + +#### Using TFTP + +1. Configure the `ipaddr` and `serverip` of the U-Boot environment. +``` +Versal> set serverip <server ip> +Versal> set ipaddr <board ip> +``` +2. Load the images to DDR address. Make sure images are copied to tftp directory. +``` +U-Boot> tftpboot 0x200000 ${TFTPDIR}/Image +U-Boot> tftpboot 0x1000 ${TFTPDIR}/system.dtb +U-Boot> tftpboot 0x4000000 ${TFTPDIR}/core-image-minimal-${MACHINE}.cpio.gz.u-boot +U-Boot> tftpboot 0x20000000 ${TFTPDIR}/boot.scr + +``` +### Booting Linux + +Once the images are loaded continue the execution. + +1. After loading images resume the execution of active target using the `con` +command in XSCT shell, Skip step 1 for if you have used TFTP to load images. +``` +xsct% con +``` +2. Terminate xsct shell. +``` +xsct% exit +``` +3. In the target Serial Terminal, from U-Boot prompt run `boot` command. +``` +U-Boot> boot +``` + +## Booting from SD + +1. Load the SD card into the VCK190 board in the J302 SD slot. +2. Configure the VCK190 board to boot in SD-Boot mode (1-ON, 2-OFF, 3-OFF, 4-OFF) + by setting the SW1. Refer [Setting Up the Target](#setting-up-the-target). +3. Follow SD boot instructions [README](README.booting.storage.md) for more details. + +## Booting from QSPI + +1. To boot VCK190 board in QSPI boot mode, you need to connect a QSPI daughter + card (part number: X_EBM-01, REV_A01). +2. With the card powered off, install the QSPI daughter card. +3. Power on the VCK190 board and boot using JTAG or SD boot mode, to ensure that + U-Boot is running and also have boot.bin copied to DDR location using XSCT + `dow` or `tftpboot` or `fatload` command. +4. Follow Flash boot instructions [README](README.booting.flash.md) for more details. +5. After flashing the images, turn off the power switch on the board, and change + the SW1 boot mode pin settings to QSPI boot mode (1-ON, 2-OFF, 3-ON, 4-ON) by + setting the SW1. Refer [Setting Up the Target](#setting-up-the-target).
\ No newline at end of file diff --git a/docs/README.booting.zynq.md b/docs/README.booting.zynq.md new file mode 100644 index 00000000..a9b6e8f3 --- /dev/null +++ b/docs/README.booting.zynq.md @@ -0,0 +1,194 @@ +# Booting OS Images on Zynq target boards + +Booting OS images on Zynq boards can be done using JTAG, SD, eMMC, QSPI and NAND +boot modes. + +* [Setting Up the Target](#setting-up-the-target) +* [Booting from JTAG](#booting-from-jtag) + * [Loading boot components using XSCT](#loading-boot-components-using-xsct) + * [Loading Kernel, Root Filesystem and U-boot boot script](#loading-kernel-root-filesystem-and-u-boot-boot-script) + * [Using XSCT](#using-xsct) + * [Using TFTP](#using-tftp) +* [Booting from SD](#booting-from-sd) +* [Booting from QSPI](#booting-from-qspi) + +## Setting Up the Target +1. Connect a USB cable between the CP210x USB-to-UART bridge USB Mini-B on + the target and the USB port on the host machine. +2. Connect a micro USB cable from the ZC702 board USB UART port (J17) to the USB + port on the host machine. +3. Default UART terminal(serial port) settings is Speed `115200`, Data `8 bit`, + Parity `None`, Stop bits ` 1 bit` and Flow control `None`. +4. Set the board to JTAG and other boot mode by setting the boot mode switch by + referring to board user guide. For zynq-generic machine configuration + file ZC702 evaluation board is used as reference and below is the + configuration boot mode settings (SW16). + +> **Note:** Switch OFF = 0 = Low; ON = 1 = High + +| Boot Mode | Mode Pins [0:4] | Mode SW16 [1:5] | Comments | +|-----------|-----------------|-------------------------|------------------------| +| JTAG | 00000 | OFF, OFF, OFF, OFF, OFF | PS JTAG | +| QSPI | 01000 | OFF, ON, OFF, OFF, OFF | QSPI 32-bit addressing | +| SD | 00110 | OFF, OFF, ON, ON, OFF | SD 2.0 | + +--- +## Booting from JTAG + +This boot flow requires the use of the AMD Xilinx tools, specifically XSCT and +the associated JTAG device drivers. This also requires access to the JTAG interface +on the board, a number of AMD Xilinx and third-party boards come with on-board JTAG +modules. + +1. Source the Vivado or Vitis tools `settings.sh` scripts. +2. Power on the board, Open the XSCT console in the Vitis IDE by clicking the + XSCT button. Alternatively, you can also open the XSCT console by selecting + Xilinx -> XSCT Console. +``` +$ xsct +``` +3. In the XSCT console, connect to the target over JTAG using the connect command. + Optionally user can use `-url` to specify the local/remote hw_server. The + connect command returns the channel ID of the connection. +``` +xsct% connect +``` +4. The targets command lists the available targets and allows you to select a + target using its ID. The targets are assigned IDs as they are discovered on + the JTAG chain, so the IDs can change from session to session. +``` +xsct% targets +``` + +> **Note:** For non-interactive usage such as scripting, you can use the `-filter` + option to select a target instead of selecting the target using its ID. +--- +### Loading boot components using XSCT + +1. Download the boot images for the target using XSCT with the `fpga` and `dow` + command. Zynq boot images will be located in the `${DEPLOY_DIR_IMAGE}` + directory. + +> **Note:** In yocto by default, ${DEPLOY_DIR_IMAGE}/system.dtb is used for both +> u-boot and kernel. + +2. Program the bitstream or skip this step if you are loading from u-boot or linux. +``` +xsct% fpga -no-revision-check ${DEPLOY_DIR_IMAGE}/download.bit +``` +3. Select APU Cortex-A9 Core 0 to load and execute FSBL. +``` +xsct% targets -set -nocase -filter {name =~ "arm*#0"} +xsct% catch {stop} +``` +5. Download and run FSBL from APU Cortex-A9 Core 0 +``` +xsct% dow ${DEPLOY_DIR_IMAGE}/zynq_fsbl.elf +xsct% con +``` +7. Now download U-boot.elf and Device tree to APU and execute. +``` +xsct% stop +xsct% dow ${DEPLOY_DIR_IMAGE}/u-boot.elf +xsct% dow -data ${DEPLOY_DIR_IMAGE}/system.dtb 0x100000 +xsct% con +``` + +8. In the target Serial Terminal, press any key to stop the U-Boot auto-boot. +``` +... +Hit any key to stop autoboot: 0 +U-Boot> +``` +--- +### Loading Kernel, Root Filesystem and U-boot boot script + +Load the images into the target DDR load address i.e., +`DDR base address + <image_offset>`. + +Below example uses base DDR address as 0x0 which matches in vivado address editor. + +| Image Type | Base DDR Address | Image Offset | Load Address in DDR | +|--------------------|------------------|---------------|---------------------| +| Kernel | 0x0 | 0x200000 | 0x200000 | +| Device Tree | 0x0 | 0x100000 | 0x100000 | +| Rootfs | 0x0 | 0x4000000 | 0x4000000 | +| U-boot boot script | 0x0 | 0x3000000 | 0x3000000 | + +> **Note:** +> 1. `<target-image>` refers to core-image-minimal or petalinux-image-minimal +> 2. For pxeboot boot create a symlink for `<target-image>-${MACHINE}-${DATETIME}.cpio.gz.u-boot` +> as shown `$ ln -sf ${DEPLOY_DIR_IMAGE}/<target-image>-${MACHINE}-${DATETIME}.cpio.gz.u-boot ${DEPLOY_DIR_IMAGE}/rootfs.cpio.gz.u-boot` +> to ensure the INITRD name in pxeboot.cfg matches with image name. +> 3. Whilst it is possible to load the images via JTAG this connection is slow and +this process can take a long time to execute (more than 10 minutes). If your +system has ethernet it is recommended that you use TFTP to load these images +using U-Boot. +> 4. If common ${DEPLOY_DIR_IMAGE}/system.dtb is used by u-boot and kernel, this +> is already part of boot.bin we can skip loading dtb, else load kernel dtb. +--- +#### Using XSCT + +1. Suspend the execution of active target using `stop` command in XSCT. +``` +xsct% stop +``` +2. Using the `dow` command to load the images into the target DDR/PL DDR load + address. +``` +xsct% dow -data ${DEPLOY_DIR_IMAGE}/uImage 0x200000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/system.dtb 0x100000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/core-image-minimal-${MACHINE}.cpio.gz.u-boot 0x4000000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/boot.scr 0x3000000 +``` +--- +#### Using TFTP + +1. Configure the `ipaddr` and `serverip` of the U-Boot environment. +``` +Versal> set serverip <server ip> +Versal> set ipaddr <board ip> +``` +2. Load the images to DDR address. Make sure images are copied to tftp directory. +``` +U-Boot> tftpboot 0x200000 ${TFTPDIR}/uImage +U-Boot> tftpboot 0x100000 ${TFTPDIR}/system.dtb +U-Boot> tftpboot 0x4000000 ${TFTPDIR}/core-image-minimal-${MACHINE}.cpio.gz.u-boot +U-Boot> tftpboot 0x3000000 ${TFTPDIR}/boot.scr +``` +--- +### Booting Linux + +Once the images are loaded continue the execution. + +1. After loading images resume the execution of active target using the `con` +command in XSCT shell, Skip step 1 for if you have used TFTP to load images. +``` +xsct% con +``` +2. Terminate xsct shell. +``` +xsct% exit +``` +3. In the target Serial Terminal, from U-Boot prompt run `boot` command. +``` +U-Boot> boot +``` +--- +## Booting from SD + +1. Load the SD card into the ZC702 board in the SD slot. +2. Configure the ZC702 board to boot in SD-Boot mode (1-OFF, 2-OFF, 3-ON, 4-ON, 5-OFF) + by setting the SW6. Refer [Setting Up the Target](#setting-up-the-target). +3. Follow SD boot instructions [README](README.booting.storage.md) for more details. +--- +## Booting from QSPI + +1. To boot ZC702 board in QSPI boot mode, Power on the ZCU102 board and boot + using JTAG or SD boot mode, to ensure that U-Boot is running and also have + boot.bin copied to DDR location using XSCT `dow` or `tftpboot` or `fatload` + command. +2. Follow Flash boot instructions [README](README.booting.flash.md) for more details. +3. After flashing the images, turn off the power switch on the board, and change + the SW16 boot mode pin settings to QSPI boot mode (1-OFF, 2-ON, 3-OFF, 4-OFF, 5-OFF) + by setting the SW16. Refer [Setting Up the Target](#setting-up-the-target).
\ No newline at end of file diff --git a/docs/README.booting.zynqmp.md b/docs/README.booting.zynqmp.md new file mode 100644 index 00000000..c8f8aa21 --- /dev/null +++ b/docs/README.booting.zynqmp.md @@ -0,0 +1,212 @@ +# Booting OS Images on ZynqMP target boards + +Booting OS images on ZynqMP boards can be done using JTAG, SD, eMMC, QSPI and +NAND boot modes. + +* [Setting Up the Target](#setting-up-the-target) +* [Booting from JTAG](#booting-from-jtag) + * [Loading boot components using XSCT](#loading-boot-components-using-xsct) + * [Loading Kernel, Root Filesystem and U-boot boot script](#loading-kernel-root-filesystem-and-u-boot-boot-script) + * [Using XSCT](#using-xsct) + * [Using TFTP](#using-tftp) +* [Booting from SD](#booting-from-sd) +* [Booting from QSPI](#booting-from-qspi) + +## Setting Up the Target +1. Connect a USB cable between the CP2180 USB-to-Quad-UART bridge USB Micro-B on + the target and the USB port on the host machine. +2. Connect a micro USB cable from the ZCU102 board USB UART port (J83) to the USB + port on the host machine. +3. Default UART terminal(serial port) settings is Speed `115200`, Data `8 bit`, + Parity `None`, Stop bits ` 1 bit` and Flow control `None`. +4. Set the board to JTAG and other boot mode by setting the boot mode switch by + referring to board user guide. For zynqmp-generic machine configuration + file zcu102 evaluation board is used as reference and below is the + configuration boot mode settings (SW6). + +> **Note:** Switch OFF = 1 = High; ON = 0 = Low + +| Boot Mode | Mode Pins [3:0] | Mode SW6 [3:0] | Comments | +|-----------|-----------------|-------------------|---------------------------| +| JTAG | 0000 | ON, ON, ON, ON | PS JTAG | +| QSPI | 0010 | ON, ON, OFF, ON | QSPI 32-bit addressing | +| SD | 1110 | OFF, OFF, OFF, ON | SD 3.0 with level shifter | + +## Booting from JTAG + +This boot flow requires the use of the AMD Xilinx tools, specifically XSCT and +the associated JTAG device drivers. This also requires access to the JTAG interface +on the board, a number of AMD Xilinx and third-party boards come with on-board JTAG +modules. + +1. Source the Vivado or Vitis tools `settings.sh` scripts. +2. Power on the board, Open the XSCT console in the Vitis IDE by clicking the + XSCT button. Alternatively, you can also open the XSCT console by selecting + Xilinx -> XSCT Console. +``` +$ xsct +``` +3. In the XSCT console, connect to the target over JTAG using the connect command. + Optionally user can use `-url` to specify the local/remote hw_server. The + connect command returns the channel ID of the connection. +``` +xsct% connect +``` +4. The targets command lists the available targets and allows you to select a + target using its ID. The targets are assigned IDs as they are discovered on + the JTAG chain, so the IDs can change from session to session. +``` +xsct% targets +``` + +> **Note:** For non-interactive usage such as scripting, you can use the `-filter` + option to select a target instead of selecting the target using its ID. + +### Loading boot components using XSCT + +1. Download the boot images for the target using XSCT with the `fpga` and `dow` + command. ZyqnMP boot images will be located in the `${DEPLOY_DIR_IMAGE}` + directory. + +> **Note:** In yocto by default, ${DEPLOY_DIR_IMAGE}/system.dtb is used for both +> u-boot and kernel. + +2. Program the bitstream or skip this step if you are loading from u-boot or linux. +``` +xsct% fpga -no-revision-check ${DEPLOY_DIR_IMAGE}/download.bit +``` +3. By default, JTAG security gates are enabled. Disable the security gates for + DAP, PL TAP, and PMU (this makes the PMU MB target visible to the debugger). +``` +xsct% targets -set -nocase -filter {name =~ "*PSU*"} +xsct% mask_write 0xFFCA0038 0x1C0 0x1C0 +``` +3. Verify if the PMU MB target is listed under the PMU device. Now, load the PMU + firmware. +``` +xsct% targets -set -nocase -filter {name =~ "*MicroBlaze PMU*"} +xsct% catch {stop} +xsct% dow ${DEPLOY_DIR_IMAGE}/pmufw.elf +xsct% con +``` +5. Reset APU Cortex-A53 Core 0 to load and execute FSBL, This step is important, + because when the ZynqMP boots up in JTAG boot mode, all the APU and RPU cores + are held in reset. You must clear the resets on each core before performing + debugging on these cores. You can use the `rst` command in XSCT to clear the + resets. +``` +xsct% targets -set -nocase -filter {name =~ "*A53*#0"} +xsct% rst -processor -clear-registers +``` +6. Download and run FSBL from APU Cortex-A53 Core 0 +``` +xsct% dow ${DEPLOY_DIR_IMAGE}/zynqmp_fsbl.elf +xsct% con +``` +7. Now download TF-A, U-boot.elf and Device tree to APU and execute. +``` +xsct% stop +xsct% dow ${DEPLOY_DIR_IMAGE}/bl31.elf +xsct% dow ${DEPLOY_DIR_IMAGE}/u-boot.elf +xsct% dow -data ${DEPLOY_DIR_IMAGE}/system.dtb 0x100000 +xsct% con +``` + +8. In the target Serial Terminal, press any key to stop the U-Boot auto-boot. +``` +... +Hit any key to stop autoboot: 0 +U-Boot> +``` + +### Loading Kernel, Root Filesystem and U-boot boot script + +Load the images into the target DDR/PL DRR load address i.e., +`DDR base address + <image_offset>`. + +Below example uses base DDR address as 0x0 which matches in vivado address editor. + +| Image Type | Base DDR Address | Image Offset | Load Address in DDR | +|--------------------|------------------|--------------|---------------------| +| Kernel | 0x0 | 0x200000 | 0x200000 | +| Device Tree | 0x0 | 0x1000 | 0x1000 | +| Rootfs | 0x0 | 0x04000000 | 0x4000000 | +| U-boot boot script | 0x0 | 0x20000000 | 0x20000000 | + +> **Note:** +> 1. `<target-image>` refers to core-image-minimal or petalinux-image-minimal +> 2. For pxeboot boot create a symlink for `<target-image>-${MACHINE}-${DATETIME}.cpio.gz.u-boot` +> as shown `$ ln -sf ${DEPLOY_DIR_IMAGE}/<target-image>-${MACHINE}-${DATETIME}.cpio.gz.u-boot ${DEPLOY_DIR_IMAGE}/rootfs.cpio.gz.u-boot` +> to ensure the INITRD name in pxeboot.cfg matches with image name. +> 3. Whilst it is possible to load the images via JTAG this connection is slow and +this process can take a long time to execute (more than 10 minutes). If your +system has ethernet it is recommended that you use TFTP to load these images +using U-Boot. +> 4. If common ${DEPLOY_DIR_IMAGE}/system.dtb is used by u-boot and kernel, this +> is already part of boot.bin we can skip loading dtb, else load kernel dtb. + +#### Using XSCT + +1. Suspend the execution of active target using `stop` command in XSCT. +``` +xsct% stop +``` +2. Using the `dow` command to load the images into the target DDR/PL DDR load + address. +``` +xsct% dow -data ${DEPLOY_DIR_IMAGE}/Image 0x200000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/system.dtb 0x100000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/core-image-minimal-${MACHINE}.cpio.gz.u-boot 0x4000000 +xsct% dow -data ${DEPLOY_DIR_IMAGE}/boot.scr 0x20000000 +``` + +#### Using TFTP + +1. Configure the `ipaddr` and `serverip` of the U-Boot environment. +``` +Versal> set serverip <server ip> +Versal> set ipaddr <board ip> +``` +2. Load the images to DDR address. Make sure images are copied to tftp directory. +``` +U-Boot> tftpboot 0x200000 ${TFTPDIR}/Image +U-Boot> tftpboot 0x100000 ${TFTPDIR}/system.dtb +U-Boot> tftpboot 0x4000000 ${TFTPDIR}/core-image-minimal-${MACHINE}.cpio.gz.u-boot +U-Boot> tftpboot 0x20000000 ${TFTPDIR}/boot.scr + +``` +### Booting Linux + +Once the images are loaded continue the execution. + +1. After loading images resume the execution of active target using the `con` +command in XSCT shell, Skip step 1 for if you have used TFTP to load images. +``` +xsct% con +``` +2. Terminate xsct shell. +``` +xsct% exit +``` +3. In the target Serial Terminal, from U-Boot prompt run `boot` command. +``` +U-Boot> boot +``` + +## Booting from SD + +1. Load the SD card into the ZCU102 board in the J100 SD slot. +2. Configure the ZCU102 board to boot in SD-Boot mode (1-ON, 2-OFF, 3-OFF, 4-OFF) + by setting the SW6. Refer [Setting Up the Target](#setting-up-the-target). +3. Follow SD boot instructions [README](README.booting.storage.md) for more details. + +## Booting from QSPI + +1. To boot ZCU012 board in QSPI boot mode, Power on the ZCU102 board and boot + using JTAG or SD boot mode, to ensure that U-Boot is running and also have + boot.bin copied to DDR location using XSCT `dow` or `tftpboot` or `fatload` + command. +2. Follow Flash boot instructions [README](README.booting.flash.md) for more details. +3. After flashing the images, turn off the power switch on the board, and change + the SW6 boot mode pin settings to QSPI boot mode (1-ON, 2-ON, 3-OFF, 4-ON) by + setting the SW6. Refer [Setting Up the Target](#setting-up-the-target).
\ No newline at end of file diff --git a/docs/README.dfx.user.dts.md b/docs/README.dfx.user.dts.md new file mode 100644 index 00000000..69e1e52b --- /dev/null +++ b/docs/README.dfx.user.dts.md @@ -0,0 +1,475 @@ +# Build Instructions to create firmware recipes using dfx_user_dts bbclass + +* [Introduction](#introduction) +* [How to create a firmware recipe app](#how-to-create-a-firmware-recipe-app) +* [Test Procedure on Target](#test-procedure-on-target) + * [Loading PL bitstream or pdi and dt overlay](#loading-pl-bitstream-or-pdi-and-dt-overlay) + * [Testing PL functionality](#testing-pl-functionality) + * [Unloading PL bitstream or pdi and dt overlay](#unloading-pl-bitstream-or-pdi-and-dt-overlay) +* [References](#references) + +## Introduction +This readme describes the build instructions to create firmware recipes using +dfx_user_dts.bbclass for dfx configuration. This bitbake class supports +following use cases. + +> **Note:** Refer https://github.com/Xilinx/dfx-mgr/blob/master/README.md for +> shell.json and accel.json file content. + +* **Zynq-7000 and ZynqMP**: + * Design: Vivado flat design. + * Input files to firmware recipes: .bit, .dtsi or dtbo and shell.json (optional) + * Usage Examples: +``` +SRC_URI = " \ + file://<flat_design_pl>.bit \ + file://<flat_design_pl>.dtsi \ + file://shell.json \ + " +``` + +``` +SRC_URI = " \ + file://<flat_design_pl>.bit \ + file://<flat_design_pl>.dtbo \ + file://shell.json \ + " +``` + +* **ZynqMP and Versal**: + * Design: Vivado DFx design. + * Input files to firmware recipes: .bit(ZynqMP) or .pdi(Versal), .dtsi or dtbo + shell.json or accel.json (optional) and .xclbin (optional). + * Usage Examples: + +``` +# ZynqMP DFx Static +SRC_URI = " \ + file://<dfx_design_static_pl>.bit \ + file://<dfx_design_static_pl>.dtsi \ + file://shell.json \ + file://<dfx_design_static_pl>.xclbin \ + " +``` + +``` +# ZynqMP DFx Static +SRC_URI = " \ + file://<dfx_design_static_pl>.bit \ + file://<dfx_design_static_pl>.dtbo \ + file://shell.json \ + file://<dfx_design_static_pl>.xclbin \ + " +``` + +``` +# ZynqMP DFx RP +SRC_URI = " \ + file://<dfx_design_rp_rm_pl>.bit \ + file://<dfx_design_rp_rm_pl>.dtsi \ + file://accel.json \ + file://<dfx_design_rp_rm_pl>.xclbin \ + " +``` + +``` +# ZynqMP DFx RP +SRC_URI = " \ + file://<dfx_design_rp_rm_pl>.bit \ + file://<dfx_design_rp_rm_pl>.dtbo \ + file://accel.json \ + file://<dfx_design_rp_rm_pl>.xclbin \ + " +``` +``` +# Versal DFx Static +SRC_URI = " \ + file://<dfx_design_static_pl>.pdi \ + file://<dfx_design_static_pl>.dtsi \ + file://shell.json \ + file://<dfx_design_static_pl>.xclbin \ + " +``` + +``` +# Versal DFx Static +SRC_URI = " \ + file://<dfx_design_static_pl>.pdi \ + file://<dfx_design_static_pl>.dtbo \ + file://shell.json \ + file://<dfx_design_static_pl>.xclbin \ + " +``` + +``` +# Versal DFx RP +SRC_URI = " \ + file://<dfx_design_rp_rm_pl>.pdi \ + file://<dfx_design_rp_rm_pl>.dtsi \ + file://accel.json \ + file://<dfx_design_rp_rm_pl>.xclbin \ + " +``` + +``` +# Versal DFx RP +SRC_URI = " \ + file://<dfx_design_rp_rm_pl>.pdi \ + file://<dfx_design_rp_rm_pl>.dtbo \ + file://accel.json \ + file://<dfx_design_rp_rm_pl>.xclbin \ + " +``` +--- + +## How to create a firmware recipe app + +1. Follow [Building Instructions](../README.building.md) upto step 4. +2. Create recipes-firmware directory in meta layer and copy the .bit/pdi, + .dtsi/dtbo, .json and .xclbin file to these directories. +``` +$ mkdir -p <meta-layer>/recipes-firmware/<recipes-firmware-app>/files +$ cp -r <path-to-files>/*.{bit or pdi, dtsi or dtbo, shell.json or accel.json and .xclbin} <meta-layer>/recipes-firmware/<firmware-app-name>/files +``` +3. Now create the recipes for flat or static or partial firmware using recipetool. +``` +$ recipetool create -o <meta-layer>/recipes-firmware/<firmware-app-name>/firmware-app-name.bb file:///<meta-layer>/recipes-firmware/<firmware-app-name>/files +``` +4. Modify the recipe and inherit dfx_user_dts bbclass as shown below. +``` +SUMMARY = "Full Bitstream loading app firmware using dfx_user_dts bbclass" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +inherit dfx_user_dts + +SRC_URI = "\ + file://zcu111-pl-demo.bit \ + file://zcu111-pl-demo.dtsi \ + " + +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +``` +5. Add firmware-recipe app to image and enable fpga-overlay machine features to + local.conf as shown below. +> **Note:** fpga-manager-script provides fpgautil tool to load .bit/pdi and dtbo +> at runtime linux. +``` +MACHINE_FEATURES += "fpga-overlay" +IMAGE_INSTALL:append = " \ + firmware-app-name \ + fpga-manager-script \ + " +``` +6. Follow [Building Instructions](../README.building.md) and continue from step 5. +7. Once images are built firmware app files will be installed on target_rootfs. +``` +# <target_rootfs>/lib/firmware/xilinx/firmware-app-name +``` +--- + +## Test Procedure on Target +* Once Linux boots on target, use fpgautil command to load .bit or .pdi and + corresponding dt overlay as shown below. +> **Note:** firmware can be loaded only with sudo or root permissions. +--- + +### Loading PL bitstream or pdi and dt overlay + +* ZynqMP +``` +yocto-zynqmp-generic-20231:~$ sudo su +yocto-zynqmp-generic-20231:/home/petalinux# cat /proc/interrupts + CPU0 CPU1 CPU2 CPU3 + 11: 13309 13021 13673 14170 GICv2 30 Level arch_timer + 14: 0 0 0 0 GICv2 67 Level zynqmp_ipi + 15: 0 0 0 0 GICv2 175 Level arm-pmu + 16: 0 0 0 0 GICv2 176 Level arm-pmu + 17: 0 0 0 0 GICv2 177 Level arm-pmu + 18: 0 0 0 0 GICv2 178 Level arm-pmu + 19: 0 0 0 0 GICv2 58 Level ffa60000.rtc + 20: 0 0 0 0 GICv2 59 Level ffa60000.rtc + 21: 0 0 0 0 GICv2 42 Level ff960000.memory-controller + 22: 0 0 0 0 GICv2 88 Level ams-irq + 23: 0 0 0 0 GICv2 155 Level axi-pmon, axi-pmon + 24: 327 0 0 0 GICv2 53 Level xuartps + 27: 0 0 0 0 GICv2 156 Level zynqmp-dma + 28: 0 0 0 0 GICv2 157 Level zynqmp-dma + 29: 0 0 0 0 GICv2 158 Level zynqmp-dma + 30: 0 0 0 0 GICv2 159 Level zynqmp-dma + 31: 0 0 0 0 GICv2 160 Level zynqmp-dma + 32: 0 0 0 0 GICv2 161 Level zynqmp-dma + 33: 0 0 0 0 GICv2 162 Level zynqmp-dma + 34: 0 0 0 0 GICv2 163 Level zynqmp-dma + 35: 0 0 0 0 GICv2 109 Level zynqmp-dma + 36: 0 0 0 0 GICv2 110 Level zynqmp-dma + 37: 0 0 0 0 GICv2 111 Level zynqmp-dma + 38: 0 0 0 0 GICv2 112 Level zynqmp-dma + 39: 0 0 0 0 GICv2 113 Level zynqmp-dma + 40: 0 0 0 0 GICv2 114 Level zynqmp-dma + 41: 0 0 0 0 GICv2 115 Level zynqmp-dma + 42: 0 0 0 0 GICv2 116 Level zynqmp-dma + 43: 0 0 0 0 GICv2 154 Level fd4c0000.dma-controller + 44: 5938 0 0 0 GICv2 47 Level ff0f0000.spi + 45: 76 0 0 0 GICv2 95 Level eth0, eth0 + 46: 0 0 0 0 GICv2 57 Level axi-pmon, axi-pmon + 47: 4802 0 0 0 GICv2 49 Level cdns-i2c + 48: 501 0 0 0 GICv2 50 Level cdns-i2c + 50: 0 0 0 0 GICv2 84 Edge ff150000.watchdog + 51: 0 0 0 0 GICv2 151 Level fd4a0000.display + 52: 548 0 0 0 GICv2 81 Level mmc0 + 53: 0 0 0 0 GICv2 165 Level ahci-ceva[fd0c0000.ahci] + 54: 0 0 0 0 GICv2 97 Level xhci-hcd:usb1 + 55: 0 0 0 0 zynq-gpio 22 Edge sw19 +IPI0: 64 25 87 38 Rescheduling interrupts +IPI1: 1933 6579 1096 5686 Function call interrupts +IPI2: 0 0 0 0 CPU stop interrupts +IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts +IPI4: 0 0 0 0 Timer broadcast interrupts +IPI5: 0 0 0 0 IRQ work interrupts +IPI6: 0 0 0 0 CPU wake-up interrupts +Err: 0 +yocto-zynqmp-generic-20231:/home/petalinux# tree /lib/firmware/ +/lib/firmware/ +`-- xilinx + `-- zcu111-pl-demo + |-- zcu111-pl-demo.bit.bin + `-- zcu111-pl-demo.dtbo + +2 directories, 2 files +yocto-zynqmp-generic-20231:/home/petalinux# fpgautil -b /lib/firmware/xilinx/zcu111-pl-demo/zcu111-pl-demo.bit -o /lib/firmware/xilinx/zcu111-pl-demo/zcu111-pl-demo.dtbo +[ 91.039773] fpga_manager fpga0: writing zcu111-pl-demo.bit to Xilinx ZynqMP FPGA Manager +[ 91.528214] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga-full/firmware-name +[ 91.538354] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga-full/pid +[ 91.547598] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga-full/resets +[ 91.557087] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga-full/uid +[ 91.566804] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/afi0 +[ 91.576312] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/clocking0 +[ 91.586255] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/axi_gpio_0 +[ 91.596280] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/misc_clk_0 +[ 91.606300] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/axi_gpio_1 +[ 91.616325] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/axi_gpio_2 +[ 91.626342] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/axi_uartlite_0 +[ 91.636705] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ddr4_0 +[ 91.661849] gpio gpiochip3: (a0000000.gpio): not an immutable chip, please consider fixing it! +[ 91.662020] gpio gpiochip4: (a0010000.gpio): not an immutable chip, please consider fixing it! +[ 91.863492] a0030000.serial: ttyUL0 at MMIO 0xa0030000 (irq = 58, base_baud = 0) is a uartlite +[ 91.876674] uartlite a0030000.serial: Runtime PM usage count underflow! +[ 91.906539] input: pl-gpio-keys as /devices/platform/pl-gpio-keys/input/input1 +Time taken to load BIN is 901.000000 Milli Seconds +BIN FILE loaded through FPGA manager successfully +yocto-zynqmp-generic-20231:/home/petalinux# +``` +* Versal (DFx Static) +``` +yocto-vck190-dfx-2023:~$ sudo su +root@yocto-vck190-dfx-2023:~# +root@yocto-vck190-dfx-2023:~# fpgautil -o /lib/firmware/xilinx/vck190-dfx-static/vck190-dfx-static.dtbo +[ 257.555571] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/external-fpga-config +[ 257.565879] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/pid +[ 257.574670] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/uid +[ 257.583599] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/fpga_PR0 +[ 257.593434] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/fpga_PR1 +[ 257.603268] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/fpga_PR2 +[ 257.613100] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/static_region_axi_bram_ctrl_0 +[ 257.624762] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/static_region_dfx_decoupler_rp1 +[ 257.636589] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/static_region_dfx_decoupler_rp2 +[ 257.648415] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/static_region_dfx_decoupler_rp3 +[ 257.663234] of-fpga-region fpga:fpga-PR0: FPGA Region probed +[ 257.669135] of-fpga-region fpga:fpga-PR1: FPGA Region probed +[ 257.675022] of-fpga-region fpga:fpga-PR2: FPGA Region probed +root@yocto-vck190-dfx-2023:~# +``` +* Versal (DFx RP) +``` +root@yocto-vck190-dfx-2023:~# fpgautil -b /lib/firmware/xilinx/vck190-dfx-static/rp1/vck190-dfx-rp1rm1-dipsw/vck190-dfx-rp1rm1-dipsw.pdi -o /lib/firmware/xilinx/vck190-dfx-static/rp1/vck190-dfx-rp1rm1-dipsw/vck190-dfx-rp1rm1-dipsw.dtbo -f Partial -n PR0 +[ 273.511455] fpga_manager fpga0: writing vck190-dfx-rp1rm1-dipsw.pdi to Xilinx Versal FPGA Manager +[284052.461]Loading PDI from DDR +[284052.566]Monolithic/Master Device +[284055.847]3.365 ms: PDI initialization time +[284059.809]+++Loading Image#: 0x0, Name: pl_cfi, Id: 0x18700002 +[284065.432]---Loading Partition#: 0x0, Id: 0x103 +[284069.829] 0.033 ms for Partition#: 0x0, Size: 1312 Bytes +[284074.973]---Loading Partition#: 0x1, Id: 0x105 +[284079.344] 0.007 ms for Partition#: 0x1, Size: 160 Bytes +[284084.430]---Loading Partition#: 0x2, Id: 0x205 +[284088.844] 0.049 ms for Partition#: 0x2, Size: 960 Bytes +[284093.887]---Loading Partition#: 0x3, Id: 0x203 +[284098.280] 0.030 ms for Partition#: 0x3, Size: 688 Bytes +[284103.342]---Loading Partition#: 0x4, Id: 0x303 +[284108.863] 1.156 ms for Partition#: 0x4, Size: 209440 Bytes +[284113.052]---Loading Partition#: 0x5, Id: 0x305 +[284117.712] 0.296 ms for Partition#: 0x5, Size: 3536 Bytes +[284122.594]---Loading Partition#: 0x6, Id: 0x403 +[284126.991] 0.034 ms for Partition#: 0x6, Size: 8096 Bytes +[284132.136]---Loading Partition#: 0x7, Id: 0x405 +[284136.507] 0.007 ms for Partition#: 0x7, Size: 160 Bytes +[284141.636]Subsystem PDI Load: Done +[ 273.615503] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/firmware-name +[ 273.627382] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/fpga-bridges +[ 273.636953] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/partial-fpga-config +[ 273.647241] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/rp1_axi_gpio_0 +[ 273.660826] gpio gpiochip1: (a4010000.gpio): not an immutable chip, please consider fixing it! +[ 273.670490] input: pl-gpio-keys as /devices/platform/pl-gpio-keys/input/input0 +Time taken to load BIN is 171.000000 Milli Seconds +BIN FILE loaded through FPGA manager successfully +root@yocto-vck190-dfx-2023:~# +``` +--- + +### Testing PL functionality + +* This examples uses PL GPIO DIP switches and Push buttons to capture interrupts. +* Verify PL GPIO DIP switches and Push buttons are registered. +* Move the DIP Switches ON/OFF and verify the interrupt counts. +``` +yocto-zynqmp-generic-20231:/home/petalinux# cat /proc/interrupts + CPU0 CPU1 CPU2 CPU3 + 11: 23303 22971 24203 24990 GICv2 30 Level arch_timer + 14: 0 0 0 0 GICv2 67 Level zynqmp_ipi + 15: 0 0 0 0 GICv2 175 Level arm-pmu + 16: 0 0 0 0 GICv2 176 Level arm-pmu + 17: 0 0 0 0 GICv2 177 Level arm-pmu + 18: 0 0 0 0 GICv2 178 Level arm-pmu + 19: 0 0 0 0 GICv2 58 Level ffa60000.rtc + 20: 0 0 0 0 GICv2 59 Level ffa60000.rtc + 21: 0 0 0 0 GICv2 42 Level ff960000.memory-controller + 22: 0 0 0 0 GICv2 88 Level ams-irq + 23: 0 0 0 0 GICv2 155 Level axi-pmon, axi-pmon + 24: 515 0 0 0 GICv2 53 Level xuartps + 27: 0 0 0 0 GICv2 156 Level zynqmp-dma + 28: 0 0 0 0 GICv2 157 Level zynqmp-dma + 29: 0 0 0 0 GICv2 158 Level zynqmp-dma + 30: 0 0 0 0 GICv2 159 Level zynqmp-dma + 31: 0 0 0 0 GICv2 160 Level zynqmp-dma + 32: 0 0 0 0 GICv2 161 Level zynqmp-dma + 33: 0 0 0 0 GICv2 162 Level zynqmp-dma + 34: 0 0 0 0 GICv2 163 Level zynqmp-dma + 35: 0 0 0 0 GICv2 109 Level zynqmp-dma + 36: 0 0 0 0 GICv2 110 Level zynqmp-dma + 37: 0 0 0 0 GICv2 111 Level zynqmp-dma + 38: 0 0 0 0 GICv2 112 Level zynqmp-dma + 39: 0 0 0 0 GICv2 113 Level zynqmp-dma + 40: 0 0 0 0 GICv2 114 Level zynqmp-dma + 41: 0 0 0 0 GICv2 115 Level zynqmp-dma + 42: 0 0 0 0 GICv2 116 Level zynqmp-dma + 43: 0 0 0 0 GICv2 154 Level fd4c0000.dma-controller + 44: 5938 0 0 0 GICv2 47 Level ff0f0000.spi + 45: 110 0 0 0 GICv2 95 Level eth0, eth0 + 46: 0 0 0 0 GICv2 57 Level axi-pmon, axi-pmon + 47: 4802 0 0 0 GICv2 49 Level cdns-i2c + 48: 501 0 0 0 GICv2 50 Level cdns-i2c + 50: 0 0 0 0 GICv2 84 Edge ff150000.watchdog + 51: 0 0 0 0 GICv2 151 Level fd4a0000.display + 52: 548 0 0 0 GICv2 81 Level mmc0 + 53: 0 0 0 0 GICv2 165 Level ahci-ceva[fd0c0000.ahci] + 54: 0 0 0 0 GICv2 97 Level xhci-hcd:usb1 + 55: 0 0 0 0 zynq-gpio 22 Edge sw19 + 59: 0 0 0 0 gpio-xilinx 4 Edge PL_GPIO_PB_SW9_N + 60: 0 0 0 0 gpio-xilinx 3 Edge PL_GPIO_PB_SW12_E + 61: 0 0 0 0 gpio-xilinx 2 Edge PL_GPIO_PB_SW13_S + 62: 0 0 0 0 gpio-xilinx 1 Edge PL_GPIO_PB_SW10_W + 63: 0 0 0 0 gpio-xilinx 0 Edge PL_GPIO_PB_SW11_C + 64: 0 0 0 0 gpio-xilinx 7 Edge PL_GPIO_DIP_SW7 + 65: 0 0 0 0 gpio-xilinx 6 Edge PL_GPIO_DIP_SW6 + 66: 0 0 0 0 gpio-xilinx 5 Edge PL_GPIO_DIP_SW5 + 67: 0 0 0 0 gpio-xilinx 4 Edge PL_GPIO_DIP_SW4 + 68: 0 0 0 0 gpio-xilinx 3 Edge PL_GPIO_DIP_SW3 + 69: 0 0 0 0 gpio-xilinx 2 Edge PL_GPIO_DIP_SW2 + 70: 0 0 0 0 gpio-xilinx 1 Edge PL_GPIO_DIP_SW1 + 71: 0 0 0 0 gpio-xilinx 0 Edge PL_GPIO_DIP_SW0 +IPI0: 64 25 87 38 Rescheduling interrupts +IPI1: 2066 6747 1212 5791 Function call interrupts +IPI2: 0 0 0 0 CPU stop interrupts +IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts +IPI4: 0 0 0 0 Timer broadcast interrupts +IPI5: 0 0 0 0 IRQ work interrupts +IPI6: 0 0 0 0 CPU wake-up interrupts +Err: 0 +yocto-zynqmp-generic-20231:/home/petalinux# cat /proc/interrupts + CPU0 CPU1 CPU2 CPU3 + 11: 28169 27725 29250 30190 GICv2 30 Level arch_timer + 14: 0 0 0 0 GICv2 67 Level zynqmp_ipi + 15: 0 0 0 0 GICv2 175 Level arm-pmu + 16: 0 0 0 0 GICv2 176 Level arm-pmu + 17: 0 0 0 0 GICv2 177 Level arm-pmu + 18: 0 0 0 0 GICv2 178 Level arm-pmu + 19: 0 0 0 0 GICv2 58 Level ffa60000.rtc + 20: 0 0 0 0 GICv2 59 Level ffa60000.rtc + 21: 0 0 0 0 GICv2 42 Level ff960000.memory-controller + 22: 0 0 0 0 GICv2 88 Level ams-irq + 23: 0 0 0 0 GICv2 155 Level axi-pmon, axi-pmon + 24: 603 0 0 0 GICv2 53 Level xuartps + 27: 0 0 0 0 GICv2 156 Level zynqmp-dma + 28: 0 0 0 0 GICv2 157 Level zynqmp-dma + 29: 0 0 0 0 GICv2 158 Level zynqmp-dma + 30: 0 0 0 0 GICv2 159 Level zynqmp-dma + 31: 0 0 0 0 GICv2 160 Level zynqmp-dma + 32: 0 0 0 0 GICv2 161 Level zynqmp-dma + 33: 0 0 0 0 GICv2 162 Level zynqmp-dma + 34: 0 0 0 0 GICv2 163 Level zynqmp-dma + 35: 0 0 0 0 GICv2 109 Level zynqmp-dma + 36: 0 0 0 0 GICv2 110 Level zynqmp-dma + 37: 0 0 0 0 GICv2 111 Level zynqmp-dma + 38: 0 0 0 0 GICv2 112 Level zynqmp-dma + 39: 0 0 0 0 GICv2 113 Level zynqmp-dma + 40: 0 0 0 0 GICv2 114 Level zynqmp-dma + 41: 0 0 0 0 GICv2 115 Level zynqmp-dma + 42: 0 0 0 0 GICv2 116 Level zynqmp-dma + 43: 0 0 0 0 GICv2 154 Level fd4c0000.dma-controller + 44: 5938 0 0 0 GICv2 47 Level ff0f0000.spi + 45: 134 0 0 0 GICv2 95 Level eth0, eth0 + 46: 0 0 0 0 GICv2 57 Level axi-pmon, axi-pmon + 47: 4802 0 0 0 GICv2 49 Level cdns-i2c + 48: 501 0 0 0 GICv2 50 Level cdns-i2c + 50: 0 0 0 0 GICv2 84 Edge ff150000.watchdog + 51: 0 0 0 0 GICv2 151 Level fd4a0000.display + 52: 548 0 0 0 GICv2 81 Level mmc0 + 53: 0 0 0 0 GICv2 165 Level ahci-ceva[fd0c0000.ahci] + 54: 0 0 0 0 GICv2 97 Level xhci-hcd:usb1 + 55: 0 0 0 0 zynq-gpio 22 Edge sw19 + 59: 2 0 0 0 gpio-xilinx 4 Edge PL_GPIO_PB_SW9_N + 60: 4 0 0 0 gpio-xilinx 3 Edge PL_GPIO_PB_SW12_E + 61: 2 0 0 0 gpio-xilinx 2 Edge PL_GPIO_PB_SW13_S + 62: 2 0 0 0 gpio-xilinx 1 Edge PL_GPIO_PB_SW10_W + 63: 2 0 0 0 gpio-xilinx 0 Edge PL_GPIO_PB_SW11_C + 64: 2 0 0 0 gpio-xilinx 7 Edge PL_GPIO_DIP_SW7 + 65: 2 0 0 0 gpio-xilinx 6 Edge PL_GPIO_DIP_SW6 + 66: 4 0 0 0 gpio-xilinx 5 Edge PL_GPIO_DIP_SW5 + 67: 2 0 0 0 gpio-xilinx 4 Edge PL_GPIO_DIP_SW4 + 68: 2 0 0 0 gpio-xilinx 3 Edge PL_GPIO_DIP_SW3 + 69: 2 0 0 0 gpio-xilinx 2 Edge PL_GPIO_DIP_SW2 + 70: 2 0 0 0 gpio-xilinx 1 Edge PL_GPIO_DIP_SW1 + 71: 2 0 0 0 gpio-xilinx 0 Edge PL_GPIO_DIP_SW0 +IPI0: 64 26 87 38 Rescheduling interrupts +IPI1: 2163 6791 1243 5866 Function call interrupts +IPI2: 0 0 0 0 CPU stop interrupts +IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts +IPI4: 0 0 0 0 Timer broadcast interrupts +IPI5: 0 0 0 0 IRQ work interrupts +IPI6: 0 0 0 0 CPU wake-up interrupts +Err: 0 +yocto-zynqmp-generic-20231:/home/petalinux# +``` +--- + +### Unloading PL bitstream or pdi and dt overlay +* Zynq or ZynqMP +``` +yocto-zynqmp-generic-20231:/home/petalinux# fpgautil -R +``` +* Versal (DFx RP) +``` +root@yocto-vck190-dfx-2023:~# fpgautil -R -n PR0 +``` +* Versal (DFx Static) +``` +root@yocto-vck190-dfx-2023:~# fpgautil -R -n Full +``` +--- + +## References +* https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841645/Solution+Zynq+PL+Programming+With+FPGA+Manager +* https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841847/Solution+ZynqMP+PL+Programming +* https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/1188397412/Solution+Versal+PL+Programming diff --git a/docs/README.fpgamanager.custom.md b/docs/README.fpgamanager.custom.md new file mode 100644 index 00000000..dbdf5907 --- /dev/null +++ b/docs/README.fpgamanager.custom.md @@ -0,0 +1,478 @@ +# Build Instructions to create firmware recipes using fpgamanager_custom bbclass + +* [Introduction](#introduction) +* [How to create a firmware recipe app](#how-to-create-a-firmware-recipe-app) +* [Test Procedure on Target](#test-procedure-on-target) + * [Loading PL bitstream or pdi and dt overlay](#loading-pl-bitstream-or-pdi-and-dt-overlay) + * [Testing PL functionality](#testing-pl-functionality) + * [Unloading PL bitstream or pdi and dt overlay](#unloading-pl-bitstream-or-pdi-and-dt-overlay) +* [References](#references) + +> **Note:** This README will be deprecated in 2024.1 release. User sthould start +> using [DFx User DTS README](README.dfx.user.dts.md) + +## Introduction +This readme describes the build instructions to create firmware recipes using +fpgamanager_custom.bbclass for dynamic configuration. This bitbake class supports +following use cases. + +> **Note:** Refer https://github.com/Xilinx/dfx-mgr/blob/master/README.md for +> shell.json and accel.json file content. + +* **Zynq-7000 and ZynqMP**: + * Design: Vivado flat design. + * Input files to firmware recipes: .bit, .dtsi or dtbo and shell.json (optional) + * Usage Examples: +``` +SRC_URI = " \ + file://<flat_design_pl>.bit \ + file://<flat_design_pl>.dtsi \ + file://shell.json \ + " +``` + +``` +SRC_URI = " \ + file://<flat_design_pl>.bit \ + file://<flat_design_pl>.dtbo \ + file://shell.json \ + " +``` + +* **ZynqMP and Versal**: + * Design: Vivado DFx design. + * Input files to firmware recipes: .bit(ZynqMP) or .pdi(Versal), .dtsi or dtbo + shell.json or accel.json (optional) and .xclbin (optional). + * Usage Examples: + +``` +# ZynqMP DFx Static +SRC_URI = " \ + file://<dfx_design_static_pl>.bit \ + file://<dfx_design_static_pl>.dtsi \ + file://shell.json \ + file://<dfx_design_static_pl>.xclbin \ + " +``` + +``` +# ZynqMP DFx Static +SRC_URI = " \ + file://<dfx_design_static_pl>.bit \ + file://<dfx_design_static_pl>.dtbo \ + file://shell.json \ + file://<dfx_design_static_pl>.xclbin \ + " +``` + +``` +# ZynqMP DFx RP +SRC_URI = " \ + file://<dfx_design_rp_rm_pl>.bit \ + file://<dfx_design_rp_rm_pl>.dtsi \ + file://accel.json \ + file://<dfx_design_rp_rm_pl>.xclbin \ + " +``` + +``` +# ZynqMP DFx RP +SRC_URI = " \ + file://<dfx_design_rp_rm_pl>.bit \ + file://<dfx_design_rp_rm_pl>.dtbo \ + file://accel.json \ + file://<dfx_design_rp_rm_pl>.xclbin \ + " +``` +``` +# Versal DFx Static +SRC_URI = " \ + file://<dfx_design_static_pl>.pdi \ + file://<dfx_design_static_pl>.dtsi \ + file://shell.json \ + file://<dfx_design_static_pl>.xclbin \ + " +``` + +``` +# Versal DFx Static +SRC_URI = " \ + file://<dfx_design_static_pl>.pdi \ + file://<dfx_design_static_pl>.dtbo \ + file://shell.json \ + file://<dfx_design_static_pl>.xclbin \ + " +``` + +``` +# Versal DFx RP +SRC_URI = " \ + file://<dfx_design_rp_rm_pl>.pdi \ + file://<dfx_design_rp_rm_pl>.dtsi \ + file://accel.json \ + file://<dfx_design_rp_rm_pl>.xclbin \ + " +``` + +``` +# Versal DFx RP +SRC_URI = " \ + file://<dfx_design_rp_rm_pl>.pdi \ + file://<dfx_design_rp_rm_pl>.dtbo \ + file://accel.json \ + file://<dfx_design_rp_rm_pl>.xclbin \ + " +``` +--- + +## How to create a firmware recipe app + +1. Follow [Building Instructions](../README.building.md) upto step 4. +2. Create recipes-firmware directory in meta layer and copy the .bit/pdi, + .dtsi/dtbo, .json and .xclbin file to these directories. +``` +$ mkdir -p <meta-layer>/recipes-firmware/<recipes-firmware-app>/files +$ cp -r <path-to-files>/*.{bit or pdi, dtsi or dtbo, shell.json or accel.json and .xclbin} <meta-layer>/recipes-firmware/<firmware-app-name>/files +``` +3. Now create the recipes for flat or static or partial firmware using recipetool. +``` +$ recipetool create -o <meta-layer>/recipes-firmware/<firmware-app-name>/firmware-app-name.bb file:///<meta-layer>/recipes-firmware/<firmware-app-name>/files +``` +4. Modify the recipe and inherit fpgamanager_custom bbclass as shown below. +``` +SUMMARY = "Full Bitstream loading zcu111-pl-demo firmware using fpgamanager_custom bbclass" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +inherit fpgamanager_custom + +SRC_URI = "\ + file://zcu111-pl-demo.bit \ + file://zcu111-pl-demo.dtsi \ + " + +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +``` +5. Add firmware-recipe app to image and enable fpga-overlay machine features to + local.conf as shown below. +> **Note:** fpga-manager-script provides fpgautil tool to load .bit/pdi and dtbo +> at runtime linux. +``` +MACHINE_FEATURES += "fpga-overlay" +IMAGE_INSTALL:append = " \ + firmware-app-name \ + fpga-manager-script \ + " +``` +6. Follow [Building Instructions](../README.building.md) and continue from step 5. +7. Once images are built firmware app files will be installed on target_rootfs. +``` +# <target_rootfs>/lib/firmware/xilinx/firmware-app-name +``` +--- + +## Test Procedure on Target +* Once Linux boots on target, use fpgautil command to load .bit or .pdi and + corresponding dt overlay as shown below. +> **Note:** firmware can be loaded only with sudo or root permissions. +--- + +### Loading PL bitstream or pdi and dt overlay + +* ZynqMP +``` +yocto-zynqmp-generic-20231:~$ sudo su +yocto-zynqmp-generic-20231:/home/petalinux# cat /proc/interrupts + CPU0 CPU1 CPU2 CPU3 + 11: 13309 13021 13673 14170 GICv2 30 Level arch_timer + 14: 0 0 0 0 GICv2 67 Level zynqmp_ipi + 15: 0 0 0 0 GICv2 175 Level arm-pmu + 16: 0 0 0 0 GICv2 176 Level arm-pmu + 17: 0 0 0 0 GICv2 177 Level arm-pmu + 18: 0 0 0 0 GICv2 178 Level arm-pmu + 19: 0 0 0 0 GICv2 58 Level ffa60000.rtc + 20: 0 0 0 0 GICv2 59 Level ffa60000.rtc + 21: 0 0 0 0 GICv2 42 Level ff960000.memory-controller + 22: 0 0 0 0 GICv2 88 Level ams-irq + 23: 0 0 0 0 GICv2 155 Level axi-pmon, axi-pmon + 24: 327 0 0 0 GICv2 53 Level xuartps + 27: 0 0 0 0 GICv2 156 Level zynqmp-dma + 28: 0 0 0 0 GICv2 157 Level zynqmp-dma + 29: 0 0 0 0 GICv2 158 Level zynqmp-dma + 30: 0 0 0 0 GICv2 159 Level zynqmp-dma + 31: 0 0 0 0 GICv2 160 Level zynqmp-dma + 32: 0 0 0 0 GICv2 161 Level zynqmp-dma + 33: 0 0 0 0 GICv2 162 Level zynqmp-dma + 34: 0 0 0 0 GICv2 163 Level zynqmp-dma + 35: 0 0 0 0 GICv2 109 Level zynqmp-dma + 36: 0 0 0 0 GICv2 110 Level zynqmp-dma + 37: 0 0 0 0 GICv2 111 Level zynqmp-dma + 38: 0 0 0 0 GICv2 112 Level zynqmp-dma + 39: 0 0 0 0 GICv2 113 Level zynqmp-dma + 40: 0 0 0 0 GICv2 114 Level zynqmp-dma + 41: 0 0 0 0 GICv2 115 Level zynqmp-dma + 42: 0 0 0 0 GICv2 116 Level zynqmp-dma + 43: 0 0 0 0 GICv2 154 Level fd4c0000.dma-controller + 44: 5938 0 0 0 GICv2 47 Level ff0f0000.spi + 45: 76 0 0 0 GICv2 95 Level eth0, eth0 + 46: 0 0 0 0 GICv2 57 Level axi-pmon, axi-pmon + 47: 4802 0 0 0 GICv2 49 Level cdns-i2c + 48: 501 0 0 0 GICv2 50 Level cdns-i2c + 50: 0 0 0 0 GICv2 84 Edge ff150000.watchdog + 51: 0 0 0 0 GICv2 151 Level fd4a0000.display + 52: 548 0 0 0 GICv2 81 Level mmc0 + 53: 0 0 0 0 GICv2 165 Level ahci-ceva[fd0c0000.ahci] + 54: 0 0 0 0 GICv2 97 Level xhci-hcd:usb1 + 55: 0 0 0 0 zynq-gpio 22 Edge sw19 +IPI0: 64 25 87 38 Rescheduling interrupts +IPI1: 1933 6579 1096 5686 Function call interrupts +IPI2: 0 0 0 0 CPU stop interrupts +IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts +IPI4: 0 0 0 0 Timer broadcast interrupts +IPI5: 0 0 0 0 IRQ work interrupts +IPI6: 0 0 0 0 CPU wake-up interrupts +Err: 0 +yocto-zynqmp-generic-20231:/home/petalinux# tree /lib/firmware/ +/lib/firmware/ +`-- xilinx + `-- zcu111-pl-demo + |-- zcu111-pl-demo.bit.bin + `-- zcu111-pl-demo.dtbo + +2 directories, 2 files +yocto-zynqmp-generic-20231:/home/petalinux# fpgautil -b /lib/firmware/xilinx/zcu111-pl-demo/zcu111-pl-demo.bit -o /lib/firmware/xilinx/zcu111-pl-demo/zcu111-pl-demo.dtbo +[ 91.039773] fpga_manager fpga0: writing zcu111-pl-demo.bit to Xilinx ZynqMP FPGA Manager +[ 91.528214] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga-full/firmware-name +[ 91.538354] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga-full/pid +[ 91.547598] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga-full/resets +[ 91.557087] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga-full/uid +[ 91.566804] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/afi0 +[ 91.576312] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/clocking0 +[ 91.586255] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/axi_gpio_0 +[ 91.596280] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/misc_clk_0 +[ 91.606300] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/axi_gpio_1 +[ 91.616325] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/axi_gpio_2 +[ 91.626342] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/axi_uartlite_0 +[ 91.636705] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ddr4_0 +[ 91.661849] gpio gpiochip3: (a0000000.gpio): not an immutable chip, please consider fixing it! +[ 91.662020] gpio gpiochip4: (a0010000.gpio): not an immutable chip, please consider fixing it! +[ 91.863492] a0030000.serial: ttyUL0 at MMIO 0xa0030000 (irq = 58, base_baud = 0) is a uartlite +[ 91.876674] uartlite a0030000.serial: Runtime PM usage count underflow! +[ 91.906539] input: pl-gpio-keys as /devices/platform/pl-gpio-keys/input/input1 +Time taken to load BIN is 901.000000 Milli Seconds +BIN FILE loaded through FPGA manager successfully +yocto-zynqmp-generic-20231:/home/petalinux# +``` +* Versal (DFx Static) +``` +yocto-vck190-dfx-2023:~$ sudo su +root@yocto-vck190-dfx-2023:~# +root@yocto-vck190-dfx-2023:~# fpgautil -o /lib/firmware/xilinx/vck190-dfx-static/vck190-dfx-static.dtbo +[ 257.555571] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/external-fpga-config +[ 257.565879] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/pid +[ 257.574670] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/uid +[ 257.583599] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/fpga_PR0 +[ 257.593434] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/fpga_PR1 +[ 257.603268] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/fpga_PR2 +[ 257.613100] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/static_region_axi_bram_ctrl_0 +[ 257.624762] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/static_region_dfx_decoupler_rp1 +[ 257.636589] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/static_region_dfx_decoupler_rp2 +[ 257.648415] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/static_region_dfx_decoupler_rp3 +[ 257.663234] of-fpga-region fpga:fpga-PR0: FPGA Region probed +[ 257.669135] of-fpga-region fpga:fpga-PR1: FPGA Region probed +[ 257.675022] of-fpga-region fpga:fpga-PR2: FPGA Region probed +root@yocto-vck190-dfx-2023:~# +``` +* Versal (DFx RP) +``` +root@yocto-vck190-dfx-2023:~# fpgautil -b /lib/firmware/xilinx/vck190-dfx-static/rp1/vck190-dfx-rp1rm1-dipsw/vck190-dfx-rp1rm1-dipsw.pdi -o /lib/firmware/xilinx/vck190-dfx-static/rp1/vck190-dfx-rp1rm1-dipsw/vck190-dfx-rp1rm1-dipsw.dtbo -f Partial -n PR0 +[ 273.511455] fpga_manager fpga0: writing vck190-dfx-rp1rm1-dipsw.pdi to Xilinx Versal FPGA Manager +[284052.461]Loading PDI from DDR +[284052.566]Monolithic/Master Device +[284055.847]3.365 ms: PDI initialization time +[284059.809]+++Loading Image#: 0x0, Name: pl_cfi, Id: 0x18700002 +[284065.432]---Loading Partition#: 0x0, Id: 0x103 +[284069.829] 0.033 ms for Partition#: 0x0, Size: 1312 Bytes +[284074.973]---Loading Partition#: 0x1, Id: 0x105 +[284079.344] 0.007 ms for Partition#: 0x1, Size: 160 Bytes +[284084.430]---Loading Partition#: 0x2, Id: 0x205 +[284088.844] 0.049 ms for Partition#: 0x2, Size: 960 Bytes +[284093.887]---Loading Partition#: 0x3, Id: 0x203 +[284098.280] 0.030 ms for Partition#: 0x3, Size: 688 Bytes +[284103.342]---Loading Partition#: 0x4, Id: 0x303 +[284108.863] 1.156 ms for Partition#: 0x4, Size: 209440 Bytes +[284113.052]---Loading Partition#: 0x5, Id: 0x305 +[284117.712] 0.296 ms for Partition#: 0x5, Size: 3536 Bytes +[284122.594]---Loading Partition#: 0x6, Id: 0x403 +[284126.991] 0.034 ms for Partition#: 0x6, Size: 8096 Bytes +[284132.136]---Loading Partition#: 0x7, Id: 0x405 +[284136.507] 0.007 ms for Partition#: 0x7, Size: 160 Bytes +[284141.636]Subsystem PDI Load: Done +[ 273.615503] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/firmware-name +[ 273.627382] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/fpga-bridges +[ 273.636953] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /fpga/partial-fpga-config +[ 273.647241] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/rp1_axi_gpio_0 +[ 273.660826] gpio gpiochip1: (a4010000.gpio): not an immutable chip, please consider fixing it! +[ 273.670490] input: pl-gpio-keys as /devices/platform/pl-gpio-keys/input/input0 +Time taken to load BIN is 171.000000 Milli Seconds +BIN FILE loaded through FPGA manager successfully +root@yocto-vck190-dfx-2023:~# +``` +--- + +### Testing PL functionality + +* This examples uses PL GPIO DIP switches and Push buttons to capture interrupts. +* Verify PL GPIO DIP switches and Push buttons are registered. +* Move the DIP Switches ON/OFF and verify the interrupt counts. +``` +yocto-zynqmp-generic-20231:/home/petalinux# cat /proc/interrupts + CPU0 CPU1 CPU2 CPU3 + 11: 23303 22971 24203 24990 GICv2 30 Level arch_timer + 14: 0 0 0 0 GICv2 67 Level zynqmp_ipi + 15: 0 0 0 0 GICv2 175 Level arm-pmu + 16: 0 0 0 0 GICv2 176 Level arm-pmu + 17: 0 0 0 0 GICv2 177 Level arm-pmu + 18: 0 0 0 0 GICv2 178 Level arm-pmu + 19: 0 0 0 0 GICv2 58 Level ffa60000.rtc + 20: 0 0 0 0 GICv2 59 Level ffa60000.rtc + 21: 0 0 0 0 GICv2 42 Level ff960000.memory-controller + 22: 0 0 0 0 GICv2 88 Level ams-irq + 23: 0 0 0 0 GICv2 155 Level axi-pmon, axi-pmon + 24: 515 0 0 0 GICv2 53 Level xuartps + 27: 0 0 0 0 GICv2 156 Level zynqmp-dma + 28: 0 0 0 0 GICv2 157 Level zynqmp-dma + 29: 0 0 0 0 GICv2 158 Level zynqmp-dma + 30: 0 0 0 0 GICv2 159 Level zynqmp-dma + 31: 0 0 0 0 GICv2 160 Level zynqmp-dma + 32: 0 0 0 0 GICv2 161 Level zynqmp-dma + 33: 0 0 0 0 GICv2 162 Level zynqmp-dma + 34: 0 0 0 0 GICv2 163 Level zynqmp-dma + 35: 0 0 0 0 GICv2 109 Level zynqmp-dma + 36: 0 0 0 0 GICv2 110 Level zynqmp-dma + 37: 0 0 0 0 GICv2 111 Level zynqmp-dma + 38: 0 0 0 0 GICv2 112 Level zynqmp-dma + 39: 0 0 0 0 GICv2 113 Level zynqmp-dma + 40: 0 0 0 0 GICv2 114 Level zynqmp-dma + 41: 0 0 0 0 GICv2 115 Level zynqmp-dma + 42: 0 0 0 0 GICv2 116 Level zynqmp-dma + 43: 0 0 0 0 GICv2 154 Level fd4c0000.dma-controller + 44: 5938 0 0 0 GICv2 47 Level ff0f0000.spi + 45: 110 0 0 0 GICv2 95 Level eth0, eth0 + 46: 0 0 0 0 GICv2 57 Level axi-pmon, axi-pmon + 47: 4802 0 0 0 GICv2 49 Level cdns-i2c + 48: 501 0 0 0 GICv2 50 Level cdns-i2c + 50: 0 0 0 0 GICv2 84 Edge ff150000.watchdog + 51: 0 0 0 0 GICv2 151 Level fd4a0000.display + 52: 548 0 0 0 GICv2 81 Level mmc0 + 53: 0 0 0 0 GICv2 165 Level ahci-ceva[fd0c0000.ahci] + 54: 0 0 0 0 GICv2 97 Level xhci-hcd:usb1 + 55: 0 0 0 0 zynq-gpio 22 Edge sw19 + 59: 0 0 0 0 gpio-xilinx 4 Edge PL_GPIO_PB_SW9_N + 60: 0 0 0 0 gpio-xilinx 3 Edge PL_GPIO_PB_SW12_E + 61: 0 0 0 0 gpio-xilinx 2 Edge PL_GPIO_PB_SW13_S + 62: 0 0 0 0 gpio-xilinx 1 Edge PL_GPIO_PB_SW10_W + 63: 0 0 0 0 gpio-xilinx 0 Edge PL_GPIO_PB_SW11_C + 64: 0 0 0 0 gpio-xilinx 7 Edge PL_GPIO_DIP_SW7 + 65: 0 0 0 0 gpio-xilinx 6 Edge PL_GPIO_DIP_SW6 + 66: 0 0 0 0 gpio-xilinx 5 Edge PL_GPIO_DIP_SW5 + 67: 0 0 0 0 gpio-xilinx 4 Edge PL_GPIO_DIP_SW4 + 68: 0 0 0 0 gpio-xilinx 3 Edge PL_GPIO_DIP_SW3 + 69: 0 0 0 0 gpio-xilinx 2 Edge PL_GPIO_DIP_SW2 + 70: 0 0 0 0 gpio-xilinx 1 Edge PL_GPIO_DIP_SW1 + 71: 0 0 0 0 gpio-xilinx 0 Edge PL_GPIO_DIP_SW0 +IPI0: 64 25 87 38 Rescheduling interrupts +IPI1: 2066 6747 1212 5791 Function call interrupts +IPI2: 0 0 0 0 CPU stop interrupts +IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts +IPI4: 0 0 0 0 Timer broadcast interrupts +IPI5: 0 0 0 0 IRQ work interrupts +IPI6: 0 0 0 0 CPU wake-up interrupts +Err: 0 +yocto-zynqmp-generic-20231:/home/petalinux# cat /proc/interrupts + CPU0 CPU1 CPU2 CPU3 + 11: 28169 27725 29250 30190 GICv2 30 Level arch_timer + 14: 0 0 0 0 GICv2 67 Level zynqmp_ipi + 15: 0 0 0 0 GICv2 175 Level arm-pmu + 16: 0 0 0 0 GICv2 176 Level arm-pmu + 17: 0 0 0 0 GICv2 177 Level arm-pmu + 18: 0 0 0 0 GICv2 178 Level arm-pmu + 19: 0 0 0 0 GICv2 58 Level ffa60000.rtc + 20: 0 0 0 0 GICv2 59 Level ffa60000.rtc + 21: 0 0 0 0 GICv2 42 Level ff960000.memory-controller + 22: 0 0 0 0 GICv2 88 Level ams-irq + 23: 0 0 0 0 GICv2 155 Level axi-pmon, axi-pmon + 24: 603 0 0 0 GICv2 53 Level xuartps + 27: 0 0 0 0 GICv2 156 Level zynqmp-dma + 28: 0 0 0 0 GICv2 157 Level zynqmp-dma + 29: 0 0 0 0 GICv2 158 Level zynqmp-dma + 30: 0 0 0 0 GICv2 159 Level zynqmp-dma + 31: 0 0 0 0 GICv2 160 Level zynqmp-dma + 32: 0 0 0 0 GICv2 161 Level zynqmp-dma + 33: 0 0 0 0 GICv2 162 Level zynqmp-dma + 34: 0 0 0 0 GICv2 163 Level zynqmp-dma + 35: 0 0 0 0 GICv2 109 Level zynqmp-dma + 36: 0 0 0 0 GICv2 110 Level zynqmp-dma + 37: 0 0 0 0 GICv2 111 Level zynqmp-dma + 38: 0 0 0 0 GICv2 112 Level zynqmp-dma + 39: 0 0 0 0 GICv2 113 Level zynqmp-dma + 40: 0 0 0 0 GICv2 114 Level zynqmp-dma + 41: 0 0 0 0 GICv2 115 Level zynqmp-dma + 42: 0 0 0 0 GICv2 116 Level zynqmp-dma + 43: 0 0 0 0 GICv2 154 Level fd4c0000.dma-controller + 44: 5938 0 0 0 GICv2 47 Level ff0f0000.spi + 45: 134 0 0 0 GICv2 95 Level eth0, eth0 + 46: 0 0 0 0 GICv2 57 Level axi-pmon, axi-pmon + 47: 4802 0 0 0 GICv2 49 Level cdns-i2c + 48: 501 0 0 0 GICv2 50 Level cdns-i2c + 50: 0 0 0 0 GICv2 84 Edge ff150000.watchdog + 51: 0 0 0 0 GICv2 151 Level fd4a0000.display + 52: 548 0 0 0 GICv2 81 Level mmc0 + 53: 0 0 0 0 GICv2 165 Level ahci-ceva[fd0c0000.ahci] + 54: 0 0 0 0 GICv2 97 Level xhci-hcd:usb1 + 55: 0 0 0 0 zynq-gpio 22 Edge sw19 + 59: 2 0 0 0 gpio-xilinx 4 Edge PL_GPIO_PB_SW9_N + 60: 4 0 0 0 gpio-xilinx 3 Edge PL_GPIO_PB_SW12_E + 61: 2 0 0 0 gpio-xilinx 2 Edge PL_GPIO_PB_SW13_S + 62: 2 0 0 0 gpio-xilinx 1 Edge PL_GPIO_PB_SW10_W + 63: 2 0 0 0 gpio-xilinx 0 Edge PL_GPIO_PB_SW11_C + 64: 2 0 0 0 gpio-xilinx 7 Edge PL_GPIO_DIP_SW7 + 65: 2 0 0 0 gpio-xilinx 6 Edge PL_GPIO_DIP_SW6 + 66: 4 0 0 0 gpio-xilinx 5 Edge PL_GPIO_DIP_SW5 + 67: 2 0 0 0 gpio-xilinx 4 Edge PL_GPIO_DIP_SW4 + 68: 2 0 0 0 gpio-xilinx 3 Edge PL_GPIO_DIP_SW3 + 69: 2 0 0 0 gpio-xilinx 2 Edge PL_GPIO_DIP_SW2 + 70: 2 0 0 0 gpio-xilinx 1 Edge PL_GPIO_DIP_SW1 + 71: 2 0 0 0 gpio-xilinx 0 Edge PL_GPIO_DIP_SW0 +IPI0: 64 26 87 38 Rescheduling interrupts +IPI1: 2163 6791 1243 5866 Function call interrupts +IPI2: 0 0 0 0 CPU stop interrupts +IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts +IPI4: 0 0 0 0 Timer broadcast interrupts +IPI5: 0 0 0 0 IRQ work interrupts +IPI6: 0 0 0 0 CPU wake-up interrupts +Err: 0 +yocto-zynqmp-generic-20231:/home/petalinux# +``` +--- + +### Unloading PL bitstream or pdi and dt overlay +* Zynq or ZynqMP +``` +yocto-zynqmp-generic-20231:/home/petalinux# fpgautil -R +``` +* Versal (DFx RP) +``` +root@yocto-vck190-dfx-2023:~# fpgautil -R -n PR0 +``` +* Versal (DFx Static) +``` +root@yocto-vck190-dfx-2023:~# fpgautil -R -n Full +``` +--- + +## References +* https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841645/Solution+Zynq+PL+Programming+With+FPGA+Manager +* https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841847/Solution+ZynqMP+PL+Programming +* https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/1188397412/Solution+Versal+PL+Programming diff --git a/gen-machine-conf b/gen-machine-conf new file mode 120000 index 00000000..3fe520d6 --- /dev/null +++ b/gen-machine-conf @@ -0,0 +1 @@ +meta-xilinx-core/gen-machine-conf
\ No newline at end of file diff --git a/meta-microblaze/README.md b/meta-microblaze/README.md new file mode 100644 index 00000000..9da3f813 --- /dev/null +++ b/meta-microblaze/README.md @@ -0,0 +1,21 @@ +# meta-microblaze + +This layer provides support specific to the MicroBlaze architecture + +## Dependencies + +This layer depends on: + + URI: https://git.yoctoproject.org/poky + layers: meta, meta-poky + branch: langdale + + URI: https://git.openembedded.org/meta-openembedded + layers: meta-oe + branch: langdale + + URI: + https://git.yoctoproject.org/meta-xilinx (official version) + https://github.com/Xilinx/meta-xilinx (development and amd xilinx release) + layers: meta-xilinx-core + branch: langdale or amd xilinx release version (e.g. rel-v2023.1) diff --git a/meta-microblaze/classes/rust_microblaze.bbclass b/meta-microblaze/classes/rust_microblaze.bbclass new file mode 100644 index 00000000..d129d2b0 --- /dev/null +++ b/meta-microblaze/classes/rust_microblaze.bbclass @@ -0,0 +1,5 @@ +python __anonymous() { + if bb.data.inherits_class('rust-target-config', d): + if d.getVar('TARGET_ARCH') in ['microblaze', 'microblazeel', 'microblazeeb']: + raise bb.parse.SkipRecipe("Rust does not support microblaze.") +} diff --git a/meta-microblaze/conf/layer.conf b/meta-microblaze/conf/layer.conf new file mode 100644 index 00000000..d1443c16 --- /dev/null +++ b/meta-microblaze/conf/layer.conf @@ -0,0 +1,35 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have a packages directory, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb" +BBFILES += "${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "xilinx-microblaze" +BBFILE_PATTERN_xilinx-microblaze = "^${LAYERDIR}/" +BBFILE_PRIORITY_xilinx-microblaze = "5" + +LAYERDEPENDS_xilinx-microblaze = "core" + +LAYERSERIES_COMPAT_xilinx-microblaze = "scarthgap" + +# Microblaze does not support stack-protector! +SECURITY_STACK_PROTECTOR:microblaze = "" + +OLDEST_KERNEL:microblaze = "3.15" + +INHERIT += "rust_microblaze" + +# We want to use gcc 12.x for the microblaze stuff, and 13.x for any host tooling +GCCVERSION:microblaze = "12.2.%" +SDKGCCVERSION:microblaze = "13.%" + +GDBVERSION:microblaze = "12.1" +# canon-prefix-map doesn't exist in gcc 12.x +DEBUG_PREFIX_MAP:remove:microblaze = "-fcanon-prefix-map" + +MICROBLAZE_SKIP_MSG = "" +MICROBLAZE_SKIP_MSG:microblaze = "This recipe does not currently work on microblaze." + +# ../../../alsa-lib-1.2.9/src/control/control.c:3648:1: error: symver is only supported on ELF platforms +SKIP_RECIPE[alsa-lib] = "${MICROBLAZE_SKIP_MSG}" diff --git a/meta-microblaze/recipes-core/glibc/glibc_%.bbappend b/meta-microblaze/recipes-core/glibc/glibc_%.bbappend new file mode 100644 index 00000000..d42bcca5 --- /dev/null +++ b/meta-microblaze/recipes-core/glibc/glibc_%.bbappend @@ -0,0 +1 @@ +INSANE_SKIP:${PN}:append:microblaze = " textrel" diff --git a/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch b/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch new file mode 100644 index 00000000..584aab11 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch @@ -0,0 +1,91 @@ +From d3b09cb319fb1af1bcb83aa50d559ccccdeac639 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:27:25 +0530 +Subject: [PATCH 01/11] [Patch, microblaze]: Add config/microblaze.mt for + target_makefile_frag Mirror MIPS method of creating copy of default.mt which + drops the compilation of generic sbrk.c to instead continue using the + microblaze provided version. + +[Libgloss] + +Changelog + +2013-07-15 David Holsgrove <david.holsgrove@xilinx.com> + + * config/microblaze.mt: New file. + * microblaze/configure.in: Switch default.mt to microblaze.mt. + * microblaze/configure: Likewise. + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + libgloss/config/microblaze.mt | 30 ++++++++++++++++++++++++++++++ + libgloss/microblaze/configure | 2 +- + libgloss/microblaze/configure.ac | 2 +- + 3 files changed, 32 insertions(+), 2 deletions(-) + create mode 100644 libgloss/config/microblaze.mt + +diff --git a/libgloss/config/microblaze.mt b/libgloss/config/microblaze.mt +new file mode 100644 +index 000000000..e8fb922dd +--- /dev/null ++++ b/libgloss/config/microblaze.mt +@@ -0,0 +1,30 @@ ++# ++# Match default.mt to compile generic objects but continue building ++# MicroBlaze specific sbrk.c ++# ++close.o: ${srcdir}/../close.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++fstat.o: ${srcdir}/../fstat.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++getpid.o: ${srcdir}/../getpid.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++isatty.o: ${srcdir}/../isatty.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++kill.o: ${srcdir}/../kill.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++lseek.o: ${srcdir}/../lseek.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++open.o: ${srcdir}/../open.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++print.o: ${srcdir}/../print.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++putnum.o: ${srcdir}/../putnum.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++read.o: ${srcdir}/../read.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++stat.o: ${srcdir}/../stat.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++unlink.o: ${srcdir}/../unlink.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++write.o: ${srcdir}/../write.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +diff --git a/libgloss/microblaze/configure b/libgloss/microblaze/configure +index 05f68682c..faa23c584 100755 +--- a/libgloss/microblaze/configure ++++ b/libgloss/microblaze/configure +@@ -2550,7 +2550,7 @@ test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS + + + host_makefile_frag=${srcdir}/../config/default.mh +-target_makefile_frag=${srcdir}/../config/default.mt ++target_makefile_frag=${srcdir}/../config/microblaze.mt + + host_makefile_frag_path=$host_makefile_frag + +diff --git a/libgloss/microblaze/configure.ac b/libgloss/microblaze/configure.ac +index 5eda42e73..d5c789d40 100644 +--- a/libgloss/microblaze/configure.ac ++++ b/libgloss/microblaze/configure.ac +@@ -35,7 +35,7 @@ LIB_AM_PROG_AS + AC_SUBST(bsp_prefix) + + host_makefile_frag=${srcdir}/../config/default.mh +-target_makefile_frag=${srcdir}/../config/default.mt ++target_makefile_frag=${srcdir}/../config/microblaze.mt + + dnl We have to assign the same value to other variables because autoconf + dnl doesn't provide a mechanism to substitute a replacement keyword with +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch b/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch new file mode 100644 index 00000000..e39ee5b7 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch @@ -0,0 +1,25 @@ +From c96521b00af5259e1404c921cc6a22fbb16c1ace Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:30:02 +0530 +Subject: [PATCH 02/11] [Patch, microblaze]: Modified _exceptional_handler + Modified the _exceptional_handler to support the changes made in GCC related + to Superviosry call + +Signed-off-by:Nagaraju Mekala<nmekala@xilix.com> +--- + libgloss/microblaze/_exception_handler.S | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/libgloss/microblaze/_exception_handler.S b/libgloss/microblaze/_exception_handler.S +index 59385ad9b..7a91a781e 100644 +--- a/libgloss/microblaze/_exception_handler.S ++++ b/libgloss/microblaze/_exception_handler.S +@@ -36,5 +36,4 @@ + .type _exception_handler, @function + + _exception_handler: +- addi r11,r11,8 + bra r11 +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch b/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch new file mode 100644 index 00000000..e6404369 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch @@ -0,0 +1,31 @@ +From 765f715f4077780395d381bf25870b61008f8013 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:39:45 +0530 +Subject: [PATCH 03/11] [LOCAL]: Add missing declarations for xil_printf to + stdio.h for inclusion in toolchain and use in c++ apps + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> + +Conflicts: + newlib/libc/include/stdio.h +--- + newlib/libc/include/stdio.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h +index 7748351f0..fd95f1344 100644 +--- a/newlib/libc/include/stdio.h ++++ b/newlib/libc/include/stdio.h +@@ -245,6 +245,9 @@ int sprintf (char *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); + int remove (const char *); + int rename (const char *, const char *); ++void xil_printf (const char*, ...); ++void putnum (unsigned int ); ++void print (const char* ); + #ifdef _LIBC + int _rename (const char *, const char *); + #endif +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch b/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch new file mode 100644 index 00000000..4fa3da7f --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch @@ -0,0 +1,304 @@ +From edf132aae14fadd15630916781a14a29cafd37ef Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:42:11 +0530 +Subject: [PATCH 04/11] [Local]: deleting the xil_printf.c file as now it part + of BSP + +--- + libgloss/microblaze/xil_printf.c | 284 ------------------------------- + 1 file changed, 284 deletions(-) + delete mode 100644 libgloss/microblaze/xil_printf.c + +diff --git a/libgloss/microblaze/xil_printf.c b/libgloss/microblaze/xil_printf.c +deleted file mode 100644 +index f18ee8446..000000000 +--- a/libgloss/microblaze/xil_printf.c ++++ /dev/null +@@ -1,284 +0,0 @@ +-/* Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are +- * met: +- * +- * 1. Redistributions source code must retain the above copyright notice, +- * this list of conditions and the following disclaimer. +- * +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * +- * 3. Neither the name of Xilinx nor the names of its contributors may be +- * used to endorse or promote products derived from this software without +- * specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +- +-#include <ctype.h> +-#include <string.h> +-#include <stdarg.h> +- +-extern void outbyte (char); +- +-/*----------------------------------------------------*/ +-/* Use the following parameter passing structure to */ +-/* make xil_printf re-entrant. */ +-/*----------------------------------------------------*/ +-typedef struct params_s { +- int len; +- int num1; +- int num2; +- char pad_character; +- int do_padding; +- int left_flag; +-} params_t; +- +-/*---------------------------------------------------*/ +-/* The purpose of this routine is to output data the */ +-/* same as the standard printf function without the */ +-/* overhead most run-time libraries involve. Usually */ +-/* the printf brings in many kilobytes of code and */ +-/* that is unacceptable in most embedded systems. */ +-/*---------------------------------------------------*/ +- +-typedef char* charptr; +-typedef int (*func_ptr)(int c); +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine puts pad characters into the output */ +-/* buffer. */ +-/* */ +-static void padding( const int l_flag, params_t *par) +-{ +- int i; +- +- if (par->do_padding && l_flag && (par->len < par->num1)) +- for (i=par->len; i<par->num1; i++) +- outbyte( par->pad_character); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine moves a string to the output buffer */ +-/* as directed by the padding and positioning flags. */ +-/* */ +-static void outs( charptr lp, params_t *par) +-{ +- /* pad on left if needed */ +- par->len = strlen( lp); +- padding( !(par->left_flag), par); +- +- /* Move string to the buffer */ +- while (*lp && (par->num2)--) +- outbyte( *lp++); +- +- /* Pad on right if needed */ +- /* CR 439175 - elided next stmt. Seemed bogus. */ +- /* par->len = strlen( lp); */ +- padding( par->left_flag, par); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine moves a number to the output buffer */ +-/* as directed by the padding and positioning flags. */ +-/* */ +- +-static void outnum( const long n, const long base, params_t *par) +-{ +- charptr cp; +- int negative; +- char outbuf[32]; +- const char digits[] = "0123456789ABCDEF"; +- unsigned long num; +- +- /* Check if number is negative */ +- if (base == 10 && n < 0L) { +- negative = 1; +- num = -(n); +- } +- else{ +- num = (n); +- negative = 0; +- } +- +- /* Build number (backwards) in outbuf */ +- cp = outbuf; +- do { +- *cp++ = digits[(int)(num % base)]; +- } while ((num /= base) > 0); +- if (negative) +- *cp++ = '-'; +- *cp-- = 0; +- +- /* Move the converted number to the buffer and */ +- /* add in the padding where needed. */ +- par->len = strlen(outbuf); +- padding( !(par->left_flag), par); +- while (cp >= outbuf) +- outbyte( *cp--); +- padding( par->left_flag, par); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine gets a number from the format */ +-/* string. */ +-/* */ +-static int getnum( charptr* linep) +-{ +- int n; +- charptr cp; +- +- n = 0; +- cp = *linep; +- while (isdigit(*cp)) +- n = n*10 + ((*cp++) - '0'); +- *linep = cp; +- return(n); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine operates just like a printf/sprintf */ +-/* routine. It outputs a set of data under the */ +-/* control of a formatting string. Not all of the */ +-/* standard C format control are supported. The ones */ +-/* provided are primarily those needed for embedded */ +-/* systems work. Primarily the floaing point */ +-/* routines are omitted. Other formats could be */ +-/* added easily by following the examples shown for */ +-/* the supported formats. */ +-/* */ +- +-/* void esp_printf( const func_ptr f_ptr, +- const charptr ctrl1, ...) */ +-void xil_printf( const charptr ctrl1, ...) +-{ +- +- int long_flag; +- int dot_flag; +- +- params_t par; +- +- char ch; +- va_list argp; +- charptr ctrl = ctrl1; +- +- va_start( argp, ctrl1); +- +- for ( ; *ctrl; ctrl++) { +- +- /* move format string chars to buffer until a */ +- /* format control is found. */ +- if (*ctrl != '%') { +- outbyte(*ctrl); +- continue; +- } +- +- /* initialize all the flags for this format. */ +- dot_flag = long_flag = par.left_flag = par.do_padding = 0; +- par.pad_character = ' '; +- par.num2=32767; +- +- try_next: +- ch = *(++ctrl); +- +- if (isdigit(ch)) { +- if (dot_flag) +- par.num2 = getnum(&ctrl); +- else { +- if (ch == '0') +- par.pad_character = '0'; +- +- par.num1 = getnum(&ctrl); +- par.do_padding = 1; +- } +- ctrl--; +- goto try_next; +- } +- +- switch (tolower(ch)) { +- case '%': +- outbyte( '%'); +- continue; +- +- case '-': +- par.left_flag = 1; +- break; +- +- case '.': +- dot_flag = 1; +- break; +- +- case 'l': +- long_flag = 1; +- break; +- +- case 'd': +- if (long_flag || ch == 'D') { +- outnum( va_arg(argp, long), 10L, &par); +- continue; +- } +- else { +- outnum( va_arg(argp, int), 10L, &par); +- continue; +- } +- case 'x': +- outnum((long)va_arg(argp, int), 16L, &par); +- continue; +- +- case 's': +- outs( va_arg( argp, charptr), &par); +- continue; +- +- case 'c': +- outbyte( va_arg( argp, int)); +- continue; +- +- case '\\': +- switch (*ctrl) { +- case 'a': +- outbyte( 0x07); +- break; +- case 'h': +- outbyte( 0x08); +- break; +- case 'r': +- outbyte( 0x0D); +- break; +- case 'n': +- outbyte( 0x0D); +- outbyte( 0x0A); +- break; +- default: +- outbyte( *ctrl); +- break; +- } +- ctrl++; +- break; +- +- default: +- continue; +- } +- goto try_next; +- } +- va_end( argp); +-} +- +-/*---------------------------------------------------*/ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch b/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch new file mode 100644 index 00000000..025f7192 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch @@ -0,0 +1,25 @@ +From 250aa479da0b688b87f1fa42f45ecd4536194a45 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:44:17 +0530 +Subject: [PATCH 05/11] [Local]: deleting the xil_printf.o from MAKEFILE + +--- + libgloss/microblaze/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgloss/microblaze/Makefile.in b/libgloss/microblaze/Makefile.in +index fe04a08c9..32aafda37 100644 +--- a/libgloss/microblaze/Makefile.in ++++ b/libgloss/microblaze/Makefile.in +@@ -81,7 +81,7 @@ GENOBJS = fstat.o getpid.o isatty.o kill.o lseek.o print.o putnum.o stat.o unlin + open.o close.o read.o write.o + OBJS = ${GENOBJS} sbrk.o timer.o _exception_handler.o _hw_exception_handler.o \ + _interrupt_handler.o _program_clean.o _program_init.o \ +- xil_malloc.o xil_sbrk.o xil_printf.o ++ xil_malloc.o xil_sbrk.o + SCRIPTS = xilinx.ld + + # Tiny Linux BSP. +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch b/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch new file mode 100644 index 00000000..805e755e --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch @@ -0,0 +1,194 @@ +From 97684eb81807189dbcdca560d086100ba8bfa906 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Fri, 27 Jul 2018 16:10:36 +0530 +Subject: [PATCH 06/11] MB-X intial commit + +--- + libgloss/microblaze/crt0.S | 2 +- + libgloss/microblaze/crt1.S | 2 +- + libgloss/microblaze/crt2.S | 2 +- + libgloss/microblaze/crt3.S | 2 +- + libgloss/microblaze/crt4.S | 2 +- + libgloss/microblaze/crtinit.S | 4 ++-- + libgloss/microblaze/pgcrtinit.S | 4 ++-- + libgloss/microblaze/sim-crtinit.S | 4 ++-- + libgloss/microblaze/sim-pgcrtinit.S | 4 ++-- + newlib/libc/machine/microblaze/strcmp.c | 8 ++++---- + 10 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index b39ea90b3..865a8c269 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -84,7 +84,7 @@ _vector_hw_exception: + _start1: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index 20323ff6d..a8bf74937 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -75,7 +75,7 @@ _vector_hw_exception: + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index e3fb15b26..34d9f951d 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -73,7 +73,7 @@ _vector_hw_exception: + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index 452ea5265..ebcf207f5 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -59,7 +59,7 @@ + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 475acecfd..4cf0b01a4 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -59,7 +59,7 @@ + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crtinit.S b/libgloss/microblaze/crtinit.S +index 78eb76df6..86c6dfcb0 100644 +--- a/libgloss/microblaze/crtinit.S ++++ b/libgloss/microblaze/crtinit.S +@@ -33,7 +33,7 @@ + .ent _crtinit + .type _crtinit, @function + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + addi r6, r0, __sbss_start /* clear SBSS */ +@@ -82,6 +82,6 @@ _crtinit: + + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/pgcrtinit.S b/libgloss/microblaze/pgcrtinit.S +index fca1bc45e..25930821c 100644 +--- a/libgloss/microblaze/pgcrtinit.S ++++ b/libgloss/microblaze/pgcrtinit.S +@@ -33,7 +33,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + addi r6, r0, __sbss_start /* clear SBSS */ +@@ -87,6 +87,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/sim-crtinit.S b/libgloss/microblaze/sim-crtinit.S +index d2f59fe6d..74586d9a7 100644 +--- a/libgloss/microblaze/sim-crtinit.S ++++ b/libgloss/microblaze/sim-crtinit.S +@@ -39,7 +39,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + brlid r15, _program_init /* Initialize the program */ +@@ -64,6 +64,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/sim-pgcrtinit.S b/libgloss/microblaze/sim-pgcrtinit.S +index 3c6ba8371..82ebccad4 100644 +--- a/libgloss/microblaze/sim-pgcrtinit.S ++++ b/libgloss/microblaze/sim-pgcrtinit.S +@@ -39,7 +39,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + brlid r15, _program_init /* Initialize the program */ +@@ -67,6 +67,6 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index 434195e2c..3119d82c5 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -96,15 +96,15 @@ strcmp (const char *s1, + + return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #else +- unsigned long *a1; +- unsigned long *a2; ++ unsigned int *a1; ++ unsigned int *a2; + + /* If s1 or s2 are unaligned, then compare bytes. */ + if (!UNALIGNED (s1, s2)) + { + /* If s1 and s2 are word-aligned, compare them a word at a time. */ +- a1 = (unsigned long*)s1; +- a2 = (unsigned long*)s2; ++ a1 = (unsigned int*)s1; ++ a2 = (unsigned int*)s2; + while (*a1 == *a2) + { + /* To get here, *a1 == *a2, thus if we find a null in *a1, +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch b/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch new file mode 100644 index 00000000..ee7037a7 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch @@ -0,0 +1,1137 @@ +From e7b0c93274c2f51adc7c20c24a28d3cd5974fddc Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 11 Sep 2018 14:32:20 +0530 +Subject: [PATCH 07/11] [Patch, Microblaze]: newlib port for microblaze m64 + flag... + +Conflicts: + libgloss/microblaze/_hw_exception_handler.S + libgloss/microblaze/_interrupt_handler.S +--- + libgloss/microblaze/_exception_handler.S | 6 +- + libgloss/microblaze/_hw_exception_handler.S | 7 +- + libgloss/microblaze/_interrupt_handler.S | 7 +- + libgloss/microblaze/_program_clean.S | 6 +- + libgloss/microblaze/_program_init.S | 6 +- + libgloss/microblaze/crt0.S | 53 ++++++++- + libgloss/microblaze/crt1.S | 54 +++++++-- + libgloss/microblaze/crt2.S | 52 +++++++-- + libgloss/microblaze/crt3.S | 32 +++++- + libgloss/microblaze/crt4.S | 37 +++++- + libgloss/microblaze/crtinit.S | 120 ++++++++++++++------ + libgloss/microblaze/linux-crt0.S | 60 ++++++++-- + libgloss/microblaze/linux-syscalls.S | 15 ++- + libgloss/microblaze/pgcrtinit.S | 59 +++++++++- + libgloss/microblaze/sim-crtinit.S | 31 +++++ + libgloss/microblaze/sim-pgcrtinit.S | 31 +++++ + newlib/libc/machine/microblaze/longjmp.S | 45 ++++++-- + newlib/libc/machine/microblaze/setjmp.S | 33 +++++- + 18 files changed, 563 insertions(+), 91 deletions(-) + +diff --git a/libgloss/microblaze/_exception_handler.S b/libgloss/microblaze/_exception_handler.S +index 7a91a781e..0fdff3fec 100644 +--- a/libgloss/microblaze/_exception_handler.S ++++ b/libgloss/microblaze/_exception_handler.S +@@ -30,7 +30,11 @@ + */ + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .weakext _exception_handler + .ent _exception_handler + .type _exception_handler, @function +diff --git a/libgloss/microblaze/_hw_exception_handler.S b/libgloss/microblaze/_hw_exception_handler.S +index 47df945c4..b951a6325 100644 +--- a/libgloss/microblaze/_hw_exception_handler.S ++++ b/libgloss/microblaze/_hw_exception_handler.S +@@ -32,8 +32,11 @@ + .text + .weakext _hw_exception_handler # HW Exception Handler Label + .type _hw_exception_handler, %function +- .align 2 +- ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + _hw_exception_handler: + rted r17, 0 + nop +diff --git a/libgloss/microblaze/_interrupt_handler.S b/libgloss/microblaze/_interrupt_handler.S +index 5bb7329cc..a0ef92df0 100644 +--- a/libgloss/microblaze/_interrupt_handler.S ++++ b/libgloss/microblaze/_interrupt_handler.S +@@ -32,8 +32,11 @@ + .text + .weakext _interrupt_handler # Interrupt Handler Label + .type _interrupt_handler, %function +- .align 2 +- ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + _interrupt_handler: + rtid r14, 0 + nop +diff --git a/libgloss/microblaze/_program_clean.S b/libgloss/microblaze/_program_clean.S +index c46059434..0d55d8ab8 100644 +--- a/libgloss/microblaze/_program_clean.S ++++ b/libgloss/microblaze/_program_clean.S +@@ -33,7 +33,11 @@ + # + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .globl _program_clean + .ent _program_clean + _program_clean: +diff --git a/libgloss/microblaze/_program_init.S b/libgloss/microblaze/_program_init.S +index 0daa42e14..862ef786b 100644 +--- a/libgloss/microblaze/_program_init.S ++++ b/libgloss/microblaze/_program_init.S +@@ -32,7 +32,11 @@ + # Dummy file to be replaced by LibGen + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .globl _program_init + .ent _program_init + _program_init: +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index 865a8c269..e4df73b66 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -54,7 +54,11 @@ + + .globl _start + .section .vectors.reset, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _start + .type _start, @function + _start: +@@ -62,36 +66,64 @@ _start: + .end _start + + .section .vectors.sw_exception, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start1 ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + .ent _start1 + .type _start1, @function + _start1: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 ++ brealid r15, _crtinit ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +- + brlid r15, _crtinit /* Initialize BSS and run program */ + nop + +- brlid r15, exit /* Call exit with the return value of main */ +- addik r5, r3, 0 +- ++ brlid r15, exit /* Call exit with the return value of main */ ++ addik r5, r3, 0 ++#endif + /* Control does not reach here */ + .end _start1 + +@@ -101,9 +133,18 @@ _start1: + Our simple _exit + */ + .globl _exit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index a8bf74937..b24eeb531 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -53,36 +53,67 @@ + + + .section .vectors.sw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + .end _start + +@@ -92,11 +123,18 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: ++#ifdef __arch64__ ++ addl r3, r0, r5 ++#else + add r3, r0, r5 ++#endif + brki r16, 0x4 /* Return to hook in XMDSTUB */ + .end _exit +- +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index 34d9f951d..ae4c89ee0 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -51,26 +51,56 @@ + */ + + .section .vectors.sw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -80,7 +110,7 @@ _start: + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + + .end _start +@@ -90,9 +120,17 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index ebcf207f5..a8bc7839b 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -53,10 +53,26 @@ + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ ++ addlik r5, r3, 0 ++ brealid r15, exit /* Call exit with the return value of main */ ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -66,7 +82,7 @@ _start: + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + .end _start + +@@ -76,9 +92,17 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 4cf0b01a4..54ba473ea 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -53,10 +53,27 @@ + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ ++ addlik r5, r3, 0 ++ brealid r15, exit /* Call exit with the return value of main */ ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -68,19 +85,27 @@ _start: + addik r5, r3, 0 + + /* Control does not reach here */ +- ++#endif + .end _start + +- + /* + _exit + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- brlid r15,elf_process_exit +- nop ++#ifdef __arch64__ ++ brealid r15,elf_process_exit ++ nop ++#else ++ brlid r15,elf_process_exit ++ nop ++#endif + .end _exit +diff --git a/libgloss/microblaze/crtinit.S b/libgloss/microblaze/crtinit.S +index 86c6dfcb0..854117536 100644 +--- a/libgloss/microblaze/crtinit.S ++++ b/libgloss/microblaze/crtinit.S +@@ -29,59 +29,115 @@ + */ + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + .type _crtinit, @function + _crtinit: +- addi r1, r1, -40 /* Save Link register */ +- swi r15, r1, 0 ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 + +- addi r6, r0, __sbss_start /* clear SBSS */ +- addi r7, r0, __sbss_end +- rsub r18, r6, r7 +- blei r18, .Lendsbss ++ addli r6, r0, __sbss_start /* clear SBSS */ ++ addli r7, r0, __sbss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendsbss + + .Lloopsbss: +- swi r0, r6, 0 +- addi r6, r6, 4 +- rsub r18, r6, r7 +- bgti r18, .Lloopsbss ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopsbss + .Lendsbss: +- +- addi r6, r0, __bss_start /* clear BSS */ +- addi r7, r0, __bss_end +- rsub r18, r6, r7 +- blei r18, .Lendbss ++ addli r6, r0, __bss_start /* clear BSS */ ++ addli r7, r0, __bss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendbss + .Lloopbss: +- swi r0, r6, 0 +- addi r6, r6, 4 +- rsub r18, r6, r7 +- bgti r18, .Lloopbss ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopbss + .Lendbss: + +- brlid r15, _program_init /* Initialize the program */ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ + nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ++ ll r15, r1, r0 /* Return back to CRT */ ++ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else ++ addi r1, r1, -40 /* Save Link register */ ++ swi r15, r1, 0 ++ ++ addi r6, r0, __sbss_start /* clear SBSS */ ++ addi r7, r0, __sbss_end ++ rsub r18, r6, r7 ++ blei r18, .Lendsbss ++ ++.Lloopsbss: ++ swi r0, r6, 0 ++ addi r6, r6, 4 ++ rsub r18, r6, r7 ++ bgti r18, .Lloopsbss ++.Lendsbss: ++ ++ addi r6, r0, __bss_start /* clear BSS */ ++ addi r7, r0, __bss_end ++ rsub r18, r6, r7 ++ blei r18, .Lendbss ++.Lloopbss: ++ swi r0, r6, 0 ++ addi r6, r6, 4 ++ rsub r18, r6, r7 ++ bgti r18, .Lloopbss ++.Lendbss: ++ ++ brlid r15, _program_init /* Initialize the program */ ++ nop + + brlid r15, __init /* Invoke language initialization functions */ + nop +- +- addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ +- addi r7, r0, 0 +- brlid r15, main /* Execute the program */ +- addi r5, r0, 0 ++ ++ addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addi r7, r0, 0 ++ brlid r15, main /* Execute the program */ ++ addi r5, r0, 0 + + addik r19, r3, 0 /* Save return value */ +- ++ + brlid r15, __fini /* Invoke language cleanup functions */ + nop +- +- brlid r15, _program_clean /* Cleanup the program */ +- nop + +- lw r15, r1, r0 /* Return back to CRT */ ++ brlid r15, _program_clean /* Cleanup the program */ ++ nop ++ ++ lw r15, r1, r0 /* Return back to CRT */ + + addik r3, r19, 0 /* Restore return value */ +- rtsd r15, 8 +- addi r1, r1, 40 ++ rtsd r15, 8 ++ addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/linux-crt0.S b/libgloss/microblaze/linux-crt0.S +index 8650bb5d2..503439b2e 100644 +--- a/libgloss/microblaze/linux-crt0.S ++++ b/libgloss/microblaze/linux-crt0.S +@@ -18,26 +18,50 @@ + .ent _start + .type _start, @function + _start: +- la r13, r0, _SDA_BASE_ +- la r2, r0, _SDA2_BASE_ ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ ++ lli r2, r0, _SDA2_BASE_ + +- brlid r15, __init ++ brealid r15, __init + nop + +- lwi r5, r1, 0 +- addik r6, r1, 4 ++ lli r5, r1, 0 ++ addlik r6, r1, 4 + + # Add argc * 4. +- addk r7, r5, r5 +- addk r7, r7, r7 ++ addlk r7, r5, r5 ++ addlk r7, r7, r7 + +- brlid r15, main + # Now add 4 + r1 (i.e r6) in the delayslot. +- addk r7, r7, r6 ++ addlk r7, r7, r6 ++ brealid r15, main ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++ .size _start, . - _start ++#else ++ la r13, r0, _SDA_BASE_ ++ la r2, r0, _SDA2_BASE_ ++ ++ brlid r15, __init ++ nop ++ ++ lwi r5, r1, 0 ++ addik r6, r1, 4 + +- brlid r15, exit ++ # Add argc * 4. ++ addk r7, r5, r5 ++ addk r7, r7, r7 ++ ++ brlid r15, main ++ # Now add 4 + r1 (i.e r6) in the delayslot. ++ addk r7, r7, r6 ++ ++ brlid r15, exit + addik r5, r3, 0 +- .size _start, . - _start ++ .size _start, . - _start ++#endif + .end _start + + /* Replacement for the GCC provided crti.S. This one avoids the +@@ -45,14 +69,28 @@ _start: + insn exceptions when running in user-space). */ + .section .init, "ax" + .global __init ++#ifdef __arch64__ ++ .align 3 ++__init: ++ addlik r1, r1, -8 ++ sl r15, r0, r1 ++#else + .align 2 + __init: + addik r1, r1, -8 + sw r15, r0, r1 + ++#endif + .section .fini, "ax" + .global __fini ++#ifdef __arch64__ ++ .align 3 ++__fini: ++ addlik r1, r1, -8 ++ sl r15, r0, r1 ++#else + .align 2 + __fini: + addik r1, r1, -8 + sw r15, r0, r1 ++#endif +diff --git a/libgloss/microblaze/linux-syscalls.S b/libgloss/microblaze/linux-syscalls.S +index 506de78fd..8594f136e 100644 +--- a/libgloss/microblaze/linux-syscalls.S ++++ b/libgloss/microblaze/linux-syscalls.S +@@ -20,8 +20,9 @@ + #define GLOBAL(name) .global name; FUNC(name) + #define SIZE(name) .size name, .-name + ++#ifdef __arch64__ + # define SYSCALL_BODY(name) \ +- addik r12, r0, SYS_ ## name; \ ++ addlik r12, r0, SYS_ ## name; \ + brki r14, 8; \ + rtsd r15, 8; \ + nop; +@@ -31,6 +32,18 @@ + SYSCALL_BODY(name); \ + SIZE(_ ## name) + ++#else ++# define SYSCALL_BODY(name) \ ++ addik r12, r0, SYS_ ## name; \ ++ brki r14, 8; \ ++ rtsd r15, 8; \ ++ nop; ++ ++# define SYSCALL(name) \ ++ GLOBAL(_ ## name); \ ++ SYSCALL_BODY(name); \ ++ SIZE(_ ## name) ++#endif + SYSCALL(brk) + SYSCALL(exit) + SYSCALL(read) +diff --git a/libgloss/microblaze/pgcrtinit.S b/libgloss/microblaze/pgcrtinit.S +index 25930821c..638dbd383 100644 +--- a/libgloss/microblaze/pgcrtinit.S ++++ b/libgloss/microblaze/pgcrtinit.S +@@ -29,10 +29,66 @@ + + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ addli r6, r0, __sbss_start /* clear SBSS */ ++ addli r7, r0, __sbss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendsbss ++.Lloopsbss: ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopsbss ++.Lendsbss: ++ ++ addli r6, r0, __bss_start /* clear BSS */ ++ addli r7, r0, __bss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendbss ++.Lloopbss: ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopbss ++.Lendbss: ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, _profile_init /* Initialize profiling library */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _profile_clean /* Cleanup profiling library */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -86,7 +142,8 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ +- rtsd r15, 8 ++ rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/sim-crtinit.S b/libgloss/microblaze/sim-crtinit.S +index 74586d9a7..9892cb0bd 100644 +--- a/libgloss/microblaze/sim-crtinit.S ++++ b/libgloss/microblaze/sim-crtinit.S +@@ -35,10 +35,39 @@ + # + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -63,7 +92,9 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ ++ + rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/sim-pgcrtinit.S b/libgloss/microblaze/sim-pgcrtinit.S +index 82ebccad4..939f5372f 100644 +--- a/libgloss/microblaze/sim-pgcrtinit.S ++++ b/libgloss/microblaze/sim-pgcrtinit.S +@@ -35,10 +35,40 @@ + # + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, _profile_init /* Initialize profiling library */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _profile_clean /* Cleanup profiling library */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -68,5 +98,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/newlib/libc/machine/microblaze/longjmp.S b/newlib/libc/machine/microblaze/longjmp.S +index f972bbd88..5ed1c2626 100644 +--- a/newlib/libc/machine/microblaze/longjmp.S ++++ b/newlib/libc/machine/microblaze/longjmp.S +@@ -51,16 +51,46 @@ + + .globl longjmp + .section .text +-.align 2 ++#ifdef __arch64__ ++.align 3 ++#else ++.align 2 ++#endif + .ent longjmp + longjmp: ++#ifdef __arch64__ ++ lli r1, r5, 0 ++ lli r13, r5, 4 ++ lli r14, r5, 8 ++ lli r15, r5, 12 ++ lli r16, r5, 16 ++ lli r17, r5, 20 ++ lli r18, r5, 24 ++ lli r19, r5, 28 ++ lli r20, r5, 32 ++ lli r21, r5, 36 ++ lli r22, r5, 40 ++ lli r23, r5, 44 ++ lli r24, r5, 48 ++ lli r25, r5, 52 ++ lli r26, r5, 56 ++ lli r27, r5, 60 ++ lli r28, r5, 64 ++ lli r29, r5, 68 ++ lli r30, r5, 72 ++ lli r31, r5, 76 ++ ++ or r3, r0, r6 ++ rtsd r15, 8 ++ nop ++#else + lwi r1, r5, 0 + lwi r13, r5, 4 + lwi r14, r5, 8 +- lwi r15, r5, 12 ++ lwi r15, r5, 12 + lwi r16, r5, 16 + lwi r17, r5, 20 +- lwi r18, r5, 24 ++ lwi r18, r5, 24 + lwi r19, r5, 28 + lwi r20, r5, 32 + lwi r21, r5, 36 +@@ -69,12 +99,13 @@ longjmp: + lwi r24, r5, 48 + lwi r25, r5, 52 + lwi r26, r5, 56 +- lwi r27, r5, 60 +- lwi r28, r5, 64 +- lwi r29, r5, 68 ++ lwi r27, r5, 60 ++ lwi r28, r5, 64 ++ lwi r29, r5, 68 + lwi r30, r5, 72 +- lwi r31, r5, 76 ++ lwi r31, r5, 76 + + rtsd r15, 8 + or r3, r0, r6 ++#endif + .end longjmp +diff --git a/newlib/libc/machine/microblaze/setjmp.S b/newlib/libc/machine/microblaze/setjmp.S +index cdd87c76f..971862bcb 100644 +--- a/newlib/libc/machine/microblaze/setjmp.S ++++ b/newlib/libc/machine/microblaze/setjmp.S +@@ -50,9 +50,39 @@ + + .globl setjmp + .section .text +-.align 2 ++#ifdef __arch64__ ++.align 3 ++#else ++.align 2 ++#endif + .ent setjmp + setjmp: ++#ifdef __arch64__ ++ sli r1, r5, 0 ++ sli r13, r5, 4 ++ sli r14, r5, 8 ++ sli r15, r5, 12 ++ sli r16, r5, 16 ++ sli r17, r5, 20 ++ sli r18, r5, 24 ++ sli r19, r5, 28 ++ sli r20, r5, 32 ++ sli r21, r5, 36 ++ sli r22, r5, 40 ++ sli r23, r5, 44 ++ sli r24, r5, 48 ++ sli r25, r5, 52 ++ sli r26, r5, 56 ++ sli r27, r5, 60 ++ sli r28, r5, 64 ++ sli r29, r5, 68 ++ sli r30, r5, 72 ++ sli r31, r5, 76 ++ ++ or r3, r0, r0 ++ rtsd r15, 8 ++ nop ++#else + swi r1, r5, 0 + swi r13, r5, 4 + swi r14, r5, 8 +@@ -76,4 +106,5 @@ setjmp: + + rtsd r15, 8 + or r3, r0, r0 ++#endif + .end setjmp +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch b/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch new file mode 100644 index 00000000..915a26ef --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch @@ -0,0 +1,102 @@ +From 924721fdb8eed60fe58c8a7976955bac02efc200 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Fri, 28 Sep 2018 12:07:43 +0530 +Subject: [PATCH 08/11] fixing the bug in crt files, added addlik instead of + lli insn + +--- + libgloss/microblaze/crt0.S | 6 +++--- + libgloss/microblaze/crt1.S | 6 +++--- + libgloss/microblaze/crt2.S | 6 +++--- + libgloss/microblaze/crt3.S | 6 +++--- + libgloss/microblaze/crt4.S | 6 +++--- + 5 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index e4df73b66..25e7c4af3 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -106,9 +106,9 @@ _vector_hw_exception: + .type _start1, @function + _start1: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 ++ addlik r13, r0, _SDA_BASE_ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 + brealid r15, _crtinit + nop + addlik r5, r3, 0 +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index b24eeb531..38440c957 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -94,9 +94,9 @@ _vector_hw_exception: + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index ae4c89ee0..352927dab 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -92,9 +92,9 @@ _vector_hw_exception: + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + brealid r15, _crtinit /* Initialize BSS and run program */ + nop + addlik r5, r3, 0 +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index a8bc7839b..bc32cda86 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -62,9 +62,9 @@ + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 54ba473ea..a25c84734 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -63,9 +63,9 @@ + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch b/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch new file mode 100644 index 00000000..40d69465 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch @@ -0,0 +1,230 @@ +From e7a5086bc3e38cf5bc5c5943de6cf5135ed6a77b Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 17 Nov 2020 13:06:41 +0530 +Subject: [PATCH 09/11] [Patch,MicroBlaze] : Added MB-64 support to + strcmp/strcpy/strlen files Signed-off-by:Mahesh Bodapati<mbodapat@xilinx.com> + +--- + newlib/libc/machine/microblaze/strcmp.c | 63 ++++++++++++++++++++++++- + newlib/libc/machine/microblaze/strcpy.c | 57 ++++++++++++++++++++++ + newlib/libc/machine/microblaze/strlen.c | 38 +++++++++++++++ + 3 files changed, 157 insertions(+), 1 deletion(-) + +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index 3119d82c5..2cfef7388 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -133,6 +133,66 @@ strcmp (const char *s1, + + #include "mb_endian.h" + ++#ifdef __arch64__ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */ \n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ andli r4, r6, 3 \n\ ++ beanei r3, try_align_args \n\ ++ beanei r4, regular_strcmp /* At this point we don't have a choice */ \n\ ++cmp_loop: \n" ++ LOAD4BYTES("r3", "r5", "r9") ++ LOAD4BYTES("r4", "r6", "r9") ++" \n\ ++ pcmplbf r7, r3, r0 /* See if there is Null byte */ \n\ ++ beanei r7, end_cmp_loop /* IF yes (r7 > 0) use byte compares in end_cmp_loop */ \n\ ++ cmplu r7, r4, r3 /* ELSE compare whole word */ \n\ ++ beanei r7, end_cmp \n\ ++ addlik r9, r9, 4 /* delay slot */ \n\ ++ breaid cmp_loop \n\ ++ nop /* delay slot */ \n\ ++end_cmp_loop: \n\ ++ lbu r3, r5, r9 /* byte compare loop */ \n\ ++ lbu r4, r6, r9 \n\ ++ cmplu r7, r4, r3 /* Compare bytes */ \n\ ++ beanei r7, end_cmp_early \n\ ++ addlik r9, r9, 1 /* delay slot */ \n\ ++ beaneid r3, end_cmp_loop /* If reached null on one string, terminate */ \n\ ++ nop \n\ ++end_cmp_early: \n\ ++ orl r3, r0, r7 /* delay slot */ \n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++try_align_args: \n\ ++ xorl r7, r4, r3 \n\ ++ beanei r7, regular_strcmp /* cannot align args */ \n\ ++ rsublik r10, r3, 4 /* Number of initial bytes to align */ \n\ ++align_loop: \n\ ++ lbu r3, r5, r9 \n\ ++ lbu r4, r6, r9 \n\ ++ cmplu r7, r4, r3 \n\ ++ beanei r7, end_cmp \n\ ++ beaeqi r3, end_cmp \n\ ++ addlik r10, r10, -1 \n\ ++ addlik r9, r9, 1 \n\ ++ beaeqid r10, cmp_loop \n\ ++ nop \n\ ++ breai align_loop \n\ ++regular_strcmp: \n\ ++ lbu r3, r5, r9 \n\ ++ lbu r4, r6, r9 \n\ ++ cmplu r7, r4, r3 \n\ ++ beanei r7, end_cmp \n\ ++ beaeqi r3, end_cmp \n\ ++ addlik r9, r9, 1 \n\ ++ breaid regular_strcmp \n\ ++ nop \n\ ++end_cmp: \n\ ++ orl r3, r0, r7 \n\ ++ rtsd r15, 8 \n\ ++ nop /* Return strcmp result */"); ++#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */\n\ + check_alignment: \n\ +@@ -181,11 +241,12 @@ regular_strcmp: + bnei r7, end_cmp \n\ + beqi r3, end_cmp \n\ + brid regular_strcmp \n\ +- addik r9, r9, 1 \n\ ++ addik r9, r9, 1 + end_cmp: \n\ + rtsd r15, 8 \n\ + or r3, r0, r7 /* Return strcmp result */"); + ++#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c +index 62072fa28..6dbc60d77 100644 +--- a/newlib/libc/machine/microblaze/strcpy.c ++++ b/newlib/libc/machine/microblaze/strcpy.c +@@ -125,6 +125,62 @@ strcpy (char *__restrict dst0, + #else + + #include "mb_endian.h" ++#ifdef __arch64__ ++ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */ \n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ andli r4, r6, 3 \n\ ++ beanei r3, try_align_args \n\ ++ beanei r4, regular_strcpy /* At this point we dont have a choice */ \n\ ++cpy_loop: \n" ++ LOAD4BYTES("r3", "r6", "r9") ++" \n\ ++ pcmplbf r4, r0, r3 \n\ ++ beanei r4, cpy_bytes /* If r4 != 0, then null present within string */\n" ++ STORE4BYTES("r3", "r5", "r9") ++" \n\ ++ addlik r9, r9, 4 \n\ ++ breaid cpy_loop \n\ ++ nop \n\ ++cpy_bytes: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r4, r4, -1 \n\ ++ addlik r9, r9, 1 /* delay slot */\n\ ++ beaneid r4, cpy_bytes \n\ ++ nop \n\ ++cpy_null: \n\ ++ orl r3, r0, r5 /* Return strcpy result */\n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++try_align_args: \n\ ++ xorl r7, r4, r3 \n\ ++ beanei r7, regular_strcpy /* cannot align args */\n\ ++ rsublik r10, r3, 4 /* Number of initial bytes to align */\n\ ++align_loop: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r10, r10, -1 \n\ ++ beaeqid r3, end_cpy /* Break if we have seen null character */\n\ ++ nop \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r10, align_loop \n\ ++ nop \n\ ++ breai cpy_loop \n\ ++regular_strcpy: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r3, regular_strcpy \n\ ++ nop \n\ ++end_cpy: \n\ ++ orl r3, r0, r5 \n\ ++ rtsd r15, 8 \n\ ++ nop /* Return strcpy result */"); ++ ++#else + + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ +@@ -171,6 +227,7 @@ regular_strcpy: \n\ + end_cpy: \n\ + rtsd r15, 8 \n\ + or r3, r0, r5 /* Return strcpy result */"); ++#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c +index acb4464bc..b6f2d3c13 100644 +--- a/newlib/libc/machine/microblaze/strlen.c ++++ b/newlib/libc/machine/microblaze/strlen.c +@@ -116,6 +116,43 @@ strlen (const char *str) + + #include "mb_endian.h" + ++#ifdef __arch64__ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */ \n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ beanei r3, align_arg \n\ ++len_loop: \n" ++ LOAD4BYTES("r3", "r5", "r9") ++" \n\ ++ pcmplbf r4, r3, r0 \n\ ++ beanei r4, end_len \n\ ++ addlik r9, r9, 4 \n\ ++ breaid len_loop \n\ ++ nop \n\ ++end_len: \n\ ++ lbu r3, r5, r9 \n\ ++ beaeqi r3, done_len \n\ ++ addlik r9, r9, 1 \n\ ++ breaid end_len \n\ ++ nop \n\ ++done_len: \n\ ++ orl r3, r0, r9 /* Return len */ \n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++align_arg: \n\ ++ rsublik r10, r3, 4 \n\ ++align_loop: \n\ ++ lbu r3, r5, r9 \n\ ++ addlik r10, r10, -1 \n\ ++ beaeqid r3, done_len \n\ ++ nop \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r10, align_loop \n\ ++ nop \n\ ++ breai len_loop"); ++ ++#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -146,5 +183,6 @@ align_loop: \n\ + addik r9, r9, 1 \n\ + bri len_loop"); + ++#endif + #endif /* ! HAVE_HW_PCMP */ + } +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch b/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch new file mode 100644 index 00000000..cd98dfa1 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch @@ -0,0 +1,339 @@ +From 6b8e5c7a773de4609f9c855aa714eca5a3f8b4ab Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 9 Nov 2021 22:53:44 +0530 +Subject: [PATCH 10/11] [Patch,MicroBlaze] : Removing the Assembly + implementation of 64bit string function. + +Revisit in next release and fix it +--- + newlib/libc/machine/microblaze/mb_endian.h | 4 + + newlib/libc/machine/microblaze/strcmp.c | 95 ++++++++-------------- + newlib/libc/machine/microblaze/strcpy.c | 82 ++++++------------- + newlib/libc/machine/microblaze/strlen.c | 59 +++++--------- + 4 files changed, 82 insertions(+), 158 deletions(-) + +diff --git a/newlib/libc/machine/microblaze/mb_endian.h b/newlib/libc/machine/microblaze/mb_endian.h +index fb217ec85..17772c88f 100644 +--- a/newlib/libc/machine/microblaze/mb_endian.h ++++ b/newlib/libc/machine/microblaze/mb_endian.h +@@ -8,8 +8,12 @@ + #ifdef __LITTLE_ENDIAN__ + #define LOAD4BYTES(rD,rA,rB) "\tlwr\t" rD ", " rA ", " rB "\n" + #define STORE4BYTES(rD,rA,rB) "\tswr\t" rD ", " rA ", " rB "\n" ++#define LOAD8BYTES(rD,rA,rB) "\tllr\t" rD ", " rA ", " rB "\n" ++#define STORE8BYTES(rD,rA,rB) "\tslr\t" rD ", " rA ", " rB "\n" + #else + #define LOAD4BYTES(rD,rA,rB) "\tlw\t" rD ", " rA ", " rB "\n" + #define STORE4BYTES(rD,rA,rB) "\tsw\t" rD ", " rA ", " rB "\n" ++#define LOAD8BYTES(rD,rA,rB) "\tll\t" rD ", " rA ", " rB "\n" ++#define STORE8BYTES(rD,rA,rB) "\tsl\t" rD ", " rA ", " rB "\n" + #endif + #endif +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index 2cfef7388..e34c64a0c 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -129,70 +129,42 @@ strcmp (const char *s1, + return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #endif /* not PREFER_SIZE_OVER_SPEED */ + ++#elif __arch64__ ++ unsigned int *a1; ++ unsigned int *a2; ++ ++ /* If s1 or s2 are unaligned, then compare bytes. */ ++ if (!UNALIGNED (s1, s2)) ++ { ++ /* If s1 and s2 are word-aligned, compare them a word at a time. */ ++ a1 = (unsigned int*)s1; ++ a2 = (unsigned int*)s2; ++ while (*a1 == *a2) ++ { ++ /* To get here, *a1 == *a2, thus if we find a null in *a1, ++ then the strings must be equal, so return zero. */ ++ if (DETECTNULL (*a1)) ++ return 0; ++ ++ a1++; ++ a2++; ++ } ++ ++ /* A difference was detected in last few bytes of s1, so search bytewise */ ++ s1 = (char*)a1; ++ s2 = (char*)a2; ++ } ++ ++ while (*s1 != '\0' && *s1 == *s2) ++ { ++ s1++; ++ s2++; ++ } ++ return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #else + + #include "mb_endian.h" + +-#ifdef __arch64__ +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- andli r4, r6, 3 \n\ +- beanei r3, try_align_args \n\ +- beanei r4, regular_strcmp /* At this point we don't have a choice */ \n\ +-cmp_loop: \n" +- LOAD4BYTES("r3", "r5", "r9") +- LOAD4BYTES("r4", "r6", "r9") +-" \n\ +- pcmplbf r7, r3, r0 /* See if there is Null byte */ \n\ +- beanei r7, end_cmp_loop /* IF yes (r7 > 0) use byte compares in end_cmp_loop */ \n\ +- cmplu r7, r4, r3 /* ELSE compare whole word */ \n\ +- beanei r7, end_cmp \n\ +- addlik r9, r9, 4 /* delay slot */ \n\ +- breaid cmp_loop \n\ +- nop /* delay slot */ \n\ +-end_cmp_loop: \n\ +- lbu r3, r5, r9 /* byte compare loop */ \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 /* Compare bytes */ \n\ +- beanei r7, end_cmp_early \n\ +- addlik r9, r9, 1 /* delay slot */ \n\ +- beaneid r3, end_cmp_loop /* If reached null on one string, terminate */ \n\ +- nop \n\ +-end_cmp_early: \n\ +- orl r3, r0, r7 /* delay slot */ \n\ +- rtsd r15, 8 \n\ +- nop \n\ +-try_align_args: \n\ +- xorl r7, r4, r3 \n\ +- beanei r7, regular_strcmp /* cannot align args */ \n\ +- rsublik r10, r3, 4 /* Number of initial bytes to align */ \n\ +-align_loop: \n\ +- lbu r3, r5, r9 \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 \n\ +- beanei r7, end_cmp \n\ +- beaeqi r3, end_cmp \n\ +- addlik r10, r10, -1 \n\ +- addlik r9, r9, 1 \n\ +- beaeqid r10, cmp_loop \n\ +- nop \n\ +- breai align_loop \n\ +-regular_strcmp: \n\ +- lbu r3, r5, r9 \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 \n\ +- beanei r7, end_cmp \n\ +- beaeqi r3, end_cmp \n\ +- addlik r9, r9, 1 \n\ +- breaid regular_strcmp \n\ +- nop \n\ +-end_cmp: \n\ +- orl r3, r0, r7 \n\ +- rtsd r15, 8 \n\ +- nop /* Return strcmp result */"); +-#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */\n\ + check_alignment: \n\ +@@ -241,12 +213,11 @@ regular_strcmp: + bnei r7, end_cmp \n\ + beqi r3, end_cmp \n\ + brid regular_strcmp \n\ +- addik r9, r9, 1 ++ addik r9, r9, 1 \n\ + end_cmp: \n\ + rtsd r15, 8 \n\ + or r3, r0, r7 /* Return strcmp result */"); + +-#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c +index 6dbc60d77..ddb69227e 100644 +--- a/newlib/libc/machine/microblaze/strcpy.c ++++ b/newlib/libc/machine/microblaze/strcpy.c +@@ -121,67 +121,36 @@ strcpy (char *__restrict dst0, + ; + return dst0; + #endif /* not PREFER_SIZE_OVER_SPEED */ ++#elif __arch64__ ++ char *dst = dst0; ++ const char *src = src0; ++ long *aligned_dst; ++ const long *aligned_src; + +-#else ++ /* If SRC or DEST is unaligned, then copy bytes. */ ++ if (!UNALIGNED (src, dst)) ++ { ++ aligned_dst = (long*)dst; ++ aligned_src = (long*)src; + +-#include "mb_endian.h" +-#ifdef __arch64__ ++ /* SRC and DEST are both "long int" aligned, try to do "long int" ++ sized copies. */ ++ while (!DETECTNULL(*aligned_src)) ++ { ++ *aligned_dst++ = *aligned_src++; ++ } + +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- andli r4, r6, 3 \n\ +- beanei r3, try_align_args \n\ +- beanei r4, regular_strcpy /* At this point we dont have a choice */ \n\ +-cpy_loop: \n" +- LOAD4BYTES("r3", "r6", "r9") +-" \n\ +- pcmplbf r4, r0, r3 \n\ +- beanei r4, cpy_bytes /* If r4 != 0, then null present within string */\n" +- STORE4BYTES("r3", "r5", "r9") +-" \n\ +- addlik r9, r9, 4 \n\ +- breaid cpy_loop \n\ +- nop \n\ +-cpy_bytes: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r4, r4, -1 \n\ +- addlik r9, r9, 1 /* delay slot */\n\ +- beaneid r4, cpy_bytes \n\ +- nop \n\ +-cpy_null: \n\ +- orl r3, r0, r5 /* Return strcpy result */\n\ +- rtsd r15, 8 \n\ +- nop \n\ +-try_align_args: \n\ +- xorl r7, r4, r3 \n\ +- beanei r7, regular_strcpy /* cannot align args */\n\ +- rsublik r10, r3, 4 /* Number of initial bytes to align */\n\ +-align_loop: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r10, r10, -1 \n\ +- beaeqid r3, end_cpy /* Break if we have seen null character */\n\ +- nop \n\ +- addlik r9, r9, 1 \n\ +- beaneid r10, align_loop \n\ +- nop \n\ +- breai cpy_loop \n\ +-regular_strcpy: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r9, r9, 1 \n\ +- beaneid r3, regular_strcpy \n\ +- nop \n\ +-end_cpy: \n\ +- orl r3, r0, r5 \n\ +- rtsd r15, 8 \n\ +- nop /* Return strcpy result */"); ++ dst = (char*)aligned_dst; ++ src = (char*)aligned_src; ++ } + +-#else ++ while (*dst++ = *src++) ++ ; ++ return dst0; ++ ++#else + ++#include "mb_endian.h" + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -227,7 +196,6 @@ regular_strcpy: \n\ + end_cpy: \n\ + rtsd r15, 8 \n\ + or r3, r0, r5 /* Return strcpy result */"); +-#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c +index b6f2d3c13..940753996 100644 +--- a/newlib/libc/machine/microblaze/strlen.c ++++ b/newlib/libc/machine/microblaze/strlen.c +@@ -112,47 +112,29 @@ strlen (const char *str) + return str - start; + #endif /* not PREFER_SIZE_OVER_SPEED */ + +-#else +- +-#include "mb_endian.h" ++#elif __arch64__ ++ const char *start = str; ++ unsigned long *aligned_addr; + +-#ifdef __arch64__ +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- beanei r3, align_arg \n\ +-len_loop: \n" +- LOAD4BYTES("r3", "r5", "r9") +-" \n\ +- pcmplbf r4, r3, r0 \n\ +- beanei r4, end_len \n\ +- addlik r9, r9, 4 \n\ +- breaid len_loop \n\ +- nop \n\ +-end_len: \n\ +- lbu r3, r5, r9 \n\ +- beaeqi r3, done_len \n\ +- addlik r9, r9, 1 \n\ +- breaid end_len \n\ +- nop \n\ +-done_len: \n\ +- orl r3, r0, r9 /* Return len */ \n\ +- rtsd r15, 8 \n\ +- nop \n\ +-align_arg: \n\ +- rsublik r10, r3, 4 \n\ +-align_loop: \n\ +- lbu r3, r5, r9 \n\ +- addlik r10, r10, -1 \n\ +- beaeqid r3, done_len \n\ +- nop \n\ +- addlik r9, r9, 1 \n\ +- beaneid r10, align_loop \n\ +- nop \n\ +- breai len_loop"); ++ if (!UNALIGNED (str)) ++ { ++ /* If the string is word-aligned, we can check for the presence of ++ a null in each word-sized block. */ ++ aligned_addr = (unsigned long*)str; ++ while (!DETECTNULL (*aligned_addr)) ++ aligned_addr++; + ++ /* Once a null is detected, we check each byte in that block for a ++ precise position of the null. */ ++ str = (char*)aligned_addr; ++ } ++ ++ while (*str) ++ str++; ++ return str - start; + #else ++ ++#include "mb_endian.h" + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -183,6 +165,5 @@ align_loop: \n\ + addik r9, r9, 1 \n\ + bri len_loop"); + +-#endif + #endif /* ! HAVE_HW_PCMP */ + } +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch b/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch new file mode 100644 index 00000000..ba5fcb8c --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch @@ -0,0 +1,25 @@ +From bab2eafd2d4ca1f2caacd50120e8ac94aca1b7c4 Mon Sep 17 00:00:00 2001 +From: Nagaraju <nmekala@xilinx.com> +Date: Tue, 14 Jan 2020 22:32:30 +0530 +Subject: [PATCH 11/11] Fixed the bug in crtinit.s for MB-64 + +--- + libgloss/microblaze/crtinit.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgloss/microblaze/crtinit.S b/libgloss/microblaze/crtinit.S +index 854117536..f79140734 100644 +--- a/libgloss/microblaze/crtinit.S ++++ b/libgloss/microblaze/crtinit.S +@@ -48,7 +48,7 @@ _crtinit: + + .Lloopsbss: + sli r0, r6, 0 +- addli r6, r6, 4 ++ addli r6, r6, 8 + rsubl r18, r6, r7 + beagti r18, .Lloopsbss + .Lendsbss: +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-core/newlib/libgloss_%.bbappend b/meta-microblaze/recipes-core/newlib/libgloss_%.bbappend new file mode 100644 index 00000000..15be1732 --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/libgloss_%.bbappend @@ -0,0 +1,13 @@ +require microblaze-newlib.inc + +do_configure:prepend:microblaze() { + # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) + export CC="${CC} -L${S}/libgloss/microblaze" +} + +# Libgloss provides various .o files in libdir +# These must NOT be stripped, but for some reason they are installed +x +# which triggers them to be stripped. +do_install:append:microblaze() { + chmod 0644 ${D}${libdir}/*.o +} diff --git a/meta-microblaze/recipes-core/newlib/microblaze-newlib.inc b/meta-microblaze/recipes-core/newlib/microblaze-newlib.inc new file mode 100644 index 00000000..a1e3b92f --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/microblaze-newlib.inc @@ -0,0 +1,19 @@ +# Add MicroBlaze Patches +FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/files" +SRC_URI:append:microblaze = " \ + file://0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch \ + file://0002-Patch-microblaze-Modified-_exceptional_handler.patch \ + file://0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch \ + file://0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch \ + file://0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch \ + file://0006-MB-X-intial-commit.patch \ + file://0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch \ + file://0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch \ + file://0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch \ + file://0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch \ + file://0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch \ + " + +EXTRA_OECONF:append:xilinx-standalone:microblaze = " \ + --disable-newlib-reent-check-verify \ +" diff --git a/meta-microblaze/recipes-core/newlib/newlib_%.bbappend b/meta-microblaze/recipes-core/newlib/newlib_%.bbappend new file mode 100644 index 00000000..d30e61ec --- /dev/null +++ b/meta-microblaze/recipes-core/newlib/newlib_%.bbappend @@ -0,0 +1,7 @@ +require microblaze-newlib.inc + +do_configure:prepend:microblaze() { + # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) + export CC="${CC} -L${S}/libgloss/microblaze" +} + diff --git a/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend b/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend new file mode 100644 index 00000000..8be39fe2 --- /dev/null +++ b/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend @@ -0,0 +1,15 @@ +GOTOOLS:microblaze ?= "" +RUSTTOOLS:microblaze ?= "" +GSTEXAMPLES:microblaze ?= "" +X11GLTOOLS:microblaze ?= "" +3GTOOLS:microblaze ?= "" +KEXECTOOLS:microblaze = "" + +RDEPENDS:${PN}:remove:microblaze = "\ +alsa-utils-amixer \ +alsa-utils-aplay \ +ltp \ +connman-tools \ +connman-tests \ +connman-client \ +" diff --git a/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch b/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch new file mode 100644 index 00000000..88373e2b --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch @@ -0,0 +1,70 @@ +From 5c3f3f1b1b50d1e2a1a141943b94f08f19f59b6d Mon Sep 17 00:00:00 2001 +From: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> +Date: Sun, 11 Apr 2021 20:04:06 -0700 +Subject: [PATCH] Add systemd support for microblaze architecture + +Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> + +Applied to current version of systemd +Reworked to split microblaze and microblazeel + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/basic/architecture.c | 3 +++ + src/basic/architecture.h | 4 ++++ + 2 files changed, 7 insertions(+) + +Index: git/src/basic/architecture.c +=================================================================== +--- git.orig/src/basic/architecture.c ++++ git/src/basic/architecture.c +@@ -49,6 +49,10 @@ Architecture uname_architecture(void) { + #elif defined(__alpha__) + { "alpha" , ARCHITECTURE_ALPHA }, + ++#elif defined(__microblaze__) ++ { "microblaze", ARCHITECTURE_MICROBLAZE }, ++ { "microblazeel", ARCHITECTURE_MICROBLAZE_LE }, ++ + #elif defined(__arc__) + { "arc", ARCHITECTURE_ARC }, + { "arceb", ARCHITECTURE_ARC_BE }, +@@ -147,6 +151,8 @@ static const char *const architecture_ta + [ARCHITECTURE_ALPHA] = "alpha", + [ARCHITECTURE_ARC] = "arc", + [ARCHITECTURE_ARC_BE] = "arc-be", ++ [ARCHITECTURE_MICROBLAZE] = "microblaze", ++ [ARCHITECTURE_MICROBLAZE_LE] = "microblazeel", + [ARCHITECTURE_CRIS] = "cris", + [ARCHITECTURE_X86_64] = "x86-64", + [ARCHITECTURE_X86] = "x86", +Index: git/src/basic/architecture.h +=================================================================== +--- git.orig/src/basic/architecture.h ++++ git/src/basic/architecture.h +@@ -22,6 +22,8 @@ typedef enum { + ARCHITECTURE_IA64, + ARCHITECTURE_LOONGARCH64, + ARCHITECTURE_M68K, ++ ARCHITECTURE_MICROBLAZE, ++ ARCHITECTURE_MICROBLAZE_LE, + ARCHITECTURE_MIPS, + ARCHITECTURE_MIPS64, + ARCHITECTURE_MIPS64_LE, +@@ -239,6 +241,14 @@ Architecture uname_architecture(void); + # define native_architecture() ARCHITECTURE_ARC + # define LIB_ARCH_TUPLE "arc-linux" + # endif ++#elif defined(__microblaze__) ++# if __BYTE_ORDER == __BIG_ENDIAN ++# define native_architecture() ARCHITECTURE_MICROBLAZE ++# define LIB_ARCH_TUPLE "microblaze-linux" ++# else ++# define native_architecture() ARCHITECTURE_MICROBLAZE_LE ++# define LIB_ARCH_TUPLE "microblazeel-linux" ++# endif + #else + # error "Please register your architecture here!" + #endif diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch new file mode 100644 index 00000000..157b008a --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch @@ -0,0 +1,37 @@ +From ec286a0b613a9fa487be75b7c1c01e5c8ce62a1a Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Fri, 22 Sep 2023 11:01:16 -0600 +Subject: [PATCH] meson.build: Microblaze does not support stack-protector + +| cc1: warning: '-fstack-protector' not supported for this target +| ninja: build stopped: subcommand failed. + +Upstream-Status: Inappropriate [Configuration] + +Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> +--- + meson.build | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/meson.build b/meson.build +index 395eca1943..8b87c5b3a2 100644 +--- a/meson.build ++++ b/meson.build +@@ -405,14 +405,11 @@ possible_common_cc_flags = [ + + '-fdiagnostics-show-option', + '-fno-common', +- '-fstack-protector', +- '-fstack-protector-strong', + '-fstrict-flex-arrays', + '--param=ssp-buffer-size=4', + ] + + possible_common_link_flags = [ +- '-fstack-protector', + ] + + c_args = get_option('c_args') +-- +2.34.1 + diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch new file mode 100644 index 00000000..3862803b --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch @@ -0,0 +1,56 @@ +From 239d51b5b02ba766f34b3fce9803f8fd13097471 Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Fri, 22 Sep 2023 11:09:50 -0600 +Subject: [PATCH] macro-funcamental.h: Microblaze does not have atomic + functions + +For some reason the systemd developers decided that needed to hardcode +the usage of __atomic_exchange functions, however not all architectures +define this. Microblaze is one such architecture, so we fall back to +a less safe way of doing the same thing. A quick inspection of +the ONCE users show that even if we end up with a race condition the +worst expected behavior could be multiple log messages. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/fundamental/macro-fundamental.h | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h +index 1d49765fce..f45f55cdfe 100644 +--- a/src/fundamental/macro-fundamental.h ++++ b/src/fundamental/macro-fundamental.h +@@ -116,11 +116,28 @@ + * on this macro will run concurrently to all other code conditionalized + * the same way, there's no ordering or completion enforced. */ + #define ONCE __ONCE(UNIQ_T(_once_, UNIQ)) ++#if !defined (__microblaze__) + #define __ONCE(o) \ + ({ \ + static bool (o) = false; \ + __atomic_exchange_n(&(o), true, __ATOMIC_SEQ_CST); \ + }) ++#else ++ /* Microblaze does not contain __atomic_exchange_n*, so we do it ++ * the old fashioned way. Note, it's possible that ONCE may run more ++ * then ONCE due to possible races, however it is not expected to cause ++ * an issue with systemd usage. */ ++#define __ONCE(o) \ ++ ({ \ ++ static bool (o) = false; \ ++ bool rc = false; \ ++ if ((o) == false) { \ ++ (o) = true; \ ++ rc = true; \ ++ } \ ++ rc; \ ++ }) ++#endif + + #undef MAX + #define MAX(a, b) __MAX(UNIQ, (a), UNIQ, (b)) +-- +2.34.1 + diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch new file mode 100644 index 00000000..75e0300b --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch @@ -0,0 +1,804 @@ +From 2bd273c3a474b04b60c08c98fb7859fce28eac6d Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Fri, 22 Sep 2023 10:26:47 -0600 +Subject: [PATCH] syscalls-microblaze.txt: Add microblaze syscalls to systemd + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/basic/meson.build | 1 + + src/basic/missing_syscall_def.h | 33 ++ + src/basic/missing_syscalls.py | 2 + + src/basic/syscalls-microblaze.txt | 598 ++++++++++++++++++++++++++++++ + 4 files changed, 634 insertions(+) + create mode 100644 src/basic/syscalls-microblaze.txt + +diff --git a/src/basic/meson.build b/src/basic/meson.build +index 3af013b014..e77f7cef16 100644 +--- a/src/basic/meson.build ++++ b/src/basic/meson.build +@@ -190,6 +190,7 @@ arch_list = [ + 'ia64', + 'loongarch64', + 'm68k', ++ 'microblaze', + 'mips64', + 'mips64n32', + 'mipso32', +diff --git a/src/basic/missing_syscall_def.h b/src/basic/missing_syscall_def.h +index 402fdd00dc..94f41c1522 100644 +--- a/src/basic/missing_syscall_def.h ++++ b/src/basic/missing_syscall_def.h +@@ -16,6 +16,7 @@ + # elif defined(__ia64__) + # elif defined(__loongarch64) + # elif defined(__m68k__) ++# elif defined(__microblaze__) + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # elif _MIPS_SIM == _MIPS_SIM_NABI32 +@@ -59,6 +60,8 @@ + # define systemd_NR_bpf 280 + # elif defined(__m68k__) + # define systemd_NR_bpf 354 ++# elif defined(__microblaze__) ++# define systemd_NR_bpf 387 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_bpf 4355 +@@ -127,6 +130,8 @@ assert_cc(__NR_bpf == systemd_NR_bpf); + # define systemd_NR_close_range 436 + # elif defined(__m68k__) + # define systemd_NR_close_range 436 ++# elif defined(__microblaze__) ++# define systemd_NR_close_range 436 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_close_range 4436 +@@ -195,6 +200,8 @@ assert_cc(__NR_close_range == systemd_NR_close_range); + # define systemd_NR_copy_file_range 285 + # elif defined(__m68k__) + # define systemd_NR_copy_file_range 376 ++# elif defined(__microblaze__) ++# define systemd_NR_copy_file_range 392 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_copy_file_range 4360 +@@ -263,6 +270,8 @@ assert_cc(__NR_copy_file_range == systemd_NR_copy_file_range); + # define systemd_NR_getrandom 278 + # elif defined(__m68k__) + # define systemd_NR_getrandom 352 ++# elif defined(__microblaze__) ++# define systemd_NR_getrandom 385 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_getrandom 4353 +@@ -331,6 +340,8 @@ assert_cc(__NR_getrandom == systemd_NR_getrandom); + # define systemd_NR_memfd_create 279 + # elif defined(__m68k__) + # define systemd_NR_memfd_create 353 ++# elif defined(__microblaze__) ++# define systemd_NR_memfd_create 386 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_memfd_create 4354 +@@ -399,6 +410,8 @@ assert_cc(__NR_memfd_create == systemd_NR_memfd_create); + # define systemd_NR_mount_setattr 442 + # elif defined(__m68k__) + # define systemd_NR_mount_setattr 442 ++# elif defined(__microblaze__) ++# define systemd_NR_mount_setattr 442 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_mount_setattr 4442 +@@ -467,6 +480,8 @@ assert_cc(__NR_mount_setattr == systemd_NR_mount_setattr); + # define systemd_NR_move_mount 429 + # elif defined(__m68k__) + # define systemd_NR_move_mount 429 ++# elif defined(__microblaze__) ++# define systemd_NR_move_mount 429 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_move_mount 4429 +@@ -535,6 +550,8 @@ assert_cc(__NR_move_mount == systemd_NR_move_mount); + # define systemd_NR_name_to_handle_at 264 + # elif defined(__m68k__) + # define systemd_NR_name_to_handle_at 340 ++# elif defined(__microblaze__) ++# define systemd_NR_name_to_handle_at 371 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_name_to_handle_at 4339 +@@ -603,6 +620,8 @@ assert_cc(__NR_name_to_handle_at == systemd_NR_name_to_handle_at); + # define systemd_NR_open_tree 428 + # elif defined(__m68k__) + # define systemd_NR_open_tree 428 ++# elif defined(__microblaze__) ++# define systemd_NR_open_tree 428 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_open_tree 4428 +@@ -671,6 +690,8 @@ assert_cc(__NR_open_tree == systemd_NR_open_tree); + # define systemd_NR_openat2 437 + # elif defined(__m68k__) + # define systemd_NR_openat2 437 ++# elif defined(__microblaze__) ++# define systemd_NR_openat2 437 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_openat2 4437 +@@ -739,6 +760,8 @@ assert_cc(__NR_openat2 == systemd_NR_openat2); + # define systemd_NR_pidfd_open 434 + # elif defined(__m68k__) + # define systemd_NR_pidfd_open 434 ++# elif defined(__microblaze__) ++# define systemd_NR_pidfd_open 434 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_pidfd_open 4434 +@@ -807,6 +830,8 @@ assert_cc(__NR_pidfd_open == systemd_NR_pidfd_open); + # define systemd_NR_pidfd_send_signal 424 + # elif defined(__m68k__) + # define systemd_NR_pidfd_send_signal 424 ++# elif defined(__microblaze__) ++# define systemd_NR_pidfd_send_signal 424 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_pidfd_send_signal 4424 +@@ -875,6 +900,8 @@ assert_cc(__NR_pidfd_send_signal == systemd_NR_pidfd_send_signal); + # define systemd_NR_pkey_mprotect 288 + # elif defined(__m68k__) + # define systemd_NR_pkey_mprotect 381 ++# elif defined(__microblaze__) ++# define systemd_NR_pkey_mprotect 395 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_pkey_mprotect 4363 +@@ -943,6 +970,8 @@ assert_cc(__NR_pkey_mprotect == systemd_NR_pkey_mprotect); + # define systemd_NR_renameat2 276 + # elif defined(__m68k__) + # define systemd_NR_renameat2 351 ++# elif defined(__microblaze__) ++# define systemd_NR_renameat2 383 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_renameat2 4351 +@@ -1011,6 +1040,8 @@ assert_cc(__NR_renameat2 == systemd_NR_renameat2); + # define systemd_NR_setns 268 + # elif defined(__m68k__) + # define systemd_NR_setns 344 ++# elif defined(__microblaze__) ++# define systemd_NR_setns 375 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_setns 4344 +@@ -1079,6 +1110,8 @@ assert_cc(__NR_setns == systemd_NR_setns); + # define systemd_NR_statx 291 + # elif defined(__m68k__) + # define systemd_NR_statx 379 ++# elif defined(__microblaze__) ++# define systemd_NR_statx 398 + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_statx 4366 +diff --git a/src/basic/missing_syscalls.py b/src/basic/missing_syscalls.py +index 5ccf02adec..e09023abe1 100644 +--- a/src/basic/missing_syscalls.py ++++ b/src/basic/missing_syscalls.py +@@ -63,6 +63,8 @@ DEF_TEMPLATE_B = '''\ + # define systemd_NR_{syscall} {nr_loongarch64} + # elif defined(__m68k__) + # define systemd_NR_{syscall} {nr_m68k} ++# elif defined(__microblaze__) ++# define systemd_NR_{syscall} {nr_microblaze} + # elif defined(_MIPS_SIM) + # if _MIPS_SIM == _MIPS_SIM_ABI32 + # define systemd_NR_{syscall} {nr_mipso32} +diff --git a/src/basic/syscalls-microblaze.txt b/src/basic/syscalls-microblaze.txt +new file mode 100644 +index 0000000000..3fc4cd6aef +--- /dev/null ++++ b/src/basic/syscalls-microblaze.txt +@@ -0,0 +1,598 @@ ++_llseek 140 ++_newselect 142 ++_sysctl 149 ++accept 349 ++accept4 362 ++access 33 ++acct 51 ++add_key 286 ++adjtimex 124 ++alarm 27 ++arc_gettls ++arc_settls ++arc_usr_cmpxchg ++arch_prctl ++arm_fadvise64_64 ++atomic_barrier ++atomic_cmpxchg_32 ++bdflush 134 ++bind 347 ++bpf 387 ++brk 45 ++cachectl ++cacheflush ++capget 184 ++capset 185 ++chdir 12 ++chmod 15 ++chown 182 ++chown32 212 ++chroot 61 ++clock_adjtime 373 ++clock_adjtime64 405 ++clock_getres 266 ++clock_getres_time64 406 ++clock_gettime 265 ++clock_gettime64 403 ++clock_nanosleep 267 ++clock_nanosleep_time64 407 ++clock_settime 264 ++clock_settime64 404 ++clone 120 ++clone2 ++clone3 435 ++close 6 ++close_range 436 ++connect 350 ++copy_file_range 392 ++creat 8 ++create_module 127 ++delete_module 129 ++dipc ++dup 41 ++dup2 63 ++dup3 342 ++epoll_create 254 ++epoll_create1 341 ++epoll_ctl 255 ++epoll_ctl_old ++epoll_pwait 319 ++epoll_pwait2 441 ++epoll_wait 256 ++epoll_wait_old ++eventfd 323 ++eventfd2 340 ++exec_with_loader ++execv ++execve 11 ++execveat 388 ++exit 1 ++exit_group 252 ++faccessat 307 ++faccessat2 439 ++fadvise64 250 ++fadvise64_64 272 ++fallocate 324 ++fanotify_init 368 ++fanotify_mark 369 ++fchdir 133 ++fchmod 94 ++fchmodat 306 ++fchown 95 ++fchown32 207 ++fchownat 298 ++fcntl 55 ++fcntl64 221 ++fdatasync 148 ++fgetxattr 231 ++finit_module 380 ++flistxattr 234 ++flock 143 ++fork 2 ++fp_udfiex_crtl ++fremovexattr 237 ++fsconfig 431 ++fsetxattr 228 ++fsmount 432 ++fsopen 430 ++fspick 433 ++fstat 108 ++fstat64 197 ++fstatat64 300 ++fstatfs 100 ++fstatfs64 269 ++fsync 118 ++ftruncate 93 ++ftruncate64 194 ++futex 240 ++futex_time64 422 ++futimesat 299 ++get_kernel_syms 130 ++get_mempolicy 275 ++get_robust_list 312 ++get_thread_area 244 ++getcpu 318 ++getcwd 183 ++getdents 141 ++getdents64 220 ++getdomainname ++getdtablesize ++getegid 50 ++getegid32 202 ++geteuid 49 ++geteuid32 201 ++getgid 47 ++getgid32 200 ++getgroups 80 ++getgroups32 205 ++gethostname ++getitimer 105 ++getpagesize ++getpeername 352 ++getpgid 132 ++getpgrp 65 ++getpid 20 ++getpmsg 188 ++getppid 64 ++getpriority 96 ++getrandom 385 ++getresgid 171 ++getresgid32 211 ++getresuid 165 ++getresuid32 209 ++getrlimit 76 ++getrusage 77 ++getsid 147 ++getsockname 351 ++getsockopt 358 ++gettid 224 ++gettimeofday 78 ++getuid 24 ++getuid32 199 ++getunwind ++getxattr 229 ++getxgid ++getxpid ++getxuid ++idle 112 ++init_module 128 ++inotify_add_watch 292 ++inotify_init 291 ++inotify_init1 344 ++inotify_rm_watch 293 ++io_cancel 249 ++io_destroy 246 ++io_getevents 247 ++io_pgetevents 399 ++io_pgetevents_time64 416 ++io_setup 245 ++io_submit 248 ++io_uring_enter 426 ++io_uring_register 427 ++io_uring_setup 425 ++ioctl 54 ++ioperm 101 ++iopl 110 ++ioprio_get 290 ++ioprio_set 289 ++ipc 117 ++kcmp 379 ++kern_features ++kexec_file_load ++kexec_load 283 ++keyctl 288 ++kill 37 ++landlock_add_rule 445 ++landlock_create_ruleset 444 ++landlock_restrict_self 446 ++lchown 16 ++lchown32 198 ++lgetxattr 230 ++link 9 ++linkat 303 ++listen 348 ++listxattr 232 ++llistxattr 233 ++lookup_dcookie 253 ++lremovexattr 236 ++lseek 19 ++lsetxattr 227 ++lstat 107 ++lstat64 196 ++madvise 219 ++mbind 274 ++membarrier 390 ++memfd_create 386 ++memory_ordering ++migrate_pages 294 ++mincore 218 ++mkdir 39 ++mkdirat 296 ++mknod 14 ++mknodat 297 ++mlock 150 ++mlock2 391 ++mlockall 152 ++mmap 90 ++mmap2 192 ++modify_ldt 123 ++mount 21 ++mount_setattr 442 ++move_mount 429 ++move_pages 317 ++mprotect 125 ++mq_getsetattr 282 ++mq_notify 281 ++mq_open 277 ++mq_timedreceive 280 ++mq_timedreceive_time64 419 ++mq_timedsend 279 ++mq_timedsend_time64 418 ++mq_unlink 278 ++mremap 163 ++msgctl 331 ++msgget 332 ++msgrcv 333 ++msgsnd 334 ++msync 144 ++multiplexer ++munlock 151 ++munlockall 153 ++munmap 91 ++name_to_handle_at 371 ++nanosleep 162 ++newfstatat ++nfsservctl 169 ++nice 34 ++old_adjtimex ++old_getpagesize ++oldfstat 28 ++oldlstat 84 ++oldolduname 59 ++oldstat 18 ++oldumount ++olduname 109 ++open 5 ++open_by_handle_at 372 ++open_tree 428 ++openat 295 ++openat2 437 ++or1k_atomic ++osf_adjtime ++osf_afs_syscall ++osf_alt_plock ++osf_alt_setsid ++osf_alt_sigpending ++osf_asynch_daemon ++osf_audcntl ++osf_audgen ++osf_chflags ++osf_execve ++osf_exportfs ++osf_fchflags ++osf_fdatasync ++osf_fpathconf ++osf_fstat ++osf_fstatfs ++osf_fstatfs64 ++osf_fuser ++osf_getaddressconf ++osf_getdirentries ++osf_getdomainname ++osf_getfh ++osf_getfsstat ++osf_gethostid ++osf_getitimer ++osf_getlogin ++osf_getmnt ++osf_getrusage ++osf_getsysinfo ++osf_gettimeofday ++osf_kloadcall ++osf_kmodcall ++osf_lstat ++osf_memcntl ++osf_mincore ++osf_mount ++osf_mremap ++osf_msfs_syscall ++osf_msleep ++osf_mvalid ++osf_mwakeup ++osf_naccept ++osf_nfssvc ++osf_ngetpeername ++osf_ngetsockname ++osf_nrecvfrom ++osf_nrecvmsg ++osf_nsendmsg ++osf_ntp_adjtime ++osf_ntp_gettime ++osf_old_creat ++osf_old_fstat ++osf_old_getpgrp ++osf_old_killpg ++osf_old_lstat ++osf_old_open ++osf_old_sigaction ++osf_old_sigblock ++osf_old_sigreturn ++osf_old_sigsetmask ++osf_old_sigvec ++osf_old_stat ++osf_old_vadvise ++osf_old_vtrace ++osf_old_wait ++osf_oldquota ++osf_pathconf ++osf_pid_block ++osf_pid_unblock ++osf_plock ++osf_priocntlset ++osf_profil ++osf_proplist_syscall ++osf_reboot ++osf_revoke ++osf_sbrk ++osf_security ++osf_select ++osf_set_program_attributes ++osf_set_speculative ++osf_sethostid ++osf_setitimer ++osf_setlogin ++osf_setsysinfo ++osf_settimeofday ++osf_shmat ++osf_signal ++osf_sigprocmask ++osf_sigsendset ++osf_sigstack ++osf_sigwaitprim ++osf_sstk ++osf_stat ++osf_statfs ++osf_statfs64 ++osf_subsys_info ++osf_swapctl ++osf_swapon ++osf_syscall ++osf_sysinfo ++osf_table ++osf_uadmin ++osf_usleep_thread ++osf_uswitch ++osf_utc_adjtime ++osf_utc_gettime ++osf_utimes ++osf_utsname ++osf_wait4 ++osf_waitid ++pause 29 ++pciconfig_iobase ++pciconfig_read ++pciconfig_write ++perf_event_open 366 ++perfctr ++perfmonctl ++personality 136 ++pidfd_getfd 438 ++pidfd_open 434 ++pidfd_send_signal 424 ++pipe 42 ++pipe2 343 ++pivot_root 217 ++pkey_alloc 396 ++pkey_free 397 ++pkey_mprotect 395 ++poll 168 ++ppoll 309 ++ppoll_time64 414 ++prctl 172 ++pread64 180 ++preadv 363 ++preadv2 393 ++prlimit64 370 ++process_madvise 440 ++process_vm_readv 377 ++process_vm_writev 378 ++pselect6 308 ++pselect6_time64 413 ++ptrace 26 ++pwrite64 181 ++pwritev 364 ++pwritev2 394 ++query_module 167 ++quotactl 131 ++quotactl_path ++read 3 ++readahead 225 ++readdir 89 ++readlink 85 ++readlinkat 305 ++readv 145 ++reboot 88 ++recv 356 ++recvfrom 355 ++recvmmsg 367 ++recvmmsg_time64 417 ++recvmsg 361 ++remap_file_pages 257 ++removexattr 235 ++rename 38 ++renameat 302 ++renameat2 383 ++request_key 287 ++restart_syscall 0 ++riscv_flush_icache ++rmdir 40 ++rseq 400 ++rt_sigaction 174 ++rt_sigpending 176 ++rt_sigprocmask 175 ++rt_sigqueueinfo 178 ++rt_sigreturn 173 ++rt_sigsuspend 179 ++rt_sigtimedwait 177 ++rt_sigtimedwait_time64 421 ++rt_tgsigqueueinfo 365 ++rtas ++s390_guarded_storage ++s390_pci_mmio_read ++s390_pci_mmio_write ++s390_runtime_instr ++s390_sthyi ++sched_get_affinity ++sched_get_priority_max 159 ++sched_get_priority_min 160 ++sched_getaffinity 242 ++sched_getattr 382 ++sched_getparam 155 ++sched_getscheduler 157 ++sched_rr_get_interval 161 ++sched_rr_get_interval_time64 423 ++sched_set_affinity ++sched_setaffinity 241 ++sched_setattr 381 ++sched_setparam 154 ++sched_setscheduler 156 ++sched_yield 158 ++seccomp 384 ++select 82 ++semctl 328 ++semget 329 ++semop 330 ++semtimedop 325 ++semtimedop_time64 420 ++send 354 ++sendfile 187 ++sendfile64 239 ++sendmmsg 376 ++sendmsg 360 ++sendto 353 ++set_mempolicy 276 ++set_robust_list 311 ++set_thread_area 243 ++set_tid_address 258 ++setdomainname 121 ++setfsgid 139 ++setfsgid32 216 ++setfsuid 138 ++setfsuid32 215 ++setgid 46 ++setgid32 214 ++setgroups 81 ++setgroups32 206 ++sethae ++sethostname 74 ++setitimer 104 ++setns 375 ++setpgid 57 ++setpgrp ++setpriority 97 ++setregid 71 ++setregid32 204 ++setresgid 170 ++setresgid32 210 ++setresuid 164 ++setresuid32 208 ++setreuid 70 ++setreuid32 203 ++setrlimit 75 ++setsid 66 ++setsockopt 357 ++settimeofday 79 ++setuid 23 ++setuid32 213 ++setxattr 226 ++sgetmask 68 ++shmat 335 ++shmctl 336 ++shmdt 337 ++shmget 338 ++shutdown 359 ++sigaction 67 ++sigaltstack 186 ++signal 48 ++signalfd 321 ++signalfd4 339 ++sigpending 73 ++sigprocmask 126 ++sigreturn 119 ++sigsuspend 72 ++socket 345 ++socketcall 102 ++socketpair 346 ++splice 313 ++spu_create ++spu_run ++ssetmask 69 ++stat 106 ++stat64 195 ++statfs 99 ++statfs64 268 ++statx 398 ++stime 25 ++subpage_prot ++swapcontext ++swapoff 115 ++swapon 87 ++switch_endian ++symlink 83 ++symlinkat 304 ++sync 36 ++sync_file_range 314 ++sync_file_range2 ++syncfs 374 ++sys_debug_setcontext ++syscall ++sysfs 135 ++sysinfo 116 ++syslog 103 ++sysmips ++tee 315 ++tgkill 270 ++time 13 ++timer_create 259 ++timer_delete 263 ++timer_getoverrun 262 ++timer_gettime 261 ++timer_gettime64 408 ++timer_settime 260 ++timer_settime64 409 ++timerfd ++timerfd_create 322 ++timerfd_gettime 327 ++timerfd_gettime64 410 ++timerfd_settime 326 ++timerfd_settime64 411 ++times 43 ++tkill 238 ++truncate 92 ++truncate64 193 ++ugetrlimit 191 ++umask 60 ++umount 22 ++umount2 52 ++uname 122 ++unlink 10 ++unlinkat 301 ++unshare 310 ++uselib 86 ++userfaultfd 389 ++ustat 62 ++utime 30 ++utimensat 320 ++utimensat_time64 412 ++utimes 271 ++utrap_install ++vfork 190 ++vhangup 111 ++vm86 166 ++vm86old 113 ++vmsplice 316 ++wait4 114 ++waitid 284 ++waitpid 7 ++write 4 ++writev 146 +-- +2.34.1 + diff --git a/meta-microblaze/recipes-core/systemd/systemd_%.bbappend b/meta-microblaze/recipes-core/systemd/systemd_%.bbappend new file mode 100644 index 00000000..0d31eb8f --- /dev/null +++ b/meta-microblaze/recipes-core/systemd/systemd_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/files" +SRC_URI:append:microblaze = " \ + file://0001-architecture-Add-Microblaze-architecture-to-systemd-.patch \ + file://microblaze-syscalls.patch \ + file://microblaze-disable-stack-protector.patch \ + file://microblaze-once-macro.patch \ +" diff --git a/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch b/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch new file mode 100644 index 00000000..07712c98 --- /dev/null +++ b/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch @@ -0,0 +1,17 @@ +SECCOMP / Audit support needs to know about the microblaze architecture. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- util-linux-2.39.1/include/audit-arch.h.orig 2023-08-23 14:55:54.318732126 -0600 ++++ util-linux-2.39.1/include/audit-arch.h 2023-08-23 15:02:51.058552660 -0600 +@@ -57,6 +57,8 @@ + # else + # define SECCOMP_ARCH_NATIVE AUDIT_ARCH_LOONGARCH64 + # endif ++#elif __microblaze__ ++# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MICROBLAZE + #else + # error Unknown target architecture + #endif diff --git a/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend b/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend new file mode 100644 index 00000000..7774dda5 --- /dev/null +++ b/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/util-linux" +SRC_URI:append:microblaze = " file://util-linux-microblaze.patch" diff --git a/meta-microblaze/recipes-devtools/binutils/binutils-cross-canadian_%.bbappend b/meta-microblaze/recipes-devtools/binutils/binutils-cross-canadian_%.bbappend new file mode 100644 index 00000000..3d57ddbf --- /dev/null +++ b/meta-microblaze/recipes-devtools/binutils/binutils-cross-canadian_%.bbappend @@ -0,0 +1,4 @@ +MICROBLAZEPATCHES = "" +MICROBLAZEPATCHES:microblaze = "binutils-microblaze.inc" + +require ${MICROBLAZEPATCHES} diff --git a/meta-microblaze/recipes-devtools/binutils/binutils-cross_%.bbappend b/meta-microblaze/recipes-devtools/binutils/binutils-cross_%.bbappend new file mode 100644 index 00000000..3d57ddbf --- /dev/null +++ b/meta-microblaze/recipes-devtools/binutils/binutils-cross_%.bbappend @@ -0,0 +1,4 @@ +MICROBLAZEPATCHES = "" +MICROBLAZEPATCHES:microblaze = "binutils-microblaze.inc" + +require ${MICROBLAZEPATCHES} diff --git a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc new file mode 100644 index 00000000..3701d245 --- /dev/null +++ b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:append := ":${THISDIR}/binutils" + +LDGOLD_ALTS:microblaze = "" +USE_ALTERNATIVES_FOR:remove:microblaze = "gprof" diff --git a/meta-microblaze/recipes-devtools/binutils/binutils_%.bbappend b/meta-microblaze/recipes-devtools/binutils/binutils_%.bbappend new file mode 100644 index 00000000..3d57ddbf --- /dev/null +++ b/meta-microblaze/recipes-devtools/binutils/binutils_%.bbappend @@ -0,0 +1,4 @@ +MICROBLAZEPATCHES = "" +MICROBLAZEPATCHES:microblaze = "binutils-microblaze.inc" + +require ${MICROBLAZEPATCHES} diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc b/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc new file mode 100644 index 00000000..0dbbecad --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc @@ -0,0 +1,114 @@ +require gcc-common.inc + +# Third digit in PV should be incremented after a minor release + +PV = "12.2.0" + +# BINV should be incremented to a revision after a minor gcc release + +BINV = "12.2.0" + +FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:" + +DEPENDS =+ "mpfr gmp libmpc zlib flex-native" +NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native" + +LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only" + +LIC_FILES_CHKSUM = "\ + file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ + file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \ + file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \ + file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \ +" +# from git +#RELEASE ?= "7092b7aea122a91824d048aeb23834cf1d19b1a1" +#BASEURI ?= "https://repo.or.cz/official-gcc.git/snapshot/${RELEASE}.tar.gz;downloadfilename=gcc-${PV}-${RELEASE}.tar.gz" +#SOURCEDIR ?= "official-gcc-${@'${RELEASE}'[0:7]}" + +# from snapshot +#RELEASE ?= "12.1.0-RC-20220429" +#SOURCEDIR ?= "gcc-${RELEASE}" +#BASEURI ?= "https://gcc.gnu.org/pub/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz" + +# official release +RELEASE ?= "${PV}" +BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz" +SOURCEDIR ?= "gcc-${PV}" + +SRC_URI = "${BASEURI} \ + file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \ + file://0002-gcc-poison-system-directories.patch \ + file://0003-64-bit-multilib-hack.patch \ + file://0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch \ + file://0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \ + file://0006-cpp-honor-sysroot.patch \ + file://0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \ + file://0008-libtool.patch \ + file://0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \ + file://0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch \ + file://0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \ + file://0013-Ensure-target-gcc-headers-can-be-included.patch \ + file://0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch \ + file://0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch \ + file://0016-handle-sysroot-support-for-nativesdk-gcc.patch \ + file://0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch \ + file://0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \ + file://0019-Re-introduce-spe-commandline-options.patch \ + file://0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \ + file://0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \ + file://0023-libatomic-Do-not-enforce-march-on-aarch64.patch \ + file://0024-Fix-install-path-of-linux64.h.patch \ + file://0026-rust-recursion-limit.patch \ + file://prefix-map-realpath.patch \ + file://hardcoded-paths.patch \ +" +SRC_URI[sha256sum] = "e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff" + +S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}" +B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" + +# Language Overrides +FORTRAN = "" +JAVA = "" + +SSP ?= "--disable-libssp" +SSP:mingw32 = "--enable-libssp" + +EXTRA_OECONF_BASE = "\ + ${SSP} \ + --enable-libitm \ + --enable-lto \ + --disable-bootstrap \ + --with-system-zlib \ + ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \ + --enable-linker-build-id \ + --with-ppl=no \ + --with-cloog=no \ + --enable-checking=release \ + --enable-cheaders=c_global \ + --without-isl \ +" + +EXTRA_OECONF_INITIAL = "\ + --disable-libgomp \ + --disable-libitm \ + --disable-libquadmath \ + --with-system-zlib \ + --disable-lto \ + --disable-plugin \ + --enable-linker-build-id \ + --enable-decimal-float=no \ + --without-isl \ + --disable-libssp \ +" + +EXTRA_OECONF_PATHS = "\ + --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \ + --with-sysroot=/not/exist \ + --with-build-sysroot=${STAGING_DIR_TARGET} \ +" + +# Is a binutils 2.26 issue, not gcc +CVE_CHECK_IGNORE += "CVE-2021-37322" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch new file mode 100644 index 00000000..f8985752 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch @@ -0,0 +1,37 @@ +From 376b0ee790231a99fe50b50e20070c104bbba0d8 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 11 Jan 2017 13:13:57 +0530 +Subject: [PATCH 01/53] LOCAL]: Testsuite - builtins tests require fpic +Upstream-Status: Pending + + Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> + +Conflicts: + + gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp +--- + gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp +index fb47f51f90c..d9ecf045554 100644 +--- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp ++++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp +@@ -48,6 +48,14 @@ if { [istarget *-*-eabi*] + lappend additional_flags "-Wl,--allow-multiple-definition" + } + ++<<<<<<< HEAD ++======= ++if [istarget "microblaze*-*-linux*"] { ++ lappend additional_flags "-Wl,-zmuldefs" ++ lappend additional_flags "-fPIC" ++} ++ ++>>>>>>> 6ef6e5b... [LOCAL]: Testsuite - builtins tests require fpic + foreach src [lsort [find $srcdir/$subdir *.c]] { + if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} { + c-torture-execute [list $src \ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch new file mode 100644 index 00000000..5302b942 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch @@ -0,0 +1,33 @@ +From b1aea8e71692065497ee3e9be5a9f1fccecf5685 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 11 Jan 2017 14:31:10 +0530 +Subject: [PATCH 02/53] [LOCAL]: Quick fail g++.dg/opt/memcpy1.C This + particular testcase fails with a timeout. Instead, fail it at compile-time + for microblaze. This speeds up the testsuite without removing it from the + FAIL reports. + +Upstream-Status: Pending + +Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> +--- + gcc/testsuite/g++.dg/opt/memcpy1.C | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/gcc/testsuite/g++.dg/opt/memcpy1.C b/gcc/testsuite/g++.dg/opt/memcpy1.C +index 3862756083d..db9f990f781 100644 +--- a/gcc/testsuite/g++.dg/opt/memcpy1.C ++++ b/gcc/testsuite/g++.dg/opt/memcpy1.C +@@ -4,6 +4,10 @@ + // { dg-do compile } + // { dg-options "-O" } + ++#if defined (__MICROBLAZE__) ++#error "too slow on mb. Investigate." ++#endif ++ + typedef unsigned char uint8_t; + typedef uint8_t uint8; + __extension__ typedef __SIZE_TYPE__ size_t; +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch new file mode 100644 index 00000000..89fe0ff6 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch @@ -0,0 +1,37 @@ +From af78edb2cb91c55f54ac2d720cee9871da13b845 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 11 Jan 2017 15:46:28 +0530 +Subject: [PATCH 03/53] [LOCAL]: For dejagnu static testing on qemu, suppress + warnings about multiple definitions from the test function and libc in line + with method used by powerpc. Dynamic linking and using a qemu binary which + understands sysroot resolves all test failures with builtins + +Upstream-Status: Pending + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp +index d9ecf045554..d6c2b04f286 100644 +--- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp ++++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp +@@ -48,14 +48,10 @@ if { [istarget *-*-eabi*] + lappend additional_flags "-Wl,--allow-multiple-definition" + } + +-<<<<<<< HEAD +-======= + if [istarget "microblaze*-*-linux*"] { + lappend additional_flags "-Wl,-zmuldefs" +- lappend additional_flags "-fPIC" + } + +->>>>>>> 6ef6e5b... [LOCAL]: Testsuite - builtins tests require fpic + foreach src [lsort [find $srcdir/$subdir *.c]] { + if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} { + c-torture-execute [list $src \ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch new file mode 100644 index 00000000..39c9c17e --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch @@ -0,0 +1,37 @@ +From 34b7dd28e3fe40f55ec7f6df3f000dd797d6c1cc Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 11 Jan 2017 15:50:35 +0530 +Subject: [PATCH 04/53] [Patch, testsuite]: Add MicroBlaze to target-supports + for atomic buil. .tin tests + +MicroBlaze added to supported targets for atomic builtin tests. + +Changelog/testsuite + +2014-02-14 David Holsgrove <david.holsgrove@xilinx.com> + + * gcc/testsuite/lib/target-supports.exp: Add microblaze to + check_effective_target_sync_int_long. + +Upstream-Status: Pending + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + gcc/testsuite/lib/target-supports.exp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp +index 244fe2306f4..c19f251f0d2 100644 +--- a/gcc/testsuite/lib/target-supports.exp ++++ b/gcc/testsuite/lib/target-supports.exp +@@ -8639,6 +8639,7 @@ proc check_effective_target_sync_int_long { } { + && [check_effective_target_arm_acq_rel]) + || [istarget bfin*-*linux*] + || [istarget hppa*-*linux*] ++ || [istarget microblaze*-*linux*] + || [istarget s390*-*-*] + || [istarget powerpc*-*-*] + || [istarget cris-*-*] +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch new file mode 100644 index 00000000..d127a03e --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch @@ -0,0 +1,38 @@ +From 2d0b5d68aff95a95dfb4ed0b207849658502bd53 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 11 Jan 2017 16:20:01 +0530 +Subject: [PATCH 05/53] [Patch, testsuite]: Update MicroBlaze strings test for + new scan-assembly output resulting in use of $LC label + +ChangeLog/testsuite + +2014-02-14 David Holsgrove <david.holsgrove@xilinx.com> + + * gcc/testsuite/gcc.target/microblaze/others/strings1.c: Update + to include $LC label. + +Upstream-Status: Pending + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + gcc/testsuite/gcc.target/microblaze/others/strings1.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/gcc/testsuite/gcc.target/microblaze/others/strings1.c b/gcc/testsuite/gcc.target/microblaze/others/strings1.c +index efaf3c660ea..347872360d3 100644 +--- a/gcc/testsuite/gcc.target/microblaze/others/strings1.c ++++ b/gcc/testsuite/gcc.target/microblaze/others/strings1.c +@@ -3,6 +3,10 @@ + /* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),\\\$LC.*" } } */ + /* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),*" } } */ + ++/* { dg-final { scan-assembler "\.rodata*" } } */ ++/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),\\\$LC.*" } } */ ++/* { dg-final { scan-assembler "\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),*" } } */ ++ + #include <string.h> + + extern void somefunc (char *); +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch new file mode 100644 index 00000000..3c412471 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch @@ -0,0 +1,69 @@ +From 20b6479f240bfebb46daad06839286a7abcff56c Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Thu, 12 Jan 2017 16:14:15 +0530 +Subject: [PATCH 06/53] [Patch, testsuite]: Allow MicroBlaze .weakext pattern + in regex match Extend regex pattern to include optional ext at the end of + .weak to match the MicroBlaze weak label .weakext + +ChangeLog/testsuite + +2014-02-14 David Holsgrove <david.holsgrove@xilinx.com> + + * gcc/testsuite/g++.dg/abi/rtti3.C: Extend scan-assembler + pattern to take optional ext after .weak. + * gcc/testsuite/g++.dg/abi/thunk4.C: Likewise. + +Upstream-Status: Pending + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> + +Conflicts: + + gcc/testsuite/g++.dg/abi/rtti3.C +--- + gcc/testsuite/g++.dg/abi/rtti3.C | 4 ++-- + gcc/testsuite/g++.dg/abi/thunk3.C | 2 +- + gcc/testsuite/g++.dg/abi/thunk4.C | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/gcc/testsuite/g++.dg/abi/rtti3.C b/gcc/testsuite/g++.dg/abi/rtti3.C +index 0cc7d3e79d0..f284cd9255c 100644 +--- a/gcc/testsuite/g++.dg/abi/rtti3.C ++++ b/gcc/testsuite/g++.dg/abi/rtti3.C +@@ -3,8 +3,8 @@ + + // { dg-require-weak "" } + // { dg-skip-if "Linkonce not weak" { *-*-mingw* *-*-cygwin } } +-// { dg-final { scan-assembler ".weak\[ \t\]_?_ZTSPP1A" { target { ! { *-*-darwin* hppa*-*-hpux* } } } } } +-// { dg-final { scan-assembler-not ".weak\[ \t\]_?_ZTIPP1A" { target { ! { *-*-darwin* } } } } } ++// { dg-final { scan-assembler ".weak(ext)?\[ \t\]_?_ZTSPP1A" { target { ! { *-*-darwin* } } } } } ++// { dg-final { scan-assembler-not ".weak(ext)?\[ \t\]_?_ZTIPP1A" { target { ! { *-*-darwin* } } } } } + // { dg-final { scan-assembler ".weak_definition\[ \t\]_?_ZTSPP1A" { target { *-*-darwin* } } } } + // { dg-final { scan-assembler-not ".weak_definition\[ \t\]_?_ZTIPP1A" { target { *-*-darwin* } } } } + +diff --git a/gcc/testsuite/g++.dg/abi/thunk3.C b/gcc/testsuite/g++.dg/abi/thunk3.C +index f2347f79ecd..dcec8a771a1 100644 +--- a/gcc/testsuite/g++.dg/abi/thunk3.C ++++ b/gcc/testsuite/g++.dg/abi/thunk3.C +@@ -1,5 +1,5 @@ + // { dg-require-weak "" } +-// { dg-final { scan-assembler-not ".weak\[\t \]_?_ZThn._N7Derived3FooEv" { target { ! { *-*-darwin* } } } } } ++// { dg-final { scan-assembler-not ".weak(ext)?\[\t \]_?_ZThn._N7Derived3FooEv" { target { ! { *-*-darwin* } } } } } + // { dg-final { scan-assembler-not ".weak_definition\[\t \]_?_ZThn._N7Derived3FooEv" { target { *-*-darwin* } } } } + + struct Base +diff --git a/gcc/testsuite/g++.dg/abi/thunk4.C b/gcc/testsuite/g++.dg/abi/thunk4.C +index 6e8f124bc5e..d1d34fe1e4a 100644 +--- a/gcc/testsuite/g++.dg/abi/thunk4.C ++++ b/gcc/testsuite/g++.dg/abi/thunk4.C +@@ -1,6 +1,6 @@ + // { dg-require-weak "" } + // { dg-skip-if "Linkonce not weak" { *-*-mingw* *-*-cygwin } } +-// { dg-final { scan-assembler ".weak\[ \t\]_?_ZThn._N7Derived3FooEv" { target { ! { *-*-darwin* } } } } } ++// { dg-final { scan-assembler ".weak(ext)?\[ \t\]_?_ZThn._N7Derived3FooEv" { target { ! { *-*-darwin* } } } } } + // { dg-final { scan-assembler ".weak_definition\[ \t\]_?_ZThn._N7Derived3FooEv" { target { *-*-darwin* } } } } + + struct Base +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch new file mode 100644 index 00000000..89d3b75a --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch @@ -0,0 +1,30 @@ +From 0efefd8ac71dd084c745402afdf07319de9774c6 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Thu, 12 Jan 2017 16:34:27 +0530 +Subject: [PATCH 07/53] [Patch, testsuite]: Add MicroBlaze to + check_profiling_available Testsuite, add microblaze*-*-* target in + check_profiling_available inline with other archs setting + profiling_available_saved to 0 + +Upstream-Status: Pending + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + gcc/testsuite/lib/target-supports.exp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp +index c19f251f0d2..c136c93e673 100644 +--- a/gcc/testsuite/lib/target-supports.exp ++++ b/gcc/testsuite/lib/target-supports.exp +@@ -729,6 +729,7 @@ proc check_profiling_available { test_what } { + || [istarget m68k-*-elf] + || [istarget m68k-*-uclinux*] + || [istarget mips*-*-elf*] ++ || [istarget microblaze*-*-*] + || [istarget mmix-*-*] + || [istarget mn10300-*-elf*] + || [istarget moxie-*-elf*] +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch new file mode 100644 index 00000000..21747726 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch @@ -0,0 +1,70 @@ +From 42ab0f7a2e6834feed456d00b3e2ec0ae2532a41 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Thu, 12 Jan 2017 16:41:43 +0530 +Subject: [PATCH 08/53] [Patch, microblaze]: Fix atomic side effects. In + atomic_compare_and_swapsi, add side effects to prevent incorrect assumptions + during optimization. Previously, the outputs were considered unused; this + generated assembly code with undefined side effects after invocation of the + atomic. + +Upstream-Status: Pending + +Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com> +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> + +Conflicts: + gcc/config/microblaze/microblaze.md +--- + gcc/config/microblaze/microblaze.md | 3 +++ + gcc/config/microblaze/sync.md | 21 +++++++++++++-------- + 2 files changed, 16 insertions(+), 8 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 0765ff930c6..ea7f74f1dff 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -43,6 +43,9 @@ + (UNSPEC_TLS 106) ;; jump table + (UNSPEC_SET_TEXT 107) ;; set text start + (UNSPEC_TEXT 108) ;; data text relative ++ (UNSPECV_CAS_BOOL 201) ;; compare and swap (bool) ++ (UNSPECV_CAS_VAL 202) ;; compare and swap (val) ++ (UNSPECV_CAS_MEM 203) ;; compare and swap (mem) + ]) + + (define_c_enum "unspec" [ +diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md +index ae8955ce691..77c3ce8ff27 100644 +--- a/gcc/config/microblaze/sync.md ++++ b/gcc/config/microblaze/sync.md +@@ -18,14 +18,19 @@ + ;; <http://www.gnu.org/licenses/>. + + (define_insn "atomic_compare_and_swapsi" +- [(match_operand:SI 0 "register_operand" "=&d") ;; bool output +- (match_operand:SI 1 "register_operand" "=&d") ;; val output +- (match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory +- (match_operand:SI 3 "register_operand" "d") ;; expected value +- (match_operand:SI 4 "register_operand" "d") ;; desired value +- (match_operand:SI 5 "const_int_operand" "") ;; is_weak +- (match_operand:SI 6 "const_int_operand" "") ;; mod_s +- (match_operand:SI 7 "const_int_operand" "") ;; mod_f ++ [(set (match_operand:SI 0 "register_operand" "=&d") ;; bool output ++ (unspec_volatile:SI ++ [(match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory ++ (match_operand:SI 3 "register_operand" "d") ;; expected value ++ (match_operand:SI 4 "register_operand" "d")] ;; desired value ++ UNSPECV_CAS_BOOL)) ++ (set (match_operand:SI 1 "register_operand" "=&d") ;; val output ++ (unspec_volatile:SI [(const_int 0)] UNSPECV_CAS_VAL)) ++ (set (match_dup 2) ++ (unspec_volatile:SI [(const_int 0)] UNSPECV_CAS_MEM)) ++ (match_operand:SI 5 "const_int_operand" "") ;; is_weak ++ (match_operand:SI 6 "const_int_operand" "") ;; mod_s ++ (match_operand:SI 7 "const_int_operand" "") ;; mod_f + (clobber (match_scratch:SI 8 "=&d"))] + "" + { +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch new file mode 100644 index 00000000..97f35569 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch @@ -0,0 +1,42 @@ +From a1b8136a157c549f0f65c14d628e694310ca0d23 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Thu, 12 Jan 2017 16:45:45 +0530 +Subject: [PATCH 09/53] [Patch, microblaze]: Fix atomic boolean return value. + In atomic_compare_and_swapsi, fix boolean return value. Previously, it + contained zero if successful and non-zero if unsuccessful. + +Upstream-Status: Pending + +Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com> +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + gcc/config/microblaze/sync.md | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md +index 77c3ce8ff27..573ce4765a0 100644 +--- a/gcc/config/microblaze/sync.md ++++ b/gcc/config/microblaze/sync.md +@@ -34,15 +34,16 @@ + (clobber (match_scratch:SI 8 "=&d"))] + "" + { +- output_asm_insn ("addc \tr0,r0,r0", operands); ++ output_asm_insn ("add \t%0,r0,r0", operands); + output_asm_insn ("lwx \t%1,%y2,r0", operands); + output_asm_insn ("addic\t%8,r0,0", operands); + output_asm_insn ("bnei \t%8,.-8", operands); +- output_asm_insn ("cmp \t%0,%1,%3", operands); +- output_asm_insn ("bnei \t%0,.+16", operands); ++ output_asm_insn ("cmp \t%8,%1,%3", operands); ++ output_asm_insn ("bnei \t%8,.+20", operands); + output_asm_insn ("swx \t%4,%y2,r0", operands); + output_asm_insn ("addic\t%8,r0,0", operands); + output_asm_insn ("bnei \t%8,.-28", operands); ++ output_asm_insn ("addi \t%0,r0,1", operands); + return ""; + } + ) +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch new file mode 100644 index 00000000..62bb02a9 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch @@ -0,0 +1,38 @@ +From 1ab5b8af098d100a1d7af05cca680b3c7181549d Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Thu, 12 Jan 2017 16:50:17 +0530 +Subject: [PATCH 10/53] [Patch, microblaze]: Fix the Microblaze crash with + msmall-divides flag Compiler is crashing when we use msmall-divides and + mxl-barrel-shift flag. This is because when use above flags + microblaze_expand_divide function will be called for division operation. In + microblaze_expand_divide function we are using sub_reg but MicroBlaze doesn't + have subreg register due to this compiler was crashing. Changed the logic to + avoid sub_reg call + +Upstream-Status: Pending + +Signed-off-by:Nagaraju Mekala <nmekala@xilix.com> + +Conflicts: + gcc/config/microblaze/microblaze.c +--- + gcc/config/microblaze/microblaze.cc | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index f32effecfb6..6922dd94af7 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -3710,8 +3710,7 @@ microblaze_expand_divide (rtx operands[]) + mem_rtx = gen_rtx_MEM (QImode, + gen_rtx_PLUS (Pmode, regt1, div_table_rtx)); + +- insn = emit_insn (gen_movqi (regqi, mem_rtx)); +- insn = emit_insn (gen_movsi (operands[0], gen_rtx_SUBREG (SImode, regqi, 0))); ++ insn = emit_insn (gen_zero_extendqisi2(operands[0],mem_rtx)); + jump = emit_jump_insn_after (gen_jump (div_end_label), insn); + JUMP_LABEL (jump) = div_end_label; + LABEL_NUSES (div_end_label) = 1; +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch new file mode 100644 index 00000000..09ebfca6 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch @@ -0,0 +1,50 @@ +From 7dd4ae2ad891094aa85a907b168cbdce744789e9 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Thu, 12 Jan 2017 16:52:56 +0530 +Subject: [PATCH 11/53] [Patch, microblaze]: Added ashrsi3_with_size_opt Added + ashrsi3_with_size_opt pattern to optimize the sra instructions when the -Os + optimization is used. lshrsi3_with_size_opt is being removed as it has + conflicts with unsigned int variables + +Upstream-Status: Pending + +Signed-off-by:Nagaraju Mekala <nmekala@xilix.com> +--- + gcc/config/microblaze/microblaze.md | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index ea7f74f1dff..9fbb3113f3c 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -1508,6 +1508,27 @@ + (set_attr "length" "4,4")] + ) + ++(define_insn "*ashrsi3_with_size_opt" ++ [(set (match_operand:SI 0 "register_operand" "=&d") ++ (ashiftrt:SI (match_operand:SI 1 "register_operand" "d") ++ (match_operand:SI 2 "immediate_operand" "I")))] ++ "(INTVAL (operands[2]) > 5 && optimize_size)" ++ { ++ operands[3] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM); ++ ++ output_asm_insn ("ori\t%3,r0,%2", operands); ++ if (REGNO (operands[0]) != REGNO (operands[1])) ++ output_asm_insn ("addk\t%0,%1,r0", operands); ++ ++ output_asm_insn ("addik\t%3,%3,-1", operands); ++ output_asm_insn ("bneid\t%3,.-4", operands); ++ return "sra\t%0,%0"; ++ } ++ [(set_attr "type" "arith") ++ (set_attr "mode" "SI") ++ (set_attr "length" "20")] ++) ++ + (define_insn "*ashrsi_inline" + [(set (match_operand:SI 0 "register_operand" "=&d") + (ashiftrt:SI (match_operand:SI 1 "register_operand" "d") +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch new file mode 100644 index 00000000..c26d46d4 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch @@ -0,0 +1,28 @@ +From 12d7e086376916ef61e2c48639671fd0f7c8fbbf Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 17 Jan 2017 10:57:19 +0530 +Subject: [PATCH 12/53] [Patch, microblaze]: Use bralid for profiler calls +Upstream-Status: Pending + + Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> + +--- + gcc/config/microblaze/microblaze.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index d28bc766de8..cd544f2030e 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -486,7 +486,7 @@ typedef struct microblaze_args + + #define FUNCTION_PROFILER(FILE, LABELNO) { \ + { \ +- fprintf (FILE, "\tbrki\tr16,_mcount\n"); \ ++ fprintf (FILE, "\tbralid\tr15,_mcount\nnop\n"); \ + } \ + } + +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch new file mode 100644 index 00000000..8739e6ea --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch @@ -0,0 +1,162 @@ +From cd8c9f3c43b266628d1585b74fc78f3e34a33c44 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Thu, 12 Jan 2017 17:36:16 +0530 +Subject: [PATCH 13/53] [Patch, microblaze]: Removed moddi3 routinue Using the + default moddi3 function as the existing implementation has many bugs + +Upstream-Status: Pending + +Signed-off-by:Nagaraju <nmekala@xilix.com> + +Conflicts: + libgcc/config/microblaze/moddi3.S +--- + libgcc/config/microblaze/moddi3.S | 121 -------------------------- + libgcc/config/microblaze/t-microblaze | 3 +- + 2 files changed, 1 insertion(+), 123 deletions(-) + delete mode 100644 libgcc/config/microblaze/moddi3.S + +diff --git a/libgcc/config/microblaze/moddi3.S b/libgcc/config/microblaze/moddi3.S +deleted file mode 100644 +index 9b77865df38..00000000000 +--- a/libgcc/config/microblaze/moddi3.S ++++ /dev/null +@@ -1,121 +0,0 @@ +-################################### +-# +-# Copyright (C) 2009-2022 Free Software Foundation, Inc. +-# +-# Contributed by Michael Eager <eager@eagercon.com>. +-# +-# This file is free software; you can redistribute it and/or modify it +-# under the terms of the GNU General Public License as published by the +-# Free Software Foundation; either version 3, or (at your option) any +-# later version. +-# +-# GCC is distributed in the hope that it will be useful, but WITHOUT +-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +-# License for more details. +-# +-# Under Section 7 of GPL version 3, you are granted additional +-# permissions described in the GCC Runtime Library Exception, version +-# 3.1, as published by the Free Software Foundation. +-# +-# You should have received a copy of the GNU General Public License and +-# a copy of the GCC Runtime Library Exception along with this program; +-# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +-# <http://www.gnu.org/licenses/>. +-# +-# modsi3.S +-# +-# modulo operation for 64 bit integers. +-# +-####################################### +- +- +-/* An executable stack is *not* required for these functions. */ +-#ifdef __linux__ +-.section .note.GNU-stack,"",%progbits +-.previous +-#endif +- +- .globl __moddi3 +- .ent __moddi3 +-__moddi3: +- .frame r1,0,r15 +- +-#Change the stack pointer value and Save callee saved regs +- addik r1,r1,-24 +- swi r25,r1,0 +- swi r26,r1,4 +- swi r27,r1,8 # used for sign +- swi r28,r1,12 # used for loop count +- swi r29,r1,16 # Used for div value High +- swi r30,r1,20 # Used for div value Low +- +-#Check for Zero Value in the divisor/dividend +- OR r9,r5,r6 # Check for the op1 being zero +- BEQID r9,$LaResult_Is_Zero # Result is zero +- OR r9,r7,r8 # Check for the dividend being zero +- BEQI r9,$LaDiv_By_Zero # Div_by_Zero # Division Error +- BGEId r5,$La1_Pos +- XOR r27,r5,r7 # Get the sign of the result +- RSUBI r6,r6,0 # Make dividend positive +- RSUBIC r5,r5,0 # Make dividend positive +-$La1_Pos: +- BGEI r7,$La2_Pos +- RSUBI r8,r8,0 # Make Divisor Positive +- RSUBIC r9,r9,0 # Make Divisor Positive +-$La2_Pos: +- ADDIK r4,r0,0 # Clear mod low +- ADDIK r3,r0,0 # Clear mod high +- ADDIK r29,r0,0 # clear div high +- ADDIK r30,r0,0 # clear div low +- ADDIK r28,r0,64 # Initialize the loop count +- # First part try to find the first '1' in the r5/r6 +-$LaDIV1: +- ADD r6,r6,r6 +- ADDC r5,r5,r5 # left shift logical r5 +- BGEID r5,$LaDIV1 +- ADDIK r28,r28,-1 +-$LaDIV2: +- ADD r6,r6,r6 +- ADDC r5,r5,r5 # left shift logical r5/r6 get the '1' into the Carry +- ADDC r4,r4,r4 # Move that bit into the Mod register +- ADDC r3,r3,r3 # Move carry into high mod register +- rsub r18,r7,r3 # Compare the High Parts of Mod and Divisor +- bnei r18,$L_High_EQ +- rsub r18,r6,r4 # Compare Low Parts only if Mod[h] == Divisor[h] +-$L_High_EQ: +- rSUB r26,r8,r4 # Subtract divisor[L] from Mod[L] +- rsubc r25,r7,r3 # Subtract divisor[H] from Mod[H] +- BLTi r25,$LaMOD_TOO_SMALL +- OR r3,r0,r25 # move r25 to mod [h] +- OR r4,r0,r26 # move r26 to mod [l] +- ADDI r30,r30,1 +- ADDC r29,r29,r0 +-$LaMOD_TOO_SMALL: +- ADDIK r28,r28,-1 +- BEQi r28,$LaLOOP_END +- ADD r30,r30,r30 # Shift in the '1' into div [low] +- ADDC r29,r29,r29 # Move the carry generated into high +- BRI $LaDIV2 # Div2 +-$LaLOOP_END: +- BGEI r27,$LaRETURN_HERE +- rsubi r30,r30,0 +- rsubc r29,r29,r0 +- BRI $LaRETURN_HERE +-$LaDiv_By_Zero: +-$LaResult_Is_Zero: +- or r29,r0,r0 # set result to 0 [High] +- or r30,r0,r0 # set result to 0 [Low] +-$LaRETURN_HERE: +-# Restore values of CSRs and that of r29 and the divisor and the dividend +- +- lwi r25,r1,0 +- lwi r26,r1,4 +- lwi r27,r1,8 +- lwi r28,r1,12 +- lwi r29,r1,16 +- lwi r30,r1,20 +- rtsd r15,8 +- addik r1,r1,24 +- .end __moddi3 +- +diff --git a/libgcc/config/microblaze/t-microblaze b/libgcc/config/microblaze/t-microblaze +index 96959f0292b..8d954a49575 100644 +--- a/libgcc/config/microblaze/t-microblaze ++++ b/libgcc/config/microblaze/t-microblaze +@@ -1,8 +1,7 @@ +-LIB2FUNCS_EXCLUDE += _divsi3 _modsi3 _moddi3 _mulsi3 _udivsi3 _umodsi3 ++LIB2FUNCS_EXCLUDE += _divsi3 _modsi3 _mulsi3 _udivsi3 _umodsi3 + + LIB2ADD += \ + $(srcdir)/config/microblaze/divsi3.S \ +- $(srcdir)/config/microblaze/moddi3.S \ + $(srcdir)/config/microblaze/modsi3.S \ + $(srcdir)/config/microblaze/muldi3_hard.S \ + $(srcdir)/config/microblaze/mulsi3.S \ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch new file mode 100644 index 00000000..472c543c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch @@ -0,0 +1,94 @@ +From 30aa7cef2dd076637155384fba539838ddaf0163 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 12 Sep 2022 20:20:00 +0530 +Subject: [PATCH 14/53] [Patch, microblaze]: Add INIT_PRIORITY support Added + TARGET_ASM_CONSTRUCTOR and TARGET_ASM_DESTRUCTOR macros. + +These macros allows users to control the order of initialization +of objects defined at namespace scope with the init_priority +attribute by specifying a relative priority, a constant integral +expression currently bounded between 101 and 65535 inclusive. + +Lower numbers indicate a higher priority. +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 53 +++++++++++++++++++++++++++++ + 1 file changed, 53 insertions(+) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 6922dd94af7..4b0621db168 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -2635,6 +2635,53 @@ print_operand_address (FILE * file, rtx addr) + } + } + ++/* Output an element in the table of global constructors. */ ++void ++microblaze_asm_constructor (rtx symbol ATTRIBUTE_UNUSED, int priority) ++{ ++ const char *section = ".ctors"; ++ char buf[16]; ++ ++ if (priority != DEFAULT_INIT_PRIORITY) ++ { ++ sprintf (buf, ".ctors.%.5u", ++ /* Invert the numbering so the linker puts us in the proper ++ order; constructors are run from right to left, and the ++ linker sorts in increasing order. */ ++ MAX_INIT_PRIORITY - priority); ++ section = buf; ++ } ++ ++ switch_to_section (get_section (section, 0, NULL)); ++ assemble_align (POINTER_SIZE); ++ fputs ("\t.word\t", asm_out_file); ++ output_addr_const (asm_out_file, symbol); ++ fputs ("\n", asm_out_file); ++} ++ ++/* Output an element in the table of global destructors. */ ++void ++microblaze_asm_destructor (rtx symbol, int priority) ++{ ++ const char *section = ".dtors"; ++ char buf[16]; ++ if (priority != DEFAULT_INIT_PRIORITY) ++ { ++ sprintf (buf, ".dtors.%.5u", ++ /* Invert the numbering so the linker puts us in the proper ++ order; constructors are run from right to left, and the ++ linker sorts in increasing order. */ ++ MAX_INIT_PRIORITY - priority); ++ section = buf; ++ } ++ ++ switch_to_section (get_section (section, 0, NULL)); ++ assemble_align (POINTER_SIZE); ++ fputs ("\t.word\t", asm_out_file); ++ output_addr_const (asm_out_file, symbol); ++ fputs ("\n", asm_out_file); ++} ++ + /* Emit either a label, .comm, or .lcomm directive, and mark that the symbol + is used, so that we don't emit an .extern for it in + microblaze_asm_file_end. */ +@@ -3976,6 +4023,12 @@ microblaze_starting_frame_offset (void) + #undef TARGET_ATTRIBUTE_TABLE + #define TARGET_ATTRIBUTE_TABLE microblaze_attribute_table + ++#undef TARGET_ASM_CONSTRUCTOR ++#define TARGET_ASM_CONSTRUCTOR microblaze_asm_constructor ++ ++#undef TARGET_ASM_DESTRUCTOR ++#define TARGET_ASM_DESTRUCTOR microblaze_asm_destructor ++ + #undef TARGET_IN_SMALL_DATA_P + #define TARGET_IN_SMALL_DATA_P microblaze_elf_in_small_data_p + +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch new file mode 100644 index 00000000..7ce5ebc0 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch @@ -0,0 +1,83 @@ +From b9bb669d9404bd04676f09c793310e1b7f228674 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 17 Jan 2017 15:23:57 +0530 +Subject: [PATCH 15/53] [Patch, microblaze]: Add optimized lshrsi3 When barrel + shifter is not present, the immediate value is greater than #5 and + optimization is -OS, the compiler will generate shift operation using loop. + +Changelog + +2013-11-26 David Holsgrove <david.holsgrove@xilinx.com> + + * gcc/config/microblaze/microblaze.md: Add size optimized lshrsi3 insn + +ChangeLog/testsuite + +2014-02-12 David Holsgrove <david.holsgrove@xilinx.com> + + * gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c: New test. + +Upstream-Status: Pending + +Signed-off-by:Nagaraju <nmekala@xilix.com> +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + gcc/config/microblaze/microblaze.md | 21 +++++++++++++++++++ + .../microblaze/others/lshrsi_Os_1.c | 13 ++++++++++++ + 2 files changed, 34 insertions(+) + create mode 100644 gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 9fbb3113f3c..52308cce0cb 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -1618,6 +1618,27 @@ + (set_attr "length" "4,4")] + ) + ++(define_insn "*lshrsi3_with_size_opt" ++ [(set (match_operand:SI 0 "register_operand" "=&d") ++ (lshiftrt:SI (match_operand:SI 1 "register_operand" "d") ++ (match_operand:SI 2 "immediate_operand" "I")))] ++ "(INTVAL (operands[2]) > 5 && optimize_size)" ++ { ++ operands[3] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM); ++ ++ output_asm_insn ("ori\t%3,r0,%2", operands); ++ if (REGNO (operands[0]) != REGNO (operands[1])) ++ output_asm_insn ("addk\t%0,%1,r0", operands); ++ ++ output_asm_insn ("addik\t%3,%3,-1", operands); ++ output_asm_insn ("bneid\t%3,.-4", operands); ++ return "srl\t%0,%0"; ++ } ++ [(set_attr "type" "multi") ++ (set_attr "mode" "SI") ++ (set_attr "length" "20")] ++) ++ + (define_insn "*lshrsi_inline" + [(set (match_operand:SI 0 "register_operand" "=&d") + (lshiftrt:SI (match_operand:SI 1 "register_operand" "d") +diff --git a/gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c b/gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c +new file mode 100644 +index 00000000000..32a3be7c76a +--- /dev/null ++++ b/gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c +@@ -0,0 +1,13 @@ ++/* { dg-options "-Os -mno-xl-barrel-shift" } */ ++ ++void testfunc(void) ++{ ++ unsigned volatile int z = 8192; ++ z >>= 8; ++} ++/* { dg-final { scan-assembler-not "\bsrli" } } */ ++/* { dg-final { scan-assembler "\ori\tr18,r0" } } */ ++/* { dg-final { scan-assembler "addk\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0" } } */ ++/* { dg-final { scan-assembler "addik\tr18,r18,-1" } } */ ++/* { dg-final { scan-assembler "bneid\tr18,.-4" } } */ ++/* { dg-final { scan-assembler "\srl\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])" } } */ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch new file mode 100644 index 00000000..dc645c30 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch @@ -0,0 +1,149 @@ +From 08d7bb4062024f3e34fbb17d695f8fa2c9e1b305 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 17 Jan 2017 17:04:37 +0530 +Subject: [PATCH 16/53] [Patch, microblaze]: Add cbranchsi4_reg This patch + optimizes the generation of pcmpne/pcmpeq instruction if the compare + instruction has no immediate values.For the immediate values the xor + instruction is generated + +Upstream-Status: Pending + +Signed-off-by: Nagaraju Mekala <nmekala@xilix.com> +Signed-off-by: Ajit Agarwal <ajitkum@xilinx.com> + +ChangeLog: +2015-01-13 Nagaraju Mekala <nmekala@xilix.com> + Ajit Agarwal <ajitkum@xilinx.com> + + *microblaze.md (cbranchsi4_reg): New + *microblaze.c (microblaze_expand_conditional_branch_reg): New + +Conflicts: + + gcc/config/microblaze/microblaze-protos.h +--- + gcc/config/microblaze/microblaze-protos.h | 2 +- + gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c | 2 +- + gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c | 2 +- + gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c | 2 +- + gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c | 2 +- + gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c | 14 +++++++------- + gcc/testsuite/gcc.target/microblaze/isa/vanilla.c | 12 ++++++------ + 7 files changed, 18 insertions(+), 18 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h +index d67355697b5..848cd509003 100644 +--- a/gcc/config/microblaze/microblaze-protos.h ++++ b/gcc/config/microblaze/microblaze-protos.h +@@ -33,7 +33,7 @@ extern int microblaze_expand_shift (rtx *); + extern bool microblaze_expand_move (machine_mode, rtx *); + extern bool microblaze_expand_block_move (rtx, rtx, rtx, rtx); + extern void microblaze_expand_divide (rtx *); +-extern void microblaze_expand_conditional_branch (machine_mode, rtx *); ++extern void microblaze_expand_conditional_branch (enum machine_mode, rtx *); + extern void microblaze_expand_conditional_branch_reg (machine_mode, rtx *); + extern void microblaze_expand_conditional_branch_sf (rtx *); + extern int microblaze_can_use_return_insn (void); +diff --git a/gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c b/gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c +index 4041a241391..ccc6a461cd9 100644 +--- a/gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c ++++ b/gcc/testsuite/gcc.target/microblaze/isa/fcmp1.c +@@ -6,5 +6,5 @@ void float_func () + { + /* { dg-final { scan-assembler "fcmp\.(le|gt)\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ + if (f2 <= f3) +- print ("le"); ++ f2 = f3; + } +diff --git a/gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c b/gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c +index 3902b839db9..1dd5fe6c539 100644 +--- a/gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c ++++ b/gcc/testsuite/gcc.target/microblaze/isa/fcmp2.c +@@ -6,5 +6,5 @@ void float_func () + { + /* { dg-final { scan-assembler "fcmp\.(lt|ge)\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ + if (f2 < f3) +- print ("lt"); ++ f2 = f3; + } +diff --git a/gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c b/gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c +index 8555974dda5..d6f80fb0ec3 100644 +--- a/gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c ++++ b/gcc/testsuite/gcc.target/microblaze/isa/fcmp3.c +@@ -6,5 +6,5 @@ void float_func () + { + /* { dg-final { scan-assembler "fcmp\.(eq|ne)\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ + if (f2 == f3) +- print ("eq"); ++ f1 = f2 + f3; + } +diff --git a/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c b/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c +index 79cc5f9dd8e..d1177249552 100644 +--- a/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c ++++ b/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c +@@ -5,5 +5,5 @@ void float_func(float f1, float f2, float f3) + /* { dg-final { scan-assembler "fcmp\.eq\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ + /* { dg-final { scan-assembler "fcmp\.le\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ + if(f1==f2 && f1<=f3) +- print ("f1 eq f2 && f1 le f3"); ++ f2 = f3; + } +diff --git a/gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c b/gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c +index ebfb170ecee..75822977ef8 100644 +--- a/gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c ++++ b/gcc/testsuite/gcc.target/microblaze/isa/nofcmp.c +@@ -5,17 +5,17 @@ volatile float f1, f2, f3; + void float_func () + { + /* { dg-final { scan-assembler-not "fcmp" } } */ +- if (f2 <= f3) +- print ("le"); ++ if (f2 <= f3) ++ f1 = f3; + else if (f2 == f3) +- print ("eq"); ++ f1 = f3; + else if (f2 < f3) +- print ("lt"); ++ f1 = f3; + else if (f2 > f3) +- print ("gt"); ++ f1 = f3; + else if (f2 >= f3) +- print ("ge"); ++ f1 = f3; + else if (f2 != f3) +- print ("ne"); ++ f1 = f3; + + } +diff --git a/gcc/testsuite/gcc.target/microblaze/isa/vanilla.c b/gcc/testsuite/gcc.target/microblaze/isa/vanilla.c +index 1d6ba807b12..532c035adfd 100644 +--- a/gcc/testsuite/gcc.target/microblaze/isa/vanilla.c ++++ b/gcc/testsuite/gcc.target/microblaze/isa/vanilla.c +@@ -74,16 +74,16 @@ void float_cmp_func () + { + /* { dg-final { scan-assembler-not "fcmp" } } */ + if (f2 <= f3) +- print ("le"); ++ f1 = f3; + else if (f2 == f3) +- print ("eq"); ++ f1 = f3; + else if (f2 < f3) +- print ("lt"); ++ f1 = f3; + else if (f2 > f3) +- print ("gt"); ++ f1 = f3; + else if (f2 >= f3) +- print ("ge"); ++ f1 = f3; + else if (f2 != f3) +- print ("ne"); ++ f1 = f3; + + } +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch new file mode 100644 index 00000000..b0d33516 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch @@ -0,0 +1,60 @@ +From 1593e5a9839b7cade95e9f55ba3cff66d64d0e84 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 17 Jan 2017 17:11:04 +0530 +Subject: [PATCH 17/53] [Patch,microblaze]: Inline Expansion of fsqrt builtin. + The changes are made in the patch for the inline expansion of the fsqrt + builtin with fqrt instruction. The sqrt math function takes double as + argument and return double as argument. The pattern is selected while + expanding the unary op through expand_unop which passes DFmode and the DFmode + pattern was not there returning zero. Thus the sqrt math function is not + inlined and expanded. The pattern with DFmode argument is added. Also the + source and destination argument is not same the DF through two different + consecutive registers with lower 32 bit is the argument passed to sqrt and + the higher 32 bit is zero. If the source and destinations are different the + DFmode 64 bits registers is not set properly giving the problem in runtime. + Such changes are taken care in the implementation of the pattern for DFmode + for inline expansion of the sqrt. + +ChangeLog: +2015-06-16 Ajit Agarwal <ajitkum@xilinx.com> + Nagaraju Mekala <nmekala@xilinx.com> + + * config/microblaze/microblaze.md (sqrtdf2): New + pattern. + +Upstream-Status: Pending + +Signed-off-by:Ajit Agarwal ajitkum@xilinx.com + Nagaraju Mekala nmekala@xilinx.com +--- + gcc/config/microblaze/microblaze.md | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 52308cce0cb..0e5ef4d7649 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -451,6 +451,20 @@ + (set_attr "mode" "SF") + (set_attr "length" "4")]) + ++(define_insn "sqrtdf2" ++ [(set (match_operand:DF 0 "register_operand" "=d") ++ (sqrt:DF (match_operand:DF 1 "register_operand" "dG")))] ++ "TARGET_HARD_FLOAT && TARGET_FLOAT_SQRT" ++ { ++ if (REGNO (operands[0]) == REGNO (operands[1])) ++ return "fsqrt\t%0,%1"; ++ else ++ return "fsqrt\t%0,%1\n\taddk\t%D0,%D1,r0"; ++ } ++ [(set_attr "type" "fsqrt") ++ (set_attr "mode" "SF") ++ (set_attr "length" "4")]) ++ + (define_insn "fix_truncsfsi2" + [(set (match_operand:SI 0 "register_operand" "=d") + (fix:SI (match_operand:SF 1 "register_operand" "d")))] +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0002-microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch index 9aa5d98a..94235be6 100644 --- a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0002-microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch @@ -1,17 +1,14 @@ -From db7a0ac634ccaa1781d0a0d17dfffd3f1719bb6d Mon Sep 17 00:00:00 2001 -From: Nathan Rossi <nathan@nathanrossi.com> -Date: Thu, 12 Nov 2015 16:09:31 +1000 -Subject: [PATCH 2/4] microblaze.md: Improve 'adddi3' and 'subdi3' insn - definitions - -Change adddi3 to handle DI immediates as the second operand, this -requires modification to the output template however reduces the need to -specify seperate templates for 16-bit positive/negative immediate -operands. The use of 32-bit immediates for the addi and addic -instructions is handled by the assembler, which will emit the imm -instructions when required. This conveniently handles the optimizable -cases where the immediate constant value does not need the higher half -words of the operands upper/lower words. +From 9002b7d4c295bef95a3fc28c05f86dde5087dde1 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 17 Jan 2017 18:07:24 +0530 +Subject: [PATCH 18/53] [PATCH] microblaze.md: Improve 'adddi3' and 'subdi3' + insn definitions Change adddi3 to handle DI immediates as the second operand, + this requires modification to the output template however reduces the need to + specify seperate templates for 16-bit positive/negative immediate operands. + The use of 32-bit immediates for the addi and addic instructions is handled + by the assembler, which will emit the imm instructions when required. This + conveniently handles the optimizable cases where the immediate constant value + does not need the higher half words of the operands upper/lower words. Change the constraints of the subdi3 instruction definition such that it does not match the second operand as an immediate value. This is because @@ -20,17 +17,18 @@ implement purely with instructions as microblaze does not provide an instruction to perform a forward arithmetic subtraction (it only provides reverse 'rD = IMM - rA'). +Upstream-Status: Pending + Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> -Upstream-Status: Unsubmitted --- gcc/config/microblaze/microblaze.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md -index b3a0011fd7..8a372d7ebb 100644 +index 0e5ef4d7649..effb9774c32 100644 --- a/gcc/config/microblaze/microblaze.md +++ b/gcc/config/microblaze/microblaze.md -@@ -483,17 +483,16 @@ +@@ -502,17 +502,16 @@ ;; Adding 2 DI operands in register or reg/imm (define_insn "adddi3" @@ -53,7 +51,7 @@ index b3a0011fd7..8a372d7ebb 100644 ;;---------------------------------------------------------------- ;; Subtraction -@@ -530,7 +529,7 @@ +@@ -549,7 +548,7 @@ (define_insn "subdi3" [(set (match_operand:DI 0 "register_operand" "=&d") (minus:DI (match_operand:DI 1 "register_operand" "d") @@ -63,5 +61,5 @@ index b3a0011fd7..8a372d7ebb 100644 "rsub\t%L0,%L2,%L1\;rsubc\t%M0,%M2,%M1" [(set_attr "type" "darith") -- -2.11.0 +2.37.1 (Apple Git-137.1) diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch new file mode 100644 index 00000000..e955938e --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch @@ -0,0 +1,79 @@ +From ef94a8b2110f5a3becefb00c1f7c0c3adac6fcac Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 17 Jan 2017 18:18:41 +0530 +Subject: [PATCH 19/53] [Patch, microblaze]: Update ashlsi3 & movsf patterns + This patch removes the use of HOST_WIDE_INT_PRINT_HEX macro in print_operand + of ashlsi3_with_mul_nodelay,ashlsi3_with_mul_delay and movsf_internal + patterns beacuse HOST_WIDE_INT_PRINT_HEX is generating 64-bit value which our + instruction doesn't support so using gen_int_mode function + +Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> + :Ajit Agarwal <ajitkum@xilinx.com> + +ChangeLog: +2016-01-07 Nagaraju Mekala <nmekala@xilix.com> + Ajit Agarwal <ajitkum@xilinx.com> + + *microblaze.md (ashlsi3_with_mul_nodelay, + ashlsi3_with_mul_delay, + movsf_internal): + Updated the patterns to use gen_int_mode function + *microblaze.cc (print_operand): + updated the 'F' case to use "unsinged int" instead + of HOST_WIDE_INT_PRINT_HEX + +Conflicts: + gcc/config/microblaze/microblaze.c +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 2 +- + gcc/config/microblaze/microblaze.md | 10 ++++++++-- + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 4b0621db168..c23061c4e4a 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -2469,7 +2469,7 @@ print_operand (FILE * file, rtx op, int letter) + unsigned long value_long; + REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (op), + value_long); +- fprintf (file, "0x%lx", value_long); ++ fprintf (file, "0x%08x", (unsigned int) value_long); + } + else + { +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index effb9774c32..a4d7ea29219 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -1368,7 +1368,10 @@ + (match_operand:SI 2 "immediate_operand" "I")))] + "!TARGET_SOFT_MUL + && ((1 << INTVAL (operands[2])) <= 32767 && (1 << INTVAL (operands[2])) >= -32768)" +- "muli\t%0,%1,%m2" ++ { ++ operands[2] = gen_int_mode (1 << INTVAL (operands[2]), SImode); ++ return "muli\t%0,%1,%2"; ++ } + ;; This MUL will not generate an imm. Can go into a delay slot. + [(set_attr "type" "arith") + (set_attr "mode" "SI") +@@ -1380,7 +1383,10 @@ + (ashift:SI (match_operand:SI 1 "register_operand" "d") + (match_operand:SI 2 "immediate_operand" "I")))] + "!TARGET_SOFT_MUL" +- "muli\t%0,%1,%m2" ++ { ++ operands[2] = gen_int_mode (1 << INTVAL (operands[2]), SImode); ++ return "muli\t%0,%1,%2"; ++ } + ;; This MUL will generate an IMM. Cannot go into a delay slot + [(set_attr "type" "no_delay_arith") + (set_attr "mode" "SI") +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch new file mode 100644 index 00000000..2d384b78 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch @@ -0,0 +1,181 @@ +From 65574bdca9006fda7654e33a0081eeecfcd9976b Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 12 Sep 2022 21:05:51 +0530 +Subject: [PATCH 20/53] [Patch, microblaze]: 8-stage pipeline for microblaze + This patch adds the support for the 8-stage pipeline. The new 8-stage + pipeline reduces the latencies of float & integer division drastically + +Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 11 ++++ + gcc/config/microblaze/microblaze.h | 3 +- + gcc/config/microblaze/microblaze.md | 79 +++++++++++++++++++++++++++- + gcc/config/microblaze/microblaze.opt | 4 ++ + 4 files changed, 94 insertions(+), 3 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index c23061c4e4a..bd394c411b8 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -1841,6 +1841,17 @@ microblaze_option_override (void) + "%<-mcpu=v8.30.a%>"); + TARGET_REORDER = 0; + } ++ ver = microblaze_version_to_int("v10.0"); ++ if (ver < 0) ++ { ++ if (TARGET_AREA_OPTIMIZED_2) ++ warning (0, "-mxl-frequency can be used only with -mcpu=v10.0 or greater"); ++ } ++ else ++ { ++ if (TARGET_AREA_OPTIMIZED_2) ++ microblaze_pipe = MICROBLAZE_PIPE_8; ++ } + + if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL) + error ("%<-mxl-multiply-high%> requires %<-mno-xl-soft-mul%>"); +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index cd544f2030e..640ae6ea9a3 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -27,7 +27,8 @@ + enum pipeline_type + { + MICROBLAZE_PIPE_3 = 0, +- MICROBLAZE_PIPE_5 = 1 ++ MICROBLAZE_PIPE_5 = 1, ++ MICROBLAZE_PIPE_8 = 2 + }; + + #define MICROBLAZE_MASK_NO_UNSAFE_DELAY 0x00000001 +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index a4d7ea29219..9e9dfb1ccb0 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -35,6 +35,7 @@ + (R_GOT 20) ;; GOT ptr reg + (MB_PIPE_3 0) ;; Microblaze 3-stage pipeline + (MB_PIPE_5 1) ;; Microblaze 5-stage pipeline ++ (MB_PIPE_8 2) ;; Microblaze 8-stage pipeline + (UNSPEC_SET_GOT 101) ;; + (UNSPEC_GOTOFF 102) ;; GOT offset + (UNSPEC_PLT 103) ;; jump table +@@ -82,7 +83,7 @@ + ;; bshift Shift operations + + (define_attr "type" +- "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,trap" ++ "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,fint,trap" + (const_string "unknown")) + + ;; Main data type used by the insn +@@ -224,6 +225,80 @@ + ;;----------------------------------------------------------------- + + ++ ++;;---------------------------------------------------------------- ++;; Microblaze 8-stage pipeline description (v10.0 and later) ++;;---------------------------------------------------------------- ++ ++(define_automaton "mbpipe_8") ++(define_cpu_unit "mb8_issue,mb8_iu,mb8_wb,mb8_fpu,mb8_fpu_2,mb8_mul,mb8_mul_2,mb8_div,mb8_div_2,mb8_bs,mb8_bs_2" "mbpipe_8") ++ ++(define_insn_reservation "mb8-integer" 1 ++ (and (eq_attr "type" "branch,jump,call,arith,darith,icmp,nop,no_delay_arith") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_iu,mb8_wb") ++ ++(define_insn_reservation "mb8-special-move" 2 ++ (and (eq_attr "type" "move") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_iu*2,mb8_wb") ++ ++(define_insn_reservation "mb8-mem-load" 3 ++ (and (eq_attr "type" "load,no_delay_load") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_iu,mb8_wb") ++ ++(define_insn_reservation "mb8-mem-store" 1 ++ (and (eq_attr "type" "store,no_delay_store") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_iu,mb8_wb") ++ ++(define_insn_reservation "mb8-mul" 3 ++ (and (eq_attr "type" "imul,no_delay_imul") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_mul,mb8_mul_2*2,mb8_wb") ++ ++(define_insn_reservation "mb8-div" 30 ++ (and (eq_attr "type" "idiv") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_div,mb8_div_2*29,mb8_wb") ++ ++(define_insn_reservation "mb8-bs" 2 ++ (and (eq_attr "type" "bshift") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_bs,mb8_bs_2,mb8_wb") ++ ++(define_insn_reservation "mb8-fpu-add-sub-mul" 1 ++ (and (eq_attr "type" "fadd,frsub,fmul") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_fpu,mb8_wb") ++ ++(define_insn_reservation "mb8-fpu-fcmp" 3 ++ (and (eq_attr "type" "fcmp") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_fpu,mb8_fpu*2,mb8_wb") ++ ++(define_insn_reservation "mb8-fpu-div" 24 ++ (and (eq_attr "type" "fdiv") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_fpu,mb8_fpu_2*23,mb8_wb") ++ ++(define_insn_reservation "mb8-fpu-sqrt" 23 ++ (and (eq_attr "type" "fsqrt") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_fpu,mb8_fpu_2*22,mb8_wb") ++ ++(define_insn_reservation "mb8-fpu-fcvt" 1 ++ (and (eq_attr "type" "fcvt") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_fpu,mb8_wb") ++ ++(define_insn_reservation "mb8-fpu-fint" 2 ++ (and (eq_attr "type" "fint") ++ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8))) ++ "mb8_issue,mb8_fpu,mb8_wb") ++ ++ + ;;---------------------------------------------------------------- + ;; Microblaze 5-stage pipeline description (v5.00.a and later) + ;;---------------------------------------------------------------- +@@ -470,7 +545,7 @@ + (fix:SI (match_operand:SF 1 "register_operand" "d")))] + "TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" + "fint\t%0,%1" +- [(set_attr "type" "fcvt") ++ [(set_attr "type" "fint") + (set_attr "mode" "SF") + (set_attr "length" "4")]) + +diff --git a/gcc/config/microblaze/microblaze.opt b/gcc/config/microblaze/microblaze.opt +index 9f47e67cf2a..cc009363f87 100644 +--- a/gcc/config/microblaze/microblaze.opt ++++ b/gcc/config/microblaze/microblaze.opt +@@ -133,3 +133,7 @@ Data referenced by offset from start of text instead of GOT (with -fPIC/-fPIE). + + mxl-mode-xilkernel + Target ++ ++mxl-frequency ++Target Mask(AREA_OPTIMIZED_2) ++Use 8 stage pipeline (frequency optimization) +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch new file mode 100644 index 00000000..1b8d924c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch @@ -0,0 +1,62 @@ +From 1d56bfb436b008422b4a7d4d4e3180667130c840 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 11:49:11 +0530 +Subject: [PATCH 21/53] [PATCH 21/53] [Patch, microblaze]: Correct the const + high double immediate value with this patch the loading of the DI mode + immediate values will be using REAL_VALUE_FROM_CONST_DOUBLE and + REAL_VALUE_TO_TARGET_DOUBLE functions, as CONST_DOUBLE_HIGH was returning + the sign extension value even of the unsigned long long constants also + +Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> + Ajit Agarwal <ajitkum@xilinx.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 6 ++++-- + gcc/testsuite/gcc.target/microblaze/others/long.c | 9 +++++++++ + 2 files changed, 13 insertions(+), 2 deletions(-) + create mode 100644 gcc/testsuite/gcc.target/microblaze/others/long.c + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index bd394c411b8..7c648cda1b2 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -2453,14 +2453,16 @@ print_operand (FILE * file, rtx op, int letter) + else if (letter == 'h' || letter == 'j') + { + long val[2]; ++ long l[2]; + if (code == CONST_DOUBLE) + { + if (GET_MODE (op) == DFmode) + REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), val); + else + { +- val[0] = CONST_DOUBLE_HIGH (op); +- val[1] = CONST_DOUBLE_LOW (op); ++ REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), l); ++ val[1] = l[WORDS_BIG_ENDIAN == 0]; ++ val[0] = l[WORDS_BIG_ENDIAN != 0]; + } + } + else if (code == CONST_INT) +diff --git a/gcc/testsuite/gcc.target/microblaze/others/long.c b/gcc/testsuite/gcc.target/microblaze/others/long.c +new file mode 100644 +index 00000000000..b6b55d5ad65 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/microblaze/others/long.c +@@ -0,0 +1,9 @@ ++#define BASEADDR 0xF0000000ULL ++int main () ++{ ++ unsigned long long start; ++ start = (unsigned long long) BASEADDR; ++ return 0; ++} ++/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0x00000000" } } */ ++/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0xf0000000" } } */ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch new file mode 100644 index 00000000..a5917947 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch @@ -0,0 +1,35 @@ +From cd60ea1bd88ac47856ac66266a0771478ac73bad Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 11:58:14 +0530 +Subject: [PATCH 22/53] [Fix, microblaze]: Fix internal compiler error with + msmall-divides This patch will fix the internal error + microblaze_expand_divide function which come of rtx PLUS where the + mem_rtx is of type SI and the operand is of type QImode. This patch + modifies the mem_rtx as QImode and Plus as QImode to fix the error. + + Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> + Ajit Agarwal <ajitkum@xilinx.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 7c648cda1b2..907c0afa9b8 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -3768,7 +3768,7 @@ microblaze_expand_divide (rtx operands[]) + emit_insn (gen_ashlsi3_bshift (regt1, operands[1], GEN_INT(4))); + emit_insn (gen_addsi3 (regt1, regt1, operands[2])); + mem_rtx = gen_rtx_MEM (QImode, +- gen_rtx_PLUS (Pmode, regt1, div_table_rtx)); ++ gen_rtx_PLUS (QImode, regt1, div_table_rtx)); + + insn = emit_insn (gen_zero_extendqisi2(operands[0],mem_rtx)); + jump = emit_jump_insn_after (gen_jump (div_end_label), insn); +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch new file mode 100644 index 00000000..ae05e791 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch @@ -0,0 +1,41 @@ +From b98cddb206ce84994425ede4b116365977768e37 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 12:03:08 +0530 +Subject: [PATCH 23/53] [patch,microblaze]: Fix the calculation of high word in + a long long 64-bit + + This patch will change the calculation of high word in a long long 64-bit. + Earlier to this patch the high word of long long word (0xF0000000ULL) is + coming to be 0xFFFFFFFF and low word is 0xF0000000. Instead the high word + should be 0x00000000 and the low word should be 0xF0000000. This patch + removes the condition of checking high word = 0 & low word < 0. + This check is not required for the correctness of calculating 32-bit high + and low words in a 64-bit long long. + + Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> + Ajit Agarwal <ajitkum@xilinx.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 907c0afa9b8..f75eaff4b49 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -2469,9 +2469,6 @@ print_operand (FILE * file, rtx op, int letter) + { + val[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32; + val[1] = INTVAL (op) & 0x00000000ffffffffLL; +- if (val[0] == 0 && val[1] < 0) +- val[0] = -1; +- + } + fprintf (file, "0x%8.8lx", (letter == 'h') ? val[0] : val[1]); + } +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch new file mode 100644 index 00000000..444c9397 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch @@ -0,0 +1,377 @@ +From 89269c9b8d2047ebbc13e98c45e94746edc63de6 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 12:23:54 +0530 +Subject: [PATCH 24/53] [Patch,MicroBlaze] : this patch has 1.Fixed the bug in + version calculation. 2.Add new bitfield instructions. + +Signed-off-by :Mahesh Bodapati <mbodapat@xilinx.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 154 ++++++++++++++-------------- + gcc/config/microblaze/microblaze.h | 2 + + gcc/config/microblaze/microblaze.md | 69 +++++++++++++ + 3 files changed, 147 insertions(+), 78 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index f75eaff4b49..3abfc834ff2 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -165,6 +165,9 @@ int microblaze_no_unsafe_delay; + /* Set to one if the targeted core has the CLZ insn. */ + int microblaze_has_clz = 0; + ++/* Set to one if the targeted core has barrel-shift and cpu > 10.0 */ ++int microblaze_has_bitfield = 0; ++ + /* Which CPU pipeline do we use. We haven't really standardized on a CPU + version having only a particular type of pipeline. There can still be + options on the CPU to scale pipeline features up or down. :( +@@ -240,6 +243,63 @@ section *sdata2_section; + #define TARGET_HAVE_TLS true + #endif + ++/* Convert a version number of the form "vX.YY.Z" to an integer encoding ++ for easier range comparison. */ ++static int ++microblaze_version_to_int (const char *version) ++{ ++ const char *p, *v; ++ const char *tmpl = "vXX.YY.Z"; ++ int iver1 =0, iver2 =0, iver3 =0; ++ ++ p = version; ++ v = tmpl; ++ ++ while (*p) ++ { ++ if (*v == 'X') ++ { /* Looking for major */ ++ if (*p == '.') ++ { ++ *v++; ++ } ++ else ++ { ++ if (!(*p >= '0' && *p <= '9')) ++ return -1; ++ iver1 += (int) (*p - '0'); ++ iver1 *= 1000; ++ } ++ } ++ else if (*v == 'Y') ++ { /* Looking for minor */ ++ if (!(*p >= '0' && *p <= '9')) ++ return -1; ++ iver2 += (int) (*p - '0'); ++ iver2 *= 10; ++ } ++ else if (*v == 'Z') ++ { /* Looking for compat */ ++ if (!(*p >= 'a' && *p <= 'z')) ++ return -1; ++ iver3 = ((int) (*p)) - 96; ++ } ++ else ++ { ++ if (*p != *v) ++ return -1; ++ } ++ ++ v++; ++ p++; ++ } ++ ++ if (*p) ++ return -1; ++ ++ return iver1 + iver2 + iver3; ++} ++ + /* Return truth value if a CONST_DOUBLE is ok to be a legitimate constant. */ + static bool + microblaze_const_double_ok (rtx op, machine_mode mode) +@@ -1339,8 +1399,7 @@ microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, + { + if (TARGET_BARREL_SHIFT) + { +- if (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v5.00.a") +- >= 0) ++ if (microblaze_version_to_int(microblaze_select_cpu) >= microblaze_version_to_int("v5.00.a")) + *total = COSTS_N_INSNS (1); + else + *total = COSTS_N_INSNS (2); +@@ -1401,8 +1460,7 @@ microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, + } + else if (!TARGET_SOFT_MUL) + { +- if (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v5.00.a") +- >= 0) ++ if (microblaze_version_to_int(microblaze_select_cpu) >= microblaze_version_to_int("v5.00.a")) + *total = COSTS_N_INSNS (1); + else + *total = COSTS_N_INSNS (3); +@@ -1675,72 +1733,13 @@ function_arg_partial_bytes (cumulative_args_t cum_v, + return 0; + } + +-/* Convert a version number of the form "vX.YY.Z" to an integer encoding +- for easier range comparison. */ +-static int +-microblaze_version_to_int (const char *version) +-{ +- const char *p, *v; +- const char *tmpl = "vXX.YY.Z"; +- int iver = 0; +- +- p = version; +- v = tmpl; +- +- while (*p) +- { +- if (*v == 'X') +- { /* Looking for major */ +- if (*p == '.') +- { +- v++; +- } +- else +- { +- if (!(*p >= '0' && *p <= '9')) +- return -1; +- iver += (int) (*p - '0'); +- iver *= 10; +- } +- } +- else if (*v == 'Y') +- { /* Looking for minor */ +- if (!(*p >= '0' && *p <= '9')) +- return -1; +- iver += (int) (*p - '0'); +- iver *= 10; +- } +- else if (*v == 'Z') +- { /* Looking for compat */ +- if (!(*p >= 'a' && *p <= 'z')) +- return -1; +- iver *= 10; +- iver += (int) (*p - 'a'); +- } +- else +- { +- if (*p != *v) +- return -1; +- } +- +- v++; +- p++; +- } +- +- if (*p) +- return -1; +- +- return iver; +-} +- +- + static void + microblaze_option_override (void) + { + int i, start; + int regno; + machine_mode mode; +- int ver; ++ int ver,ver_int; + + microblaze_section_threshold = (OPTION_SET_P (g_switch_value) + ? g_switch_value +@@ -1761,13 +1760,13 @@ microblaze_option_override (void) + /* Check the MicroBlaze CPU version for any special action to be done. */ + if (microblaze_select_cpu == NULL) + microblaze_select_cpu = MICROBLAZE_DEFAULT_CPU; +- ver = microblaze_version_to_int (microblaze_select_cpu); +- if (ver == -1) ++ ver_int = microblaze_version_to_int (microblaze_select_cpu); ++ if (ver_int == -1) + { + error ("%qs is an invalid argument to %<-mcpu=%>", microblaze_select_cpu); + } + +- ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v3.00.a"); ++ ver = ver_int - microblaze_version_to_int("v3.00.a"); + if (ver < 0) + { + /* No hardware exceptions in earlier versions. So no worries. */ +@@ -1778,8 +1777,7 @@ microblaze_option_override (void) + microblaze_pipe = MICROBLAZE_PIPE_3; + } + else if (ver == 0 +- || (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v4.00.b") +- == 0)) ++ || (ver_int == microblaze_version_to_int("v4.00.b"))) + { + #if 0 + microblaze_select_flags |= (MICROBLAZE_MASK_NO_UNSAFE_DELAY); +@@ -1796,11 +1794,9 @@ microblaze_option_override (void) + #endif + microblaze_no_unsafe_delay = 0; + microblaze_pipe = MICROBLAZE_PIPE_5; +- if (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v5.00.a") == 0 +- || MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, +- "v5.00.b") == 0 +- || MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, +- "v5.00.c") == 0) ++ if ((ver_int == microblaze_version_to_int("v5.00.a")) ++ || (ver_int == microblaze_version_to_int("v5.00.b")) ++ || (ver_int == microblaze_version_to_int("v5.00.c"))) + { + /* Pattern compares are to be turned on by default only when + compiling for MB v5.00.'z'. */ +@@ -1808,7 +1804,7 @@ microblaze_option_override (void) + } + } + +- ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v6.00.a"); ++ ver = ver_int - microblaze_version_to_int("v6.00.a"); + if (ver < 0) + { + if (TARGET_MULTIPLY_HIGH) +@@ -1817,7 +1813,7 @@ microblaze_option_override (void) + "%<-mcpu=v6.00.a%> or greater"); + } + +- ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v8.10.a"); ++ ver = ver_int - microblaze_version_to_int("v8.10.a"); + microblaze_has_clz = 1; + if (ver < 0) + { +@@ -1826,7 +1822,7 @@ microblaze_option_override (void) + } + + /* TARGET_REORDER defaults to 2 if -mxl-reorder not specified. */ +- ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v8.30.a"); ++ ver = ver_int - microblaze_version_to_int("v8.30.a"); + if (ver < 0) + { + if (TARGET_REORDER == 1) +@@ -1841,7 +1837,7 @@ microblaze_option_override (void) + "%<-mcpu=v8.30.a%>"); + TARGET_REORDER = 0; + } +- ver = microblaze_version_to_int("v10.0"); ++ ver = ver_int - microblaze_version_to_int("v10.0"); + if (ver < 0) + { + if (TARGET_AREA_OPTIMIZED_2) +@@ -1851,6 +1847,8 @@ microblaze_option_override (void) + { + if (TARGET_AREA_OPTIMIZED_2) + microblaze_pipe = MICROBLAZE_PIPE_8; ++ if (TARGET_BARREL_SHIFT) ++ microblaze_has_bitfield = 1; + } + + if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL) +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index 640ae6ea9a3..67015058198 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -44,6 +44,7 @@ extern int microblaze_dbx_regno[]; + + extern int microblaze_no_unsafe_delay; + extern int microblaze_has_clz; ++extern int microblaze_has_bitfield; + extern enum pipeline_type microblaze_pipe; + + #define OBJECT_FORMAT_ELF +@@ -63,6 +64,7 @@ extern enum pipeline_type microblaze_pipe; + /* Do we have CLZ? */ + #define TARGET_HAS_CLZ (TARGET_PATTERN_COMPARE && microblaze_has_clz) + ++#define TARGET_HAS_BITFIELD (TARGET_BARREL_SHIFT && microblaze_has_bitfield) + /* The default is to support PIC. */ + #define TARGET_SUPPORTS_PIC 1 + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 9e9dfb1ccb0..dede4d068d3 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -2491,4 +2491,73 @@ + DONE; + }") + ++(define_expand "extvsi" ++ [(set (match_operand:SI 0 "register_operand" "r") ++ (zero_extract:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "immediate_operand" "I") ++ (match_operand:SI 3 "immediate_operand" "I")))] ++"TARGET_HAS_BITFIELD" ++" ++{ ++ unsigned HOST_WIDE_INT len = UINTVAL (operands[2]); ++ unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]); ++ ++ if ((len == 0) || (pos + len > 32) ) ++ FAIL; ++ ++ ;;if (!register_operand (operands[1], VOIDmode)) ++ ;; FAIL; ++ if (operands[0] == operands[1]) ++ FAIL; ++ if (GET_CODE (operands[1]) == ASHIFT) ++ FAIL; ++;; operands[2] = GEN_INT(INTVAL(operands[2])+1 ); ++ emit_insn (gen_extv_32 (operands[0], operands[1], ++ operands[2], operands[3])); ++ DONE; ++}") ++ ++(define_insn "extv_32" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (zero_extract:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "immediate_operand" "I") ++ (match_operand:SI 3 "immediate_operand" "I")))] ++ "TARGET_HAS_BITFIELD && (UINTVAL (operands[2]) > 0) ++ && ((UINTVAL (operands[2]) + UINTVAL (operands[3])) <= 32)" ++ "bsefi %0,%1,%2,%3" ++ [(set_attr "type" "bshift") ++ (set_attr "length" "4")]) ++ ++(define_expand "insvsi" ++ [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r") ++ (match_operand:SI 1 "immediate_operand" "I") ++ (match_operand:SI 2 "immediate_operand" "I")) ++ (match_operand:SI 3 "register_operand" "r"))] ++ "TARGET_HAS_BITFIELD" ++ " ++{ ++ unsigned HOST_WIDE_INT len = UINTVAL (operands[1]); ++ unsigned HOST_WIDE_INT pos = UINTVAL (operands[2]); ++ ++ if (len <= 0 || pos + len > 32) ++ FAIL; ++ ++ ;;if (!register_operand (operands[0], VOIDmode)) ++ ;; FAIL; ++ emit_insn (gen_insv_32 (operands[0], operands[1], ++ operands[2], operands[3])); ++ DONE; ++}") ++ ++(define_insn "insv_32" ++ [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r") ++ (match_operand:SI 1 "immediate_operand" "I") ++ (match_operand:SI 2 "immediate_operand" "I")) ++ (match_operand:SI 3 "register_operand" "r"))] ++ "TARGET_HAS_BITFIELD && UINTVAL (operands[1]) > 0 ++ && UINTVAL (operands[1]) + UINTVAL (operands[2]) <= 32" ++ "bsifi %0, %3, %1, %2" ++ [(set_attr "type" "bshift") ++ (set_attr "length" "4")]) ++ + (include "sync.md") +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch new file mode 100644 index 00000000..2800dee7 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch @@ -0,0 +1,48 @@ +From 101f47dedd82fc09bcefd5db986e6d6b0a1761ad Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Thu, 23 Feb 2017 17:09:04 +0530 +Subject: [PATCH 25/53] Fixing the issue with the builtin_alloc. register r18 + was not properly handling the stack pattern which was resolved by using free + available register + +signed-off-by:nagaraju mekala <nmekala@xilinx.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index dede4d068d3..c6d8a87e9d1 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -2075,10 +2075,10 @@ + "" + { + rtx retaddr = gen_rtx_MEM (Pmode, stack_pointer_rtx); +- rtx rtmp = gen_rtx_REG (SImode, R_TMP); ++ rtx reg = gen_reg_rtx (Pmode); + rtx neg_op0; + +- emit_move_insn (rtmp, retaddr); ++ emit_move_insn (reg, retaddr); + if (GET_CODE (operands[1]) != CONST_INT) + { + neg_op0 = gen_reg_rtx (Pmode); +@@ -2087,9 +2087,9 @@ + neg_op0 = GEN_INT (- INTVAL (operands[1])); + + emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, neg_op0)); +- emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), rtmp); ++ emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), reg); + emit_move_insn (operands[0], virtual_stack_dynamic_rtx); +- emit_insn (gen_rtx_CLOBBER (SImode, rtmp)); ++ emit_insn (gen_rtx_CLOBBER (SImode, reg)); + DONE; + } + ) +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch new file mode 100644 index 00000000..a1e4fb36 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch @@ -0,0 +1,42 @@ +From b3e51ca34dc4048445b178253051ad4bbdfc5ec4 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 4 Jun 2018 10:10:18 +0530 +Subject: [PATCH 26/53] [Patch,Microblaze] : Removed fsqrt generation for + double values. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index c6d8a87e9d1..f23a85c7ac7 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -526,20 +526,6 @@ + (set_attr "mode" "SF") + (set_attr "length" "4")]) + +-(define_insn "sqrtdf2" +- [(set (match_operand:DF 0 "register_operand" "=d") +- (sqrt:DF (match_operand:DF 1 "register_operand" "dG")))] +- "TARGET_HARD_FLOAT && TARGET_FLOAT_SQRT" +- { +- if (REGNO (operands[0]) == REGNO (operands[1])) +- return "fsqrt\t%0,%1"; +- else +- return "fsqrt\t%0,%1\n\taddk\t%D0,%D1,r0"; +- } +- [(set_attr "type" "fsqrt") +- (set_attr "mode" "SF") +- (set_attr "length" "4")]) +- + (define_insn "fix_truncsfsi2" + [(set (match_operand:SI 0 "register_operand" "=d") + (fix:SI (match_operand:SF 1 "register_operand" "d")))] +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch new file mode 100644 index 00000000..a9222e54 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch @@ -0,0 +1,788 @@ +From cf9ab9693d02212e1a49465e55d759a01acc507a Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 13:56:52 +0530 +Subject: [PATCH 27/53] [Patch,MicroBlaze]: Intial commit of 64-bit Microblaze + + Conflicts: + gcc/config/microblaze/microblaze.md +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/constraints.md | 6 + + gcc/config/microblaze/microblaze-protos.h | 1 + + gcc/config/microblaze/microblaze.cc | 109 +++++-- + gcc/config/microblaze/microblaze.h | 4 +- + gcc/config/microblaze/microblaze.md | 352 +++++++++++++++++++++- + gcc/config/microblaze/microblaze.opt | 7 +- + gcc/config/microblaze/t-microblaze | 7 +- + 7 files changed, 456 insertions(+), 30 deletions(-) + +diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md +index a8934d305ee..2133650147e 100644 +--- a/gcc/config/microblaze/constraints.md ++++ b/gcc/config/microblaze/constraints.md +@@ -52,6 +52,12 @@ + (and (match_code "const_int") + (match_test "ival > 0 && ival < 0x10000"))) + ++(define_constraint "K" ++ "A constant in the range 0xffffff8000000000L to 0x0000007fffffffffL (inclusive)." ++ (and (match_code "const_int") ++ (match_test "ival > (long)0xffffff8000000000L && ival < (long)0x0000007fffffffffL"))) ++ ++ + ;; Define floating point constraints + + (define_constraint "G" +diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h +index 848cd509003..7f575c2adec 100644 +--- a/gcc/config/microblaze/microblaze-protos.h ++++ b/gcc/config/microblaze/microblaze-protos.h +@@ -36,6 +36,7 @@ extern void microblaze_expand_divide (rtx *); + extern void microblaze_expand_conditional_branch (enum machine_mode, rtx *); + extern void microblaze_expand_conditional_branch_reg (machine_mode, rtx *); + extern void microblaze_expand_conditional_branch_sf (rtx *); ++extern void microblaze_expand_conditional_branch_df (rtx *); + extern int microblaze_can_use_return_insn (void); + extern void print_operand (FILE *, rtx, int); + extern void print_operand_address (FILE *, rtx); +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 3abfc834ff2..1ac889041b8 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -3433,11 +3433,11 @@ microblaze_expand_move (machine_mode mode, rtx operands[]) + op0 = operands[0]; + op1 = operands[1]; + +- if (!register_operand (op0, SImode) +- && !register_operand (op1, SImode) ++ if (!register_operand (op0, mode) ++ && !register_operand (op1, mode) + && (GET_CODE (op1) != CONST_INT || INTVAL (op1) != 0)) + { +- rtx temp = force_reg (SImode, op1); ++ rtx temp = force_reg (mode, op1); + emit_move_insn (op0, temp); + return true; + } +@@ -3502,12 +3502,12 @@ microblaze_expand_move (machine_mode mode, rtx operands[]) + && (flag_pic == 2 || microblaze_tls_symbol_p (p0) + || !SMALL_INT (p1))))) + { +- rtx temp = force_reg (SImode, p0); ++ rtx temp = force_reg (mode, p0); + rtx temp2 = p1; + + if (flag_pic && reload_in_progress) + df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true); +- emit_move_insn (op0, gen_rtx_PLUS (SImode, temp, temp2)); ++ emit_move_insn (op0, gen_rtx_PLUS (mode, temp, temp2)); + return true; + } + } +@@ -3638,7 +3638,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) + rtx cmp_op0 = operands[1]; + rtx cmp_op1 = operands[2]; + rtx label1 = operands[3]; +- rtx comp_reg = gen_reg_rtx (SImode); ++ rtx comp_reg = gen_reg_rtx (mode); + rtx condition; + + gcc_assert ((GET_CODE (cmp_op0) == REG) || (GET_CODE (cmp_op0) == SUBREG)); +@@ -3647,23 +3647,36 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) + if (cmp_op1 == const0_rtx) + { + comp_reg = cmp_op0; +- condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp_reg, const0_rtx); +- emit_jump_insn (gen_condjump (condition, label1)); ++ condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx); ++ if (mode == SImode) ++ emit_jump_insn (gen_condjump (condition, label1)); ++ else ++ emit_jump_insn (gen_long_condjump (condition, label1)); ++ + } + + else if (code == EQ || code == NE) + { + /* Use xor for equal/not-equal comparison. */ +- emit_insn (gen_xorsi3 (comp_reg, cmp_op0, cmp_op1)); +- condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp_reg, const0_rtx); +- emit_jump_insn (gen_condjump (condition, label1)); ++ if (mode == SImode) ++ emit_insn (gen_xorsi3 (comp_reg, cmp_op0, cmp_op1)); ++ else ++ emit_insn (gen_xordi3 (comp_reg, cmp_op0, cmp_op1)); ++ condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx); ++ if (mode == SImode) ++ emit_jump_insn (gen_condjump (condition, label1)); ++ else ++ emit_jump_insn (gen_long_condjump (condition, label1)); + } + else + { + /* Generate compare and branch in single instruction. */ + cmp_op1 = force_reg (mode, cmp_op1); + condition = gen_rtx_fmt_ee (code, mode, cmp_op0, cmp_op1); +- emit_jump_insn (gen_branch_compare(condition, cmp_op0, cmp_op1, label1)); ++ if (mode == SImode) ++ emit_jump_insn (gen_branch_compare(condition, cmp_op0, cmp_op1, label1)); ++ else ++ emit_jump_insn (gen_long_branch_compare(condition, cmp_op0, cmp_op1, label1)); + } + } + +@@ -3674,7 +3687,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) + rtx cmp_op0 = operands[1]; + rtx cmp_op1 = operands[2]; + rtx label1 = operands[3]; +- rtx comp_reg = gen_reg_rtx (SImode); ++ rtx comp_reg = gen_reg_rtx (mode); + rtx condition; + + gcc_assert ((GET_CODE (cmp_op0) == REG) +@@ -3685,30 +3698,63 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) + { + comp_reg = cmp_op0; + condition = gen_rtx_fmt_ee (signed_condition (code), +- SImode, comp_reg, const0_rtx); +- emit_jump_insn (gen_condjump (condition, label1)); ++ mode, comp_reg, const0_rtx); ++ if (mode == SImode) ++ emit_jump_insn (gen_condjump (condition, label1)); ++ else ++ emit_jump_insn (gen_long_condjump (condition, label1)); + } + else if (code == EQ) + { +- emit_insn (gen_seq_internal_pat (comp_reg, +- cmp_op0, cmp_op1)); +- condition = gen_rtx_EQ (SImode, comp_reg, const0_rtx); +- emit_jump_insn (gen_condjump (condition, label1)); ++ if (mode == SImode) ++ { ++ emit_insn (gen_seq_internal_pat (comp_reg, cmp_op0, ++ cmp_op1)); ++ } ++ else ++ { ++ emit_insn (gen_seq_internal_pat (comp_reg, cmp_op0, ++ cmp_op1)); ++ } ++ condition = gen_rtx_EQ (mode, comp_reg, const0_rtx); ++ if (mode == SImode) ++ emit_jump_insn (gen_condjump (condition, label1)); ++ else ++ emit_jump_insn (gen_long_condjump (condition, label1)); ++ + } + else if (code == NE) + { +- emit_insn (gen_sne_internal_pat (comp_reg, cmp_op0, +- cmp_op1)); +- condition = gen_rtx_NE (SImode, comp_reg, const0_rtx); +- emit_jump_insn (gen_condjump (condition, label1)); ++ if (mode == SImode) ++ { ++ emit_insn (gen_sne_internal_pat (comp_reg, cmp_op0, ++ cmp_op1)); ++ } ++ else ++ { ++ emit_insn (gen_sne_internal_pat (comp_reg, cmp_op0, ++ cmp_op1)); ++ } ++ condition = gen_rtx_NE (mode, comp_reg, const0_rtx); ++ if (mode == SImode) ++ emit_jump_insn (gen_condjump (condition, label1)); ++ else ++ emit_jump_insn (gen_long_condjump (condition, label1)); + } + else + { + /* Generate compare and branch in single instruction. */ + cmp_op1 = force_reg (mode, cmp_op1); + condition = gen_rtx_fmt_ee (code, mode, cmp_op0, cmp_op1); +- emit_jump_insn (gen_branch_compare (condition, cmp_op0, +- cmp_op1, label1)); ++ if (mode == SImode) ++ emit_jump_insn (gen_branch_compare (condition, cmp_op0, ++ cmp_op1, label1)); ++ else ++ { ++ emit_jump_insn (gen_long_branch_compare (condition, cmp_op0, ++ cmp_op1, label1)); ++ } ++ + } + } + +@@ -3725,6 +3771,19 @@ microblaze_expand_conditional_branch_sf (rtx operands[]) + emit_jump_insn (gen_condjump (condition, operands[3])); + } + ++void ++microblaze_expand_conditional_branch_df (rtx operands[]) ++{ ++ rtx condition; ++ rtx cmp_op0 = XEXP (operands[0], 0); ++ rtx cmp_op1 = XEXP (operands[0], 1); ++ rtx comp_reg = gen_reg_rtx (DImode); ++ ++ emit_insn (gen_cstoredf4 (comp_reg, operands[0], cmp_op0, cmp_op1)); ++ condition = gen_rtx_NE (DImode, comp_reg, const0_rtx); ++ emit_jump_insn (gen_long_condjump (condition, operands[3])); ++} ++ + /* Implement TARGET_FRAME_POINTER_REQUIRED. */ + + static bool +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index 67015058198..885abc6e5a1 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -102,6 +102,7 @@ extern enum pipeline_type microblaze_pipe; + #define ASM_SPEC "\ + %(target_asm_spec) \ + %{mbig-endian:-EB} \ ++%{m64:-m64} \ + %{mlittle-endian:-EL}" + + /* Extra switches sometimes passed to the linker. */ +@@ -110,6 +111,7 @@ extern enum pipeline_type microblaze_pipe; + #define LINK_SPEC "%{shared:-shared} -N -relax \ + %{mbig-endian:-EB --oformat=elf32-microblaze} \ + %{mlittle-endian:-EL --oformat=elf32-microblazeel} \ ++ %{m64:-EL --oformat=elf64-microblazeel} \ + %{Zxl-mode-xmdstub:-defsym _TEXT_START_ADDR=0x800} \ + %{mxl-mode-xmdstub:-defsym _TEXT_START_ADDR=0x800} \ + %{mxl-gp-opt:%{G*}} %{!mxl-gp-opt: -G 0} \ +@@ -217,7 +219,7 @@ extern enum pipeline_type microblaze_pipe; + #define MIN_UNITS_PER_WORD 4 + #define INT_TYPE_SIZE 32 + #define SHORT_TYPE_SIZE 16 +-#define LONG_TYPE_SIZE 32 ++#define LONG_TYPE_SIZE 64 + #define LONG_LONG_TYPE_SIZE 64 + #define FLOAT_TYPE_SIZE 32 + #define DOUBLE_TYPE_SIZE 64 +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index f23a85c7ac7..40711fe224b 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -497,7 +497,6 @@ + (set_attr "mode" "SF") + (set_attr "length" "4")]) + +- + (define_insn "divsf3" + [(set (match_operand:SF 0 "register_operand" "=d") + (div:SF (match_operand:SF 1 "register_operand" "d") +@@ -508,6 +507,7 @@ + (set_attr "mode" "SF") + (set_attr "length" "4")]) + ++ + (define_insn "sqrtsf2" + [(set (match_operand:SF 0 "register_operand" "=d") + (sqrt:SF (match_operand:SF 1 "register_operand" "d")))] +@@ -562,6 +562,18 @@ + + ;; Adding 2 DI operands in register or reg/imm + ++(define_insn "adddi3_long" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%dJ,dJ") ++ (match_operand:DI 2 "arith_plus_operand" "d,K")))] ++ "TARGET_MB_64" ++ "@ ++ addlk\t%0,%z1,%2 ++ addlik\t%0,%z1,%2" ++ [(set_attr "type" "arith,arith") ++ (set_attr "mode" "DI,DI") ++ (set_attr "length" "4,4")]) ++ + (define_insn "adddi3" + [(set (match_operand:DI 0 "register_operand" "=d,d") + (plus:DI (match_operand:DI 1 "register_operand" "%d,d") +@@ -606,6 +618,18 @@ + ;; Double Precision Subtraction + ;;---------------------------------------------------------------- + ++(define_insn "subdi3_long" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (minus:DI (match_operand:DI 1 "register_operand" "d,d") ++ (match_operand:DI 2 "register_operand" "d,n")))] ++ "TARGET_MB_64" ++ "@ ++ rsubl\t%0,%2,%1 ++ addlik\t%0,%z1,-%2" ++ [(set_attr "type" "darith") ++ (set_attr "mode" "DI,DI") ++ (set_attr "length" "4,4")]) ++ + (define_insn "subdi3" + [(set (match_operand:DI 0 "register_operand" "=&d") + (minus:DI (match_operand:DI 1 "register_operand" "d") +@@ -795,6 +819,15 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + ++(define_insn "negdi2_long" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (neg:DI (match_operand:DI 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "rsubl\t%0,%1,r0" ++ [(set_attr "type" "darith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) ++ + (define_insn "negdi2" + [(set (match_operand:DI 0 "register_operand" "=d") + (neg:DI (match_operand:DI 1 "register_operand" "d")))] +@@ -814,6 +847,15 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + ++(define_insn "one_cmpldi2_long" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (not:DI (match_operand:DI 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "xorli\t%0,%1,-1" ++ [(set_attr "type" "arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) ++ + (define_insn "*one_cmpldi2" + [(set (match_operand:DI 0 "register_operand" "=d") + (not:DI (match_operand:DI 1 "register_operand" "d")))] +@@ -840,6 +882,20 @@ + ;; Logical + ;;---------------------------------------------------------------- + ++(define_insn "anddi3" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (and:DI (match_operand:DI 1 "arith_operand" "d,d") ++ (match_operand:DI 2 "arith_operand" "d,K")))] ++ "TARGET_MB_64" ++ "@ ++ andl\t%0,%1,%2 ++ andli\t%0,%1,%2 #andl1" ++ ;; andli\t%0,%1,%2 #andl3 ++ ;; andli\t%0,%1,%2 #andl2 ++ [(set_attr "type" "arith,arith") ++ (set_attr "mode" "DI,DI") ++ (set_attr "length" "4,4")]) ++ + (define_insn "andsi3" + [(set (match_operand:SI 0 "register_operand" "=d,d,d,d") + (and:SI (match_operand:SI 1 "arith_operand" "%d,d,d,d") +@@ -855,6 +911,18 @@ + (set_attr "length" "4,8,8,8")]) + + ++(define_insn "iordi3" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (ior:DI (match_operand:DI 1 "arith_operand" "d,d") ++ (match_operand:DI 2 "arith_operand" "d,K")))] ++ "TARGET_MB_64" ++ "@ ++ orl\t%0,%1,%2 ++ orli\t%0,%1,%2 #andl1" ++ [(set_attr "type" "arith,arith") ++ (set_attr "mode" "DI,DI") ++ (set_attr "length" "4,4")]) ++ + (define_insn "iorsi3" + [(set (match_operand:SI 0 "register_operand" "=d,d,d,d") + (ior:SI (match_operand:SI 1 "arith_operand" "%d,d,d,d") +@@ -869,6 +937,19 @@ + (set_attr "mode" "SI,SI,SI,SI") + (set_attr "length" "4,8,8,8")]) + ++(define_insn "xordi3" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (xor:DI (match_operand:DI 1 "arith_operand" "%d,d") ++ (match_operand:DI 2 "arith_operand" "d,K")))] ++ "TARGET_MB_64" ++ "@ ++ xorl\t%0,%1,%2 ++ xorli\t%0,%1,%2 #andl1" ++ [(set_attr "type" "arith,arith") ++ (set_attr "mode" "DI,DI") ++ (set_attr "length" "4,4")]) ++ ++ + (define_insn "xorsi3" + [(set (match_operand:SI 0 "register_operand" "=d,d,d") + (xor:SI (match_operand:SI 1 "arith_operand" "%d,d,d") +@@ -937,6 +1018,26 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + ++;;(define_expand "extendqidi2" ++;; [(set (match_operand:DI 0 "register_operand" "=d") ++;; (sign_extend:DI (match_operand:QI 1 "general_operand" "d")))] ++;; "TARGET_MB_64" ++;; { ++;; if (GET_CODE (operands[1]) != REG) ++;; FAIL; ++;; } ++;;) ++ ++ ++;;(define_insn "extendqidi2" ++;; [(set (match_operand:DI 0 "register_operand" "=d") ++;; (sign_extend:DI (match_operand:QI 1 "register_operand" "d")))] ++;; "TARGET_MB_64" ++;; "sextl8\t%0,%1" ++;; [(set_attr "type" "arith") ++;; (set_attr "mode" "DI") ++;; (set_attr "length" "4")]) ++ + (define_insn "extendhisi2" + [(set (match_operand:SI 0 "register_operand" "=d") + (sign_extend:SI (match_operand:HI 1 "register_operand" "d")))] +@@ -946,6 +1047,16 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + ++(define_insn "extendhidi2" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (sign_extend:DI (match_operand:HI 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "sextl16\t%0,%1" ++ [(set_attr "type" "arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) ++ ++ + ;; Those for integer source operand are ordered + ;; widest source type first. + +@@ -1009,6 +1120,32 @@ + ) + + ++(define_insn "*movdi_internal_64" ++ [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,R,o") ++ (match_operand:DI 1 "general_operand" " d,K,J,R,o,d,d"))] ++ "TARGET_MB_64 && (INTVAL(operands[1]) < 0x7fffffffff) && (INTVAL(operands[1]) > 0xffffff8000000000)" ++ { ++ switch (which_alternative) ++ { ++ case 0: ++ return "addlk\t%0,%1"; ++ case 1: ++ return "addlik\t%0,r0,%1"; ++ case 2: ++ return "addlk\t%0,r0,r0"; ++ case 3: ++ case 4: ++ return "lli\t%0,%1"; ++ case 5: ++ case 6: ++ return "sli\t%1,%0"; ++ } ++ return "unreachable"; ++ } ++ [(set_attr "type" "no_delay_move,no_delay_arith,no_delay_arith,no_delay_load,no_delay_load,no_delay_store,no_delay_store") ++ (set_attr "mode" "DI") ++ (set_attr "length" "8,8,8,8,12,8,12")]) ++ + + (define_insn "*movdi_internal" + [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,R,o") +@@ -1421,6 +1558,36 @@ + (set_attr "length" "4,4")] + ) + ++;; Barrel shift left ++(define_expand "ashldi3" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (ashift:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "arith_operand" "")))] ++"TARGET_MB_64" ++{ ++;;if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++ { ++ emit_insn(gen_ashldi3_long (operands[0], operands[1],operands[2])); ++ DONE; ++ } ++else ++ FAIL; ++} ++) ++ ++(define_insn "ashldi3_long" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (ashift:DI (match_operand:DI 1 "register_operand" "d,d") ++ (match_operand:DI 2 "arith_operand" "I,d")))] ++ "TARGET_MB_64" ++ "@ ++ bsllli\t%0,%1,%2 ++ bslll\t%0,%1,%2" ++ [(set_attr "type" "bshift,bshift") ++ (set_attr "mode" "DI,DI") ++ (set_attr "length" "4,4")] ++) + ;; The following patterns apply when there is no barrel shifter present + + (define_insn "*ashlsi3_with_mul_delay" +@@ -1546,6 +1713,36 @@ + ;;---------------------------------------------------------------- + ;; 32-bit right shifts + ;;---------------------------------------------------------------- ++;; Barrel shift left ++(define_expand "ashrdi3" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (ashiftrt:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "arith_operand" "")))] ++"TARGET_MB_64" ++{ ++;;if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++ { ++ emit_insn(gen_ashrdi3_long (operands[0], operands[1],operands[2])); ++ DONE; ++ } ++else ++ FAIL; ++} ++) ++ ++(define_insn "ashrdi3_long" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d") ++ (match_operand:DI 2 "arith_operand" "I,d")))] ++ "TARGET_MB_64" ++ "@ ++ bslrai\t%0,%1,%2 ++ bslra\t%0,%1,%2" ++ [(set_attr "type" "bshift,bshift") ++ (set_attr "mode" "DI,DI") ++ (set_attr "length" "4,4")] ++ ) + (define_expand "ashrsi3" + [(set (match_operand:SI 0 "register_operand" "=&d") + (ashiftrt:SI (match_operand:SI 1 "register_operand" "d") +@@ -1655,6 +1852,36 @@ + ;;---------------------------------------------------------------- + ;; 32-bit right shifts (logical) + ;;---------------------------------------------------------------- ++;; Barrel shift left ++(define_expand "lshrdi3" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (lshiftrt:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "arith_operand" "")))] ++"TARGET_MB_64" ++{ ++;;if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++ { ++ emit_insn(gen_lshrdi3_long (operands[0], operands[1],operands[2])); ++ DONE; ++ } ++else ++ FAIL; ++} ++) ++ ++(define_insn "lshrdi3_long" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (lshiftrt:DI (match_operand:DI 1 "register_operand" "d,d") ++ (match_operand:DI 2 "arith_operand" "I,d")))] ++ "TARGET_MB_64" ++ "@ ++ bslrli\t%0,%1,%2 ++ bslrl\t%0,%1,%2" ++ [(set_attr "type" "bshift,bshift") ++ (set_attr "mode" "DI,DI") ++ (set_attr "length" "4,4")] ++ ) + + (define_expand "lshrsi3" + [(set (match_operand:SI 0 "register_operand" "=&d") +@@ -1800,6 +2027,8 @@ + (set_attr "length" "4")] + ) + ++ ++ + ;;---------------------------------------------------------------- + ;; Setting a register from an floating point comparison. + ;;---------------------------------------------------------------- +@@ -1815,6 +2044,18 @@ + (set_attr "length" "4")] + ) + ++(define_insn "cstoredf4" ++ [(set (match_operand:DI 0 "register_operand" "=r") ++ (match_operator:DI 1 "ordered_comparison_operator" ++ [(match_operand:DF 2 "register_operand" "r") ++ (match_operand:DF 3 "register_operand" "r")]))] ++ "TARGET_MB_64" ++ "dcmp.%C1\t%0,%3,%2" ++ [(set_attr "type" "fcmp") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4")] ++) ++ + ;;---------------------------------------------------------------- + ;; Conditional branches + ;;---------------------------------------------------------------- +@@ -1927,6 +2168,115 @@ + (set_attr "length" "12")] + ) + ++ ++(define_expand "cbranchdi4" ++ [(set (pc) ++ (if_then_else (match_operator 0 "ordered_comparison_operator" ++ [(match_operand:DI 1 "register_operand") ++ (match_operand:DI 2 "arith_operand" "I,i")]) ++ (label_ref (match_operand 3 "")) ++ (pc)))] ++ "TARGET_MB_64" ++{ ++ microblaze_expand_conditional_branch (DImode, operands); ++ DONE; ++}) ++ ++(define_expand "cbranchdi4_reg" ++ [(set (pc) ++ (if_then_else (match_operator 0 "ordered_comparison_operator" ++ [(match_operand:DI 1 "register_operand") ++ (match_operand:DI 2 "register_operand")]) ++ (label_ref (match_operand 3 "")) ++ (pc)))] ++ "TARGET_MB_64" ++{ ++ microblaze_expand_conditional_branch_reg (DImode, operands); ++ DONE; ++}) ++ ++(define_expand "cbranchdf4" ++ [(set (pc) ++ (if_then_else (match_operator 0 "ordered_comparison_operator" ++ [(match_operand:DF 1 "register_operand") ++ (match_operand:DF 2 "register_operand")]) ++ (label_ref (match_operand 3 "")) ++ (pc)))] ++ "TARGET_MB_64" ++{ ++ microblaze_expand_conditional_branch_df (operands); ++ DONE; ++ ++}) ++ ++;; Used to implement comparison instructions ++(define_expand "long_condjump" ++ [(set (pc) ++ (if_then_else (match_operand 0) ++ (label_ref (match_operand 1)) ++ (pc)))]) ++ ++(define_insn "long_branch_zero" ++ [(set (pc) ++ (if_then_else (match_operator:DI 0 "ordered_comparison_operator" ++ [(match_operand:DI 1 "register_operand" "d") ++ (const_int 0)]) ++ (match_operand:DI 2 "pc_or_label_operand" "") ++ (match_operand:DI 3 "pc_or_label_operand" ""))) ++ ] ++ "TARGET_MB_64" ++ { ++ if (operands[3] == pc_rtx) ++ return "beal%C0i%?\t%z1,%2"; ++ else ++ return "beal%N0i%?\t%z1,%3"; ++ } ++ [(set_attr "type" "branch") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")] ++) ++ ++(define_insn "long_branch_compare" ++ [(set (pc) ++ (if_then_else (match_operator:DI 0 "cmp_op" ++ [(match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "register_operand" "d") ++ ]) ++ (label_ref (match_operand 3)) ++ (pc))) ++ (clobber(reg:DI R_TMP))] ++ "TARGET_MB_64" ++ { ++ operands[4] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ enum rtx_code code = GET_CODE (operands[0]); ++ ++ if (code == GT || code == LE) ++ { ++ output_asm_insn ("cmpl\tr18,%z1,%z2", operands); ++ code = swap_condition (code); ++ } ++ else if (code == GTU || code == LEU) ++ { ++ output_asm_insn ("cmplu\tr18,%z1,%z2", operands); ++ code = swap_condition (code); ++ } ++ else if (code == GE || code == LT) ++ { ++ output_asm_insn ("cmpl\tr18,%z2,%z1", operands); ++ } ++ else if (code == GEU || code == LTU) ++ { ++ output_asm_insn ("cmplu\tr18,%z2,%z1", operands); ++ } ++ ++ operands[0] = gen_rtx_fmt_ee (signed_condition (code), DImode, operands[4], const0_rtx); ++ return "beal%C0i%?\tr18,%3"; ++ } ++ [(set_attr "type" "branch") ++ (set_attr "mode" "none") ++ (set_attr "length" "12")] ++) ++ + ;;---------------------------------------------------------------- + ;; Unconditional branches + ;;---------------------------------------------------------------- +diff --git a/gcc/config/microblaze/microblaze.opt b/gcc/config/microblaze/microblaze.opt +index cc009363f87..10910dbb83f 100644 +--- a/gcc/config/microblaze/microblaze.opt ++++ b/gcc/config/microblaze/microblaze.opt +@@ -136,4 +136,9 @@ Target + + mxl-frequency + Target Mask(AREA_OPTIMIZED_2) +-Use 8 stage pipeline (frequency optimization) ++Use 8 stage pipeline (frequency optimization). ++ ++m64 ++Target Mask(MB_64) ++MicroBlaze 64-bit mode. ++ +diff --git a/gcc/config/microblaze/t-microblaze b/gcc/config/microblaze/t-microblaze +index 7e2fc5dcef8..4c25cfe15e7 100644 +--- a/gcc/config/microblaze/t-microblaze ++++ b/gcc/config/microblaze/t-microblaze +@@ -1,8 +1,11 @@ +-MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high mlittle-endian +-MULTILIB_DIRNAMES = bs m mh le ++MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high mlittle-endian m64 ++MULTILIB_DIRNAMES = bs m mh le m64 + MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high + MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/mlittle-endian ++MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/m64 + MULTILIB_EXCEPTIONS += mxl-multiply-high/mlittle-endian ++MULTILIB_EXCEPTIONS += mxl-multiply-high/m64 ++MULTILIB_EXCEPTIONS += *mxl-multiply-high/mlittle-endian/m64 + + # Extra files + microblaze-c.o: $(srcdir)/config/microblaze/microblaze-c.cc \ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch new file mode 100644 index 00000000..c36e246a --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch @@ -0,0 +1,2446 @@ +From da40b160857d0b6a56b6f6c9c81d61dabb5255db Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 14:38:48 +0530 +Subject: [PATCH 28/53] Intial commit for 64bit-MB sources. Need to cleanup + the code later. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/constraints.md | 2 +- + gcc/config/microblaze/microblaze-c.cc | 6 + + gcc/config/microblaze/microblaze.cc | 216 ++++++--- + gcc/config/microblaze/microblaze.h | 63 ++- + gcc/config/microblaze/microblaze.md | 605 ++++++++++++++++++------ + gcc/config/microblaze/t-microblaze | 3 +- + libgcc/config/microblaze/crti.S | 4 +- + libgcc/config/microblaze/crtn.S | 4 +- + libgcc/config/microblaze/divdi3.S | 98 ++++ + libgcc/config/microblaze/divdi3_table.c | 62 +++ + libgcc/config/microblaze/moddi3.S | 97 ++++ + libgcc/config/microblaze/muldi3.S | 73 +++ + libgcc/config/microblaze/t-microblaze | 11 +- + libgcc/config/microblaze/udivdi3.S | 107 +++++ + libgcc/config/microblaze/umoddi3.S | 110 +++++ + 15 files changed, 1229 insertions(+), 232 deletions(-) + create mode 100644 libgcc/config/microblaze/divdi3.S + create mode 100644 libgcc/config/microblaze/divdi3_table.c + create mode 100644 libgcc/config/microblaze/moddi3.S + create mode 100644 libgcc/config/microblaze/muldi3.S + create mode 100644 libgcc/config/microblaze/udivdi3.S + create mode 100644 libgcc/config/microblaze/umoddi3.S + +diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md +index 2133650147e..0ced155340d 100644 +--- a/gcc/config/microblaze/constraints.md ++++ b/gcc/config/microblaze/constraints.md +@@ -55,7 +55,7 @@ + (define_constraint "K" + "A constant in the range 0xffffff8000000000L to 0x0000007fffffffffL (inclusive)." + (and (match_code "const_int") +- (match_test "ival > (long)0xffffff8000000000L && ival < (long)0x0000007fffffffffL"))) ++ (match_test "ival > (long)-549755813888 && ival < (long)549755813887"))) + + + ;; Define floating point constraints +diff --git a/gcc/config/microblaze/microblaze-c.cc b/gcc/config/microblaze/microblaze-c.cc +index caabe99b993..ef8d2430565 100644 +--- a/gcc/config/microblaze/microblaze-c.cc ++++ b/gcc/config/microblaze/microblaze-c.cc +@@ -100,4 +100,10 @@ microblaze_cpp_define (cpp_reader *pfile) + builtin_define ("HAVE_HW_FPU_SQRT"); + builtin_define ("__HAVE_HW_FPU_SQRT__"); + } ++ if (TARGET_MB_64) ++ { ++ builtin_define ("__arch64__"); ++ builtin_define ("__microblaze64__"); ++ builtin_define ("__MICROBLAZE64__"); ++ } + } +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 1ac889041b8..9d3628c6816 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -384,10 +384,10 @@ simple_memory_operand (rtx op, machine_mode mode ATTRIBUTE_UNUSED) + { + return 1; + } +- else if (GET_CODE (plus0) == REG && GET_CODE (plus1) == REG) ++ /*else if (GET_CODE (plus0) == REG && GET_CODE (plus1) == REG) + { + return 1; +- } ++ }*/ + else + return 0; + +@@ -435,7 +435,7 @@ double_memory_operand (rtx op, machine_mode mode) + return 1; + + return memory_address_p ((GET_MODE_CLASS (mode) == MODE_INT +- ? E_SImode : E_SFmode), ++ ? Pmode : E_SFmode), + plus_constant (Pmode, addr, 4)); + } + +@@ -682,7 +682,7 @@ microblaze_legitimize_tls_address(rtx x, rtx reg) + /* Load the addend. */ + addend = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, x, GEN_INT (TLS_DTPREL)), + UNSPEC_TLS); +- addend = force_reg (SImode, gen_rtx_CONST (SImode, addend)); ++ addend = force_reg (Pmode, gen_rtx_CONST (Pmode, addend)); + dest = gen_rtx_PLUS (Pmode, dest, addend); + break; + +@@ -700,7 +700,7 @@ microblaze_classify_unspec (struct microblaze_address_info *info, rtx x) + + if (XINT (x, 1) == UNSPEC_GOTOFF) + { +- info->regA = gen_rtx_REG (SImode, PIC_OFFSET_TABLE_REGNUM); ++ info->regA = gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM); + info->type = ADDRESS_GOTOFF; + } + else if (XINT (x, 1) == UNSPEC_PLT) +@@ -1303,8 +1303,16 @@ microblaze_block_move_loop (rtx dest, rtx src, HOST_WIDE_INT length) + emit_move_insn (dest_reg, plus_constant (Pmode, dest_reg, MAX_MOVE_BYTES)); + + /* Emit the test & branch. */ +- emit_insn (gen_cbranchsi4 (gen_rtx_NE (SImode, src_reg, final_src), ++ ++ if (TARGET_MB_64) { ++ emit_insn (gen_cbranchdi4 (gen_rtx_NE (Pmode, src_reg, final_src), ++ src_reg, final_src, label)); ++ } ++ else { ++ emit_insn (gen_cbranchsi4 (gen_rtx_NE (Pmode, src_reg, final_src), + src_reg, final_src, label)); ++ ++ } + + /* Mop up any left-over bytes. */ + if (leftover) +@@ -1634,14 +1642,20 @@ microblaze_function_arg_advance (cumulative_args_t cum_v, + break; + + case E_DFmode: +- cum->arg_words += 2; ++ if (TARGET_MB_64) ++ cum->arg_words++; ++ else ++ cum->arg_words += 2; + if (!cum->gp_reg_found && cum->arg_number <= 2) + cum->fp_code += 2 << ((cum->arg_number - 1) * 2); + break; + + case E_DImode: + cum->gp_reg_found = 1; +- cum->arg_words += 2; ++ if (TARGET_MB_64) ++ cum->arg_words++; ++ else ++ cum->arg_words += 2; + break; + + case E_QImode: +@@ -2156,7 +2170,7 @@ compute_frame_size (HOST_WIDE_INT size) + + if (regno != MB_ABI_SUB_RETURN_ADDR_REGNUM) + /* Don't account for link register. It is accounted specially below. */ +- gp_reg_size += GET_MODE_SIZE (SImode); ++ gp_reg_size += GET_MODE_SIZE (Pmode); + + mask |= (1L << (regno - GP_REG_FIRST)); + } +@@ -2425,7 +2439,7 @@ print_operand (FILE * file, rtx op, int letter) + + if ((letter == 'M' && !WORDS_BIG_ENDIAN) + || (letter == 'L' && WORDS_BIG_ENDIAN) || letter == 'D') +- regnum++; ++ regnum++; + + fprintf (file, "%s", reg_names[regnum]); + } +@@ -2451,6 +2465,7 @@ print_operand (FILE * file, rtx op, int letter) + else if (letter == 'h' || letter == 'j') + { + long val[2]; ++ int val1[2]; + long l[2]; + if (code == CONST_DOUBLE) + { +@@ -2463,12 +2478,12 @@ print_operand (FILE * file, rtx op, int letter) + val[0] = l[WORDS_BIG_ENDIAN != 0]; + } + } +- else if (code == CONST_INT) ++ else if (code == CONST_INT || code == CONST)// || code == SYMBOL_REF ||code == LABEL_REF) + { +- val[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32; +- val[1] = INTVAL (op) & 0x00000000ffffffffLL; ++ val1[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32; ++ val1[1] = INTVAL (op) & 0x00000000ffffffffLL; + } +- fprintf (file, "0x%8.8lx", (letter == 'h') ? val[0] : val[1]); ++ fprintf (file, "0x%8.8lx", (letter == 'h') ? val1[0] : val1[1]); + } + else if (code == CONST_DOUBLE) + { +@@ -2662,7 +2677,10 @@ microblaze_asm_constructor (rtx symbol ATTRIBUTE_UNUSED, int priority) + + switch_to_section (get_section (section, 0, NULL)); + assemble_align (POINTER_SIZE); +- fputs ("\t.word\t", asm_out_file); ++ if (TARGET_MB_64) ++ fputs ("\t.dword\t", asm_out_file); ++ else ++ fputs ("\t.word\t", asm_out_file); + output_addr_const (asm_out_file, symbol); + fputs ("\n", asm_out_file); + } +@@ -2685,7 +2703,10 @@ microblaze_asm_destructor (rtx symbol, int priority) + + switch_to_section (get_section (section, 0, NULL)); + assemble_align (POINTER_SIZE); +- fputs ("\t.word\t", asm_out_file); ++ if (TARGET_MB_64) ++ fputs ("\t.dword\t", asm_out_file); ++ else ++ fputs ("\t.word\t", asm_out_file); + output_addr_const (asm_out_file, symbol); + fputs ("\n", asm_out_file); + } +@@ -2751,7 +2772,7 @@ save_restore_insns (int prologue) + /* For interrupt_handlers, need to save/restore the MSR. */ + if (microblaze_is_interrupt_variant ()) + { +- isr_mem_rtx = gen_rtx_MEM (SImode, ++ isr_mem_rtx = gen_rtx_MEM (Pmode, + gen_rtx_PLUS (Pmode, base_reg_rtx, + GEN_INT (current_frame_info. + gp_offset - +@@ -2759,8 +2780,8 @@ save_restore_insns (int prologue) + + /* Do not optimize in flow analysis. */ + MEM_VOLATILE_P (isr_mem_rtx) = 1; +- isr_reg_rtx = gen_rtx_REG (SImode, MB_ABI_MSR_SAVE_REG); +- isr_msr_rtx = gen_rtx_REG (SImode, ST_REG); ++ isr_reg_rtx = gen_rtx_REG (Pmode, MB_ABI_MSR_SAVE_REG); ++ isr_msr_rtx = gen_rtx_REG (Pmode, ST_REG); + } + + if (microblaze_is_interrupt_variant () && !prologue) +@@ -2768,8 +2789,8 @@ save_restore_insns (int prologue) + emit_move_insn (isr_reg_rtx, isr_mem_rtx); + emit_move_insn (isr_msr_rtx, isr_reg_rtx); + /* Do not optimize in flow analysis. */ +- emit_insn (gen_rtx_USE (SImode, isr_reg_rtx)); +- emit_insn (gen_rtx_USE (SImode, isr_msr_rtx)); ++ emit_insn (gen_rtx_USE (Pmode, isr_reg_rtx)); ++ emit_insn (gen_rtx_USE (Pmode, isr_msr_rtx)); + } + + for (regno = GP_REG_FIRST; regno <= GP_REG_LAST; regno++) +@@ -2780,9 +2801,9 @@ save_restore_insns (int prologue) + /* Don't handle here. Already handled as the first register. */ + continue; + +- reg_rtx = gen_rtx_REG (SImode, regno); ++ reg_rtx = gen_rtx_REG (Pmode, regno); + insn = gen_rtx_PLUS (Pmode, base_reg_rtx, GEN_INT (gp_offset)); +- mem_rtx = gen_rtx_MEM (SImode, insn); ++ mem_rtx = gen_rtx_MEM (Pmode, insn); + if (microblaze_is_interrupt_variant () || save_volatiles) + /* Do not optimize in flow analysis. */ + MEM_VOLATILE_P (mem_rtx) = 1; +@@ -2797,7 +2818,7 @@ save_restore_insns (int prologue) + insn = emit_move_insn (reg_rtx, mem_rtx); + } + +- gp_offset += GET_MODE_SIZE (SImode); ++ gp_offset += GET_MODE_SIZE (Pmode); + } + } + +@@ -2807,8 +2828,8 @@ save_restore_insns (int prologue) + emit_move_insn (isr_mem_rtx, isr_reg_rtx); + + /* Do not optimize in flow analysis. */ +- emit_insn (gen_rtx_USE (SImode, isr_reg_rtx)); +- emit_insn (gen_rtx_USE (SImode, isr_msr_rtx)); ++ emit_insn (gen_rtx_USE (Pmode, isr_reg_rtx)); ++ emit_insn (gen_rtx_USE (Pmode, isr_msr_rtx)); + } + + /* Done saving and restoring */ +@@ -2898,7 +2919,10 @@ microblaze_elf_asm_cdtor (rtx symbol, int priority, bool is_ctor) + + switch_to_section (s); + assemble_align (POINTER_SIZE); +- fputs ("\t.word\t", asm_out_file); ++ if (TARGET_MB_64) ++ fputs ("\t.dword\t", asm_out_file); ++ else ++ fputs ("\t.word\t", asm_out_file); + output_addr_const (asm_out_file, symbol); + fputs ("\n", asm_out_file); + } +@@ -3042,10 +3066,10 @@ microblaze_expand_prologue (void) + { + if (offset != 0) + ptr = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (offset)); +- emit_move_insn (gen_rtx_MEM (SImode, ptr), +- gen_rtx_REG (SImode, regno)); ++ emit_move_insn (gen_rtx_MEM (Pmode, ptr), ++ gen_rtx_REG (Pmode, regno)); + +- offset += GET_MODE_SIZE (SImode); ++ offset += GET_MODE_SIZE (Pmode); + } + } + +@@ -3054,15 +3078,23 @@ microblaze_expand_prologue (void) + rtx fsiz_rtx = GEN_INT (fsiz); + + rtx_insn *insn = NULL; +- insn = emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, ++ if (TARGET_MB_64) ++ { ++ ++ insn = emit_insn (gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx, + fsiz_rtx)); ++ } ++ else { ++ insn = emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, ++ fsiz_rtx)); ++ } + if (insn) + RTX_FRAME_RELATED_P (insn) = 1; + + /* Handle SUB_RETURN_ADDR_REGNUM specially at first. */ + if (!crtl->is_leaf || interrupt_handler) + { +- mem_rtx = gen_rtx_MEM (SImode, ++ mem_rtx = gen_rtx_MEM (Pmode, + gen_rtx_PLUS (Pmode, stack_pointer_rtx, + const0_rtx)); + +@@ -3070,7 +3102,7 @@ microblaze_expand_prologue (void) + /* Do not optimize in flow analysis. */ + MEM_VOLATILE_P (mem_rtx) = 1; + +- reg_rtx = gen_rtx_REG (SImode, MB_ABI_SUB_RETURN_ADDR_REGNUM); ++ reg_rtx = gen_rtx_REG (Pmode, MB_ABI_SUB_RETURN_ADDR_REGNUM); + insn = emit_move_insn (mem_rtx, reg_rtx); + RTX_FRAME_RELATED_P (insn) = 1; + } +@@ -3180,12 +3212,12 @@ microblaze_expand_epilogue (void) + if (!crtl->is_leaf || interrupt_handler) + { + mem_rtx = +- gen_rtx_MEM (SImode, ++ gen_rtx_MEM (Pmode, + gen_rtx_PLUS (Pmode, stack_pointer_rtx, const0_rtx)); + if (interrupt_handler) + /* Do not optimize in flow analysis. */ + MEM_VOLATILE_P (mem_rtx) = 1; +- reg_rtx = gen_rtx_REG (SImode, MB_ABI_SUB_RETURN_ADDR_REGNUM); ++ reg_rtx = gen_rtx_REG (Pmode, MB_ABI_SUB_RETURN_ADDR_REGNUM); + emit_move_insn (reg_rtx, mem_rtx); + } + +@@ -3201,15 +3233,25 @@ microblaze_expand_epilogue (void) + /* _restore_ registers for epilogue. */ + save_restore_insns (0); + emit_insn (gen_blockage ()); +- emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx)); ++ if (TARGET_MB_64) ++ emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx)); ++ else ++ emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx)); + } + + if (crtl->calls_eh_return) +- emit_insn (gen_addsi3 (stack_pointer_rtx, ++ if (TARGET_MB_64) { ++ emit_insn (gen_adddi3 (stack_pointer_rtx, + stack_pointer_rtx, +- gen_raw_REG (SImode, ++ gen_raw_REG (Pmode, + MB_EH_STACKADJ_REGNUM))); +- ++ } ++ else { ++ emit_insn (gen_addsi3 (stack_pointer_rtx, ++ stack_pointer_rtx, ++ gen_raw_REG (Pmode, ++ MB_EH_STACKADJ_REGNUM))); ++ } + emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST + + MB_ABI_SUB_RETURN_ADDR_REGNUM))); + } +@@ -3376,9 +3418,14 @@ microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, + else + this_rtx = gen_rtx_REG (Pmode, MB_ABI_FIRST_ARG_REGNUM); + +- /* Apply the constant offset, if required. */ ++ /* Apply the constant offset, if required. */ + if (delta) +- emit_insn (gen_addsi3 (this_rtx, this_rtx, GEN_INT (delta))); ++ { ++ if (TARGET_MB_64) ++ emit_insn (gen_adddi3 (this_rtx, this_rtx, GEN_INT (delta))); ++ else ++ emit_insn (gen_addsi3 (this_rtx, this_rtx, GEN_INT (delta))); ++ } + + /* Apply the offset from the vtable, if required. */ + if (vcall_offset) +@@ -3391,7 +3438,10 @@ microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, + rtx loc = gen_rtx_PLUS (Pmode, temp1, vcall_offset_rtx); + emit_move_insn (temp1, gen_rtx_MEM (Pmode, loc)); + +- emit_insn (gen_addsi3 (this_rtx, this_rtx, temp1)); ++ if (TARGET_MB_64) ++ emit_insn (gen_adddi3 (this_rtx, this_rtx, temp1)); ++ else ++ emit_insn (gen_addsi3 (this_rtx, this_rtx, temp1)); + } + + /* Generate a tail call to the target function. */ +@@ -3622,9 +3672,9 @@ microblaze_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) + emit_block_move (m_tramp, assemble_trampoline_template (), + GEN_INT (6*UNITS_PER_WORD), BLOCK_OP_NORMAL); + +- mem = adjust_address (m_tramp, SImode, 16); ++ mem = adjust_address (m_tramp, Pmode, 16); + emit_move_insn (mem, chain_value); +- mem = adjust_address (m_tramp, SImode, 20); ++ mem = adjust_address (m_tramp, Pmode, 20); + emit_move_insn (mem, fnaddr); + } + +@@ -3648,7 +3698,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) + { + comp_reg = cmp_op0; + condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx); +- if (mode == SImode) ++ if (mode == Pmode) + emit_jump_insn (gen_condjump (condition, label1)); + else + emit_jump_insn (gen_long_condjump (condition, label1)); +@@ -3767,7 +3817,7 @@ microblaze_expand_conditional_branch_sf (rtx operands[]) + rtx comp_reg = gen_reg_rtx (SImode); + + emit_insn (gen_cstoresf4 (comp_reg, operands[0], cmp_op0, cmp_op1)); +- condition = gen_rtx_NE (SImode, comp_reg, const0_rtx); ++ condition = gen_rtx_NE (Pmode, comp_reg, const0_rtx); + emit_jump_insn (gen_condjump (condition, operands[3])); + } + +@@ -3777,10 +3827,10 @@ microblaze_expand_conditional_branch_df (rtx operands[]) + rtx condition; + rtx cmp_op0 = XEXP (operands[0], 0); + rtx cmp_op1 = XEXP (operands[0], 1); +- rtx comp_reg = gen_reg_rtx (DImode); ++ rtx comp_reg = gen_reg_rtx (Pmode); + + emit_insn (gen_cstoredf4 (comp_reg, operands[0], cmp_op0, cmp_op1)); +- condition = gen_rtx_NE (DImode, comp_reg, const0_rtx); ++ condition = gen_rtx_NE (Pmode, comp_reg, const0_rtx); + emit_jump_insn (gen_long_condjump (condition, operands[3])); + } + +@@ -3801,8 +3851,8 @@ microblaze_expand_divide (rtx operands[]) + { + /* Table lookup software divides. Works for all (nr/dr) where (0 <= nr,dr <= 15). */ + +- rtx regt1 = gen_reg_rtx (SImode); +- rtx reg18 = gen_rtx_REG (SImode, R_TMP); ++ rtx regt1 = gen_reg_rtx (Pmode); ++ rtx reg18 = gen_rtx_REG (Pmode, R_TMP); + rtx regqi = gen_reg_rtx (QImode); + rtx_code_label *div_label = gen_label_rtx (); + rtx_code_label *div_end_label = gen_label_rtx (); +@@ -3810,17 +3860,31 @@ microblaze_expand_divide (rtx operands[]) + rtx mem_rtx; + rtx ret; + rtx_insn *jump, *cjump, *insn; +- +- insn = emit_insn (gen_iorsi3 (regt1, operands[1], operands[2])); +- cjump = emit_jump_insn_after (gen_cbranchsi4 ( +- gen_rtx_GTU (SImode, regt1, GEN_INT (15)), ++ ++ if (TARGET_MB_64) { ++ insn = emit_insn (gen_iordi3 (regt1, operands[1], operands[2])); ++ cjump = emit_jump_insn_after (gen_cbranchdi4 ( ++ gen_rtx_GTU (Pmode, regt1, GEN_INT (15)), ++ regt1, GEN_INT (15), div_label), insn); ++ } ++ else { ++ insn = emit_insn (gen_iorsi3 (regt1, operands[1], operands[2])); ++ cjump = emit_jump_insn_after (gen_cbranchsi4 ( ++ gen_rtx_GTU (Pmode, regt1, GEN_INT (15)), + regt1, GEN_INT (15), div_label), insn); ++ } + LABEL_NUSES (div_label) = 1; + JUMP_LABEL (cjump) = div_label; +- emit_insn (gen_rtx_CLOBBER (SImode, reg18)); ++ emit_insn (gen_rtx_CLOBBER (Pmode, reg18)); + +- emit_insn (gen_ashlsi3_bshift (regt1, operands[1], GEN_INT(4))); +- emit_insn (gen_addsi3 (regt1, regt1, operands[2])); ++ if (TARGET_MB_64) { ++ emit_insn (gen_ashldi3_long (regt1, operands[1], GEN_INT(4))); ++ emit_insn (gen_adddi3 (regt1, regt1, operands[2])); ++ } ++ else { ++ emit_insn (gen_ashlsi3_bshift (regt1, operands[1], GEN_INT(4))); ++ emit_insn (gen_addsi3 (regt1, regt1, operands[2])); ++ } + mem_rtx = gen_rtx_MEM (QImode, + gen_rtx_PLUS (QImode, regt1, div_table_rtx)); + +@@ -3967,7 +4031,7 @@ insert_wic_for_ilb_runout (rtx_insn *first) + { + insn = + emit_insn_before (gen_iprefetch +- (gen_int_mode (addr_offset, SImode)), ++ (gen_int_mode (addr_offset, Pmode)), + before_4); + recog_memoized (insn); + INSN_LOCATION (insn) = INSN_LOCATION (before_4); +@@ -3977,7 +4041,27 @@ insert_wic_for_ilb_runout (rtx_insn *first) + } + } + } +- ++ ++/* Set the names for various arithmetic operations according to the ++ * MICROBLAZE ABI. */ ++static void ++microblaze_init_libfuncs (void) ++{ ++ set_optab_libfunc (smod_optab, SImode, "__modsi3"); ++ set_optab_libfunc (sdiv_optab, SImode, "__divsi3"); ++ set_optab_libfunc (smul_optab, SImode, "__mulsi3"); ++ set_optab_libfunc (umod_optab, SImode, "__umodsi3"); ++ set_optab_libfunc (udiv_optab, SImode, "__udivsi3"); ++ ++ if (TARGET_MB_64) ++ { ++ set_optab_libfunc (smod_optab, DImode, "__moddi3"); ++ set_optab_libfunc (sdiv_optab, DImode, "__divdi3"); ++ set_optab_libfunc (smul_optab, DImode, "__muldi3"); ++ set_optab_libfunc (umod_optab, DImode, "__umoddi3"); ++ set_optab_libfunc (udiv_optab, DImode, "__udivdi3"); ++ } ++} + /* Insert instruction prefetch instruction at the fall + through path of the function call. */ + +@@ -4130,6 +4214,17 @@ microblaze_starting_frame_offset (void) + #undef TARGET_LRA_P + #define TARGET_LRA_P hook_bool_void_false + ++#ifdef TARGET_MB_64 ++#undef TARGET_ASM_ALIGNED_DI_OP ++#define TARGET_ASM_ALIGNED_DI_OP "\t.dword\t" ++ ++#undef TARGET_ASM_ALIGNED_HI_OP ++#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" ++ ++#undef TARGET_ASM_ALIGNED_SI_OP ++#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" ++#endif ++ + #undef TARGET_FRAME_POINTER_REQUIRED + #define TARGET_FRAME_POINTER_REQUIRED microblaze_frame_pointer_required + +@@ -4139,6 +4234,9 @@ microblaze_starting_frame_offset (void) + #undef TARGET_TRAMPOLINE_INIT + #define TARGET_TRAMPOLINE_INIT microblaze_trampoline_init + ++#undef TARGET_INIT_LIBFUNCS ++#define TARGET_INIT_LIBFUNCS microblaze_init_libfuncs ++ + #undef TARGET_PROMOTE_FUNCTION_MODE + #define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote + +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index 885abc6e5a1..5f30b8ac195 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -173,7 +173,6 @@ extern enum pipeline_type microblaze_pipe; + + /* Generate DWARF exception handling info. */ + #define DWARF2_UNWIND_INFO 1 +- + /* Don't generate .loc operations. */ + #define DWARF2_ASM_LINE_DEBUG_INFO 0 + +@@ -206,38 +205,51 @@ extern enum pipeline_type microblaze_pipe; + ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr) + + /* Use DWARF 2 debugging information by default. */ +-#define DWARF2_DEBUGGING_INFO ++#define DWARF2_DEBUGGING_INFO 1 + #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG ++#define DWARF2_ADDR_SIZE 4 + + /* Target machine storage layout */ + + #define BITS_BIG_ENDIAN 0 + #define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0) + #define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN) +-#define BITS_PER_WORD 32 +-#define UNITS_PER_WORD 4 ++//#define BITS_PER_WORD 64 ++//Revisit ++#define MAX_BITS_PER_WORD 64 ++#define UNITS_PER_WORD (TARGET_MB_64 ? 8 : 4) ++//#define MIN_UNITS_PER_WORD (TARGET_MB_64 ? 8 : 4) ++//#define UNITS_PER_WORD 4 + #define MIN_UNITS_PER_WORD 4 + #define INT_TYPE_SIZE 32 + #define SHORT_TYPE_SIZE 16 +-#define LONG_TYPE_SIZE 64 ++#define LONG_TYPE_SIZE (TARGET_MB_64 ? 64 : 32) + #define LONG_LONG_TYPE_SIZE 64 + #define FLOAT_TYPE_SIZE 32 + #define DOUBLE_TYPE_SIZE 64 + #define LONG_DOUBLE_TYPE_SIZE 64 +-#define POINTER_SIZE 32 +-#define PARM_BOUNDARY 32 +-#define FUNCTION_BOUNDARY 32 +-#define EMPTY_FIELD_BOUNDARY 32 ++#define POINTER_SIZE (TARGET_MB_64 ? 64 : 32) ++//#define WIDEST_HARDWARE_FP_SIZE 64 ++//#define POINTERS_EXTEND_UNSIGNED 1 ++#define PARM_BOUNDARY (TARGET_MB_64 ? 64 : 32) ++#define FUNCTION_BOUNDARY (TARGET_MB_64 ? 64 : 32) ++#define EMPTY_FIELD_BOUNDARY (TARGET_MB_64 ? 64 : 32) + #define STRUCTURE_SIZE_BOUNDARY 8 +-#define BIGGEST_ALIGNMENT 32 ++#define BIGGEST_ALIGNMENT (TARGET_MB_64 ? 64 : 32) + #define STRICT_ALIGNMENT 1 + #define PCC_BITFIELD_TYPE_MATTERS 1 + ++//#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_MB_64 ? TImode : DImode) + #undef SIZE_TYPE +-#define SIZE_TYPE "unsigned int" ++#define SIZE_TYPE (TARGET_MB_64 ? "long unsigned int" : "unsigned int") + + #undef PTRDIFF_TYPE +-#define PTRDIFF_TYPE "int" ++#define PTRDIFF_TYPE (TARGET_MB_64 ? "long int" : "int") ++ ++/*#undef INTPTR_TYPE ++#define INTPTR_TYPE (TARGET_MB_64 ? "long int" : "int")*/ ++#undef UINTPTR_TYPE ++#define UINTPTR_TYPE (TARGET_MB_64 ? "long unsigned int" : "unsigned int") + + #define DATA_ALIGNMENT(TYPE, ALIGN) \ + ((((ALIGN) < BITS_PER_WORD) \ +@@ -253,12 +265,12 @@ extern enum pipeline_type microblaze_pipe; + #define WORD_REGISTER_OPERATIONS 1 + + #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND +- ++/* + #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ + if (GET_MODE_CLASS (MODE) == MODE_INT \ +- && GET_MODE_SIZE (MODE) < 4) \ +- (MODE) = SImode; +- ++ && GET_MODE_SIZE (MODE) < (TARGET_MB_64 ? 8 : 4)) \ ++ (MODE) = TARGET_MB_64 ? DImode : SImode; ++*/ + /* Standard register usage. */ + + /* On the MicroBlaze, we have 32 integer registers */ +@@ -438,13 +450,16 @@ extern struct microblaze_frame_info current_frame_info; + #define FIRST_PARM_OFFSET(FNDECL) (UNITS_PER_WORD) + + #define ARG_POINTER_CFA_OFFSET(FNDECL) 0 ++#define DWARF_CIE_DATA_ALIGNMENT -1 + + #define REG_PARM_STACK_SPACE(FNDECL) (MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD) + + #define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1 + +-#define STACK_BOUNDARY 32 ++#define STACK_BOUNDARY (TARGET_MB_64 ? 64 : 32) + ++#define PREFERRED_STACK_BOUNDARY (TARGET_MB_64 ? 64 : 32) ++ + #define NUM_OF_ARGS 6 + + #define GP_RETURN (GP_REG_FIRST + MB_ABI_INT_RETURN_VAL_REGNUM) +@@ -455,12 +470,15 @@ extern struct microblaze_frame_info current_frame_info; + #define MAX_ARGS_IN_REGISTERS MB_ABI_MAX_ARG_REGS + + #define LIBCALL_VALUE(MODE) \ ++ gen_rtx_REG (MODE,GP_RETURN) ++ ++/*#define LIBCALL_VALUE(MODE) \ + gen_rtx_REG ( \ + ((GET_MODE_CLASS (MODE) != MODE_INT \ + || GET_MODE_SIZE (MODE) >= 4) \ + ? (MODE) \ + : SImode), GP_RETURN) +- ++*/ + /* 1 if N is a possible register number for a function value. + On the MicroBlaze, R2 R3 are the only register thus used. + Currently, R2 are only implemented here (C has no complex type) */ +@@ -500,7 +518,7 @@ typedef struct microblaze_args + /* 4 insns + 2 words of data. */ + #define TRAMPOLINE_SIZE (6 * 4) + +-#define TRAMPOLINE_ALIGNMENT 32 ++#define TRAMPOLINE_ALIGNMENT 64 + + #define REGNO_OK_FOR_BASE_P(regno) microblaze_regno_ok_for_base_p ((regno), 1) + +@@ -529,13 +547,13 @@ typedef struct microblaze_args + addresses which require two reload registers. */ + #define LEGITIMATE_PIC_OPERAND_P(X) microblaze_legitimate_pic_operand (X) + +-#define CASE_VECTOR_MODE (SImode) ++#define CASE_VECTOR_MODE (TARGET_MB_64? DImode:SImode) + + #ifndef DEFAULT_SIGNED_CHAR + #define DEFAULT_SIGNED_CHAR 1 + #endif + +-#define MOVE_MAX 4 ++#define MOVE_MAX (TARGET_MB_64 ? 8 : 4) + #define MAX_MOVE_MAX 8 + + #define SLOW_BYTE_ACCESS 1 +@@ -545,7 +563,7 @@ typedef struct microblaze_args + + #define SHIFT_COUNT_TRUNCATED 1 + +-#define Pmode SImode ++#define Pmode (TARGET_MB_64? DImode:SImode) + + #define FUNCTION_MODE SImode + +@@ -707,6 +725,7 @@ do { \ + + #undef TARGET_ASM_OUTPUT_IDENT + #define TARGET_ASM_OUTPUT_IDENT microblaze_asm_output_ident ++//#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive + + /* Default to -G 8 */ + #ifndef MICROBLAZE_DEFAULT_GVALUE +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 40711fe224b..c99150ff0da 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -26,6 +26,7 @@ + ;; Constants + ;;---------------------------------------------------- + (define_constants [ ++ (R_Z 0) ;; For reg r0 + (R_SP 1) ;; Stack pointer reg + (R_SR 15) ;; Sub-routine return addr reg + (R_IR 14) ;; Interrupt return addr reg +@@ -541,6 +542,7 @@ + + ;; Add 2 SImode integers [ src1 = reg ; src2 = arith ; dest = reg ] + ;; Leave carry as is ++ + (define_insn "addsi3" + [(set (match_operand:SI 0 "register_operand" "=d,d,d") + (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%dJ,dJ,dJ") +@@ -562,23 +564,38 @@ + + ;; Adding 2 DI operands in register or reg/imm + +-(define_insn "adddi3_long" ++(define_expand "adddi3" ++ [(set (match_operand:DI 0 "register_operand" "") ++ (plus:DI (match_operand:DI 1 "register_operand" "") ++ (match_operand:DI 2 "arith_plus_operand" "")))] ++"" ++{ ++ if (TARGET_MB_64) ++ { ++ if (GET_CODE (operands[2]) == CONST_INT && ++ INTVAL(operands[2]) < (long)-549755813888 && ++ INTVAL(operands[2]) > (long)549755813887) ++ FAIL; ++ } ++}) ++ ++(define_insn "*adddi3_long" + [(set (match_operand:DI 0 "register_operand" "=d,d") +- (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%dJ,dJ") ++ (plus:DI (match_operand:DI 1 "register_operand" "%d,d") + (match_operand:DI 2 "arith_plus_operand" "d,K")))] + "TARGET_MB_64" + "@ +- addlk\t%0,%z1,%2 +- addlik\t%0,%z1,%2" +- [(set_attr "type" "arith,arith") +- (set_attr "mode" "DI,DI") ++ addlk\t%0,%1,%2 ++ addlik\t%0,%1,%2 #N10" ++ [(set_attr "type" "darith,no_delay_arith") ++ (set_attr "mode" "DI") + (set_attr "length" "4,4")]) + +-(define_insn "adddi3" ++(define_insn "*adddi3_all" + [(set (match_operand:DI 0 "register_operand" "=d,d") + (plus:DI (match_operand:DI 1 "register_operand" "%d,d") + (match_operand:DI 2 "arith_operand" "d,i")))] +- "" ++ "!TARGET_MB_64" + "@ + add\t%L0,%L1,%L2\;addc\t%M0,%M1,%M2 + addi\t%L0,%L1,%j2\;addic\t%M0,%M1,%h2" +@@ -605,7 +622,7 @@ + (define_insn "iprefetch" + [(unspec [(match_operand:SI 0 "const_int_operand" "n")] UNSPEC_IPREFETCH) + (clobber (mem:BLK (scratch)))] +- "TARGET_PREFETCH" ++ "TARGET_PREFETCH && !TARGET_MB_64" + { + operands[2] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM); + return "mfs\t%2,rpc\n\twic\t%2,r0"; +@@ -618,23 +635,33 @@ + ;; Double Precision Subtraction + ;;---------------------------------------------------------------- + +-(define_insn "subdi3_long" +- [(set (match_operand:DI 0 "register_operand" "=d,d") +- (minus:DI (match_operand:DI 1 "register_operand" "d,d") +- (match_operand:DI 2 "register_operand" "d,n")))] ++(define_expand "subdi3" ++ [(set (match_operand:DI 0 "register_operand" "") ++ (minus:DI (match_operand:DI 1 "register_operand" "") ++ (match_operand:DI 2 "arith_operand" "")))] ++"" ++" ++{ ++}") ++ ++(define_insn "subsidi3" ++ [(set (match_operand:DI 0 "register_operand" "=d,d,d") ++ (minus:DI (match_operand:DI 1 "register_operand" "d,d,d") ++ (match_operand:DI 2 "arith_operand" "d,K,n")))] + "TARGET_MB_64" + "@ + rsubl\t%0,%2,%1 +- addlik\t%0,%z1,-%2" +- [(set_attr "type" "darith") +- (set_attr "mode" "DI,DI") +- (set_attr "length" "4,4")]) ++ addik\t%0,%z1,-%2 ++ addik\t%0,%z1,-%2" ++ [(set_attr "type" "arith,no_delay_arith,no_delay_arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4,4,4")]) + +-(define_insn "subdi3" ++(define_insn "subdi3_small" + [(set (match_operand:DI 0 "register_operand" "=&d") + (minus:DI (match_operand:DI 1 "register_operand" "d") + (match_operand:DI 2 "register_operand" "d")))] +- "" ++ "!TARGET_MB_64" + "rsub\t%L0,%L2,%L1\;rsubc\t%M0,%M2,%M1" + [(set_attr "type" "darith") + (set_attr "mode" "DI") +@@ -663,7 +690,7 @@ + (mult:DI + (sign_extend:DI (match_operand:SI 1 "register_operand" "d")) + (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))] +- "!TARGET_SOFT_MUL && TARGET_MULTIPLY_HIGH" ++ "!TARGET_SOFT_MUL && TARGET_MULTIPLY_HIGH && !TARGET_MB_64" + "mul\t%L0,%1,%2\;mulh\t%M0,%1,%2" + [(set_attr "type" "no_delay_arith") + (set_attr "mode" "DI") +@@ -674,7 +701,7 @@ + (mult:DI + (zero_extend:DI (match_operand:SI 1 "register_operand" "d")) + (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))] +- "!TARGET_SOFT_MUL && TARGET_MULTIPLY_HIGH" ++ "!TARGET_SOFT_MUL && TARGET_MULTIPLY_HIGH && !TARGET_MB_64" + "mul\t%L0,%1,%2\;mulhu\t%M0,%1,%2" + [(set_attr "type" "no_delay_arith") + (set_attr "mode" "DI") +@@ -685,7 +712,7 @@ + (mult:DI + (zero_extend:DI (match_operand:SI 1 "register_operand" "d")) + (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))] +- "!TARGET_SOFT_MUL && TARGET_MULTIPLY_HIGH" ++ "!TARGET_SOFT_MUL && TARGET_MULTIPLY_HIGH && !TARGET_MB_64" + "mul\t%L0,%1,%2\;mulhsu\t%M0,%2,%1" + [(set_attr "type" "no_delay_arith") + (set_attr "mode" "DI") +@@ -789,7 +816,7 @@ + (match_operand:SI 4 "arith_operand")]) + (label_ref (match_operand 5)) + (pc)))] +- "TARGET_HARD_FLOAT" ++ "TARGET_HARD_FLOAT && !TARGET_MB_64" + [(set (match_dup 1) (match_dup 3))] + + { +@@ -819,6 +846,15 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + ++(define_insn "negsi_long" ++ [(set (match_operand:SI 0 "register_operand" "=d") ++ (neg:SI (match_operand:DI 1 "register_operand" "d")))] ++ "" ++ "rsubk\t%0,%1,r0" ++ [(set_attr "type" "arith") ++ (set_attr "mode" "SI") ++ (set_attr "length" "4")]) ++ + (define_insn "negdi2_long" + [(set (match_operand:DI 0 "register_operand" "=d") + (neg:DI (match_operand:DI 1 "register_operand" "d")))] +@@ -847,16 +883,24 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + +-(define_insn "one_cmpldi2_long" ++(define_expand "one_cmpldi2" ++ [(set (match_operand:DI 0 "register_operand" "") ++ (not:DI (match_operand:DI 1 "register_operand" "")))] ++ "" ++ " ++{ ++}") ++ ++(define_insn "" + [(set (match_operand:DI 0 "register_operand" "=d") +- (not:DI (match_operand:DI 1 "register_operand" "d")))] ++ (not:DI (match_operand:DI 1 "arith_operand" "d")))] + "TARGET_MB_64" + "xorli\t%0,%1,-1" +- [(set_attr "type" "arith") ++ [(set_attr "type" "no_delay_arith") + (set_attr "mode" "DI") + (set_attr "length" "4")]) + +-(define_insn "*one_cmpldi2" ++(define_insn "" + [(set (match_operand:DI 0 "register_operand" "=d") + (not:DI (match_operand:DI 1 "register_operand" "d")))] + "" +@@ -871,7 +915,8 @@ + (not:DI (match_operand:DI 1 "register_operand" "")))] + "reload_completed + && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0])) +- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))" ++ && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1])) ++ && !TARGET_MB_64" + + [(set (subreg:SI (match_dup 0) 0) (not:SI (subreg:SI (match_dup 1) 0))) + (set (subreg:SI (match_dup 0) 4) (not:SI (subreg:SI (match_dup 1) 4)))] +@@ -883,18 +928,17 @@ + ;;---------------------------------------------------------------- + + (define_insn "anddi3" +- [(set (match_operand:DI 0 "register_operand" "=d,d") +- (and:DI (match_operand:DI 1 "arith_operand" "d,d") +- (match_operand:DI 2 "arith_operand" "d,K")))] ++ [(set (match_operand:DI 0 "register_operand" "=d,d,d") ++ (and:DI (match_operand:DI 1 "arith_operand" "d,d,d") ++ (match_operand:DI 2 "arith_operand" "d,K,I")))] + "TARGET_MB_64" + "@ + andl\t%0,%1,%2 +- andli\t%0,%1,%2 #andl1" +- ;; andli\t%0,%1,%2 #andl3 +- ;; andli\t%0,%1,%2 #andl2 +- [(set_attr "type" "arith,arith") +- (set_attr "mode" "DI,DI") +- (set_attr "length" "4,4")]) ++ andli\t%0,%1,%2 #andl2 ++ andli\t%0,%1,%2 #andl3" ++ [(set_attr "type" "arith,no_delay_arith,no_delay_arith") ++ (set_attr "mode" "DI,DI,DI") ++ (set_attr "length" "4,4,4")]) + + (define_insn "andsi3" + [(set (match_operand:SI 0 "register_operand" "=d,d,d,d") +@@ -919,7 +963,7 @@ + "@ + orl\t%0,%1,%2 + orli\t%0,%1,%2 #andl1" +- [(set_attr "type" "arith,arith") ++ [(set_attr "type" "arith,no_delay_arith") + (set_attr "mode" "DI,DI") + (set_attr "length" "4,4")]) + +@@ -945,7 +989,7 @@ + "@ + xorl\t%0,%1,%2 + xorli\t%0,%1,%2 #andl1" +- [(set_attr "type" "arith,arith") ++ [(set_attr "type" "arith,no_delay_arith") + (set_attr "mode" "DI,DI") + (set_attr "length" "4,4")]) + +@@ -1018,26 +1062,6 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + +-;;(define_expand "extendqidi2" +-;; [(set (match_operand:DI 0 "register_operand" "=d") +-;; (sign_extend:DI (match_operand:QI 1 "general_operand" "d")))] +-;; "TARGET_MB_64" +-;; { +-;; if (GET_CODE (operands[1]) != REG) +-;; FAIL; +-;; } +-;;) +- +- +-;;(define_insn "extendqidi2" +-;; [(set (match_operand:DI 0 "register_operand" "=d") +-;; (sign_extend:DI (match_operand:QI 1 "register_operand" "d")))] +-;; "TARGET_MB_64" +-;; "sextl8\t%0,%1" +-;; [(set_attr "type" "arith") +-;; (set_attr "mode" "DI") +-;; (set_attr "length" "4")]) +- + (define_insn "extendhisi2" + [(set (match_operand:SI 0 "register_operand" "=d") + (sign_extend:SI (match_operand:HI 1 "register_operand" "d")))] +@@ -1060,6 +1084,27 @@ + ;; Those for integer source operand are ordered + ;; widest source type first. + ++(define_insn "extendsidi2_long" ++ [(set (match_operand:DI 0 "register_operand" "=d,d,d") ++ (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))] ++ "TARGET_MB_64" ++ { ++ switch (which_alternative) ++ { ++ case 0: ++ return "sextl32\t%0,%1"; ++ case 1: ++ case 2: ++ { ++ output_asm_insn ("ll%i1\t%0,%1", operands); ++ return "sextl32\t%0,%0"; ++ } ++ } ++ } ++ [(set_attr "type" "multi,multi,multi") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4,8,8")]) ++ + (define_insn "extendsidi2" + [(set (match_operand:DI 0 "register_operand" "=d,d,d") + (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))] +@@ -1088,69 +1133,118 @@ + ;; Unlike most other insns, the move insns can't be split with + ;; different predicates, because register spilling and other parts of + ;; the compiler, have memoized the insn number already. ++;; //} + + (define_expand "movdi" + [(set (match_operand:DI 0 "nonimmediate_operand" "") + (match_operand:DI 1 "general_operand" ""))] + "" + { +- /* If operands[1] is a constant address illegal for pic, then we need to +- handle it just like microblaze_legitimize_address does. */ +- if (flag_pic && pic_address_needs_scratch (operands[1])) ++ if (TARGET_MB_64) + { ++ if (microblaze_expand_move (DImode, operands)) DONE; ++ } ++ else ++ { ++ /* If operands[1] is a constant address illegal for pic, then we need to ++ handle it just like microblaze_legitimize_address does. */ ++ if (flag_pic && pic_address_needs_scratch (operands[1])) ++ { + rtx temp = force_reg (DImode, XEXP (XEXP (operands[1], 0), 0)); + rtx temp2 = XEXP (XEXP (operands[1], 0), 1); + emit_move_insn (operands[0], gen_rtx_PLUS (DImode, temp, temp2)); + DONE; +- } +- +- +- if ((reload_in_progress | reload_completed) == 0 +- && !register_operand (operands[0], DImode) +- && !register_operand (operands[1], DImode) +- && (((GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0) +- && operands[1] != CONST0_RTX (DImode)))) +- { ++ } + +- rtx temp = force_reg (DImode, operands[1]); +- emit_move_insn (operands[0], temp); +- DONE; ++ if ((reload_in_progress | reload_completed) == 0 ++ && !register_operand (operands[0], DImode) ++ && !register_operand (operands[1], DImode) ++ && (((GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0) ++ && operands[1] != CONST0_RTX (DImode)))) ++ { ++ rtx temp = force_reg (DImode, operands[1]); ++ emit_move_insn (operands[0], temp); ++ DONE; ++ } + } + } + ) + ++;; Added for status registers ++(define_insn "movdi_status" ++ [(set (match_operand:DI 0 "register_operand" "=d,d,z") ++ (match_operand:DI 1 "register_operand" "z,d,d"))] ++ "microblaze_is_interrupt_variant () && TARGET_MB_64" ++ "@ ++ mfs\t%0,%1 #mfs ++ addlk\t%0,%1,r0 #add movdi ++ mts\t%0,%1 #mts" ++ [(set_attr "type" "move") ++ (set_attr "mode" "DI") ++ (set_attr "length" "12")]) ++ ++;; This move will be not be moved to delay slot. ++(define_insn "*movdi_internal3" ++ [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d") ++ (match_operand:DI 1 "immediate_operand" "J,I,Mnis"))] ++ "TARGET_MB_64 && (register_operand (operands[0], DImode) && ++ (GET_CODE (operands[1]) == CONST_INT && ++ (INTVAL (operands[1]) <= (long)549755813887 && INTVAL (operands[1]) >= (long)-549755813888)))" ++ "@ ++ addlk\t%0,r0,r0\t ++ addlik\t%0,r0,%1\t #N1 %X1 ++ addlik\t%0,r0,%1\t #N2 %X1" ++ [(set_attr "type" "arith,no_delay_arith,no_delay_arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) + +-(define_insn "*movdi_internal_64" +- [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,R,o") +- (match_operand:DI 1 "general_operand" " d,K,J,R,o,d,d"))] +- "TARGET_MB_64 && (INTVAL(operands[1]) < 0x7fffffffff) && (INTVAL(operands[1]) > 0xffffff8000000000)" ++;; This move may be used for PLT label operand ++(define_insn "*movdi_internal5_pltop" ++ [(set (match_operand:DI 0 "register_operand" "=d,d") ++ (match_operand:DI 1 "call_insn_operand" ""))] ++ "TARGET_MB_64 && (register_operand (operands[0], Pmode) && ++ PLT_ADDR_P (operands[1]))" ++ { ++ gcc_unreachable (); ++ } ++ [(set_attr "type" "load") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) ++ ++(define_insn "*movdi_internal2" ++ [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d, d,d,R,m") ++ (match_operand:DI 1 "move_src_operand" " d,I,Mnis,R,m,dJ,dJ"))] ++ "TARGET_MB_64" + { + switch (which_alternative) + { + case 0: +- return "addlk\t%0,%1"; +- case 1: +- return "addlik\t%0,r0,%1"; +- case 2: +- return "addlk\t%0,r0,r0"; +- case 3: +- case 4: +- return "lli\t%0,%1"; +- case 5: +- case 6: +- return "sli\t%1,%0"; +- } +- return "unreachable"; +- } +- [(set_attr "type" "no_delay_move,no_delay_arith,no_delay_arith,no_delay_load,no_delay_load,no_delay_store,no_delay_store") ++ return "addlk\t%0,%1,r0"; ++ case 1: ++ case 2: ++ if (GET_CODE (operands[1]) == CONST_INT && ++ (INTVAL (operands[1]) > (long)549755813887 || INTVAL (operands[1]) < (long)-549755813888)) ++ return "addlik\t%0,r0,%h1\n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #li => la"; ++ else ++ return "addlik\t%0,r0,%1"; ++ case 3: ++ case 4: ++ return "ll%i1\t%0,%1"; ++ case 5: ++ case 6: ++ return "sl%i0\t%z1,%0"; ++ } ++ } ++ [(set_attr "type" "load,no_delay_load,no_delay_load,no_delay_load,no_delay_load,no_delay_store,no_delay_store") + (set_attr "mode" "DI") +- (set_attr "length" "8,8,8,8,12,8,12")]) ++ (set_attr "length" "4,4,12,4,8,4,8")]) ++ + + + (define_insn "*movdi_internal" + [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,R,o") + (match_operand:DI 1 "general_operand" " d,i,J,R,o,d,d"))] +- "" ++ "!TARGET_MB_64" + { + switch (which_alternative) + { +@@ -1182,7 +1276,8 @@ + "reload_completed + && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0])) + && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1])) +- && (REGNO(operands[0]) == (REGNO(operands[1]) + 1))" ++ && (REGNO(operands[0]) == (REGNO(operands[1]) + 1)) ++ && !(TARGET_MB_64)" + + [(set (subreg:SI (match_dup 0) 4) (subreg:SI (match_dup 1) 4)) + (set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))] +@@ -1194,12 +1289,22 @@ + "reload_completed + && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0])) + && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1])) +- && (REGNO (operands[0]) != (REGNO (operands[1]) + 1))" ++ && (REGNO (operands[0]) != (REGNO (operands[1]) + 1)) ++ && !(TARGET_MB_64)" + + [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0)) + (set (subreg:SI (match_dup 0) 4) (subreg:SI (match_dup 1) 4))] + "") + ++(define_insn "movdi_long_int" ++ [(set (match_operand:DI 0 "nonimmediate_operand" "=d") ++ (match_operand:DI 1 "general_operand" "i"))] ++ "" ++ "addlik\t%0,r0,%h1\n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #li => la"; ++ [(set_attr "type" "no_delay_arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "12")]) ++ + ;; Unlike most other insns, the move insns can't be split with + ;; different predicates, because register spilling and other parts of + ;; the compiler, have memoized the insn number already. +@@ -1271,6 +1376,8 @@ + (set_attr "length" "4,4,8,4,8,4,8")]) + + ++ ++ + ;; 16-bit Integer moves + + ;; Unlike most other insns, the move insns can't be split with +@@ -1303,8 +1410,8 @@ + "@ + addik\t%0,r0,%1\t# %X1 + addk\t%0,%1,r0 +- lhui\t%0,%1 +- lhui\t%0,%1 ++ lhu%i1\t%0,%1 ++ lhu%i1\t%0,%1 + sh%i0\t%z1,%0 + sh%i0\t%z1,%0" + [(set_attr "type" "arith,move,load,no_delay_load,store,no_delay_store") +@@ -1347,7 +1454,7 @@ + lbu%i1\t%0,%1 + lbu%i1\t%0,%1 + sb%i0\t%z1,%0 +- sbi\t%z1,%0" ++ sb%i0\t%z1,%0" + [(set_attr "type" "arith,arith,move,load,no_delay_load,store,no_delay_store") + (set_attr "mode" "QI") + (set_attr "length" "4,4,8,4,8,4,8")]) +@@ -1420,7 +1527,7 @@ + addik\t%0,r0,%F1 + lw%i1\t%0,%1 + sw%i0\t%z1,%0 +- swi\t%z1,%0" ++ sw%i0\t%z1,%0" + [(set_attr "type" "move,no_delay_load,load,no_delay_load,no_delay_load,store,no_delay_store") + (set_attr "mode" "SF") + (set_attr "length" "4,4,4,4,4,4,4")]) +@@ -1459,6 +1566,33 @@ + ;; movdf_internal + ;; Applies to both TARGET_SOFT_FLOAT and TARGET_HARD_FLOAT + ;; ++(define_insn "*movdf_internal_64" ++ [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,d,d,m") ++ (match_operand:DF 1 "general_operand" "d,dG,m,F,T,d"))] ++ "TARGET_MB_64" ++ { ++ switch (which_alternative) ++ { ++ case 0: ++ return "addlk\t%0,%1,r0"; ++ case 1: ++ return "addlk\t%0,r0,r0"; ++ case 2: ++ case 4: ++ return "ll%i1\t%0,%1"; ++ case 3: ++ { ++ return "addlik\t%0,r0,%h1 \n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #Xfer Lo"; ++ } ++ case 5: ++ return "sl%i0\t%1,%0"; ++ } ++ gcc_unreachable (); ++ } ++ [(set_attr "type" "no_delay_move,no_delay_move,no_delay_load,no_delay_load,no_delay_load,no_delay_store") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4,4,4,16,4,4")]) ++ + (define_insn "*movdf_internal" + [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,d,o") + (match_operand:DF 1 "general_operand" "dG,o,F,T,d"))] +@@ -1493,7 +1627,8 @@ + "reload_completed + && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0])) + && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1])) +- && (REGNO (operands[0]) == (REGNO (operands[1]) + 1))" ++ && (REGNO (operands[0]) == (REGNO (operands[1]) + 1)) ++ && !TARGET_MB_64" + [(set (subreg:SI (match_dup 0) 4) (subreg:SI (match_dup 1) 4)) + (set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))] + "") +@@ -1504,7 +1639,8 @@ + "reload_completed + && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0])) + && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1])) +- && (REGNO (operands[0]) != (REGNO (operands[1]) + 1))" ++ && (REGNO (operands[0]) != (REGNO (operands[1]) + 1)) ++ && !TARGET_MB_64" + [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0)) + (set (subreg:SI (match_dup 0) 4) (subreg:SI (match_dup 1) 4))] + "") +@@ -2003,6 +2139,31 @@ else + " + ) + ++ ++(define_insn "seq_internal_pat_long" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (eq:DI ++ (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "pcmpleq\t%0,%1,%2" ++ [(set_attr "type" "arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")] ++) ++ ++(define_insn "sne_internal_pat_long" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (ne:DI ++ (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "pcmplne\t%0,%1,%2" ++ [(set_attr "type" "arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")] ++) ++ + (define_insn "seq_internal_pat" + [(set (match_operand:SI 0 "register_operand" "=d") + (eq:SI +@@ -2063,8 +2224,8 @@ else + (define_expand "cbranchsi4" + [(set (pc) + (if_then_else (match_operator 0 "ordered_comparison_operator" +- [(match_operand:SI 1 "register_operand") +- (match_operand:SI 2 "arith_operand" "I,i")]) ++ [(match_operand 1 "register_operand") ++ (match_operand 2 "arith_operand" "I,i")]) + (label_ref (match_operand 3 "")) + (pc)))] + "" +@@ -2076,13 +2237,13 @@ else + (define_expand "cbranchsi4_reg" + [(set (pc) + (if_then_else (match_operator 0 "ordered_comparison_operator" +- [(match_operand:SI 1 "register_operand") +- (match_operand:SI 2 "register_operand")]) ++ [(match_operand 1 "register_operand") ++ (match_operand 2 "register_operand")]) + (label_ref (match_operand 3 "")) + (pc)))] + "" + { +- microblaze_expand_conditional_branch_reg (SImode, operands); ++ microblaze_expand_conditional_branch_reg (Pmode, operands); + DONE; + }) + +@@ -2107,6 +2268,26 @@ else + (label_ref (match_operand 1)) + (pc)))]) + ++(define_insn "branch_zero64" ++ [(set (pc) ++ (if_then_else (match_operator 0 "ordered_comparison_operator" ++ [(match_operand 1 "register_operand" "d") ++ (const_int 0)]) ++ (match_operand 2 "pc_or_label_operand" "") ++ (match_operand 3 "pc_or_label_operand" ""))) ++ ] ++ "TARGET_MB_64" ++ { ++ if (operands[3] == pc_rtx) ++ return "bea%C0i%?\t%z1,%2"; ++ else ++ return "bea%N0i%?\t%z1,%3"; ++ } ++ [(set_attr "type" "branch") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")] ++) ++ + (define_insn "branch_zero" + [(set (pc) + (if_then_else (match_operator:SI 0 "ordered_comparison_operator" +@@ -2127,6 +2308,47 @@ else + (set_attr "length" "4")] + ) + ++(define_insn "branch_compare64" ++ [(set (pc) ++ (if_then_else (match_operator 0 "cmp_op" ++ [(match_operand 1 "register_operand" "d") ++ (match_operand 2 "register_operand" "d") ++ ]) ++ (label_ref (match_operand 3)) ++ (pc))) ++ (clobber(reg:SI R_TMP))] ++ "TARGET_MB_64" ++ { ++ operands[4] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM); ++ enum rtx_code code = GET_CODE (operands[0]); ++ ++ if (code == GT || code == LE) ++ { ++ output_asm_insn ("cmp\tr18,%z1,%z2", operands); ++ code = swap_condition (code); ++ } ++ else if (code == GTU || code == LEU) ++ { ++ output_asm_insn ("cmpu\tr18,%z1,%z2", operands); ++ code = swap_condition (code); ++ } ++ else if (code == GE || code == LT) ++ { ++ output_asm_insn ("cmp\tr18,%z2,%z1", operands); ++ } ++ else if (code == GEU || code == LTU) ++ { ++ output_asm_insn ("cmpu\tr18,%z2,%z1", operands); ++ } ++ ++ operands[0] = gen_rtx_fmt_ee (signed_condition (code), SImode, operands[4], const0_rtx); ++ return "bea%C0i%?\tr18,%3"; ++ } ++ [(set_attr "type" "branch") ++ (set_attr "mode" "none") ++ (set_attr "length" "12")] ++) ++ + (define_insn "branch_compare" + [(set (pc) + (if_then_else (match_operator:SI 0 "cmp_op" +@@ -2310,7 +2532,7 @@ else + ;; Indirect jumps. Jump to register values. Assuming absolute jumps + + (define_insn "indirect_jump_internal1" +- [(set (pc) (match_operand:SI 0 "register_operand" "d"))] ++ [(set (pc) (match_operand 0 "register_operand" "d"))] + "" + "bra%?\t%0" + [(set_attr "type" "jump") +@@ -2323,7 +2545,7 @@ else + (use (label_ref (match_operand 1 "" "")))] + "" + { +- gcc_assert (GET_MODE (operands[0]) == Pmode); ++ //gcc_assert (GET_MODE (operands[0]) == Pmode); + + if (!flag_pic || TARGET_PIC_DATA_TEXT_REL) + emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1])); +@@ -2335,7 +2557,7 @@ else + + (define_insn "tablejump_internal1" + [(set (pc) +- (match_operand:SI 0 "register_operand" "d")) ++ (match_operand 0 "register_operand" "d")) + (use (label_ref (match_operand 1 "" "")))] + "" + "bra%?\t%0 " +@@ -2345,9 +2567,9 @@ else + + (define_expand "tablejump_internal3" + [(parallel [(set (pc) +- (plus:SI (match_operand:SI 0 "register_operand" "d") +- (label_ref:SI (match_operand:SI 1 "" "")))) +- (use (label_ref:SI (match_dup 1)))])] ++ (plus (match_operand 0 "register_operand" "d") ++ (label_ref (match_operand:SI 1 "" "")))) ++ (use (label_ref (match_dup 1)))])] + "" + "" + ) +@@ -2408,7 +2630,7 @@ else + (minus (reg 1) (match_operand 1 "register_operand" ""))) + (set (reg 1) + (minus (reg 1) (match_dup 1)))] +- "" ++ "!TARGET_MB_64" + { + rtx retaddr = gen_rtx_MEM (Pmode, stack_pointer_rtx); + rtx reg = gen_reg_rtx (Pmode); +@@ -2433,7 +2655,7 @@ else + (define_expand "save_stack_block" + [(match_operand 0 "register_operand" "") + (match_operand 1 "register_operand" "")] +- "" ++ "!TARGET_MB_64" + { + emit_move_insn (operands[0], operands[1]); + DONE; +@@ -2443,7 +2665,7 @@ else + (define_expand "restore_stack_block" + [(match_operand 0 "register_operand" "") + (match_operand 1 "register_operand" "")] +- "" ++ "!TARGET_MB_64" + { + rtx retaddr = gen_rtx_MEM (Pmode, stack_pointer_rtx); + rtx rtmp = gen_rtx_REG (SImode, R_TMP); +@@ -2490,7 +2712,7 @@ else + + (define_insn "<optab>_internal" + [(any_return) +- (use (match_operand:SI 0 "register_operand" ""))] ++ (use (match_operand 0 "register_operand" ""))] + "" + { + if (microblaze_is_break_handler ()) +@@ -2523,7 +2745,7 @@ else + (define_expand "call" + [(parallel [(call (match_operand 0 "memory_operand" "m") + (match_operand 1 "" "i")) +- (clobber (reg:SI R_SR)) ++ (clobber (reg R_SR)) + (use (match_operand 2 "" "")) + (use (match_operand 3 "" ""))])] + "" +@@ -2544,12 +2766,12 @@ else + + if (GET_CODE (XEXP (operands[0], 0)) == UNSPEC) + emit_call_insn (gen_call_internal_plt0 (operands[0], operands[1], +- gen_rtx_REG (SImode, ++ gen_rtx_REG (Pmode, + GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM), + pic_offset_table_rtx)); + else + emit_call_insn (gen_call_internal0 (operands[0], operands[1], +- gen_rtx_REG (SImode, ++ gen_rtx_REG (Pmode, + GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM))); + + DONE; +@@ -2559,7 +2781,7 @@ else + (define_expand "call_internal0" + [(parallel [(call (match_operand 0 "" "") + (match_operand 1 "" "")) +- (clobber (match_operand:SI 2 "" ""))])] ++ (clobber (match_operand 2 "" ""))])] + "" + { + } +@@ -2568,18 +2790,34 @@ else + (define_expand "call_internal_plt0" + [(parallel [(call (match_operand 0 "" "") + (match_operand 1 "" "")) +- (clobber (match_operand:SI 2 "" "")) +- (use (match_operand:SI 3 "" ""))])] ++ (clobber (match_operand 2 "" "")) ++ (use (match_operand 3 "" ""))])] + "" + { + } + ) + ++(define_insn "call_internal_plt_64" ++ [(call (mem (match_operand 0 "call_insn_plt_operand" "")) ++ (match_operand 1 "" "i")) ++ (clobber (reg R_SR)) ++ (use (reg R_GOT))] ++ "flag_pic && TARGET_MB_64" ++ { ++ register rtx target2 = gen_rtx_REG (Pmode, ++ GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM); ++ gen_rtx_CLOBBER (VOIDmode, target2); ++ return "brealid\tr15,%0\;%#"; ++ } ++ [(set_attr "type" "call") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")]) ++ + (define_insn "call_internal_plt" +- [(call (mem (match_operand:SI 0 "call_insn_plt_operand" "")) +- (match_operand:SI 1 "" "i")) +- (clobber (reg:SI R_SR)) +- (use (reg:SI R_GOT))] ++ [(call (mem (match_operand 0 "call_insn_plt_operand" "")) ++ (match_operand 1 "" "i")) ++ (clobber (reg R_SR)) ++ (use (reg R_GOT))] + "flag_pic" + { + rtx target2 +@@ -2591,10 +2829,41 @@ else + (set_attr "mode" "none") + (set_attr "length" "4")]) + ++(define_insn "call_internal1_64" ++ [(call (mem (match_operand:VOID 0 "call_insn_simple_operand" "ri")) ++ (match_operand 1 "" "i")) ++ (clobber (reg R_SR))] ++ "TARGET_MB_64" ++ { ++ register rtx target = operands[0]; ++ register rtx target2 = gen_rtx_REG (Pmode, ++ GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM); ++ if (GET_CODE (target) == SYMBOL_REF) { ++ if (microblaze_break_function_p (SYMBOL_REF_DECL (target))) { ++ gen_rtx_CLOBBER (VOIDmode, target2); ++ return "breaki\tr16,%0\;%#"; ++ } ++ else { ++ gen_rtx_CLOBBER (VOIDmode, target2); ++ return "brealid\tr15,%0\;%#"; ++ } ++ } else if (GET_CODE (target) == CONST_INT) ++ return "la\t%@,r0,%0\;brald\tr15,%@\;%#"; ++ else if (GET_CODE (target) == REG) ++ return "brald\tr15,%0\;%#"; ++ else { ++ fprintf (stderr,"Unsupported call insn\n"); ++ return NULL; ++ } ++ } ++ [(set_attr "type" "call") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")]) ++ + (define_insn "call_internal1" + [(call (mem (match_operand:VOID 0 "call_insn_simple_operand" "ri")) +- (match_operand:SI 1 "" "i")) +- (clobber (reg:SI R_SR))] ++ (match_operand 1 "" "i")) ++ (clobber (reg R_SR))] + "" + { + rtx target = operands[0]; +@@ -2628,7 +2897,7 @@ else + [(parallel [(set (match_operand 0 "register_operand" "=d") + (call (match_operand 1 "memory_operand" "m") + (match_operand 2 "" "i"))) +- (clobber (reg:SI R_SR)) ++ (clobber (reg R_SR)) + (use (match_operand 3 "" ""))])] ;; next_arg_reg + "" + { +@@ -2649,13 +2918,13 @@ else + if (GET_CODE (XEXP (operands[1], 0)) == UNSPEC) + emit_call_insn (gen_call_value_intern_plt0 (operands[0], operands[1], + operands[2], +- gen_rtx_REG (SImode, ++ gen_rtx_REG (Pmode, + GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM), + pic_offset_table_rtx)); + else + emit_call_insn (gen_call_value_internal (operands[0], operands[1], + operands[2], +- gen_rtx_REG (SImode, ++ gen_rtx_REG (Pmode, + GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM))); + + DONE; +@@ -2667,7 +2936,7 @@ else + [(parallel [(set (match_operand 0 "" "") + (call (match_operand 1 "" "") + (match_operand 2 "" ""))) +- (clobber (match_operand:SI 3 "" "")) ++ (clobber (match_operand 3 "" "")) + ])] + "" + {} +@@ -2677,18 +2946,35 @@ else + [(parallel[(set (match_operand 0 "" "") + (call (match_operand 1 "" "") + (match_operand 2 "" ""))) +- (clobber (match_operand:SI 3 "" "")) +- (use (match_operand:SI 4 "" ""))])] ++ (clobber (match_operand 3 "" "")) ++ (use (match_operand 4 "" ""))])] + "flag_pic" + {} + ) + ++(define_insn "call_value_intern_plt_64" ++ [(set (match_operand:VOID 0 "register_operand" "=d") ++ (call (mem (match_operand 1 "call_insn_plt_operand" "")) ++ (match_operand 2 "" "i"))) ++ (clobber (match_operand 3 "register_operand" "=d")) ++ (use (match_operand 4 "register_operand"))] ++ "flag_pic && TARGET_MB_64" ++ { ++ register rtx target2=gen_rtx_REG (Pmode,GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM); ++ ++ gen_rtx_CLOBBER (VOIDmode,target2); ++ return "brealid\tr15,%1\;%#"; ++ } ++ [(set_attr "type" "call") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")]) ++ + (define_insn "call_value_intern_plt" + [(set (match_operand:VOID 0 "register_operand" "=d") +- (call (mem (match_operand:SI 1 "call_insn_plt_operand" "")) +- (match_operand:SI 2 "" "i"))) +- (clobber (match_operand:SI 3 "register_operand" "=d")) +- (use (match_operand:SI 4 "register_operand"))] ++ (call (mem (match_operand 1 "call_insn_plt_operand" "")) ++ (match_operand 2 "" "i"))) ++ (clobber (match_operand 3 "register_operand" "=d")) ++ (use (match_operand 4 "register_operand"))] + "flag_pic" + { + rtx target2 +@@ -2701,11 +2987,46 @@ else + (set_attr "mode" "none") + (set_attr "length" "4")]) + ++(define_insn "call_value_intern_64" ++ [(set (match_operand:VOID 0 "register_operand" "=d") ++ (call (mem (match_operand:VOID 1 "call_insn_operand" "ri")) ++ (match_operand 2 "" "i"))) ++ (clobber (match_operand 3 "register_operand" "=d"))] ++ "TARGET_MB_64" ++ { ++ register rtx target = operands[1]; ++ register rtx target2=gen_rtx_REG (Pmode,GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM); ++ ++ if (GET_CODE (target) == SYMBOL_REF) ++ { ++ gen_rtx_CLOBBER (VOIDmode,target2); ++ if (microblaze_break_function_p (SYMBOL_REF_DECL (target))) ++ return "breaki\tr16,%1\;%#"; ++ else if (SYMBOL_REF_FLAGS (target) & SYMBOL_FLAG_FUNCTION) ++ { ++ return "brealid\tr15,%1\;%#"; ++ } ++ else ++ { ++ return "bralid\tr15,%1\;%#"; ++ } ++ } ++ else if (GET_CODE (target) == CONST_INT) ++ return "la\t%@,r0,%1\;brald\tr15,%@\;%#"; ++ else if (GET_CODE (target) == REG) ++ return "brald\tr15,%1\;%#"; ++ else ++ return "Unsupported call insn\n"; ++ } ++ [(set_attr "type" "call") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")]) ++ + (define_insn "call_value_intern" + [(set (match_operand:VOID 0 "register_operand" "=d") + (call (mem (match_operand:VOID 1 "call_insn_operand" "ri")) +- (match_operand:SI 2 "" "i"))) +- (clobber (match_operand:SI 3 "register_operand" "=d"))] ++ (match_operand 2 "" "i"))) ++ (clobber (match_operand 3 "register_operand" "=d"))] + "" + { + rtx target = operands[1]; +diff --git a/gcc/config/microblaze/t-microblaze b/gcc/config/microblaze/t-microblaze +index 4c25cfe15e7..965132b3513 100644 +--- a/gcc/config/microblaze/t-microblaze ++++ b/gcc/config/microblaze/t-microblaze +@@ -2,7 +2,8 @@ MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high mlittle-en + MULTILIB_DIRNAMES = bs m mh le m64 + MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high + MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/mlittle-endian +-MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/m64 ++MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/mlittle-endian/m64 ++MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/m64 mxl-multiply-high + MULTILIB_EXCEPTIONS += mxl-multiply-high/mlittle-endian + MULTILIB_EXCEPTIONS += mxl-multiply-high/m64 + MULTILIB_EXCEPTIONS += *mxl-multiply-high/mlittle-endian/m64 +diff --git a/libgcc/config/microblaze/crti.S b/libgcc/config/microblaze/crti.S +index cbbe32d5f6a..ec797e1bf17 100644 +--- a/libgcc/config/microblaze/crti.S ++++ b/libgcc/config/microblaze/crti.S +@@ -40,7 +40,7 @@ + + .align 2 + __init: +- addik r1, r1, -8 ++ addik r1, r1, -16 + sw r15, r0, r1 + la r11, r0, _stack + mts rshr, r11 +@@ -51,5 +51,5 @@ __init: + .global __fini + .align 2 + __fini: +- addik r1, r1, -8 ++ addik r1, r1, -16 + sw r15, r0, r1 +diff --git a/libgcc/config/microblaze/crtn.S b/libgcc/config/microblaze/crtn.S +index cb8d8ef2bfa..977b43b9436 100644 +--- a/libgcc/config/microblaze/crtn.S ++++ b/libgcc/config/microblaze/crtn.S +@@ -33,9 +33,9 @@ + .section .init, "ax" + lw r15, r0, r1 + rtsd r15, 8 +- addik r1, r1, 8 ++ addik r1, r1, 16 + + .section .fini, "ax" + lw r15, r0, r1 + rtsd r15, 8 +- addik r1, r1, 8 ++ addik r1, r1, 16 +diff --git a/libgcc/config/microblaze/divdi3.S b/libgcc/config/microblaze/divdi3.S +new file mode 100644 +index 00000000000..d37bf5165c6 +--- /dev/null ++++ b/libgcc/config/microblaze/divdi3.S +@@ -0,0 +1,98 @@ ++###################################- ++# ++# Copyright (C) 2009-2017 Free Software Foundation, Inc. ++# ++# Contributed by Michael Eager <eager@eagercon.com>. ++# ++# This file is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by the ++# Free Software Foundation; either version 3, or (at your option) any ++# later version. ++# ++# GCC is distributed in the hope that it will be useful, but WITHOUT ++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++# License for more details. ++# ++# Under Section 7 of GPL version 3, you are granted additional ++# permissions described in the GCC Runtime Library Exception, version ++# 3.1, as published by the Free Software Foundation. ++# ++# You should have received a copy of the GNU General Public License and ++# a copy of the GCC Runtime Library Exception along with this program; ++# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++# <http://www.gnu.org/licenses/>. ++# ++# divdi3.S ++# ++# Divide operation for 32 bit integers. ++# Input : Dividend in Reg r5 ++# Divisor in Reg r6 ++# Output: Result in Reg r3 ++# ++####################################### ++ ++#ifdef __arch64__ ++ .globl __divdi3 ++ .ent __divdi3 ++ .type __divdi3,@function ++__divdi3: ++ .frame r1,0,r15 ++ ++ ADDLIK r1,r1,-32 ++ SLI r28,r1,0 ++ SLI r29,r1,8 ++ SLI r30,r1,16 ++ SLI r31,r1,24 ++ ++ BEALEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ BEALEQI r5,$LaResult_Is_Zero # Result is Zero ++ XORL r28,r5,r6 # Get the sign of the result ++ BEALGEI r5,$LaR5_Pos ++ RSUBLI r5,r5,0 # Make r5 positive ++$LaR5_Pos: ++ BEALGEI r6,$LaR6_Pos ++ RSUBLI r6,r6,0 # Make r6 positive ++$LaR6_Pos: ++ ADDLIK r30,r0,0 # Clear mod ++ ADDLIK r3,r0,0 # clear div ++ ADDLIK r29,r0,64 # Initialize the loop count ++ ++ # First part try to find the first '1' in the r5 ++$LaDIV0: ++ BEALLTI r5,$LaDIV2 # This traps r5 == 0x80000000 ++$LaDIV1: ++ ADDL r5,r5,r5 # left shift logical r5 ++ ADDLIK r29,r29,-1 ++ BEALGTI r5,$LaDIV1 ++$LaDIV2: ++ ADDL r5,r5,r5 # left shift logical r5 get the '1' into the Carry ++ ADDLC r30,r30,r30 # Move that bit into the Mod register ++ RSUBL r31,r6,r30 # Try to subtract (r30 a r6) ++ BEALLTI r31,$LaMOD_TOO_SMALL ++ ORL r30,r0,r31 # Move the r31 to mod since the result was positive ++ ADDLIK r3,r3,1 ++$LaMOD_TOO_SMALL: ++ ADDLIK r29,r29,-1 ++ BEALEQi r29,$LaLOOP_END ++ ADDL r3,r3,r3 # Shift in the '1' into div ++ BREAI $LaDIV2 # Div2 ++$LaLOOP_END: ++ BEALGEI r28,$LaRETURN_HERE ++ RSUBLI r3,r3,0 # Negate the result ++ BREAI $LaRETURN_HERE ++$LaDiv_By_Zero: ++$LaResult_Is_Zero: ++ ORL r3,r0,r0 # set result to 0 ++$LaRETURN_HERE: ++# Restore values of CSRs and that of r3 and the divisor and the dividend ++ LLI r28,r1,0 ++ LLI r29,r1,8 ++ LLI r30,r1,16 ++ LLI r31,r1,24 ++ ADDLIK r1,r1,32 ++ RTSD r15,8 ++ nop ++.end __divdi3 ++ .size __divdi3, . - __divdi3 ++#endif +diff --git a/libgcc/config/microblaze/divdi3_table.c b/libgcc/config/microblaze/divdi3_table.c +new file mode 100644 +index 00000000000..80962597ea5 +--- /dev/null ++++ b/libgcc/config/microblaze/divdi3_table.c +@@ -0,0 +1,62 @@ ++/* Table for software lookup divide for Xilinx MicroBlaze. ++ ++ Copyright (C) 2009-2017 Free Software Foundation, Inc. ++ ++ Contributed by Michael Eager <eager@eagercon.com>. ++ ++ This file is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published by the ++ Free Software Foundation; either version 3, or (at your option) any ++ later version. ++ ++ GCC is distributed in the hope that it will be useful, but WITHOUT ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++ License for more details. ++ ++ Under Section 7 of GPL version 3, you are granted additional ++ permissions described in the GCC Runtime Library Exception, version ++ 3.1, as published by the Free Software Foundation. ++ ++ You should have received a copy of the GNU General Public License and ++ a copy of the GCC Runtime Library Exception along with this program; ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++ <http://www.gnu.org/licenses/>. */ ++ ++ ++unsigned char _divdi3_table[] = ++{ ++ 0, 0/1, 0/2, 0/3, 0/4, 0/5, 0/6, 0/7, ++ 0/8, 0/9, 0/10, 0/11, 0/12, 0/13, 0/14, 0/15, ++ 0, 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, ++ 1/8, 1/9, 1/10, 1/11, 1/12, 1/13, 1/14, 1/15, ++ 0, 2/1, 2/2, 2/3, 2/4, 2/5, 2/6, 2/7, ++ 2/8, 2/9, 2/10, 2/11, 2/12, 2/13, 2/14, 2/15, ++ 0, 3/1, 3/2, 3/3, 3/4, 3/5, 3/6, 3/7, ++ 3/8, 3/9, 3/10, 3/11, 3/12, 3/13, 3/14, 3/15, ++ 0, 4/1, 4/2, 4/3, 4/4, 4/5, 4/6, 4/7, ++ 4/8, 4/9, 4/10, 4/11, 4/12, 4/13, 4/14, 4/15, ++ 0, 5/1, 5/2, 5/3, 5/4, 5/5, 5/6, 5/7, ++ 5/8, 5/9, 5/10, 5/11, 5/12, 5/13, 5/14, 5/15, ++ 0, 6/1, 6/2, 6/3, 6/4, 6/5, 6/6, 6/7, ++ 6/8, 6/9, 6/10, 6/11, 6/12, 6/13, 6/14, 6/15, ++ 0, 7/1, 7/2, 7/3, 7/4, 7/5, 7/6, 7/7, ++ 7/8, 7/9, 7/10, 7/11, 7/12, 7/13, 7/14, 7/15, ++ 0, 8/1, 8/2, 8/3, 8/4, 8/5, 8/6, 8/7, ++ 8/8, 8/9, 8/10, 8/11, 8/12, 8/13, 8/14, 8/15, ++ 0, 9/1, 9/2, 9/3, 9/4, 9/5, 9/6, 9/7, ++ 9/8, 9/9, 9/10, 9/11, 9/12, 9/13, 9/14, 9/15, ++ 0, 10/1, 10/2, 10/3, 10/4, 10/5, 10/6, 10/7, ++ 10/8, 10/9, 10/10, 10/11, 10/12, 10/13, 10/14, 10/15, ++ 0, 11/1, 11/2, 11/3, 11/4, 11/5, 11/6, 11/7, ++ 11/8, 11/9, 11/10, 11/11, 11/12, 11/13, 11/14, 11/15, ++ 0, 12/1, 12/2, 12/3, 12/4, 12/5, 12/6, 12/7, ++ 12/8, 12/9, 12/10, 12/11, 12/12, 12/13, 12/14, 12/15, ++ 0, 13/1, 13/2, 13/3, 13/4, 13/5, 13/6, 13/7, ++ 13/8, 13/9, 13/10, 13/11, 13/12, 13/13, 13/14, 13/15, ++ 0, 14/1, 14/2, 14/3, 14/4, 14/5, 14/6, 14/7, ++ 14/8, 14/9, 14/10, 14/11, 14/12, 14/13, 14/14, 14/15, ++ 0, 15/1, 15/2, 15/3, 15/4, 15/5, 15/6, 15/7, ++ 15/8, 15/9, 15/10, 15/11, 15/12, 15/13, 15/14, 15/15, ++}; ++ +diff --git a/libgcc/config/microblaze/moddi3.S b/libgcc/config/microblaze/moddi3.S +new file mode 100644 +index 00000000000..5d3f7c03fc8 +--- /dev/null ++++ b/libgcc/config/microblaze/moddi3.S +@@ -0,0 +1,97 @@ ++################################### ++# ++# Copyright (C) 2009-2017 Free Software Foundation, Inc. ++# ++# Contributed by Michael Eager <eager@eagercon.com>. ++# ++# This file is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by the ++# Free Software Foundation; either version 3, or (at your option) any ++# later version. ++# ++# GCC is distributed in the hope that it will be useful, but WITHOUT ++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++# License for more details. ++# ++# Under Section 7 of GPL version 3, you are granted additional ++# permissions described in the GCC Runtime Library Exception, version ++# 3.1, as published by the Free Software Foundation. ++# ++# You should have received a copy of the GNU General Public License and ++# a copy of the GCC Runtime Library Exception along with this program; ++# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++# <http://www.gnu.org/licenses/>. ++# ++# moddi3.S ++# ++# modulo operation for 32 bit integers. ++# Input : op1 in Reg r5 ++# op2 in Reg r6 ++# Output: op1 mod op2 in Reg r3 ++# ++####################################### ++ ++#ifdef __arch64__ ++ .globl __moddi3 ++ .ent __moddi3 ++ .type __moddi3,@function ++__moddi3: ++ .frame r1,0,r15 ++ ++ addlik r1,r1,-32 ++ sli r28,r1,0 ++ sli r29,r1,8 ++ sli r30,r1,16 ++ sli r31,r1,32 ++ ++ BEALEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ BEALEQI r5,$LaResult_Is_Zero # Result is Zero ++ ADDL r28,r5,r0 # Get the sign of the result [ Depends only on the first arg] ++ BEALGEI r5,$LaR5_Pos ++ RSUBLI r5,r5,0 # Make r5 positive ++$LaR5_Pos: ++ BEALGEI r6,$LaR6_Pos ++ RSUBLI r6,r6,0 # Make r6 positive ++$LaR6_Pos: ++ ADDLIK r3,r0,0 # Clear mod ++ ADDLIK r30,r0,0 # clear div ++ ADDLIK r29,r0,64 # Initialize the loop count ++ BEALLTI r5,$LaDIV2 # If r5 is still negative (0x80000000), skip ++ # the first bit search. ++ # First part try to find the first '1' in the r5 ++$LaDIV1: ++ ADDL r5,r5,r5 # left shift logical r5 ++ ADDLIK r29,r29,-1 ++ BEALGEI r5,$LaDIV1 # ++$LaDIV2: ++ ADDL r5,r5,r5 # left shift logical r5 get the '1' into the Carry ++ ADDLC r3,r3,r3 # Move that bit into the Mod register ++ rSUBL r31,r6,r3 # Try to subtract (r30 a r6) ++ BEALLTi r31,$LaMOD_TOO_SMALL ++ ORL r3,r0,r31 # Move the r31 to mod since the result was positive ++ ADDLIK r30,r30,1 ++$LaMOD_TOO_SMALL: ++ ADDLIK r29,r29,-1 ++ BEALEQi r29,$LaLOOP_END ++ ADDL r30,r30,r30 # Shift in the '1' into div ++ BREAI $LaDIV2 # Div2 ++$LaLOOP_END: ++ BEALGEI r28,$LaRETURN_HERE ++ rsubli r3,r3,0 # Negate the result ++ BREAI $LaRETURN_HERE ++$LaDiv_By_Zero: ++$LaResult_Is_Zero: ++ orl r3,r0,r0 # set result to 0 [Both mod as well as div are 0] ++$LaRETURN_HERE: ++# Restore values of CSRs and that of r3 and the divisor and the dividend ++ lli r28,r1,0 ++ lli r29,r1,8 ++ lli r30,r1,16 ++ lli r31,r1,24 ++ addlik r1,r1,32 ++ rtsd r15,8 ++ nop ++ .end __moddi3 ++ .size __moddi3, . - __moddi3 ++#endif +diff --git a/libgcc/config/microblaze/muldi3.S b/libgcc/config/microblaze/muldi3.S +new file mode 100644 +index 00000000000..567784197d3 +--- /dev/null ++++ b/libgcc/config/microblaze/muldi3.S +@@ -0,0 +1,73 @@ ++/*###################################-*-asm*- ++# ++# Copyright (C) 2009-2017 Free Software Foundation, Inc. ++# ++# Contributed by Michael Eager <eager@eagercon.com>. ++# ++# This file is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by the ++# Free Software Foundation; either version 3, or (at your option) any ++# later version. ++# ++# GCC is distributed in the hope that it will be useful, but WITHOUT ++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++# License for more details. ++# ++# Under Section 7 of GPL version 3, you are granted additional ++# permissions described in the GCC Runtime Library Exception, version ++# 3.1, as published by the Free Software Foundation. ++# ++# You should have received a copy of the GNU General Public License and ++# a copy of the GCC Runtime Library Exception along with this program; ++# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++# <http://www.gnu.org/licenses/>. ++# ++# muldi3.S ++# ++# Multiply operation for 32 bit integers. ++# Input : Operand1 in Reg r5 ++# Operand2 in Reg r6 ++# Output: Result [op1 * op2] in Reg r3 ++# ++#######################################*/ ++ ++#ifdef __arch64__ ++ .globl __muldi3 ++ .ent __muldi3 ++ .type __muldi3,@function ++__muldi3: ++ .frame r1,0,r15 ++ addl r3,r0,r0 ++ BEALEQI r5,$L_Result_Is_Zero # Multiply by Zero ++ BEALEQI r6,$L_Result_Is_Zero # Multiply by Zero ++ XORL r4,r5,r6 # Get the sign of the result ++ BEALGEI r5,$L_R5_Pos ++ RSUBLI r5,r5,0 # Make r5 positive ++$L_R5_Pos: ++ BEALGEI r6,$L_R6_Pos ++ RSUBLI r6,r6,0 # Make r6 positive ++$L_R6_Pos: ++ breai $L1 ++$L2: ++ addl r5,r5,r5 ++$L1: ++ srll r6,r6 ++ addlc r7,r0,r0 ++ bealeqi r7,$L2 ++ addl r3,r3,r5 ++ bealnei r6,$L2 ++ beallti r4,$L_NegateResult ++ rtsd r15,8 ++ nop ++$L_NegateResult: ++ rsubl r3,r3,r0 ++ rtsd r15,8 ++ nop ++$L_Result_Is_Zero: ++ addli r3,r0,0 ++ rtsd r15,8 ++ nop ++ .end __muldi3 ++ .size __muldi3, . - __muldi3 ++#endif +diff --git a/libgcc/config/microblaze/t-microblaze b/libgcc/config/microblaze/t-microblaze +index 8d954a49575..35021b24b7d 100644 +--- a/libgcc/config/microblaze/t-microblaze ++++ b/libgcc/config/microblaze/t-microblaze +@@ -1,11 +1,16 @@ +-LIB2FUNCS_EXCLUDE += _divsi3 _modsi3 _mulsi3 _udivsi3 _umodsi3 ++LIB2FUNCS_EXCLUDE += _divsi3 _modsi3 _mulsi3 _udivsi3 _umodsi3 \ ++ _divdi3 _moddi3 _muldi3 _udivdi3 _umoddi3 + + LIB2ADD += \ + $(srcdir)/config/microblaze/divsi3.S \ ++ $(srcdir)/config/microblaze/divdi3.S \ + $(srcdir)/config/microblaze/modsi3.S \ +- $(srcdir)/config/microblaze/muldi3_hard.S \ ++ $(srcdir)/config/microblaze/moddi3.S \ + $(srcdir)/config/microblaze/mulsi3.S \ ++ $(srcdir)/config/microblaze/muldi3.S \ + $(srcdir)/config/microblaze/stack_overflow_exit.S \ + $(srcdir)/config/microblaze/udivsi3.S \ ++ $(srcdir)/config/microblaze/udivdi3.S \ + $(srcdir)/config/microblaze/umodsi3.S \ +- $(srcdir)/config/microblaze/divsi3_table.c ++ $(srcdir)/config/microblaze/umoddi3.S \ ++ $(srcdir)/config/microblaze/divsi3_table.c \ +diff --git a/libgcc/config/microblaze/udivdi3.S b/libgcc/config/microblaze/udivdi3.S +new file mode 100644 +index 00000000000..c210fbc7128 +--- /dev/null ++++ b/libgcc/config/microblaze/udivdi3.S +@@ -0,0 +1,107 @@ ++###################################- ++# ++# Copyright (C) 2009-2017 Free Software Foundation, Inc. ++# ++# Contributed by Michael Eager <eager@eagercon.com>. ++# ++# This file is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by the ++# Free Software Foundation; either version 3, or (at your option) any ++# later version. ++# ++# GCC is distributed in the hope that it will be useful, but WITHOUT ++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++# License for more details. ++# ++# Under Section 7 of GPL version 3, you are granted additional ++# permissions described in the GCC Runtime Library Exception, version ++# 3.1, as published by the Free Software Foundation. ++# ++# You should have received a copy of the GNU General Public License and ++# a copy of the GCC Runtime Library Exception along with this program; ++# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++# <http://www.gnu.org/licenses/>. ++# ++# udivdi3.S ++# ++# Unsigned divide operation. ++# Input : Divisor in Reg r5 ++# Dividend in Reg r6 ++# Output: Result in Reg r3 ++# ++####################################### ++ ++#ifdef __arch64__ ++ .globl __udivdi3 ++ .ent __udivdi3 ++ .type __udivdi3,@function ++__udivdi3: ++ .frame r1,0,r15 ++ ++ ADDlIK r1,r1,-24 ++ SLI r29,r1,0 ++ SLI r30,r1,8 ++ SLI r31,r1,16 ++ ++ BEALEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ ADDLIK r30,r0,0 # Clear mod ++ BEALEQI r5,$LaResult_Is_Zero # Result is Zero ++ ADDLIK r29,r0,64 # Initialize the loop count ++ ++ # Check if r6 and r5 are equal # if yes, return 1 ++ RSUBL r18,r5,r6 ++ ADDLIK r3,r0,1 ++ BEALEQI r18,$LaRETURN_HERE ++ ++ # Check if (uns)r6 is greater than (uns)r5. In that case, just return 0 ++ XORL r18,r5,r6 ++ ADDL r3,r0,r0 # We would anyways clear r3 ++ BEALGEI r18,$LRSUBL ++ BEALLTI r6,$LaRETURN_HERE # r6[bit 31 = 1] hence is greater ++ BREAI $LCheckr6 ++$LRSUBL: ++ RSUBL r18,r6,r5 # MICROBLAZEcmp ++ BEALLTI r18,$LaRETURN_HERE ++ ++ # If r6 [bit 31] is set, then return result as 1 ++$LCheckr6: ++ BEALGTI r6,$LaDIV0 ++ ADDLIK r3,r0,1 ++ BREAI $LaRETURN_HERE ++ ++ # First part try to find the first '1' in the r5 ++$LaDIV0: ++ BEALLTI r5,$LaDIV2 ++$LaDIV1: ++ ADDL r5,r5,r5 # left shift logical r5 ++ ADDLIK r29,r29,-1 ++ BEALGTI r5,$LaDIV1 ++$LaDIV2: ++ ADDL r5,r5,r5 # left shift logical r5 get the '1' into the Carry ++ ADDLC r30,r30,r30 # Move that bit into the Mod register ++ RSUBL r31,r6,r30 # Try to subtract (r30 a r6) ++ BEALLTI r31,$LaMOD_TOO_SMALL ++ ORL r30,r0,r31 # Move the r31 to mod since the result was positive ++ ADDLIK r3,r3,1 ++$LaMOD_TOO_SMALL: ++ ADDLIK r29,r29,-1 ++ BEALEQi r29,$LaLOOP_END ++ ADDL r3,r3,r3 # Shift in the '1' into div ++ BREAI $LaDIV2 # Div2 ++$LaLOOP_END: ++ BREAI $LaRETURN_HERE ++$LaDiv_By_Zero: ++$LaResult_Is_Zero: ++ ORL r3,r0,r0 # set result to 0 ++$LaRETURN_HERE: ++ # Restore values of CSRs and that of r3 and the divisor and the dividend ++ LLI r29,r1,0 ++ LLI r30,r1,8 ++ LLI r31,r1,16 ++ ADDLIK r1,r1,24 ++ RTSD r15,8 ++ NOP ++ .end __udivdi3 ++ .size __udivdi3, . - __udivdi3 ++#endif +diff --git a/libgcc/config/microblaze/umoddi3.S b/libgcc/config/microblaze/umoddi3.S +new file mode 100644 +index 00000000000..7f5cd23f9a1 +--- /dev/null ++++ b/libgcc/config/microblaze/umoddi3.S +@@ -0,0 +1,110 @@ ++################################### ++# ++# Copyright (C) 2009-2017 Free Software Foundation, Inc. ++# ++# Contributed by Michael Eager <eager@eagercon.com>. ++# ++# This file is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by the ++# Free Software Foundation; either version 3, or (at your option) any ++# later version. ++# ++# GCC is distributed in the hope that it will be useful, but WITHOUT ++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++# License for more details. ++# ++# Under Section 7 of GPL version 3, you are granted additional ++# permissions described in the GCC Runtime Library Exception, version ++# 3.1, as published by the Free Software Foundation. ++# ++# You should have received a copy of the GNU General Public License and ++# a copy of the GCC Runtime Library Exception along with this program; ++# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++# <http://www.gnu.org/licenses/>. ++# ++# umoddi3.S ++# ++# Unsigned modulo operation for 32 bit integers. ++# Input : op1 in Reg r5 ++# op2 in Reg r6 ++# Output: op1 mod op2 in Reg r3 ++# ++####################################### ++ ++#ifdef __arch64__ ++ .globl __umoddi3 ++ .ent __umoddi3 ++ .type __umoddi3,@function ++__umoddi3: ++ .frame r1,0,r15 ++ ++ addlik r1,r1,-24 ++ sli r29,r1,0 ++ sli r30,r1,8 ++ sli r31,r1,16 ++ ++ BEALEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ ADDLIK r3,r0,0 # Clear div ++ BEALEQI r5,$LaResult_Is_Zero # Result is Zero ++ ADDLIK r30,r0,0 # clear mod ++ ADDLIK r29,r0,64 # Initialize the loop count ++ ++# Check if r6 and r5 are equal # if yes, return 0 ++ rsubl r18,r5,r6 ++ bealeqi r18,$LaRETURN_HERE ++ ++# Check if (uns)r6 is greater than (uns)r5. In that case, just return r5 ++ xorl r18,r5,r6 ++ addlik r3,r5,0 ++ bealgei r18,$LRSUB ++ beallti r6,$LaRETURN_HERE ++ breai $LCheckr6 ++$LRSUB: ++ rsubl r18,r5,r6 # MICROBLAZEcmp ++ bealgti r18,$LaRETURN_HERE ++ ++# If r6 [bit 31] is set, then return result as r5-r6 ++$LCheckr6: ++ addlik r3,r0,0 ++ bealgti r6,$LaDIV0 ++ addlik r18,r0,0x7fffffff ++ andl r5,r5,r18 ++ andl r6,r6,r18 ++ breaid $LaRETURN_HERE ++ rsubl r3,r6,r5 ++# First part: try to find the first '1' in the r5 ++$LaDIV0: ++ BEALLTI r5,$LaDIV2 ++$LaDIV1: ++ ADDL r5,r5,r5 # left shift logical r5 ++ ADDLIK r29,r29,-1 ++ BEALGEI r5,$LaDIV1 # ++$LaDIV2: ++ ADDL r5,r5,r5 # left shift logical r5 get the '1' into the Carry ++ ADDLC r3,r3,r3 # Move that bit into the Mod register ++ rSUBL r31,r6,r3 # Try to subtract (r3 a r6) ++ BEALLTi r31,$LaMOD_TOO_SMALL ++ ORL r3,r0,r31 # Move the r31 to mod since the result was positive ++ ADDLIK r30,r30,1 ++$LaMOD_TOO_SMALL: ++ ADDLIK r29,r29,-1 ++ BEALEQi r29,$LaLOOP_END ++ ADDL r30,r30,r30 # Shift in the '1' into div ++ BREAI $LaDIV2 # Div2 ++$LaLOOP_END: ++ BREAI $LaRETURN_HERE ++$LaDiv_By_Zero: ++$LaResult_Is_Zero: ++ orl r3,r0,r0 # set result to 0 ++$LaRETURN_HERE: ++# Restore values of CSRs and that of r3 and the divisor and the dividend ++ lli r29,r1,0 ++ lli r30,r1,8 ++ lli r31,r1,16 ++ addlik r1,r1,24 ++ rtsd r15,8 ++ nop ++.end __umoddi3 ++ .size __umoddi3, . - __umoddi3 ++#endif +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch new file mode 100644 index 00000000..0a275c0b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch @@ -0,0 +1,273 @@ +From 10d5e7d6cad5e7349b88b7469eb5ae20d87eb908 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 14:45:15 +0530 +Subject: [PATCH 29/53] [Patch,MicroBlaze] : re-arrangement of the compare + branches + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 28 ++---- + gcc/config/microblaze/microblaze.md | 141 +++++++++++++--------------- + 2 files changed, 73 insertions(+), 96 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 9d3628c6816..4792e3ba370 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -3698,11 +3698,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) + { + comp_reg = cmp_op0; + condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx); +- if (mode == Pmode) +- emit_jump_insn (gen_condjump (condition, label1)); +- else +- emit_jump_insn (gen_long_condjump (condition, label1)); +- ++ emit_jump_insn (gen_condjump (condition, label1)); + } + + else if (code == EQ || code == NE) +@@ -3713,10 +3709,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) + else + emit_insn (gen_xordi3 (comp_reg, cmp_op0, cmp_op1)); + condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx); +- if (mode == SImode) +- emit_jump_insn (gen_condjump (condition, label1)); +- else +- emit_jump_insn (gen_long_condjump (condition, label1)); ++ emit_jump_insn (gen_condjump (condition, label1)); + } + else + { +@@ -3749,10 +3742,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) + comp_reg = cmp_op0; + condition = gen_rtx_fmt_ee (signed_condition (code), + mode, comp_reg, const0_rtx); +- if (mode == SImode) +- emit_jump_insn (gen_condjump (condition, label1)); +- else +- emit_jump_insn (gen_long_condjump (condition, label1)); ++ emit_jump_insn (gen_condjump (condition, label1)); + } + else if (code == EQ) + { +@@ -3767,10 +3757,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) + cmp_op1)); + } + condition = gen_rtx_EQ (mode, comp_reg, const0_rtx); +- if (mode == SImode) +- emit_jump_insn (gen_condjump (condition, label1)); +- else +- emit_jump_insn (gen_long_condjump (condition, label1)); ++ emit_jump_insn (gen_condjump (condition, label1)); + + } + else if (code == NE) +@@ -3786,10 +3773,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) + cmp_op1)); + } + condition = gen_rtx_NE (mode, comp_reg, const0_rtx); +- if (mode == SImode) +- emit_jump_insn (gen_condjump (condition, label1)); +- else +- emit_jump_insn (gen_long_condjump (condition, label1)); ++ emit_jump_insn (gen_condjump (condition, label1)); + } + else + { +@@ -3831,7 +3815,7 @@ microblaze_expand_conditional_branch_df (rtx operands[]) + + emit_insn (gen_cstoredf4 (comp_reg, operands[0], cmp_op0, cmp_op1)); + condition = gen_rtx_NE (Pmode, comp_reg, const0_rtx); +- emit_jump_insn (gen_long_condjump (condition, operands[3])); ++ emit_jump_insn (gen_condjump (condition, operands[3])); + } + + /* Implement TARGET_FRAME_POINTER_REQUIRED. */ +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index c99150ff0da..566c53ba228 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -2268,7 +2268,27 @@ else + (label_ref (match_operand 1)) + (pc)))]) + +-(define_insn "branch_zero64" ++(define_insn "branch_zero_64" ++ [(set (pc) ++ (if_then_else (match_operator:SI 0 "ordered_comparison_operator" ++ [(match_operand:SI 1 "register_operand" "d") ++ (const_int 0)]) ++ (match_operand:SI 2 "pc_or_label_operand" "") ++ (match_operand:SI 3 "pc_or_label_operand" ""))) ++ ] ++ "TARGET_MB_64" ++ { ++ if (operands[3] == pc_rtx) ++ return "bea%C0i%?\t%z1,%2"; ++ else ++ return "bea%N0i%?\t%z1,%3"; ++ } ++ [(set_attr "type" "branch") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")] ++) ++ ++(define_insn "long_branch_zero" + [(set (pc) + (if_then_else (match_operator 0 "ordered_comparison_operator" + [(match_operand 1 "register_operand" "d") +@@ -2279,9 +2299,9 @@ else + "TARGET_MB_64" + { + if (operands[3] == pc_rtx) +- return "bea%C0i%?\t%z1,%2"; ++ return "beal%C0i%?\t%z1,%2"; + else +- return "bea%N0i%?\t%z1,%3"; ++ return "beal%N0i%?\t%z1,%3"; + } + [(set_attr "type" "branch") + (set_attr "mode" "none") +@@ -2310,9 +2330,9 @@ else + + (define_insn "branch_compare64" + [(set (pc) +- (if_then_else (match_operator 0 "cmp_op" +- [(match_operand 1 "register_operand" "d") +- (match_operand 2 "register_operand" "d") ++ (if_then_else (match_operator:SI 0 "cmp_op" ++ [(match_operand:SI 1 "register_operand" "d") ++ (match_operand:SI 2 "register_operand" "d") + ]) + (label_ref (match_operand 3)) + (pc))) +@@ -2349,6 +2369,47 @@ else + (set_attr "length" "12")] + ) + ++(define_insn "long_branch_compare" ++ [(set (pc) ++ (if_then_else (match_operator 0 "cmp_op" ++ [(match_operand 1 "register_operand" "d") ++ (match_operand 2 "register_operand" "d") ++ ]) ++ (label_ref (match_operand 3)) ++ (pc))) ++ (clobber(reg:DI R_TMP))] ++ "TARGET_MB_64" ++ { ++ operands[4] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ enum rtx_code code = GET_CODE (operands[0]); ++ ++ if (code == GT || code == LE) ++ { ++ output_asm_insn ("cmpl\tr18,%z1,%z2", operands); ++ code = swap_condition (code); ++ } ++ else if (code == GTU || code == LEU) ++ { ++ output_asm_insn ("cmplu\tr18,%z1,%z2", operands); ++ code = swap_condition (code); ++ } ++ else if (code == GE || code == LT) ++ { ++ output_asm_insn ("cmpl\tr18,%z2,%z1", operands); ++ } ++ else if (code == GEU || code == LTU) ++ { ++ output_asm_insn ("cmplu\tr18,%z2,%z1", operands); ++ } ++ ++ operands[0] = gen_rtx_fmt_ee (signed_condition (code), DImode, operands[4], const0_rtx); ++ return "beal%C0i%?\tr18,%3"; ++ } ++ [(set_attr "type" "branch") ++ (set_attr "mode" "none") ++ (set_attr "length" "12")] ++) ++ + (define_insn "branch_compare" + [(set (pc) + (if_then_else (match_operator:SI 0 "cmp_op" +@@ -2431,74 +2492,6 @@ else + + }) + +-;; Used to implement comparison instructions +-(define_expand "long_condjump" +- [(set (pc) +- (if_then_else (match_operand 0) +- (label_ref (match_operand 1)) +- (pc)))]) +- +-(define_insn "long_branch_zero" +- [(set (pc) +- (if_then_else (match_operator:DI 0 "ordered_comparison_operator" +- [(match_operand:DI 1 "register_operand" "d") +- (const_int 0)]) +- (match_operand:DI 2 "pc_or_label_operand" "") +- (match_operand:DI 3 "pc_or_label_operand" ""))) +- ] +- "TARGET_MB_64" +- { +- if (operands[3] == pc_rtx) +- return "beal%C0i%?\t%z1,%2"; +- else +- return "beal%N0i%?\t%z1,%3"; +- } +- [(set_attr "type" "branch") +- (set_attr "mode" "none") +- (set_attr "length" "4")] +-) +- +-(define_insn "long_branch_compare" +- [(set (pc) +- (if_then_else (match_operator:DI 0 "cmp_op" +- [(match_operand:DI 1 "register_operand" "d") +- (match_operand:DI 2 "register_operand" "d") +- ]) +- (label_ref (match_operand 3)) +- (pc))) +- (clobber(reg:DI R_TMP))] +- "TARGET_MB_64" +- { +- operands[4] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); +- enum rtx_code code = GET_CODE (operands[0]); +- +- if (code == GT || code == LE) +- { +- output_asm_insn ("cmpl\tr18,%z1,%z2", operands); +- code = swap_condition (code); +- } +- else if (code == GTU || code == LEU) +- { +- output_asm_insn ("cmplu\tr18,%z1,%z2", operands); +- code = swap_condition (code); +- } +- else if (code == GE || code == LT) +- { +- output_asm_insn ("cmpl\tr18,%z2,%z1", operands); +- } +- else if (code == GEU || code == LTU) +- { +- output_asm_insn ("cmplu\tr18,%z2,%z1", operands); +- } +- +- operands[0] = gen_rtx_fmt_ee (signed_condition (code), DImode, operands[4], const0_rtx); +- return "beal%C0i%?\tr18,%3"; +- } +- [(set_attr "type" "branch") +- (set_attr "mode" "none") +- (set_attr "length" "12")] +-) +- + ;;---------------------------------------------------------------- + ;; Unconditional branches + ;;---------------------------------------------------------------- +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch new file mode 100644 index 00000000..bda4e7da --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch @@ -0,0 +1,32 @@ +From af910dd71faec99838e421dd76fd5231e34bee3e Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 8 Aug 2018 17:37:26 +0530 +Subject: [PATCH 30/53] [Patch,Microblaze] : previous commit broke the + handling of SI Branch compare for Microblaze 32-bit.. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 566c53ba228..e54888550f6 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -2224,8 +2224,8 @@ else + (define_expand "cbranchsi4" + [(set (pc) + (if_then_else (match_operator 0 "ordered_comparison_operator" +- [(match_operand 1 "register_operand") +- (match_operand 2 "arith_operand" "I,i")]) ++ [(match_operand:SI 1 "register_operand") ++ (match_operand:SI 2 "arith_operand" "I,i")]) + (label_ref (match_operand 3 "")) + (pc)))] + "" +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch new file mode 100644 index 00000000..a9a7a03d --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch @@ -0,0 +1,81 @@ +From 6921698fc0acf40cb036cf71649762e7a21bf604 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 11 Sep 2018 13:43:48 +0530 +Subject: [PATCH 31/53] [Patch, Microblaze] : Support of multilibs with m64 ... + +Conflicts: + gcc/config/microblaze/microblaze-c.c + +signed-off-by : Mahesh Bodapati <mbodapat@xilinx.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze-c.cc | 1 + + gcc/config/microblaze/t-microblaze | 15 ++++++--------- + libgcc/config/microblaze/t-microblaze | 11 +++-------- + 3 files changed, 10 insertions(+), 17 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze-c.cc b/gcc/config/microblaze/microblaze-c.cc +index ef8d2430565..4e83a84b112 100644 +--- a/gcc/config/microblaze/microblaze-c.cc ++++ b/gcc/config/microblaze/microblaze-c.cc +@@ -102,6 +102,7 @@ microblaze_cpp_define (cpp_reader *pfile) + } + if (TARGET_MB_64) + { ++ builtin_define ("__microblaze64"); + builtin_define ("__arch64__"); + builtin_define ("__microblaze64__"); + builtin_define ("__MICROBLAZE64__"); +diff --git a/gcc/config/microblaze/t-microblaze b/gcc/config/microblaze/t-microblaze +index 965132b3513..47b869b9303 100644 +--- a/gcc/config/microblaze/t-microblaze ++++ b/gcc/config/microblaze/t-microblaze +@@ -1,12 +1,9 @@ +-MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high mlittle-endian m64 +-MULTILIB_DIRNAMES = bs m mh le m64 +-MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high +-MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/mlittle-endian +-MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/mlittle-endian/m64 +-MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/m64 mxl-multiply-high +-MULTILIB_EXCEPTIONS += mxl-multiply-high/mlittle-endian +-MULTILIB_EXCEPTIONS += mxl-multiply-high/m64 +-MULTILIB_EXCEPTIONS += *mxl-multiply-high/mlittle-endian/m64 ++MULTILIB_OPTIONS = m64 mxl-barrel-shift mlittle-endian mno-xl-soft-mul mxl-multiply-high ++MULTILIB_DIRNAMES = m64 bs le m mh ++MULTILIB_EXCEPTIONS = *m64/mxl-multiply-high mxl-multiply-high ++MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high ++MULTILIB_EXCEPTIONS += *mlittle-endian/mxl-multiply-high mxl-multiply-high ++MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mlittle-endian/mxl-multiply-high + + # Extra files + microblaze-c.o: $(srcdir)/config/microblaze/microblaze-c.cc \ +diff --git a/libgcc/config/microblaze/t-microblaze b/libgcc/config/microblaze/t-microblaze +index 35021b24b7d..8d954a49575 100644 +--- a/libgcc/config/microblaze/t-microblaze ++++ b/libgcc/config/microblaze/t-microblaze +@@ -1,16 +1,11 @@ +-LIB2FUNCS_EXCLUDE += _divsi3 _modsi3 _mulsi3 _udivsi3 _umodsi3 \ +- _divdi3 _moddi3 _muldi3 _udivdi3 _umoddi3 ++LIB2FUNCS_EXCLUDE += _divsi3 _modsi3 _mulsi3 _udivsi3 _umodsi3 + + LIB2ADD += \ + $(srcdir)/config/microblaze/divsi3.S \ +- $(srcdir)/config/microblaze/divdi3.S \ + $(srcdir)/config/microblaze/modsi3.S \ +- $(srcdir)/config/microblaze/moddi3.S \ ++ $(srcdir)/config/microblaze/muldi3_hard.S \ + $(srcdir)/config/microblaze/mulsi3.S \ +- $(srcdir)/config/microblaze/muldi3.S \ + $(srcdir)/config/microblaze/stack_overflow_exit.S \ + $(srcdir)/config/microblaze/udivsi3.S \ +- $(srcdir)/config/microblaze/udivdi3.S \ + $(srcdir)/config/microblaze/umodsi3.S \ +- $(srcdir)/config/microblaze/umoddi3.S \ +- $(srcdir)/config/microblaze/divsi3_table.c \ ++ $(srcdir)/config/microblaze/divsi3_table.c +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch new file mode 100644 index 00000000..cb62c5a7 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch @@ -0,0 +1,74 @@ +From 7f827e73dff27c764e5f475613e3e06ae546103f Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 15:24:25 +0530 +Subject: [PATCH 32/53] [Patch,MicroBlaze]: Fixed issues like: 1 Interrupt + alignment issue 2 Sign extension issue + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 16 ++++++++++------ + gcc/config/microblaze/microblaze.md | 2 +- + 2 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 4792e3ba370..f1da145232a 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -2178,9 +2178,14 @@ compute_frame_size (HOST_WIDE_INT size) + + total_size += gp_reg_size; + +- /* Add 4 bytes for MSR. */ ++ /* Add 4/8 bytes for MSR. */ + if (microblaze_is_interrupt_variant ()) +- total_size += 4; ++ { ++ if (TARGET_MB_64) ++ total_size += 8; ++ else ++ total_size += 4; ++ } + + /* No space to be allocated for link register in leaf functions with no other + stack requirements. */ +@@ -2465,7 +2470,6 @@ print_operand (FILE * file, rtx op, int letter) + else if (letter == 'h' || letter == 'j') + { + long val[2]; +- int val1[2]; + long l[2]; + if (code == CONST_DOUBLE) + { +@@ -2480,10 +2484,10 @@ print_operand (FILE * file, rtx op, int letter) + } + else if (code == CONST_INT || code == CONST)// || code == SYMBOL_REF ||code == LABEL_REF) + { +- val1[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32; +- val1[1] = INTVAL (op) & 0x00000000ffffffffLL; ++ val[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32; ++ val[1] = INTVAL (op) & 0x00000000ffffffffLL; + } +- fprintf (file, "0x%8.8lx", (letter == 'h') ? val1[0] : val1[1]); ++ fprintf (file, "0x%8.8lx", (letter == 'h') ? val[0] : val[1]); + } + else if (code == CONST_DOUBLE) + { +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index e54888550f6..4e5d21a1f4c 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -1096,7 +1096,7 @@ + case 1: + case 2: + { +- output_asm_insn ("ll%i1\t%0,%1", operands); ++ output_asm_insn ("lw%i1\t%0,%1", operands); + return "sextl32\t%0,%0"; + } + } +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch new file mode 100644 index 00000000..9760695c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch @@ -0,0 +1,309 @@ +From 0a86428a345ed359f788a72a0e185053b598e908 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 15:28:58 +0530 +Subject: [PATCH 33/53] [Patch,MicroBlaze]: fixed below issues: - Floating + point print issues in 64bit mode - Dejagnu Jump related issues - + Added dbl instruction + + Conflicts: + gcc/config/microblaze/microblaze.md +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 12 +++- + gcc/config/microblaze/microblaze.h | 7 +++ + gcc/config/microblaze/microblaze.md | 86 ++++++++++++++++++++++++----- + libgcc/config/microblaze/crti.S | 24 +++++++- + libgcc/config/microblaze/crtn.S | 13 +++++ + 5 files changed, 125 insertions(+), 17 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index f1da145232a..7a08390a027 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -2474,7 +2474,12 @@ print_operand (FILE * file, rtx op, int letter) + if (code == CONST_DOUBLE) + { + if (GET_MODE (op) == DFmode) +- REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), val); ++ { ++ if (TARGET_MB_64) ++ REAL_VALUE_TO_TARGET_LONG_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), val); ++ else ++ REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), val); ++ } + else + { + REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), l); +@@ -3877,7 +3882,10 @@ microblaze_expand_divide (rtx operands[]) + gen_rtx_PLUS (QImode, regt1, div_table_rtx)); + + insn = emit_insn (gen_zero_extendqisi2(operands[0],mem_rtx)); +- jump = emit_jump_insn_after (gen_jump (div_end_label), insn); ++ if (TARGET_MB_64) ++ jump = emit_jump_insn_after (gen_jump_64 (div_end_label), insn); ++ else ++ jump = emit_jump_insn_after (gen_jump (div_end_label), insn); + JUMP_LABEL (jump) = div_end_label; + LABEL_NUSES (div_end_label) = 1; + emit_barrier (); +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index 5f30b8ac195..ac4ea43a706 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -888,10 +888,17 @@ do { \ + /* We do this to save a few 10s of code space that would be taken up + by the call_FUNC () wrappers, used by the generic CRT_CALL_STATIC_FUNCTION + definition in crtstuff.c. */ ++#ifdef __arch64__ ++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ ++ asm ( SECTION_OP "\n" \ ++ "\tbrealid r15, " #FUNC "\n\t nop\n" \ ++ TEXT_SECTION_ASM_OP); ++#else + #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm ( SECTION_OP "\n" \ + "\tbrlid r15, " #FUNC "\n\t nop\n" \ + TEXT_SECTION_ASM_OP); ++#endif + + /* We need to group -lm as well, since some Newlib math functions + reference __errno! */ +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 4e5d21a1f4c..5a950b49591 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -527,6 +527,15 @@ + (set_attr "mode" "SF") + (set_attr "length" "4")]) + ++(define_insn "floatdidf2" ++ [(set (match_operand:DF 0 "register_operand" "=d") ++ (float:DF (match_operand:DI 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "dbl\t%0,%1" ++ [(set_attr "type" "fcvt") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4")]) ++ + (define_insn "fix_truncsfsi2" + [(set (match_operand:SI 0 "register_operand" "=d") + (fix:SI (match_operand:SF 1 "register_operand" "d")))] +@@ -1299,7 +1308,7 @@ + (define_insn "movdi_long_int" + [(set (match_operand:DI 0 "nonimmediate_operand" "=d") + (match_operand:DI 1 "general_operand" "i"))] +- "" ++ "TARGET_MB_64" + "addlik\t%0,r0,%h1\n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #li => la"; + [(set_attr "type" "no_delay_arith") + (set_attr "mode" "DI") +@@ -1582,7 +1591,7 @@ + return "ll%i1\t%0,%1"; + case 3: + { +- return "addlik\t%0,r0,%h1 \n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #Xfer Lo"; ++ return "addlik\t%0,r0,%j1 \n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%h1 #Xfer Lo"; + } + case 5: + return "sl%i0\t%1,%0"; +@@ -2371,9 +2380,9 @@ else + + (define_insn "long_branch_compare" + [(set (pc) +- (if_then_else (match_operator 0 "cmp_op" +- [(match_operand 1 "register_operand" "d") +- (match_operand 2 "register_operand" "d") ++ (if_then_else (match_operator:DI 0 "cmp_op" ++ [(match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "register_operand" "d") + ]) + (label_ref (match_operand 3)) + (pc))) +@@ -2495,6 +2504,20 @@ else + ;;---------------------------------------------------------------- + ;; Unconditional branches + ;;---------------------------------------------------------------- ++(define_insn "jump_64" ++ [(set (pc) ++ (label_ref (match_operand 0 "" "")))] ++ "TARGET_MB_64" ++ { ++ if (GET_CODE (operands[0]) == REG) ++ return "brea%?\t%0"; ++ else ++ return "breai%?\t%l0"; ++ } ++ [(set_attr "type" "jump") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")]) ++ + (define_insn "jump" + [(set (pc) + (label_ref (match_operand 0 "" "")))] +@@ -2540,17 +2563,25 @@ else + { + //gcc_assert (GET_MODE (operands[0]) == Pmode); + +- if (!flag_pic || TARGET_PIC_DATA_TEXT_REL) +- emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1])); +- else +- emit_jump_insn (gen_tablejump_internal3 (operands[0], operands[1])); ++ if (!flag_pic || TARGET_PIC_DATA_TEXT_REL) { ++ if (!TARGET_MB_64) ++ emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1])); ++ else ++ emit_jump_insn (gen_tablejump_internal2 (operands[0], operands[1])); ++ } ++ else { ++ if (!TARGET_MB_64) ++ emit_jump_insn (gen_tablejump_internal3 (operands[0], operands[1])); ++ else ++ emit_jump_insn (gen_tablejump_internal4 (operands[0], operands[1])); ++ } + DONE; + } + ) + + (define_insn "tablejump_internal1" + [(set (pc) +- (match_operand 0 "register_operand" "d")) ++ (match_operand:SI 0 "register_operand" "d")) + (use (label_ref (match_operand 1 "" "")))] + "" + "bra%?\t%0 " +@@ -2558,11 +2589,21 @@ else + (set_attr "mode" "none") + (set_attr "length" "4")]) + ++(define_insn "tablejump_internal2" ++ [(set (pc) ++ (match_operand:DI 0 "register_operand" "d")) ++ (use (label_ref (match_operand 1 "" "")))] ++ "TARGET_MB_64" ++ "bra%?\t%0 " ++ [(set_attr "type" "jump") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")]) ++ + (define_expand "tablejump_internal3" + [(parallel [(set (pc) +- (plus (match_operand 0 "register_operand" "d") +- (label_ref (match_operand:SI 1 "" "")))) +- (use (label_ref (match_dup 1)))])] ++ (plus:SI (match_operand:SI 0 "register_operand" "d") ++ (label_ref:SI (match_operand:SI 1 "" "")))) ++ (use (label_ref:SI (match_dup 1)))])] + "" + "" + ) +@@ -2593,6 +2634,23 @@ else + "" + ) + ++(define_insn "" ++ [(set (pc) ++ (plus:DI (match_operand:DI 0 "register_operand" "d") ++ (label_ref:DI (match_operand 1 "" "")))) ++ (use (label_ref:DI (match_dup 1)))] ++ "TARGET_MB_64 && NEXT_INSN (as_a <rtx_insn *> (operands[1])) != 0 ++ && GET_CODE (PATTERN (NEXT_INSN (as_a <rtx_insn *> (operands[1])))) == ADDR_DIFF_VEC ++ && flag_pic" ++ { ++ output_asm_insn ("addlk\t%0,%0,r20",operands); ++ return "bra%?\t%0"; ++} ++ [(set_attr "type" "jump") ++ (set_attr "mode" "none") ++ (set_attr "length" "4")]) ++ ++ + ;;---------------------------------------------------------------- + ;; Function prologue/epilogue and stack allocation + ;;---------------------------------------------------------------- +@@ -3101,7 +3159,7 @@ else + ;; The insn to set GOT. The hardcoded number "8" accounts for $pc difference + ;; between "mfs" and "addik" instructions. + (define_insn "set_got" +- [(set (match_operand:SI 0 "register_operand" "=r") ++ [(set (match_operand 0 "register_operand" "=r") + (unspec:SI [(const_int 0)] UNSPEC_SET_GOT))] + "" + "mfs\t%0,rpc\n\taddik\t%0,%0,_GLOBAL_OFFSET_TABLE_+8" +diff --git a/libgcc/config/microblaze/crti.S b/libgcc/config/microblaze/crti.S +index ec797e1bf17..15ebe68c277 100644 +--- a/libgcc/config/microblaze/crti.S ++++ b/libgcc/config/microblaze/crti.S +@@ -33,11 +33,32 @@ + .section .init, "ax" + .global __init + ++#ifdef __arch64__ + .weak _stack +- .set _stack, 0xffffffff ++ .set _stack, 0xffffffffffffffff + .weak _stack_end + .set _stack_end, 0 + ++ .align 3 ++__init: ++ addlik r1, r1, -32 ++ sl r15, r0, r1 ++ addlik r11, r0, _stack ++ mts rshr, r11 ++ addlik r11, r0, _stack_end ++ mts rslr, r11 ++ ++ .section .fini, "ax" ++ .global __fini ++ .align 3 ++__fini: ++ addlik r1, r1, -32 ++ sl r15, r0, r1 ++#else ++ .weak _stack ++ .set _stack, 0xffffffff ++ .weak _stack_end ++ .set _stack_end, 0 + .align 2 + __init: + addik r1, r1, -16 +@@ -53,3 +74,4 @@ __init: + __fini: + addik r1, r1, -16 + sw r15, r0, r1 ++#endif +diff --git a/libgcc/config/microblaze/crtn.S b/libgcc/config/microblaze/crtn.S +index 977b43b9436..9de3d4de13c 100644 +--- a/libgcc/config/microblaze/crtn.S ++++ b/libgcc/config/microblaze/crtn.S +@@ -29,7 +29,19 @@ + .section .note.GNU-stack,"",%progbits + .previous + #endif ++#ifdef __arch64__ ++ .section .init, "ax" ++ ll r15, r0, r1 ++ addlik r1, r1, 32 ++ rtsd r15, 8 ++ nop + ++ .section .fini, "ax" ++ ll r15, r0, r1 ++ addlik r1, r1, 32 ++ rtsd r15, 8 ++ nop ++#else + .section .init, "ax" + lw r15, r0, r1 + rtsd r15, 8 +@@ -39,3 +51,4 @@ + lw r15, r0, r1 + rtsd r15, 8 + addik r1, r1, 16 ++#endif +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch new file mode 100644 index 00000000..3f07dfa1 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch @@ -0,0 +1,139 @@ +From 80c16e39bdf8643184c353e34f146dc8601c2c1e Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Tue, 9 Oct 2018 10:07:08 +0530 +Subject: [PATCH 34/53] -Added double arith instructions -Fixed prologue stack + pointer decrement issue + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 78 +++++++++++++++++++++++++---- + gcc/config/microblaze/t-microblaze | 7 +++ + 2 files changed, 76 insertions(+), 9 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 5a950b49591..5506aee7be5 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -527,6 +527,66 @@ + (set_attr "mode" "SF") + (set_attr "length" "4")]) + ++(define_insn "fix_truncsfsi2" ++ [(set (match_operand:SI 0 "register_operand" "=d") ++ (fix:SI (match_operand:SF 1 "register_operand" "d")))] ++ "TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" ++ "fint\t%0,%1" ++ [(set_attr "type" "fint") ++ (set_attr "mode" "SF") ++ (set_attr "length" "4")]) ++ ++ ++(define_insn "adddf3" ++ [(set (match_operand:DF 0 "register_operand" "=d") ++ (plus:DF (match_operand:DF 1 "register_operand" "d") ++ (match_operand:DF 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "dadd\t%0,%1,%2" ++ [(set_attr "type" "fadd") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4")]) ++ ++(define_insn "subdf3" ++ [(set (match_operand:DF 0 "register_operand" "=d") ++ (minus:DF (match_operand:DF 1 "register_operand" "d") ++ (match_operand:DF 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "drsub\t%0,%2,%1" ++ [(set_attr "type" "frsub") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4")]) ++ ++(define_insn "muldf3" ++ [(set (match_operand:DF 0 "register_operand" "=d") ++ (mult:DF (match_operand:DF 1 "register_operand" "d") ++ (match_operand:DF 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "dmul\t%0,%1,%2" ++ [(set_attr "type" "fmul") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4")]) ++ ++(define_insn "divdf3" ++ [(set (match_operand:DF 0 "register_operand" "=d") ++ (div:DF (match_operand:DF 1 "register_operand" "d") ++ (match_operand:DF 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "ddiv\t%0,%2,%1" ++ [(set_attr "type" "fdiv") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4")]) ++ ++ ++(define_insn "sqrtdf2" ++ [(set (match_operand:DF 0 "register_operand" "=d") ++ (sqrt:DF (match_operand:DF 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "dsqrt\t%0,%1" ++ [(set_attr "type" "fsqrt") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4")]) ++ + (define_insn "floatdidf2" + [(set (match_operand:DF 0 "register_operand" "=d") + (float:DF (match_operand:DI 1 "register_operand" "d")))] +@@ -536,13 +596,13 @@ + (set_attr "mode" "DF") + (set_attr "length" "4")]) + +-(define_insn "fix_truncsfsi2" +- [(set (match_operand:SI 0 "register_operand" "=d") +- (fix:SI (match_operand:SF 1 "register_operand" "d")))] +- "TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" +- "fint\t%0,%1" +- [(set_attr "type" "fint") +- (set_attr "mode" "SF") ++(define_insn "floatdfdi2" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (float:DI (match_operand:DF 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "dlong\t%0,%1" ++ [(set_attr "type" "fcvt") ++ (set_attr "mode" "DI") + (set_attr "length" "4")]) + + ;;---------------------------------------------------------------- +@@ -660,8 +720,8 @@ + "TARGET_MB_64" + "@ + rsubl\t%0,%2,%1 +- addik\t%0,%z1,-%2 +- addik\t%0,%z1,-%2" ++ addlik\t%0,%z1,-%2 ++ addlik\t%0,%z1,-%2" + [(set_attr "type" "arith,no_delay_arith,no_delay_arith") + (set_attr "mode" "DI") + (set_attr "length" "4,4,4")]) +diff --git a/gcc/config/microblaze/t-microblaze b/gcc/config/microblaze/t-microblaze +index 47b869b9303..3522afd4831 100644 +--- a/gcc/config/microblaze/t-microblaze ++++ b/gcc/config/microblaze/t-microblaze +@@ -1,6 +1,13 @@ + MULTILIB_OPTIONS = m64 mxl-barrel-shift mlittle-endian mno-xl-soft-mul mxl-multiply-high + MULTILIB_DIRNAMES = m64 bs le m mh + MULTILIB_EXCEPTIONS = *m64/mxl-multiply-high mxl-multiply-high ++MULTILIB_EXCEPTIONS += *m64 ++MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift ++MULTILIB_EXCEPTIONS += *m64/mno-xl-soft-mul ++MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mno-xl-soft-mul ++MULTILIB_EXCEPTIONS += *m64/mno-xl-soft-mul ++MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mno-xl-soft-mul/mxl-multiply-high ++MULTILIB_EXCEPTIONS += *m64/mno-xl-soft-mul/mxl-multiply-high + MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high + MULTILIB_EXCEPTIONS += *mlittle-endian/mxl-multiply-high mxl-multiply-high + MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mlittle-endian/mxl-multiply-high +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch new file mode 100644 index 00000000..3ff6a2d0 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch @@ -0,0 +1,41 @@ +From 455216291580ca22767433eec11941c5f2471892 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Fri, 12 Oct 2018 16:07:36 +0530 +Subject: [PATCH 35/53] Fixed the issue in the delay slot with swap + instructions + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 5506aee7be5..4a372f8fd3f 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -443,6 +443,9 @@ + (bswap:SI (match_operand:SI 1 "register_operand" "r")))] + "TARGET_REORDER" + "swapb %0, %1" ++ [(set_attr "type" "no_delay_arith") ++ (set_attr "mode" "SI") ++ (set_attr "length" "4")] + ) + + (define_insn "bswaphi2" +@@ -451,6 +454,9 @@ + "TARGET_REORDER" + "swapb %0, %1 + swaph %0, %0" ++ [(set_attr "type" "no_delay_arith") ++ (set_attr "mode" "SI") ++ (set_attr "length" "8")] + ) + + ;;---------------------------------------------------------------- +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch new file mode 100644 index 00000000..90ddf3eb --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch @@ -0,0 +1,260 @@ +From b8c468f1bd467213083b59b54af100ee0c6dea9e Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Sat, 13 Oct 2018 21:12:43 +0530 +Subject: [PATCH 36/53] Fixed the load store issue with the 32bit arith + libraries + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + libgcc/config/microblaze/divsi3.S | 25 ++++++++++++++++++++++++- + libgcc/config/microblaze/modsi3.S | 26 +++++++++++++++++++++++++- + libgcc/config/microblaze/mulsi3.S | 3 +++ + libgcc/config/microblaze/udivsi3.S | 24 +++++++++++++++++++++++- + libgcc/config/microblaze/umodsi3.S | 24 +++++++++++++++++++++++- + 5 files changed, 98 insertions(+), 4 deletions(-) + +diff --git a/libgcc/config/microblaze/divsi3.S b/libgcc/config/microblaze/divsi3.S +index 14829ec6701..b464deed481 100644 +--- a/libgcc/config/microblaze/divsi3.S ++++ b/libgcc/config/microblaze/divsi3.S +@@ -41,6 +41,17 @@ + .globl __divsi3 + .ent __divsi3 + .type __divsi3,@function ++#ifdef __arch64__ ++ .align 3 ++__divsi3: ++ .frame r1,0,r15 ++ ++ ADDIK r1,r1,-32 ++ SLI r28,r1,0 ++ SLI r29,r1,8 ++ SLI r30,r1,16 ++ SLI r31,r1,24 ++#else + __divsi3: + .frame r1,0,r15 + +@@ -49,7 +60,7 @@ __divsi3: + SWI r29,r1,4 + SWI r30,r1,8 + SWI r31,r1,12 +- ++#endif + BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error + BEQI r5,$LaResult_Is_Zero # Result is Zero + BGEID r5,$LaR5_Pos +@@ -89,6 +100,17 @@ $LaLOOP_END: + $LaDiv_By_Zero: + $LaResult_Is_Zero: + OR r3,r0,r0 # set result to 0 ++#ifdef __arch64__ ++$LaRETURN_HERE: ++# Restore values of CSRs and that of r3 and the divisor and the dividend ++ LLI r28,r1,0 ++ LLI r29,r1,8 ++ LLI r30,r1,16 ++ LLI r31,r1,24 ++ ADDLIK r1,r1,32 ++ RTSD r15,8 ++ NOP ++#else + $LaRETURN_HERE: + # Restore values of CSRs and that of r3 and the divisor and the dividend + LWI r28,r1,0 +@@ -97,6 +119,7 @@ $LaRETURN_HERE: + LWI r31,r1,12 + RTSD r15,8 + ADDIK r1,r1,16 ++#endif + .end __divsi3 + .size __divsi3, . - __divsi3 + +diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S +index b8f2e37809d..e0fbd91e766 100644 +--- a/libgcc/config/microblaze/modsi3.S ++++ b/libgcc/config/microblaze/modsi3.S +@@ -41,6 +41,17 @@ + .globl __modsi3 + .ent __modsi3 + .type __modsi3,@function ++#ifdef __arch64__ ++ .align 3 ++__modsi3: ++ .frame r1,0,r15 ++ ++ addlik r1,r1,-32 ++ sli r28,r1,0 ++ sli r29,r1,8 ++ sli r30,r1,16 ++ sli r31,r1,24 ++#else + __modsi3: + .frame r1,0,r15 + +@@ -49,6 +60,7 @@ __modsi3: + swi r29,r1,4 + swi r30,r1,8 + swi r31,r1,12 ++#endif + + BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error + BEQI r5,$LaResult_Is_Zero # Result is Zero +@@ -88,6 +100,18 @@ $LaLOOP_END: + $LaDiv_By_Zero: + $LaResult_Is_Zero: + or r3,r0,r0 # set result to 0 [Both mod as well as div are 0] ++ ++#ifdef __arch64__ ++$LaRETURN_HERE: ++# Restore values of CSRs and that of r3 and the divisor and the dividend ++ lli r28,r1,0 ++ lli r29,r1,8 ++ lli r30,r1,16 ++ lli r31,r1,24 ++ addik r1,r1,32 ++ rtsd r15,8 ++ nop ++#else + $LaRETURN_HERE: + # Restore values of CSRs and that of r3 and the divisor and the dividend + lwi r28,r1,0 +@@ -95,7 +119,7 @@ $LaRETURN_HERE: + lwi r30,r1,8 + lwi r31,r1,12 + rtsd r15,8 +- addik r1,r1,16 ++#endif + .end __modsi3 + .size __modsi3, . - __modsi3 + +diff --git a/libgcc/config/microblaze/mulsi3.S b/libgcc/config/microblaze/mulsi3.S +index f48fcf8270c..657668ef826 100644 +--- a/libgcc/config/microblaze/mulsi3.S ++++ b/libgcc/config/microblaze/mulsi3.S +@@ -41,6 +41,9 @@ + .globl __mulsi3 + .ent __mulsi3 + .type __mulsi3,@function ++#ifdef __arch64__ ++ .align 3 ++#endif + __mulsi3: + .frame r1,0,r15 + add r3,r0,r0 +diff --git a/libgcc/config/microblaze/udivsi3.S b/libgcc/config/microblaze/udivsi3.S +index 2c321f94b09..fc6a4b5a248 100644 +--- a/libgcc/config/microblaze/udivsi3.S ++++ b/libgcc/config/microblaze/udivsi3.S +@@ -41,6 +41,16 @@ + .globl __udivsi3 + .ent __udivsi3 + .type __udivsi3,@function ++#ifdef __arch64__ ++ .align 3 ++__udivsi3: ++ .frame r1,0,r15 ++ ++ ADDLIK r1,r1,-24 ++ SLI r29,r1,0 ++ SLI r30,r1,8 ++ SLI r31,r1,16 ++#else + __udivsi3: + .frame r1,0,r15 + +@@ -48,7 +58,7 @@ __udivsi3: + SWI r29,r1,0 + SWI r30,r1,4 + SWI r31,r1,8 +- ++#endif + BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error + BEQID r5,$LaResult_Is_Zero # Result is Zero + ADDIK r30,r0,0 # Clear mod +@@ -98,6 +108,17 @@ $LaLOOP_END: + $LaDiv_By_Zero: + $LaResult_Is_Zero: + OR r3,r0,r0 # set result to 0 ++ ++#ifdef __arch64__ ++$LaRETURN_HERE: ++ # Restore values of CSRs and that of r3 and the divisor and the dividend ++ LLI r29,r1,0 ++ LLI r30,r1,8 ++ LLI r31,r1,16 ++ ADDIK r1,r1,24 ++ RTSD r15,8 ++ NOP ++#else + $LaRETURN_HERE: + # Restore values of CSRs and that of r3 and the divisor and the dividend + LWI r29,r1,0 +@@ -105,5 +126,6 @@ $LaRETURN_HERE: + LWI r31,r1,8 + RTSD r15,8 + ADDIK r1,r1,12 ++#endif + .end __udivsi3 + .size __udivsi3, . - __udivsi3 +diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S +index fbe942dc5f2..b68ba7a5ea6 100644 +--- a/libgcc/config/microblaze/umodsi3.S ++++ b/libgcc/config/microblaze/umodsi3.S +@@ -41,6 +41,16 @@ + .globl __umodsi3 + .ent __umodsi3 + .type __umodsi3,@function ++#ifdef __arch64__ ++ .align 3 ++__umodsi3: ++ .frame r1,0,r15 ++ ++ addik r1,r1,-24 ++ swi r29,r1,0 ++ swi r30,r1,8 ++ swi r31,r1,16 ++#else + __umodsi3: + .frame r1,0,r15 + +@@ -48,7 +58,7 @@ __umodsi3: + swi r29,r1,0 + swi r30,r1,4 + swi r31,r1,8 +- ++#endif + BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error + BEQId r5,$LaResult_Is_Zero # Result is Zero + ADDIK r3,r0,0 # Clear div +@@ -101,6 +111,17 @@ $LaLOOP_END: + $LaDiv_By_Zero: + $LaResult_Is_Zero: + or r3,r0,r0 # set result to 0 ++ ++#ifdef __arch64__ ++$LaRETURN_HERE: ++# Restore values of CSRs and that of r3 and the divisor and the dividend ++ lli r29,r1,0 ++ lli r30,r1,8 ++ lli r31,r1,16 ++ addlik r1,r1,24 ++ rtsd r15,8 ++ nop ++#else + $LaRETURN_HERE: + # Restore values of CSRs and that of r3 and the divisor and the dividend + lwi r29,r1,0 +@@ -108,5 +129,6 @@ $LaRETURN_HERE: + lwi r31,r1,8 + rtsd r15,8 + addik r1,r1,12 ++#endif + .end __umodsi3 + .size __umodsi3, . - __umodsi3 +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch new file mode 100644 index 00000000..191c7627 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch @@ -0,0 +1,29 @@ +From 2bc476e64f1bacc27874c152340c004c17bfd942 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Mon, 15 Oct 2018 12:00:10 +0530 +Subject: [PATCH 37/53] extending the Dwarf support to 64bit Microblaze + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index ac4ea43a706..56dfc2a3824 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -207,7 +207,7 @@ extern enum pipeline_type microblaze_pipe; + /* Use DWARF 2 debugging information by default. */ + #define DWARF2_DEBUGGING_INFO 1 + #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +-#define DWARF2_ADDR_SIZE 4 ++#define DWARF2_ADDR_SIZE (TARGET_MB_64 ? 8 : 4) + + /* Target machine storage layout */ + +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch new file mode 100644 index 00000000..8697be58 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch @@ -0,0 +1,33 @@ +From 1e0eaa1330f24d4989af6326ce1af4f613ea0d89 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Tue, 16 Oct 2018 07:55:46 +0530 +Subject: [PATCH 38/53] fixing the typo errors in umodsi3 file + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + libgcc/config/microblaze/umodsi3.S | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S +index b68ba7a5ea6..03be6df1fc6 100644 +--- a/libgcc/config/microblaze/umodsi3.S ++++ b/libgcc/config/microblaze/umodsi3.S +@@ -47,9 +47,9 @@ __umodsi3: + .frame r1,0,r15 + + addik r1,r1,-24 +- swi r29,r1,0 +- swi r30,r1,8 +- swi r31,r1,16 ++ sli r29,r1,0 ++ sli r30,r1,8 ++ sli r31,r1,16 + #else + __umodsi3: + .frame r1,0,r15 +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch new file mode 100644 index 00000000..032cab4d --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch @@ -0,0 +1,72 @@ +From 7dbdc5ba78c9237b0a367ca61f448cf3a0277ea6 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Wed, 17 Oct 2018 16:56:14 +0530 +Subject: [PATCH 39/53] fixing the 32bit LTO related issue9(1014024) + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.h | 24 ++++++++++++++---------- + 1 file changed, 14 insertions(+), 10 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index 56dfc2a3824..c48b6de0d58 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -265,12 +265,14 @@ extern enum pipeline_type microblaze_pipe; + #define WORD_REGISTER_OPERATIONS 1 + + #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND +-/* +-#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ +- if (GET_MODE_CLASS (MODE) == MODE_INT \ +- && GET_MODE_SIZE (MODE) < (TARGET_MB_64 ? 8 : 4)) \ +- (MODE) = TARGET_MB_64 ? DImode : SImode; +-*/ ++ ++#ifndef __arch64__ ++#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ ++ if (GET_MODE_CLASS (MODE) == MODE_INT \ ++ && GET_MODE_SIZE (MODE) < 4) \ ++ (MODE) = SImode; ++#endif ++ + /* Standard register usage. */ + + /* On the MicroBlaze, we have 32 integer registers */ +@@ -469,16 +471,18 @@ extern struct microblaze_frame_info current_frame_info; + + #define MAX_ARGS_IN_REGISTERS MB_ABI_MAX_ARG_REGS + ++#ifdef __aarch64__ + #define LIBCALL_VALUE(MODE) \ + gen_rtx_REG (MODE,GP_RETURN) +- +-/*#define LIBCALL_VALUE(MODE) \ ++#else ++#define LIBCALL_VALUE(MODE) \ + gen_rtx_REG ( \ + ((GET_MODE_CLASS (MODE) != MODE_INT \ + || GET_MODE_SIZE (MODE) >= 4) \ + ? (MODE) \ + : SImode), GP_RETURN) +-*/ ++#endif ++ + /* 1 if N is a possible register number for a function value. + On the MicroBlaze, R2 R3 are the only register thus used. + Currently, R2 are only implemented here (C has no complex type) */ +@@ -518,7 +522,7 @@ typedef struct microblaze_args + /* 4 insns + 2 words of data. */ + #define TRAMPOLINE_SIZE (6 * 4) + +-#define TRAMPOLINE_ALIGNMENT 64 ++#define TRAMPOLINE_ALIGNMENT (TARGET_MB_64 ? 64 : 32) + + #define REGNO_OK_FOR_BASE_P(regno) microblaze_regno_ok_for_base_p ((regno), 1) + +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch new file mode 100644 index 00000000..1ed53957 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch @@ -0,0 +1,29 @@ +From a21a41a0c574b807c7e7edaa7051a0f7395d8142 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Fri, 19 Oct 2018 14:26:25 +0530 +Subject: [PATCH 40/53] Fixed the missing stack adjustment in prologue of + modsi3 function + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + libgcc/config/microblaze/modsi3.S | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S +index e0fbd91e766..3ec17685e51 100644 +--- a/libgcc/config/microblaze/modsi3.S ++++ b/libgcc/config/microblaze/modsi3.S +@@ -119,6 +119,7 @@ $LaRETURN_HERE: + lwi r30,r1,8 + lwi r31,r1,12 + rtsd r15,8 ++ addik r1,r1,16 + #endif + .end __modsi3 + .size __modsi3, . - __modsi3 +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch new file mode 100644 index 00000000..e6335e8e --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch @@ -0,0 +1,33 @@ +From 5f799ea01bae0573a44f3fefa825861e99f4e30a Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 24 Oct 2018 18:31:04 +0530 +Subject: [PATCH 41/53] [Patch,Microblaze] : corrected SPN for dlong + instruction mapping. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 4a372f8fd3f..5a964e70d1f 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -602,9 +602,9 @@ + (set_attr "mode" "DF") + (set_attr "length" "4")]) + +-(define_insn "floatdfdi2" ++(define_insn "fix_truncdfdi2" + [(set (match_operand:DI 0 "register_operand" "=d") +- (float:DI (match_operand:DF 1 "register_operand" "d")))] ++ (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "d"))))] + "TARGET_MB_64" + "dlong\t%0,%1" + [(set_attr "type" "fcvt") +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch new file mode 100644 index 00000000..f4013b9e --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch @@ -0,0 +1,63 @@ +From 9c37b9690ec2c6290095209c039725f235537379 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Thu, 29 Nov 2018 17:55:08 +0530 +Subject: [PATCH 42/53] fixing the long & long long mingw toolchain issue + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/constraints.md | 2 +- + gcc/config/microblaze/microblaze.md | 8 ++++---- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md +index 0ced155340d..3f9805dfe0a 100644 +--- a/gcc/config/microblaze/constraints.md ++++ b/gcc/config/microblaze/constraints.md +@@ -55,7 +55,7 @@ + (define_constraint "K" + "A constant in the range 0xffffff8000000000L to 0x0000007fffffffffL (inclusive)." + (and (match_code "const_int") +- (match_test "ival > (long)-549755813888 && ival < (long)549755813887"))) ++ (match_test "ival > (long long)-549755813888 && ival < (long long)549755813887"))) + + + ;; Define floating point constraints +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 5a964e70d1f..f509bd5e665 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -648,8 +648,8 @@ + if (TARGET_MB_64) + { + if (GET_CODE (operands[2]) == CONST_INT && +- INTVAL(operands[2]) < (long)-549755813888 && +- INTVAL(operands[2]) > (long)549755813887) ++ INTVAL(operands[2]) < (long long)-549755813888 && ++ INTVAL(operands[2]) > (long long)549755813887) + FAIL; + } + }) +@@ -1264,7 +1264,7 @@ + (match_operand:DI 1 "immediate_operand" "J,I,Mnis"))] + "TARGET_MB_64 && (register_operand (operands[0], DImode) && + (GET_CODE (operands[1]) == CONST_INT && +- (INTVAL (operands[1]) <= (long)549755813887 && INTVAL (operands[1]) >= (long)-549755813888)))" ++ (INTVAL (operands[1]) <= (long long)549755813887 && INTVAL (operands[1]) >= (long long)-549755813888)))" + "@ + addlk\t%0,r0,r0\t + addlik\t%0,r0,%1\t #N1 %X1 +@@ -1298,7 +1298,7 @@ + case 1: + case 2: + if (GET_CODE (operands[1]) == CONST_INT && +- (INTVAL (operands[1]) > (long)549755813887 || INTVAL (operands[1]) < (long)-549755813888)) ++ (INTVAL (operands[1]) > (long long)549755813887 || INTVAL (operands[1]) < (long long)-549755813888)) + return "addlik\t%0,r0,%h1\n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #li => la"; + else + return "addlik\t%0,r0,%1"; +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch new file mode 100644 index 00000000..7f3c8373 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch @@ -0,0 +1,51 @@ +From 0ed24f5a2e6e47f5d13896793ab2c6ea89e8c8e6 Mon Sep 17 00:00:00 2001 +From: Nagaraju <nmekala@xilinx.com> +Date: Thu, 14 Mar 2019 18:11:04 +0530 +Subject: [PATCH 43/53] Fix the MB-64 bug of handling QI objects + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index f509bd5e665..27436c0f660 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -2345,11 +2345,11 @@ else + + (define_insn "branch_zero_64" + [(set (pc) +- (if_then_else (match_operator:SI 0 "ordered_comparison_operator" ++ (if_then_else (match_operator 0 "ordered_comparison_operator" + [(match_operand:SI 1 "register_operand" "d") + (const_int 0)]) +- (match_operand:SI 2 "pc_or_label_operand" "") +- (match_operand:SI 3 "pc_or_label_operand" ""))) ++ (match_operand 2 "pc_or_label_operand" "") ++ (match_operand 3 "pc_or_label_operand" ""))) + ] + "TARGET_MB_64" + { +@@ -2365,11 +2365,11 @@ else + + (define_insn "long_branch_zero" + [(set (pc) +- (if_then_else (match_operator 0 "ordered_comparison_operator" +- [(match_operand 1 "register_operand" "d") ++ (if_then_else (match_operator:DI 0 "ordered_comparison_operator" ++ [(match_operand:DI 1 "register_operand" "d") + (const_int 0)]) +- (match_operand 2 "pc_or_label_operand" "") +- (match_operand 3 "pc_or_label_operand" ""))) ++ (match_operand:DI 2 "pc_or_label_operand" "") ++ (match_operand:DI 3 "pc_or_label_operand" ""))) + ] + "TARGET_MB_64" + { +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch new file mode 100644 index 00000000..14eb812a --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch @@ -0,0 +1,91 @@ +From e8286e00f939486dde52e9475bc9cca0aa025a42 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Fri, 29 Mar 2019 12:08:39 +0530 +Subject: [PATCH 44/53] [Patch,Microblaze] : We will check the possibility of + peephole2 optimization,if we can then we will fix the compiler issue. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 63 +++++++++++++++++------------ + 1 file changed, 38 insertions(+), 25 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 27436c0f660..4b9acddb1f1 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -882,31 +882,44 @@ + (set_attr "mode" "SI") + (set_attr "length" "4")]) + +-(define_peephole2 +- [(set (match_operand:SI 0 "register_operand") +- (fix:SI (match_operand:SF 1 "register_operand"))) +- (set (pc) +- (if_then_else (match_operator 2 "ordered_comparison_operator" +- [(match_operand:SI 3 "register_operand") +- (match_operand:SI 4 "arith_operand")]) +- (label_ref (match_operand 5)) +- (pc)))] +- "TARGET_HARD_FLOAT && !TARGET_MB_64" +- [(set (match_dup 1) (match_dup 3))] +- +- { +- rtx condition; +- rtx cmp_op0 = operands[3]; +- rtx cmp_op1 = operands[4]; +- rtx comp_reg = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM); +- +- emit_insn (gen_cstoresf4 (comp_reg, operands[2], +- gen_rtx_REG (SFmode, REGNO (cmp_op0)), +- gen_rtx_REG (SFmode, REGNO (cmp_op1)))); +- condition = gen_rtx_NE (SImode, comp_reg, const0_rtx); +- emit_jump_insn (gen_condjump (condition, operands[5])); +- } +-) ++;; peephole2 optimization will be done only if fint and if-then-else ++;; are dependent.added condition for the same. ++;; if they are dependent then gcc is giving "flow control insn inside a basic block" ++;; testcase: ++;; volatile float vec = 1.0; ++;; volatile int ci = 2; ++;; register int cj = (int)(vec); ++;;// ci=cj; ++;;// if (ci <0) { ++;; if (cj < 0) { ++;; ci = 0; ++;; } ++;; commenting for now.we will check the possibility of this optimization later ++ ++;;(define_peephole2 ++;; [(set (match_operand:SI 0 "register_operand") ++;; (fix:SI (match_operand:SF 1 "register_operand"))) ++;; (set (pc) ++;; (if_then_else (match_operator 2 "ordered_comparison_operator" ++;; [(match_operand:SI 3 "register_operand") ++;; (match_operand:SI 4 "arith_operand")]) ++;; (label_ref (match_operand 5)) ++;; (pc)))] ++;; "TARGET_HARD_FLOAT && !TARGET_MB_64 && ((REGNO (operands[0])) == (REGNO (operands[3])))" ++;; [(set (match_dup 1) (match_dup 3))] ++;; { ++;; rtx condition; ++;; rtx cmp_op0 = operands[3]; ++;; rtx cmp_op1 = operands[4]; ++;; rtx comp_reg = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM); ++;; ++;; emit_insn (gen_cstoresf4 (comp_reg, operands[2], ++;; gen_rtx_REG (SFmode, REGNO (cmp_op0)), ++;; gen_rtx_REG (SFmode, REGNO (cmp_op1)))); ++;; condition = gen_rtx_NE (SImode, comp_reg, const0_rtx); ++;; emit_jump_insn (gen_condjump (condition, operands[5])); ++;; } ++;;) + + ;;---------------------------------------------------------------- + ;; Negation and one's complement +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch new file mode 100644 index 00000000..54135b0f --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch @@ -0,0 +1,470 @@ +From 29c33e35373d7dc52e43162dce38a3ec0e350db3 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 17 Apr 2019 12:36:16 +0530 +Subject: [PATCH 45/53] [Patch,MicroBlaze]: fixed typos in mul,div and mod + assembly files. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + libgcc/config/microblaze/divsi3.S | 47 ++++++++++++++++++++---- + libgcc/config/microblaze/modsi3.S | 40 ++++++++++++++++++--- + libgcc/config/microblaze/mulsi3.S | 33 ++++++++++++++++- + libgcc/config/microblaze/udivsi3.S | 54 +++++++++++++++++++++++++--- + libgcc/config/microblaze/umodsi3.S | 58 +++++++++++++++++++++++++++--- + 5 files changed, 212 insertions(+), 20 deletions(-) + +diff --git a/libgcc/config/microblaze/divsi3.S b/libgcc/config/microblaze/divsi3.S +index b464deed481..ceeed6be1f4 100644 +--- a/libgcc/config/microblaze/divsi3.S ++++ b/libgcc/config/microblaze/divsi3.S +@@ -46,7 +46,7 @@ + __divsi3: + .frame r1,0,r15 + +- ADDIK r1,r1,-32 ++ ADDLIK r1,r1,-32 + SLI r28,r1,0 + SLI r29,r1,8 + SLI r30,r1,16 +@@ -61,13 +61,23 @@ __divsi3: + SWI r30,r1,8 + SWI r31,r1,12 + #endif +- BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error +- BEQI r5,$LaResult_Is_Zero # Result is Zero +- BGEID r5,$LaR5_Pos ++#ifdef __arch64__ ++ BEAEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ BEAEQI r5,$LaResult_Is_Zero # Result is Zero ++ BEAGEID r5,$LaR5_Pos ++#else ++ BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ BEQI r5,$LaResult_Is_Zero # Result is Zero ++ BGEID r5,$LaR5_Pos ++#endif + XOR r28,r5,r6 # Get the sign of the result + RSUBI r5,r5,0 # Make r5 positive + $LaR5_Pos: +- BGEI r6,$LaR6_Pos ++#ifdef __arch64__ ++ BEAGEI r6,$LaR6_Pos ++#else ++ BGEI r6,$LaR6_Pos ++#endif + RSUBI r6,r6,0 # Make r6 positive + $LaR6_Pos: + ADDIK r30,r0,0 # Clear mod +@@ -76,26 +86,51 @@ $LaR6_Pos: + + # First part try to find the first '1' in the r5 + $LaDIV0: +- BLTI r5,$LaDIV2 # This traps r5 == 0x80000000 ++#ifdef __arch64__ ++ BEALTI r5,$LaDIV2 # This traps r5 == 0x80000000 ++#else ++ BLTI r5,$LaDIV2 # This traps r5 == 0x80000000 ++#endif + $LaDIV1: + ADD r5,r5,r5 # left shift logical r5 ++#ifdef __arch64__ ++ BEAGTID r5,$LaDIV1 ++#else + BGTID r5,$LaDIV1 ++#endif + ADDIK r29,r29,-1 + $LaDIV2: + ADD r5,r5,r5 # left shift logical r5 get the '1' into the Carry + ADDC r30,r30,r30 # Move that bit into the Mod register + RSUB r31,r6,r30 # Try to subtract (r30 a r6) ++#ifdef __arch64__ ++ BEALTI r31,$LaMOD_TOO_SMALL ++#else + BLTI r31,$LaMOD_TOO_SMALL ++#endif + OR r30,r0,r31 # Move the r31 to mod since the result was positive + ADDIK r3,r3,1 + $LaMOD_TOO_SMALL: + ADDIK r29,r29,-1 ++#ifdef __arch64__ ++ BEAEQi r29,$LaLOOP_END ++#else + BEQi r29,$LaLOOP_END ++#endif + ADD r3,r3,r3 # Shift in the '1' into div ++#ifdef __arch64__ ++ BREAI $LaDIV2 # Div2 ++#else + BRI $LaDIV2 # Div2 ++#endif + $LaLOOP_END: ++#ifdef __arch64__ ++ BEAGEI r28,$LaRETURN_HERE ++ BREAID $LaRETURN_HERE ++#else + BGEI r28,$LaRETURN_HERE + BRID $LaRETURN_HERE ++#endif + RSUBI r3,r3,0 # Negate the result + $LaDiv_By_Zero: + $LaResult_Is_Zero: +diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S +index 3ec17685e51..637b06c09a3 100644 +--- a/libgcc/config/microblaze/modsi3.S ++++ b/libgcc/config/microblaze/modsi3.S +@@ -62,40 +62,72 @@ __modsi3: + swi r31,r1,12 + #endif + ++#ifdef __arch64__ ++ BEAEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ BEAEQI r5,$LaResult_Is_Zero # Result is Zero ++ BEAGEId r5,$LaR5_Pos ++#else + BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error + BEQI r5,$LaResult_Is_Zero # Result is Zero + BGEId r5,$LaR5_Pos ++#endif + ADD r28,r5,r0 # Get the sign of the result [ Depends only on the first arg] + RSUBI r5,r5,0 # Make r5 positive + $LaR5_Pos: +- BGEI r6,$LaR6_Pos ++#ifdef __arch64__ ++ BEAGEI r6,$LaR6_Pos ++#else ++ BGEI r6,$LaR6_Pos ++#endif + RSUBI r6,r6,0 # Make r6 positive + $LaR6_Pos: + ADDIK r3,r0,0 # Clear mod + ADDIK r30,r0,0 # clear div +- BLTId r5,$LaDIV2 # If r5 is still negative (0x80000000), skip ++#ifdef __arch64__ ++ BEALTId r5,$LaDIV2 # If r5 is still negative (0x80000000), skip + # the first bit search. ++#else ++ BLTId r5,$LaDIV2 # If r5 is still negative (0x80000000), skip ++ # the first bit search. ++#endif + ADDIK r29,r0,32 # Initialize the loop count + # First part try to find the first '1' in the r5 + $LaDIV1: + ADD r5,r5,r5 # left shift logical r5 +- BGEID r5,$LaDIV1 # ++#ifdef __arch64__ ++ BEAGEID r5,$LaDIV1 # ++#else ++ BGEID r5,$LaDIV1 # ++#endif + ADDIK r29,r29,-1 + $LaDIV2: + ADD r5,r5,r5 # left shift logical r5 get the '1' into the Carry + ADDC r3,r3,r3 # Move that bit into the Mod register + rSUB r31,r6,r3 # Try to subtract (r30 a r6) ++#ifdef __arch64__ ++ BEALTi r31,$LaMOD_TOO_SMALL ++#else + BLTi r31,$LaMOD_TOO_SMALL ++#endif + OR r3,r0,r31 # Move the r31 to mod since the result was positive + ADDIK r30,r30,1 + $LaMOD_TOO_SMALL: + ADDIK r29,r29,-1 ++#ifdef __arch64__ ++ BEAEQi r29,$LaLOOP_END ++ ADD r30,r30,r30 # Shift in the '1' into div ++ BREAI $LaDIV2 # Div2 ++$LaLOOP_END: ++ BEAGEI r28,$LaRETURN_HERE ++ BREAId $LaRETURN_HERE ++#else + BEQi r29,$LaLOOP_END + ADD r30,r30,r30 # Shift in the '1' into div + BRI $LaDIV2 # Div2 + $LaLOOP_END: + BGEI r28,$LaRETURN_HERE + BRId $LaRETURN_HERE ++#endif + rsubi r3,r3,0 # Negate the result + $LaDiv_By_Zero: + $LaResult_Is_Zero: +@@ -108,7 +140,7 @@ $LaRETURN_HERE: + lli r29,r1,8 + lli r30,r1,16 + lli r31,r1,24 +- addik r1,r1,32 ++ addlik r1,r1,32 + rtsd r15,8 + nop + #else +diff --git a/libgcc/config/microblaze/mulsi3.S b/libgcc/config/microblaze/mulsi3.S +index 657668ef826..6be75dc95e8 100644 +--- a/libgcc/config/microblaze/mulsi3.S ++++ b/libgcc/config/microblaze/mulsi3.S +@@ -43,7 +43,37 @@ + .type __mulsi3,@function + #ifdef __arch64__ + .align 3 +-#endif ++__mulsi3: ++ .frame r1,0,r15 ++ add r3,r0,r0 ++ BEAEQI r5,$L_Result_Is_Zero # Multiply by Zero ++ BEAEQI r6,$L_Result_Is_Zero # Multiply by Zero ++ BEAGEId r5,$L_R5_Pos ++ XOR r4,r5,r6 # Get the sign of the result ++ RSUBI r5,r5,0 # Make r5 positive ++$L_R5_Pos: ++ BEAGEI r6,$L_R6_Pos ++ RSUBI r6,r6,0 # Make r6 positive ++$L_R6_Pos: ++ breai $L1 ++$L2: ++ add r5,r5,r5 ++$L1: ++ srl r6,r6 ++ addc r7,r0,r0 ++ beaeqi r7,$L2 ++ beaneid r6,$L2 ++ add r3,r3,r5 ++ bealti r4,$L_NegateResult ++ rtsd r15,8 ++ nop ++$L_NegateResult: ++ rtsd r15,8 ++ rsub r3,r3,r0 ++$L_Result_Is_Zero: ++ rtsd r15,8 ++ addi r3,r0,0 ++#else + __mulsi3: + .frame r1,0,r15 + add r3,r0,r0 +@@ -74,5 +104,6 @@ $L_NegateResult: + $L_Result_Is_Zero: + rtsd r15,8 + addi r3,r0,0 ++#endif + .end __mulsi3 + .size __mulsi3, . - __mulsi3 +diff --git a/libgcc/config/microblaze/udivsi3.S b/libgcc/config/microblaze/udivsi3.S +index fc6a4b5a248..f8ce88bd8b7 100644 +--- a/libgcc/config/microblaze/udivsi3.S ++++ b/libgcc/config/microblaze/udivsi3.S +@@ -59,52 +59,96 @@ __udivsi3: + SWI r30,r1,4 + SWI r31,r1,8 + #endif ++#ifdef __arch64__ ++ BEAEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ BEAEQID r5,$LaResult_Is_Zero # Result is Zero ++#else + BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error + BEQID r5,$LaResult_Is_Zero # Result is Zero ++#endif + ADDIK r30,r0,0 # Clear mod + ADDIK r29,r0,32 # Initialize the loop count + + # Check if r6 and r5 are equal # if yes, return 1 + RSUB r18,r5,r6 ++#ifdef __arch64__ ++ BEAEQID r18,$LaRETURN_HERE ++#else + BEQID r18,$LaRETURN_HERE ++#endif + ADDIK r3,r0,1 + + # Check if (uns)r6 is greater than (uns)r5. In that case, just return 0 + XOR r18,r5,r6 +- BGEID r18,16 ++#ifdef __arch64__ ++ BEAGEID r18,16 ++#else ++ BGEID r18,16 ++#endif + ADD r3,r0,r0 # We would anyways clear r3 ++#ifdef __arch64__ ++ BEALTI r6,$LaRETURN_HERE # r6[bit 31 = 1] hence is greater ++ BREAI $LCheckr6 ++ RSUB r18,r6,r5 # MICROBLAZEcmp ++ BEALTI r18,$LaRETURN_HERE ++#else + BLTI r6,$LaRETURN_HERE # r6[bit 31 = 1] hence is greater + BRI $LCheckr6 + RSUB r18,r6,r5 # MICROBLAZEcmp + BLTI r18,$LaRETURN_HERE +- ++#endif + # If r6 [bit 31] is set, then return result as 1 + $LCheckr6: +- BGTI r6,$LaDIV0 +- BRID $LaRETURN_HERE ++#ifdef __arch64__ ++ BEAGTI r6,$LaDIV0 ++ BREAID $LaRETURN_HERE ++#else ++ BGTI r6,$LaDIV0 ++ BRID $LaRETURN_HERE ++#endif + ADDIK r3,r0,1 + + # First part try to find the first '1' in the r5 + $LaDIV0: ++#ifdef __arch64__ ++ BEALTI r5,$LaDIV2 ++#else + BLTI r5,$LaDIV2 ++#endif + $LaDIV1: + ADD r5,r5,r5 # left shift logical r5 ++#ifdef __arch64__ ++ BEAGTID r5,$LaDIV1 ++#else + BGTID r5,$LaDIV1 ++#endif + ADDIK r29,r29,-1 + $LaDIV2: + ADD r5,r5,r5 # left shift logical r5 get the '1' into the Carry + ADDC r30,r30,r30 # Move that bit into the Mod register + RSUB r31,r6,r30 # Try to subtract (r30 a r6) ++#ifdef __arch64__ ++ BEALTI r31,$LaMOD_TOO_SMALL ++#else + BLTI r31,$LaMOD_TOO_SMALL ++#endif + OR r30,r0,r31 # Move the r31 to mod since the result was positive + ADDIK r3,r3,1 + $LaMOD_TOO_SMALL: + ADDIK r29,r29,-1 ++#ifdef __arch64__ ++ BEAEQi r29,$LaLOOP_END ++ ADD r3,r3,r3 # Shift in the '1' into div ++ BREAI $LaDIV2 # Div2 ++$LaLOOP_END: ++ BREAI $LaRETURN_HERE ++#else + BEQi r29,$LaLOOP_END + ADD r3,r3,r3 # Shift in the '1' into div + BRI $LaDIV2 # Div2 + $LaLOOP_END: + BRI $LaRETURN_HERE ++#endif + $LaDiv_By_Zero: + $LaResult_Is_Zero: + OR r3,r0,r0 # set result to 0 +@@ -115,7 +159,7 @@ $LaRETURN_HERE: + LLI r29,r1,0 + LLI r30,r1,8 + LLI r31,r1,16 +- ADDIK r1,r1,24 ++ ADDLIK r1,r1,24 + RTSD r15,8 + NOP + #else +diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S +index 03be6df1fc6..3be3658f7a2 100644 +--- a/libgcc/config/microblaze/umodsi3.S ++++ b/libgcc/config/microblaze/umodsi3.S +@@ -46,7 +46,7 @@ + __umodsi3: + .frame r1,0,r15 + +- addik r1,r1,-24 ++ addlik r1,r1,-24 + sli r29,r1,0 + sli r30,r1,8 + sli r31,r1,16 +@@ -59,27 +59,77 @@ __umodsi3: + swi r30,r1,4 + swi r31,r1,8 + #endif ++#ifdef __arch64__ ++ BEAEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error ++ BEAEQId r5,$LaResult_Is_Zero # Result is Zero ++#else + BEQI r6,$LaDiv_By_Zero # Div_by_Zero # Division Error + BEQId r5,$LaResult_Is_Zero # Result is Zero ++#endif + ADDIK r3,r0,0 # Clear div + ADDIK r30,r0,0 # clear mod + ADDIK r29,r0,32 # Initialize the loop count + + # Check if r6 and r5 are equal # if yes, return 0 + rsub r18,r5,r6 +- beqi r18,$LaRETURN_HERE + ++#ifdef __arch64__ ++ beaeqi r18,$LaRETURN_HERE ++#else ++ beqi r18,$LaRETURN_HERE ++#endif + # Check if (uns)r6 is greater than (uns)r5. In that case, just return r5 + xor r18,r5,r6 ++#ifdef __arch64__ ++ beageid r18,16 ++ addik r3,r5,0 ++ bealti r6,$LaRETURN_HERE ++ breai $LCheckr6 ++ rsub r18,r5,r6 # MICROBLAZEcmp ++ beagti r18,$LaRETURN_HERE ++#else + bgeid r18,16 + addik r3,r5,0 + blti r6,$LaRETURN_HERE + bri $LCheckr6 + rsub r18,r5,r6 # MICROBLAZEcmp + bgti r18,$LaRETURN_HERE +- ++#endif + # If r6 [bit 31] is set, then return result as r5-r6 + $LCheckr6: ++#ifdef __arch64__ ++ beagtid r6,$LaDIV0 ++ addik r3,r0,0 ++ addik r18,r0,0x7fffffff ++ and r5,r5,r18 ++ and r6,r6,r18 ++ breaid $LaRETURN_HERE ++ rsub r3,r6,r5 ++# First part: try to find the first '1' in the r5 ++$LaDIV0: ++ BEALTI r5,$LaDIV2 ++$LaDIV1: ++ ADD r5,r5,r5 # left shift logical r5 ++ BEAGEID r5,$LaDIV1 # ++ ADDIK r29,r29,-1 ++$LaDIV2: ++ ADD r5,r5,r5 # left shift logical r5 get the '1' into the Carry ++ ADDC r3,r3,r3 # Move that bit into the Mod register ++ rSUB r31,r6,r3 # Try to subtract (r3 a r6) ++ BEALTi r31,$LaMOD_TOO_SMALL ++ OR r3,r0,r31 # Move the r31 to mod since the result was positive ++ ADDIK r30,r30,1 ++$LaMOD_TOO_SMALL: ++ ADDIK r29,r29,-1 ++ BEAEQi r29,$LaLOOP_END ++ ADD r30,r30,r30 # Shift in the '1' into div ++ BREAI $LaDIV2 # Div2 ++$LaLOOP_END: ++ BREAI $LaRETURN_HERE ++$LaDiv_By_Zero: ++$LaResult_Is_Zero: ++ or r3,r0,r0 # set result to 0 ++#else + bgtid r6,$LaDIV0 + addik r3,r0,0 + addik r18,r0,0x7fffffff +@@ -111,7 +161,7 @@ $LaLOOP_END: + $LaDiv_By_Zero: + $LaResult_Is_Zero: + or r3,r0,r0 # set result to 0 +- ++#endif + #ifdef __arch64__ + $LaRETURN_HERE: + # Restore values of CSRs and that of r3 and the divisor and the dividend +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch new file mode 100644 index 00000000..def10321 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch @@ -0,0 +1,481 @@ +From 39589348962a2e0453ad49118b6bc3dd8a7b1bb5 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 15:59:12 +0530 +Subject: [PATCH 46/53] [Patch, microblaze]: MB-64 removal of barrel-shift + instructions from default By default MB-64 is generatting + barrel-shift instructions. It has been removed from default. + Barrel-shift instructions will be generated only if barrel-shifter is + enabled. Similarly to double instructions as well. + + Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 2 +- + gcc/config/microblaze/microblaze.md | 269 ++++++++++++++++++++++++++-- + 2 files changed, 252 insertions(+), 19 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 7a08390a027..3ee3996a38d 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -3871,7 +3871,7 @@ microblaze_expand_divide (rtx operands[]) + emit_insn (gen_rtx_CLOBBER (Pmode, reg18)); + + if (TARGET_MB_64) { +- emit_insn (gen_ashldi3_long (regt1, operands[1], GEN_INT(4))); ++ emit_insn (gen_ashldi3 (regt1, operands[1], GEN_INT(4))); + emit_insn (gen_adddi3 (regt1, regt1, operands[2])); + } + else { +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 4b9acddb1f1..3695e9e101d 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -547,7 +547,7 @@ + [(set (match_operand:DF 0 "register_operand" "=d") + (plus:DF (match_operand:DF 1 "register_operand" "d") + (match_operand:DF 2 "register_operand" "d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" + "dadd\t%0,%1,%2" + [(set_attr "type" "fadd") + (set_attr "mode" "DF") +@@ -557,7 +557,7 @@ + [(set (match_operand:DF 0 "register_operand" "=d") + (minus:DF (match_operand:DF 1 "register_operand" "d") + (match_operand:DF 2 "register_operand" "d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" + "drsub\t%0,%2,%1" + [(set_attr "type" "frsub") + (set_attr "mode" "DF") +@@ -567,7 +567,7 @@ + [(set (match_operand:DF 0 "register_operand" "=d") + (mult:DF (match_operand:DF 1 "register_operand" "d") + (match_operand:DF 2 "register_operand" "d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" + "dmul\t%0,%1,%2" + [(set_attr "type" "fmul") + (set_attr "mode" "DF") +@@ -577,7 +577,7 @@ + [(set (match_operand:DF 0 "register_operand" "=d") + (div:DF (match_operand:DF 1 "register_operand" "d") + (match_operand:DF 2 "register_operand" "d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" + "ddiv\t%0,%2,%1" + [(set_attr "type" "fdiv") + (set_attr "mode" "DF") +@@ -587,7 +587,7 @@ + (define_insn "sqrtdf2" + [(set (match_operand:DF 0 "register_operand" "=d") + (sqrt:DF (match_operand:DF 1 "register_operand" "d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" + "dsqrt\t%0,%1" + [(set_attr "type" "fsqrt") + (set_attr "mode" "DF") +@@ -596,7 +596,7 @@ + (define_insn "floatdidf2" + [(set (match_operand:DF 0 "register_operand" "=d") + (float:DF (match_operand:DI 1 "register_operand" "d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" + "dbl\t%0,%1" + [(set_attr "type" "fcvt") + (set_attr "mode" "DF") +@@ -605,7 +605,7 @@ + (define_insn "fix_truncdfdi2" + [(set (match_operand:DI 0 "register_operand" "=d") + (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "d"))))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT" + "dlong\t%0,%1" + [(set_attr "type" "fcvt") + (set_attr "mode" "DI") +@@ -1299,6 +1299,34 @@ + (set_attr "mode" "DI") + (set_attr "length" "4")]) + ++(define_insn "*movdi_internal2_bshift" ++ [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d, d,d,R,m") ++ (match_operand:DI 1 "move_src_operand" " d,I,Mnis,R,m,dJ,dJ"))] ++ "TARGET_MB_64 && TARGET_BARREL_SHIFT" ++ { ++ switch (which_alternative) ++ { ++ case 0: ++ return "addlk\t%0,%1,r0"; ++ case 1: ++ case 2: ++ if (GET_CODE (operands[1]) == CONST_INT && ++ (INTVAL (operands[1]) > (long long)549755813887 || INTVAL (operands[1]) < (long long)-549755813888)) ++ return "addlik\t%0,r0,%h1\n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #li => la"; ++ else ++ return "addlik\t%0,r0,%1"; ++ case 3: ++ case 4: ++ return "ll%i1\t%0,%1"; ++ case 5: ++ case 6: ++ return "sl%i0\t%z1,%0"; ++ } ++ } ++ [(set_attr "type" "load,no_delay_load,no_delay_load,no_delay_load,no_delay_load,no_delay_store,no_delay_store") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4,4,12,4,8,4,8")]) ++ + (define_insn "*movdi_internal2" + [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d, d,d,R,m") + (match_operand:DI 1 "move_src_operand" " d,I,Mnis,R,m,dJ,dJ"))] +@@ -1312,7 +1340,15 @@ + case 2: + if (GET_CODE (operands[1]) == CONST_INT && + (INTVAL (operands[1]) > (long long)549755813887 || INTVAL (operands[1]) < (long long)-549755813888)) +- return "addlik\t%0,r0,%h1\n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #li => la"; ++ { ++ operands[2] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ output_asm_insn ("addlik\t%0,r0,%h1", operands); ++ output_asm_insn ("addlik\t%2,r0,32", operands); ++ output_asm_insn ("addlik\t%2,%2,-1", operands); ++ output_asm_insn ("beaneid\t%2,.-8", operands); ++ output_asm_insn ("addlk\t%0,%0,%0", operands); ++ return "addlik\t%0,%0,%j1 #li => la"; ++ } + else + return "addlik\t%0,r0,%1"; + case 3: +@@ -1387,7 +1423,7 @@ + (define_insn "movdi_long_int" + [(set (match_operand:DI 0 "nonimmediate_operand" "=d") + (match_operand:DI 1 "general_operand" "i"))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_BARREL_SHIFT" + "addlik\t%0,r0,%h1\n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%j1 #li => la"; + [(set_attr "type" "no_delay_arith") + (set_attr "mode" "DI") +@@ -1654,6 +1690,33 @@ + ;; movdf_internal + ;; Applies to both TARGET_SOFT_FLOAT and TARGET_HARD_FLOAT + ;; ++(define_insn "*movdf_internal_64_bshift" ++ [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,d,d,m") ++ (match_operand:DF 1 "general_operand" "d,dG,m,F,T,d"))] ++ "TARGET_MB_64 && TARGET_BARREL_SHIFT" ++ { ++ switch (which_alternative) ++ { ++ case 0: ++ return "addlk\t%0,%1,r0"; ++ case 1: ++ return "addlk\t%0,r0,r0"; ++ case 2: ++ case 4: ++ return "ll%i1\t%0,%1"; ++ case 3: ++ { ++ return "addlik\t%0,r0,%j1 \n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%h1 #Xfer Lo"; ++ } ++ case 5: ++ return "sl%i0\t%1,%0"; ++ } ++ gcc_unreachable (); ++ } ++ [(set_attr "type" "no_delay_move,no_delay_move,no_delay_load,no_delay_load,no_delay_load,no_delay_store") ++ (set_attr "mode" "DF") ++ (set_attr "length" "4,4,4,16,4,4")]) ++ + (define_insn "*movdf_internal_64" + [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,d,d,m") + (match_operand:DF 1 "general_operand" "d,dG,m,F,T,d"))] +@@ -1670,7 +1733,13 @@ + return "ll%i1\t%0,%1"; + case 3: + { +- return "addlik\t%0,r0,%j1 \n\tbsllli\t%0,%0,32\n\taddlik\t%0,%0,%h1 #Xfer Lo"; ++ operands[2] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ output_asm_insn ("addlik\t%0,r0,%h1", operands); ++ output_asm_insn ("addlik\t%2,r0,32", operands); ++ output_asm_insn ("addlik\t%2,%2,-1", operands); ++ output_asm_insn ("beaneid\t%2,.-8", operands); ++ output_asm_insn ("addlk\t%0,%0,%0", operands); ++ return "addlik\t%0,%0,%j1 #li => la"; + } + case 5: + return "sl%i0\t%1,%0"; +@@ -1790,11 +1859,21 @@ + "TARGET_MB_64" + { + ;;if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) +-if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && TARGET_BARREL_SHIFT) + { + emit_insn(gen_ashldi3_long (operands[0], operands[1],operands[2])); + DONE; + } ++else if(INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && CONST_INT_P (operands[2])) ++ { ++ emit_insn(gen_ashldi3_const (operands[0], operands[1],operands[2])); ++ DONE; ++ } ++else if(INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && GET_CODE (operands[2]) == REG) ++ { ++ emit_insn(gen_ashldi3_reg (operands[0], operands[1],operands[2])); ++ DONE; ++ } + else + FAIL; + } +@@ -1804,7 +1883,7 @@ else + [(set (match_operand:DI 0 "register_operand" "=d,d") + (ashift:DI (match_operand:DI 1 "register_operand" "d,d") + (match_operand:DI 2 "arith_operand" "I,d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_BARREL_SHIFT" + "@ + bsllli\t%0,%1,%2 + bslll\t%0,%1,%2" +@@ -1812,6 +1891,51 @@ else + (set_attr "mode" "DI,DI") + (set_attr "length" "4,4")] + ) ++ ++(define_insn "ashldi3_const" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (ashift:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "immediate_operand" "I")))] ++ "TARGET_MB_64" ++ { ++ operands[3] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ ++ output_asm_insn ("orli\t%3,r0,%2", operands); ++ if (REGNO (operands[0]) != REGNO (operands[1])) ++ output_asm_insn ("addlk\t%0,%1,r0", operands); ++ ++ output_asm_insn ("addlik\t%3,%3,-1", operands); ++ output_asm_insn ("beaneid\t%3,.-8", operands); ++ return "addlk\t%0,%0,%0"; ++ } ++ [(set_attr "type" "multi") ++ (set_attr "mode" "DI") ++ (set_attr "length" "20")] ++) ++ ++(define_insn "ashldi3_reg" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (ashift:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ { ++ operands[3] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ output_asm_insn ("andli\t%3,%2,31", operands); ++ if (REGNO (operands[0]) != REGNO (operands[1])) ++ output_asm_insn ("addlk\t%0,r0,%1", operands); ++ /* Exit the loop if zero shift. */ ++ output_asm_insn ("beaeqid\t%3,.+24", operands); ++ /* Emit the loop. */ ++ output_asm_insn ("addlk\t%0,%0,r0", operands); ++ output_asm_insn ("addlik\t%3,%3,-1", operands); ++ output_asm_insn ("beaneid\t%3,.-8", operands); ++ return "addlk\t%0,%0,%0"; ++ } ++ [(set_attr "type" "multi") ++ (set_attr "mode" "DI") ++ (set_attr "length" "28")] ++) ++ + ;; The following patterns apply when there is no barrel shifter present + + (define_insn "*ashlsi3_with_mul_delay" +@@ -1945,11 +2069,21 @@ else + "TARGET_MB_64" + { + ;;if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) +-if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && TARGET_BARREL_SHIFT) + { + emit_insn(gen_ashrdi3_long (operands[0], operands[1],operands[2])); + DONE; + } ++else if(INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && CONST_INT_P (operands[2])) ++ { ++ emit_insn(gen_ashrdi3_const (operands[0], operands[1],operands[2])); ++ DONE; ++ } ++else if(INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && GET_CODE (operands[2]) == REG) ++ { ++ emit_insn(gen_ashrdi3_reg (operands[0], operands[1],operands[2])); ++ DONE; ++ } + else + FAIL; + } +@@ -1959,7 +2093,7 @@ else + [(set (match_operand:DI 0 "register_operand" "=d,d") + (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d") + (match_operand:DI 2 "arith_operand" "I,d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_BARREL_SHIFT" + "@ + bslrai\t%0,%1,%2 + bslra\t%0,%1,%2" +@@ -1967,6 +2101,51 @@ else + (set_attr "mode" "DI,DI") + (set_attr "length" "4,4")] + ) ++ ++(define_insn "ashrdi3_const" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (ashiftrt:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "immediate_operand" "I")))] ++ "TARGET_MB_64" ++ { ++ operands[3] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ ++ output_asm_insn ("orli\t%3,r0,%2", operands); ++ if (REGNO (operands[0]) != REGNO (operands[1])) ++ output_asm_insn ("addlk\t%0,%1,r0", operands); ++ ++ output_asm_insn ("addlik\t%3,%3,-1", operands); ++ output_asm_insn ("beaneid\t%3,.-8", operands); ++ return "srla\t%0,%0"; ++ } ++ [(set_attr "type" "arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "20")] ++) ++ ++(define_insn "ashrdi3_reg" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (ashiftrt:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ { ++ operands[3] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ output_asm_insn ("andli\t%3,%2,31", operands); ++ if (REGNO (operands[0]) != REGNO (operands[1])) ++ output_asm_insn ("addlk\t%0,r0,%1", operands); ++ /* Exit the loop if zero shift. */ ++ output_asm_insn ("beaeqid\t%3,.+24", operands); ++ /* Emit the loop. */ ++ output_asm_insn ("addlk\t%0,%0,r0", operands); ++ output_asm_insn ("addlik\t%3,%3,-1", operands); ++ output_asm_insn ("beaneid\t%3,.-8", operands); ++ return "srla\t%0,%0"; ++ } ++ [(set_attr "type" "multi") ++ (set_attr "mode" "DI") ++ (set_attr "length" "28")] ++) ++ + (define_expand "ashrsi3" + [(set (match_operand:SI 0 "register_operand" "=&d") + (ashiftrt:SI (match_operand:SI 1 "register_operand" "d") +@@ -2084,11 +2263,21 @@ else + "TARGET_MB_64" + { + ;;if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) +-if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65) ++if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && TARGET_BARREL_SHIFT) + { + emit_insn(gen_lshrdi3_long (operands[0], operands[1],operands[2])); + DONE; + } ++else if(INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && CONST_INT_P (operands[2])) ++ { ++ emit_insn(gen_lshrdi3_const (operands[0], operands[1],operands[2])); ++ DONE; ++ } ++else if(INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 65 && GET_CODE (operands[2]) == REG) ++ { ++ emit_insn(gen_lshrdi3_reg (operands[0], operands[1],operands[2])); ++ DONE; ++ } + else + FAIL; + } +@@ -2098,7 +2287,7 @@ else + [(set (match_operand:DI 0 "register_operand" "=d,d") + (lshiftrt:DI (match_operand:DI 1 "register_operand" "d,d") + (match_operand:DI 2 "arith_operand" "I,d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_BARREL_SHIFT" + "@ + bslrli\t%0,%1,%2 + bslrl\t%0,%1,%2" +@@ -2107,6 +2296,50 @@ else + (set_attr "length" "4,4")] + ) + ++(define_insn "lshrdi3_const" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (lshiftrt:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "immediate_operand" "I")))] ++ "TARGET_MB_64" ++ { ++ operands[3] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ ++ output_asm_insn ("orli\t%3,r0,%2", operands); ++ if (REGNO (operands[0]) != REGNO (operands[1])) ++ output_asm_insn ("addlk\t%0,%1,r0", operands); ++ ++ output_asm_insn ("addlik\t%3,%3,-1", operands); ++ output_asm_insn ("beaneid\t%3,.-8", operands); ++ return "srll\t%0,%0"; ++ } ++ [(set_attr "type" "multi") ++ (set_attr "mode" "DI") ++ (set_attr "length" "20")] ++) ++ ++(define_insn "lshrdi3_reg" ++ [(set (match_operand:DI 0 "register_operand" "=&d") ++ (lshiftrt:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "register_operand" "d")))] ++ "TARGET_MB_64" ++ { ++ operands[3] = gen_rtx_REG (DImode, MB_ABI_ASM_TEMP_REGNUM); ++ output_asm_insn ("andli\t%3,%2,31", operands); ++ if (REGNO (operands[0]) != REGNO (operands[1])) ++ output_asm_insn ("addlk\t%0,r0,%1", operands); ++ /* Exit the loop if zero shift. */ ++ output_asm_insn ("beaeqid\t%3,.+24", operands); ++ /* Emit the loop. */ ++ output_asm_insn ("addlk\t%0,%0,r0", operands); ++ output_asm_insn ("addlik\t%3,%3,-1", operands); ++ output_asm_insn ("beaneid\t%3,.-8", operands); ++ return "srll\t%0,%0"; ++ } ++ [(set_attr "type" "multi") ++ (set_attr "mode" "SI") ++ (set_attr "length" "28")] ++) ++ + (define_expand "lshrsi3" + [(set (match_operand:SI 0 "register_operand" "=&d") + (lshiftrt:SI (match_operand:SI 1 "register_operand" "d") +@@ -2233,7 +2466,7 @@ else + (eq:DI + (match_operand:DI 1 "register_operand" "d") + (match_operand:DI 2 "register_operand" "d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_PATTERN_COMPARE" + "pcmpleq\t%0,%1,%2" + [(set_attr "type" "arith") + (set_attr "mode" "DI") +@@ -2245,7 +2478,7 @@ else + (ne:DI + (match_operand:DI 1 "register_operand" "d") + (match_operand:DI 2 "register_operand" "d")))] +- "TARGET_MB_64" ++ "TARGET_MB_64 && TARGET_PATTERN_COMPARE" + "pcmplne\t%0,%1,%2" + [(set_attr "type" "arith") + (set_attr "mode" "DI") +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch new file mode 100644 index 00000000..318abe7b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch @@ -0,0 +1,111 @@ +From e32334b0f8a4c9532975001ffab33e86469ea4e1 Mon Sep 17 00:00:00 2001 +From: Nagaraju <nmekala@xilinx.com> +Date: Fri, 23 Aug 2019 16:16:53 +0530 +Subject: [PATCH 47/53] Added new MB-64 single register arithmetic instructions + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.md | 56 +++++++++++++++++++++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 3695e9e101d..85c1ab45994 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -654,6 +654,18 @@ + } + }) + ++(define_insn "adddi3_int" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (plus:DI (match_operand:DI 1 "register_operand" "%0") ++ (match_operand:DI 2 "immediate_operand" "I")))] ++ "TARGET_MB_64 && ((long long)INTVAL(operands[2]) > (long long)-32768) && ((long long) INTVAL(operands[2]) < (long long)32767)" ++ "@ ++ addlik\t%0,%2" ++ [(set_attr "type" "darith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")] ++) ++ + (define_insn "*adddi3_long" + [(set (match_operand:DI 0 "register_operand" "=d,d") + (plus:DI (match_operand:DI 1 "register_operand" "%d,d") +@@ -719,6 +731,18 @@ + { + }") + ++(define_insn "subdi316imm" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (minus:DI (match_operand:DI 1 "register_operand" "d") ++ (match_operand:DI 2 "arith_operand" "K")))] ++ "TARGET_MB_64 && ((long long)INTVAL(operands[2]) > (long long)-32768) && ((long long) INTVAL(operands[2]) < (long long)32767) && (REGNO (operands[0]) == REGNO (operands[1]))" ++ "@ ++ addlik\t%0,-%2" ++ [(set_attr "type" "darith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) ++ ++ + (define_insn "subsidi3" + [(set (match_operand:DI 0 "register_operand" "=d,d,d") + (minus:DI (match_operand:DI 1 "register_operand" "d,d,d") +@@ -1015,6 +1039,17 @@ + ;; Logical + ;;---------------------------------------------------------------- + ++(define_insn "anddi3imm16" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (and:DI (match_operand:DI 1 "arith_operand" "%0") ++ (match_operand:DI 2 "arith_operand" "K")))] ++ "TARGET_MB_64 && ((long long)INTVAL(operands[2]) > (long long)-32768) && ((long long) INTVAL(operands[2]) < (long long)32767)" ++ "@ ++ andli\t%0,%2" ++ [(set_attr "type" "darith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) ++ + (define_insn "anddi3" + [(set (match_operand:DI 0 "register_operand" "=d,d,d") + (and:DI (match_operand:DI 1 "arith_operand" "d,d,d") +@@ -1042,6 +1077,16 @@ + (set_attr "mode" "SI,SI,SI,SI") + (set_attr "length" "4,8,8,8")]) + ++(define_insn "iordi3imm16" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (ior:DI (match_operand:DI 1 "arith_operand" "%0") ++ (match_operand:DI 2 "arith_operand" "K")))] ++ "TARGET_MB_64 && ((long long)INTVAL(operands[2]) > (long long)-32768) && ((long long) INTVAL(operands[2]) < (long long)32767)" ++ "@ ++ orli\t%0,%2" ++ [(set_attr "type" "darith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) + + (define_insn "iordi3" + [(set (match_operand:DI 0 "register_operand" "=d,d") +@@ -1069,6 +1114,17 @@ + (set_attr "mode" "SI,SI,SI,SI") + (set_attr "length" "4,8,8,8")]) + ++(define_insn "xordi3imm16" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (xor:DI (match_operand:DI 1 "arith_operand" "%0") ++ (match_operand:DI 2 "arith_operand" "K")))] ++ "TARGET_MB_64 && ((long long)INTVAL(operands[2]) > (long long)-32768) && ((long long) INTVAL(operands[2]) < (long long)32767)" ++ "@ ++ xorli\t%0,%2" ++ [(set_attr "type" "darith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "4")]) ++ + (define_insn "xordi3" + [(set (match_operand:DI 0 "register_operand" "=d,d") + (xor:DI (match_operand:DI 1 "arith_operand" "%d,d") +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch new file mode 100644 index 00000000..09514a7d --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch @@ -0,0 +1,48 @@ +From f5f262b196de197b7e9ece8cc08c8715f953857f Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 26 Aug 2019 15:55:22 +0530 +Subject: [PATCH 48/53] [Patch,MicroBlaze] : Added support for 64 bit Immediate + values. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/constraints.md | 4 ++-- + gcc/config/microblaze/microblaze.md | 3 +-- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md +index 3f9805dfe0a..91653f36f52 100644 +--- a/gcc/config/microblaze/constraints.md ++++ b/gcc/config/microblaze/constraints.md +@@ -53,9 +53,9 @@ + (match_test "ival > 0 && ival < 0x10000"))) + + (define_constraint "K" +- "A constant in the range 0xffffff8000000000L to 0x0000007fffffffffL (inclusive)." ++ "A constant in the range -9223372036854775808 to 9223372036854775807 (inclusive)." + (and (match_code "const_int") +- (match_test "ival > (long long)-549755813888 && ival < (long long)549755813887"))) ++ (match_test "ival > (long long)-9223372036854775808 && ival < (long long)9223372036854775807"))) + + + ;; Define floating point constraints +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 85c1ab45994..0ac6e1480e6 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -1332,8 +1332,7 @@ + [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d") + (match_operand:DI 1 "immediate_operand" "J,I,Mnis"))] + "TARGET_MB_64 && (register_operand (operands[0], DImode) && +- (GET_CODE (operands[1]) == CONST_INT && +- (INTVAL (operands[1]) <= (long long)549755813887 && INTVAL (operands[1]) >= (long long)-549755813888)))" ++ (GET_CODE (operands[1]) == CONST_INT))" + "@ + addlk\t%0,r0,r0\t + addlik\t%0,r0,%1\t #N1 %X1 +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch new file mode 100644 index 00000000..6258e799 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch @@ -0,0 +1,80 @@ +From d45405d05a1f9079f7db86ba60dcd30d358613d4 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 16:06:10 +0530 +Subject: [PATCH 49/53] [Patch, microblaze]: Fix Compiler crash with + -freg-struct-return This patch fixes a bug in MB GCC regarding the + passing struct values in registers. Currently we are only handling SImode + With this patch all other modes are handled properly + + Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 11 ++++++++++- + gcc/config/microblaze/microblaze.h | 19 ------------------- + 2 files changed, 10 insertions(+), 20 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 3ee3996a38d..4668a81d060 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -3909,7 +3909,16 @@ microblaze_function_value (const_tree valtype, + const_tree func ATTRIBUTE_UNUSED, + bool outgoing ATTRIBUTE_UNUSED) + { +- return LIBCALL_VALUE (TYPE_MODE (valtype)); ++ return gen_rtx_REG (TYPE_MODE (valtype), GP_RETURN); ++} ++ ++#undef TARGET_LIBCALL_VALUE ++#define TARGET_LIBCALL_VALUE microblaze_libcall_value ++ ++rtx ++microblaze_libcall_value (machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED) ++{ ++ return gen_rtx_REG (mode, GP_RETURN); + } + + /* Implement TARGET_SCHED_ADJUST_COST. */ +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index c48b6de0d58..730ad87b13b 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -266,13 +266,6 @@ extern enum pipeline_type microblaze_pipe; + + #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND + +-#ifndef __arch64__ +-#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ +- if (GET_MODE_CLASS (MODE) == MODE_INT \ +- && GET_MODE_SIZE (MODE) < 4) \ +- (MODE) = SImode; +-#endif +- + /* Standard register usage. */ + + /* On the MicroBlaze, we have 32 integer registers */ +@@ -471,18 +464,6 @@ extern struct microblaze_frame_info current_frame_info; + + #define MAX_ARGS_IN_REGISTERS MB_ABI_MAX_ARG_REGS + +-#ifdef __aarch64__ +-#define LIBCALL_VALUE(MODE) \ +- gen_rtx_REG (MODE,GP_RETURN) +-#else +-#define LIBCALL_VALUE(MODE) \ +- gen_rtx_REG ( \ +- ((GET_MODE_CLASS (MODE) != MODE_INT \ +- || GET_MODE_SIZE (MODE) >= 4) \ +- ? (MODE) \ +- : SImode), GP_RETURN) +-#endif +- + /* 1 if N is a possible register number for a function value. + On the MicroBlaze, R2 R3 are the only register thus used. + Currently, R2 are only implemented here (C has no complex type) */ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch new file mode 100644 index 00000000..8d99c93d --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch @@ -0,0 +1,52 @@ +From a64afc59e82703f40d04d4d7126038811a195467 Mon Sep 17 00:00:00 2001 +From: Nagaraju <nmekala@xilinx.com> +Date: Wed, 8 May 2019 14:12:03 +0530 +Subject: [PATCH 50/53] [Patch, microblaze]: Add TARGET_OPTION_OPTIMIZATION and + disable fivopts by default + +Added TARGET_OPTION_OPTIMIZATIONS and Turn off ivopts by default. + + * gcc/common/config/microblaze/microblaze-common.c + (microblaze_option_optimization_table): Disable fivopts by default. + +Upstream-Status: Pending + +Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com> + Mahesh Bodapati <mbodapat@xilinx.com> +Conflicts: + gcc/common/config/microblaze/microblaze-common.c + +Conflicts: + gcc/common/config/microblaze/microblaze-common.c +--- + gcc/common/config/microblaze/microblaze-common.cc | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/gcc/common/config/microblaze/microblaze-common.cc b/gcc/common/config/microblaze/microblaze-common.cc +index 21b35f55b92..137332ded25 100644 +--- a/gcc/common/config/microblaze/microblaze-common.cc ++++ b/gcc/common/config/microblaze/microblaze-common.cc +@@ -24,7 +24,20 @@ + #include "common/common-target.h" + #include "common/common-target-def.h" + ++/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ ++static const struct default_options microblaze_option_optimization_table[] = ++ { ++ /* Turn off ivopts by default. It messes up cse. ++ { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, */ ++ { OPT_LEVELS_ALL, OPT_fivopts, NULL, 0 }, ++ { OPT_LEVELS_NONE, 0, NULL, 0 } ++ }; ++ ++ + #undef TARGET_DEFAULT_TARGET_FLAGS + #define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT + ++#undef TARGET_OPTION_OPTIMIZATION_TABLE ++#define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table ++ + struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch new file mode 100644 index 00000000..64069e3c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch @@ -0,0 +1,193 @@ +From 09e10c513f8970f4d2402244b7ac69ecd33b4c04 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 16:35:00 +0530 +Subject: [PATCH 51/53] [Patch, microblaze]: Reducing Stack space for arguments + + Currently in Microblaze target stack space for arguments in register is being + allocated even if there are no arguments in the function. + This patch will optimize the extra 24 bytes that are being allocated. + + Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> + :Ajit Agarwal <ajitkum@xilinx.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze-protos.h | 1 + + gcc/config/microblaze/microblaze.cc | 130 ++++++++++++++++++++++ + gcc/config/microblaze/microblaze.h | 4 +- + 3 files changed, 133 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h +index 7f575c2adec..bd594699940 100644 +--- a/gcc/config/microblaze/microblaze-protos.h ++++ b/gcc/config/microblaze/microblaze-protos.h +@@ -60,6 +60,7 @@ extern int symbol_mentioned_p (rtx); + extern int label_mentioned_p (rtx); + extern bool microblaze_cannot_force_const_mem (machine_mode, rtx); + extern void microblaze_eh_return (rtx op0); ++int microblaze_reg_parm_stack_space(tree fun); + #endif /* RTX_CODE */ + + /* Declare functions in microblaze-c.cc. */ +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 4668a81d060..24ac215b6d5 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -2081,6 +2081,136 @@ microblaze_must_save_register (int regno) + return 0; + } + ++static bool ++microblaze_parm_needs_stack (cumulative_args_t args_so_far, tree type) ++{ ++ int unsignedp; ++ rtx entry_parm; ++ ++ /* Catch errors. */ ++ if (type == NULL || type == error_mark_node) ++ return true; ++ ++ if (TREE_CODE (type) == POINTER_TYPE) ++ return true; ++ ++ /* Handle types with no storage requirement. */ ++ if (TYPE_MODE (type) == VOIDmode) ++ return false; ++ ++ /* Handle complex types. */ ++ if (TREE_CODE (type) == COMPLEX_TYPE) ++ return (microblaze_parm_needs_stack (args_so_far, TREE_TYPE (type)) ++ || microblaze_parm_needs_stack (args_so_far, TREE_TYPE (type))); ++ ++ /* Handle transparent aggregates. */ ++ if ((TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == RECORD_TYPE) ++ && TYPE_TRANSPARENT_AGGR (type)) ++ type = TREE_TYPE (first_field (type)); ++ ++ /* See if this arg was passed by invisible reference. */ ++ function_arg_info arg (type, /*named=*/true); ++ apply_pass_by_reference_rules (get_cumulative_args (args_so_far), arg); ++ ++ /* Find mode as it is passed by the ABI. */ ++ unsignedp = TYPE_UNSIGNED (type); ++ arg.mode = promote_mode (arg.type, arg.mode, &unsignedp); ++ ++ /* If there is no incoming register, we need a stack. */ ++ entry_parm = microblaze_function_arg (args_so_far, arg); ++ if (entry_parm == NULL) ++ return true; ++ ++ /* Likewise if we need to pass both in registers and on the stack. */ ++ if (GET_CODE (entry_parm) == PARALLEL ++ && XEXP (XVECEXP (entry_parm, 0, 0), 0) == NULL_RTX) ++ return true; ++ ++ /* Also true if we're partially in registers and partially not. */ ++ if (function_arg_partial_bytes (args_so_far, arg) != 0) ++ return true; ++ ++ /* Update info on where next arg arrives in registers. */ ++ microblaze_function_arg_advance (args_so_far, arg); ++ return false; ++} ++ ++static bool ++microblaze_function_parms_need_stack (tree fun, bool incoming) ++{ ++ tree fntype, result; ++ CUMULATIVE_ARGS args_so_far_v; ++ cumulative_args_t args_so_far; ++ int num_of_args = 0; ++ ++ /* Must be a libcall, all of which only use reg parms. */ ++ if (!fun) ++ return true; ++ ++ fntype = fun; ++ if (!TYPE_P (fun)) ++ fntype = TREE_TYPE (fun); ++ ++ /* Varargs functions need the parameter save area. */ ++ if ((!incoming && !prototype_p (fntype)) || stdarg_p (fntype)) ++ return true; ++ ++ INIT_CUMULATIVE_ARGS(args_so_far_v, fntype, NULL_RTX,0,0); ++ args_so_far = pack_cumulative_args (&args_so_far_v); ++ ++ /* When incoming, we will have been passed the function decl. ++ * * It is necessary to use the decl to handle K&R style functions, ++ * * where TYPE_ARG_TYPES may not be available. */ ++ if (incoming) ++ { ++ gcc_assert (DECL_P (fun)); ++ result = DECL_RESULT (fun); ++ } ++ else ++ result = TREE_TYPE (fntype); ++ ++ if (result && aggregate_value_p (result, fntype)) ++ { ++ if (!TYPE_P (result)) ++ result = build_pointer_type (result); ++ microblaze_parm_needs_stack (args_so_far, result); ++ } ++ ++ if (incoming) ++ { ++ tree parm; ++ for (parm = DECL_ARGUMENTS (fun); ++ parm && parm != void_list_node; ++ parm = TREE_CHAIN (parm)) ++ if (microblaze_parm_needs_stack (args_so_far, TREE_TYPE (parm))) ++ return true; ++ } ++ else ++ { ++ function_args_iterator args_iter; ++ tree arg_type; ++ ++ FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter) ++ { ++ num_of_args; ++ if (microblaze_parm_needs_stack (args_so_far, arg_type)) ++ return true; ++ } ++ } ++ ++ if (num_of_args > 3) return true; ++ ++ return false; ++} ++ ++int microblaze_reg_parm_stack_space(tree fun) ++{ ++ if (microblaze_function_parms_need_stack (fun,false)) ++ return MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD; ++ else ++ return 0; ++} ++ + /* Return the bytes needed to compute the frame pointer from the current + stack pointer. + +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index 730ad87b13b..dfacd080b6d 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -447,9 +447,9 @@ extern struct microblaze_frame_info current_frame_info; + #define ARG_POINTER_CFA_OFFSET(FNDECL) 0 + #define DWARF_CIE_DATA_ALIGNMENT -1 + +-#define REG_PARM_STACK_SPACE(FNDECL) (MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD) ++#define REG_PARM_STACK_SPACE(FNDECL) microblaze_reg_parm_stack_space(FNDECL) + +-#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1 ++#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1 + + #define STACK_BOUNDARY (TARGET_MB_64 ? 64 : 32) + +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch new file mode 100644 index 00000000..63feff79 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch @@ -0,0 +1,77 @@ +From fe2781d189493dc82a3714b48bbc12c6bd5cdfd0 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 16:38:43 +0530 +Subject: [PATCH 52/53] [Patch,MicroBlaze] : If we use break_handler + attribute then interrupt vector call happened to break_handler instead of + interrupt_handler. this fix will resolve the issue CR-1081780. This + fix will not change the behavior of compiler unless there is a usage of + break_handler attribute. signed-off-by : Mahesh Bodapati + <mbodapat@xilinx.com> + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gcc/config/microblaze/microblaze.cc | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 24ac215b6d5..66d62f6f909 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -2020,7 +2020,7 @@ microblaze_save_volatiles (tree func) + int + microblaze_is_interrupt_variant (void) + { +- return (interrupt_handler || fast_interrupt); ++ return (interrupt_handler || fast_interrupt || break_handler); + } + int + microblaze_is_break_handler (void) +@@ -2059,7 +2059,7 @@ microblaze_must_save_register (int regno) + { + if (df_regs_ever_live_p (regno) + || regno == MB_ABI_MSR_SAVE_REG +- || ((interrupt_handler || fast_interrupt) ++ || ((interrupt_handler || fast_interrupt || break_handler) + && (regno == MB_ABI_ASM_TEMP_REGNUM + || regno == MB_ABI_EXCEPTION_RETURN_ADDR_REGNUM))) + return 1; +@@ -2275,9 +2275,6 @@ compute_frame_size (HOST_WIDE_INT size) + fast_interrupt = + microblaze_fast_interrupt_function_p (current_function_decl); + save_volatiles = microblaze_save_volatiles (current_function_decl); +- if (break_handler) +- interrupt_handler = break_handler; +- + gp_reg_size = 0; + mask = 0; + var_size = size; +@@ -3237,7 +3234,7 @@ microblaze_expand_prologue (void) + gen_rtx_PLUS (Pmode, stack_pointer_rtx, + const0_rtx)); + +- if (interrupt_handler) ++ if (interrupt_handler || break_handler) + /* Do not optimize in flow analysis. */ + MEM_VOLATILE_P (mem_rtx) = 1; + +@@ -3348,12 +3345,12 @@ microblaze_expand_epilogue (void) + a load-use stall cycle :) This is also important to handle alloca. + (See comments for if (frame_pointer_needed) below. */ + +- if (!crtl->is_leaf || interrupt_handler) ++ if (!crtl->is_leaf || interrupt_handler || break_handler) + { + mem_rtx = + gen_rtx_MEM (Pmode, + gen_rtx_PLUS (Pmode, stack_pointer_rtx, const0_rtx)); +- if (interrupt_handler) ++ if (interrupt_handler || break_handler) + /* Do not optimize in flow analysis. */ + MEM_VOLATILE_P (mem_rtx) = 1; + reg_rtx = gen_rtx_REG (Pmode, MB_ABI_SUB_RETURN_ADDR_REGNUM); +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch new file mode 100644 index 00000000..1552a5e9 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch @@ -0,0 +1,60 @@ +From 6c2e67237a12cecfd8c0575fd17314d3024943fc Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 13 Sep 2022 16:45:41 +0530 +Subject: [PATCH 53/53] [patch, microblaze64]: Add Zero_extended instructions + + Due to latest changes in GCC-10.2 MB64 perforamance has reduced + We have added zero_extended instructions to get rid of left shift + and right shift loops + + [CR/TSR]: TSR-974519 + +Upstream-Status: Pending + + Signed-off-by: Nagaraju Mekala<nmekala@xilinx.com> + Mahesh Bodapati<mbodapat@xilinx.com> +--- + gcc/config/microblaze/microblaze.md | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 0ac6e1480e6..7a7c70d607b 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -1191,6 +1191,33 @@ + (set_attr "mode" "SI,SI,SI") + (set_attr "length" "4,4,8")]) + ++(define_insn "zero_extendhidi2" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (zero_extend:DI (match_operand:HI 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "andli\t%0,%1,0xffff" ++ [(set_attr "type" "no_delay_arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "8")]) ++ ++(define_insn "zero_extendsidi2" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (zero_extend:DI (match_operand:SI 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "andli\t%0,%1,0xffffffff" ++ [(set_attr "type" "no_delay_arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "8")]) ++ ++(define_insn "zero_extendqidi2" ++ [(set (match_operand:DI 0 "register_operand" "=d") ++ (zero_extend:DI (match_operand:QI 1 "register_operand" "d")))] ++ "TARGET_MB_64" ++ "andli\t%0,%1,0x00ff" ++ [(set_attr "type" "no_delay_arith") ++ (set_attr "mode" "DI") ++ (set_attr "length" "8")]) ++ + ;;---------------------------------------------------------------- + ;; Sign extension + ;;---------------------------------------------------------------- +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/microblaze-mulitlib-hack.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/microblaze-mulitlib-hack.patch new file mode 100644 index 00000000..af8ebf3b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/microblaze-mulitlib-hack.patch @@ -0,0 +1,58 @@ +Microblaze Mulitlib hack + +Based on the patch: + +From c2081c51db589471ea713870c72f13999abda815 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 09:10:06 +0400 +Subject: [PATCH 04/36] 64-bit multilib hack. + +GCC has internal multilib handling code but it assumes a very specific rigid directory +layout. The build system implementation of multilib layout is very generic and allows +complete customisation of the library directories. + +This patch is a partial solution to allow any custom directories to be passed into gcc +and handled correctly. It forces gcc to use the base_libdir (which is the current +directory, "."). We need to do this for each multilib that is configured as we don't +know which compiler options may be being passed into the compiler. Since we have a compiler +per mulitlib at this point that isn't an issue. + +The one problem is the target compiler is only going to work for the default multlilib at +this point. Ideally we'd figure out which multilibs were being enabled with which paths +and be able to patch these entries with a complete set of correct paths but this we +don't have such code at this point. This is something the target gcc recipe should do +and override these platform defaults in its build config. + +Do same for riscv64 and aarch64 + +RP 15/8/11 + +Upstream-Status: Inappropriate[OE-Specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com> +Signed-off-by: Mark Hatle <mark.hatle@windriver.com> +Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> + +Index: gcc-9.2.0/gcc/config/microblaze/t-microblaze +=================================================================== +--- gcc-9.2.0.orig/gcc/config/microblaze/t-microblaze ++++ gcc-9.2.0/gcc/config/microblaze/t-microblaze +@@ -1,5 +1,6 @@ + MULTILIB_OPTIONS = m64 mxl-barrel-shift mlittle-endian mno-xl-soft-mul mxl-multiply-high +-MULTILIB_DIRNAMES = m64 bs le m mh ++#MULTILIB_DIRNAMES = m64 bs le m mh ++MULTILIB_DIRNAMES = . . . . . + MULTILIB_EXCEPTIONS = *m64/mxl-multiply-high mxl-multiply-high + MULTILIB_EXCEPTIONS += *m64 + MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift +Index: gcc-9.2.0/gcc/config/microblaze/t-microblaze-linux +=================================================================== +--- gcc-9.2.0.orig/gcc/config/microblaze/t-microblaze-linux ++++ gcc-9.2.0/gcc/config/microblaze/t-microblaze-linux +@@ -1,3 +1,4 @@ + MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high +-MULTILIB_DIRNAMES = bs m mh ++#MULTILIB_DIRNAMES = bs m mh ++MULTILIB_DIRNAMES = . . . + MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-common.inc b/meta-microblaze/recipes-devtools/gcc/gcc-common.inc new file mode 100644 index 00000000..5ac82b1b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-common.inc @@ -0,0 +1,118 @@ +SUMMARY = "GNU cc and gcc C compilers" +HOMEPAGE = "http://www.gnu.org/software/gcc/" +DESCRIPTION = "The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D, as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system." +SECTION = "devel" +LICENSE = "GPL" + +NATIVEDEPS = "" + +CVE_PRODUCT = "gcc" + +inherit autotools gettext texinfo + +BPN = "gcc" +COMPILERDEP = "virtual/${TARGET_PREFIX}gcc:do_gcc_stash_builddir" + +python extract_stashed_builddir () { + src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}") + dest = d.getVar("B") + oe.path.copyhardlinktree(src, dest) + staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d) +} + +def get_gcc_float_setting(bb, d): + if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm": + return "--with-float=hard" + if d.getVar('TARGET_FPU') in [ 'soft' ]: + return "--with-float=soft" + if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]: + return "--enable-e500_double" + return "" + +get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}" + +def get_gcc_x86_64_arch_setting(bb, d): + import re + march = re.match(r'^.*-march=([^\s]*)', d.getVar('TUNE_CCARGS')) + if march: + return "--with-arch=%s " % march.group(1) + # The earliest supported x86-64 CPU + return "--with-arch=core2" + +get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}" + +def get_gcc_mips_plt_setting(bb, d): + if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d): + return "--with-mips-plt" + return "" + +def get_gcc_ppc_plt_settings(bb, d): + if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d): + return "--enable-secureplt" + return "" + +def get_gcc_multiarch_setting(bb, d): + target_arch = d.getVar('TRANSLATED_TARGET_ARCH') + multiarch_options = { + "i586": "--enable-targets=all", + "i686": "--enable-targets=all", + "powerpc": "--enable-targets=powerpc64", + "powerpc64le": "--enable-targets=powerpcle", + "mips": "--enable-targets=all", + "sparc": "--enable-targets=all", + } + + if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d): + if target_arch in multiarch_options : + return multiarch_options[target_arch] + return "" + +# this is used by the multilib setup of gcc +def get_tune_parameters(tune, d): + availtunes = d.getVar('AVAILTUNES') + if tune not in availtunes.split(): + bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes)) + + localdata = bb.data.createCopy(d) + override = ':tune-' + tune + localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override) + + retdict = {} + retdict['tune'] = tune + retdict['ccargs'] = localdata.getVar('TUNE_CCARGS') + retdict['features'] = localdata.getVar('TUNE_FEATURES') + # BASELIB is used by the multilib code to change library paths + retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB') + retdict['arch'] = localdata.getVar('TUNE_ARCH') + retdict['abiextension'] = localdata.getVar('ABIEXTENSION') + retdict['target_fpu'] = localdata.getVar('TARGET_FPU') + retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH') + retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS') + return retdict + +get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS" + +DEBIANNAME:${MLPREFIX}libgcc = "libgcc1" + +MIRRORS =+ "\ + ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \ +" +# +# Set some default values +# +gcclibdir = "${libdir}/gcc" +BINV = "${PV}" +#S = "${WORKDIR}/gcc-${PV}" +S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" + +B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" + +target_includedir ?= "${includedir}" +target_libdir ?= "${libdir}" +target_base_libdir ?= "${base_libdir}" +target_prefix ?= "${prefix}" + +# We need to ensure that for the shared work directory, the do_patch signatures match +# The real WORKDIR location isn't a dependency for the shared workdir. +src_patches[vardepsexclude] = "WORKDIR" +should_apply[vardepsexclude] += "PN" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc b/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc new file mode 100644 index 00000000..e4cdb73f --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc @@ -0,0 +1,123 @@ +require gcc-multilib-config.inc +require gcc-shared-source.inc +# +# Build the list of lanaguages to build. +# +# These can be overridden by the version specific .inc file. + +# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran' +FORTRAN ?= ",f77" +LANGUAGES ?= "c,c++${FORTRAN}" + +EXTRA_OECONF_BASE ?= "" +EXTRA_OECONF_PATHS ?= "" + +GCCMULTILIB ?= "--disable-multilib" +GCCTHREADS ?= "posix" + +GCCPIE ??= "" + +SYMVERS_CONF ?= "--enable-symvers=gnu" + +EXTRA_OECONF = "\ + ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \ + --with-gnu-ld \ + --enable-shared \ + --enable-languages=${LANGUAGES} \ + --enable-threads=${GCCTHREADS} \ + ${GCCMULTILIB} \ + ${GCCPIE} \ + --enable-c99 \ + --enable-long-long \ + ${SYMVERS_CONF} \ + --enable-libstdcxx-pch \ + --program-prefix=${TARGET_PREFIX} \ + --without-local-prefix \ + --disable-install-libiberty \ + ${EXTRA_OECONF_BASE} \ + ${EXTRA_OECONF_GCC_FLOAT} \ + ${EXTRA_OECONF_PATHS} \ + ${@get_gcc_mips_plt_setting(bb, d)} \ + ${@get_gcc_ppc_plt_settings(bb, d)} \ + ${@get_gcc_multiarch_setting(bb, d)} \ + --enable-standard-branch-protection \ +" + +# glibc version is a minimum controlling whether features are enabled. +# Doesn't need to track glibc exactly +EXTRA_OECONF:append:libc-glibc = " --with-glibc-version=2.28 " + +# Set this here since GCC configure won't auto-detect and enable +# initfini-arry when cross compiling. +EXTRA_OECONF:append = " --enable-initfini-array" + +export gcc_cv_collect2_libs = 'none required' +# We need to set gcc_cv_collect2_libs else there is cross-compilation badness +# in the config.log files (which might not get generated until do_compile +# hence being missed by the insane do_configure check). + +EXTRA_OECONF:append:linux = " --enable-__cxa_atexit" + +EXTRA_OECONF:append:mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64" +EXTRA_OECONF:append:mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64" +EXTRA_OECONF:append:mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64" +EXTRA_OECONF:append:mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64" +EXTRA_OECONF:append:mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6" +EXTRA_OECONF:append:mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6" +EXTRA_OECONF:append:mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6" +EXTRA_OECONF:append:mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6" + +EXTRA_OECONF_GCC_FLOAT ??= "" +CPPFLAGS = "" + +SYSTEMHEADERS = "${target_includedir}" +SYSTEMLIBS = "${target_base_libdir}/" +SYSTEMLIBS1 = "${target_libdir}/" + +do_configure:prepend () { + # teach gcc to find correct target includedir when checking libc ssp support + mkdir -p ${B}/gcc + echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe + cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new + cat >>${B}/gcc/defaults.h.new <<_EOF +#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}" +#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}" +#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}" +#define SYSTEMLIBS_DIR "${SYSTEMLIBS}" +#endif /* ! GCC_DEFAULTS_H */ +_EOF + mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h +} + +do_configure () { + # Setup these vars for cross building only + # ... because foo_FOR_TARGET apparently gets misinterpreted inside the + # gcc build stuff when the build is producing a cross compiler - i.e. + # when the 'current' target is the 'host' system, and the host is not + # the target (because the build is actually making a cross compiler!) + if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then + export CC_FOR_TARGET="${CC}" + export GCC_FOR_TARGET="${CC}" + export CXX_FOR_TARGET="${CXX}" + export AS_FOR_TARGET="${HOST_PREFIX}as" + export LD_FOR_TARGET="${HOST_PREFIX}ld" + export NM_FOR_TARGET="${HOST_PREFIX}nm" + export AR_FOR_TARGET="${HOST_PREFIX}ar" + export GFORTRAN_FOR_TARGET="gfortran" + export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib" + fi + export CC_FOR_BUILD="${BUILD_CC}" + export CXX_FOR_BUILD="${BUILD_CXX}" + export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}" + export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}" + export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}" + export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}" + export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}" + export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}" + export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" + export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" + + + oe_runconf +} + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc new file mode 100644 index 00000000..ec87b462 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc @@ -0,0 +1,187 @@ +inherit cross-canadian + +SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)" +PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}" + +DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc" + +GCCMULTILIB = "--enable-multilib" + +require gcc-configure-common.inc + +EXTRA_OECONF += "--with-plugin-ld=ld" +EXTRA_OECONF_PATHS = "\ + --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \ + --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \ + --with-sysroot=/not/exist \ + --with-build-sysroot=${STAGING_DIR_TARGET} \ +" +# We have to point gcc at a sysroot but we don't need to rebuild if this changes +# e.g. we switch between different machines with different tunes. +EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH" +TARGET_ARCH[vardepsexclude] = "TUNE_ARCH" +get_gcc_float_setting[vardepvalue] = "" + +# +# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky +# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse. +# +export AR_FOR_TARGET = "${TARGET_PREFIX}ar" +export AS_FOR_TARGET = "${TARGET_PREFIX}as" +export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool" +export CC_FOR_TARGET = "${TARGET_PREFIX}gcc" +export CXX_FOR_TARGET = "${TARGET_PREFIX}g++" +export GCC_FOR_TARGET = "${TARGET_PREFIX}gcc" +export LD_FOR_TARGET = "${TARGET_PREFIX}ld" +export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo" +export NM_FOR_TARGET = "${TARGET_PREFIX}nm" +export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump" +export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib" +export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip" +export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres" + +# +# We need to override this and make sure the compiler can find staging +# +export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}" + +do_configure () { + if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then + mkdir -p ${RECIPE_SYSROOT}/${target_includedir} + fi + export CC_FOR_BUILD="${BUILD_CC}" + export CXX_FOR_BUILD="${BUILD_CXX}" + export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}" + export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}" + export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}" + export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}" + export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}" + export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}" + export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" + export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" + oe_runconf +} + +do_compile () { + oe_runmake all-host configure-target-libgcc + (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h) +} + +PACKAGES = "${PN}-dbg ${PN} ${PN}-doc" + +FILES:${PN} = "\ + ${exec_prefix}/bin/* \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/include \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \ + ${libdir}/bfd-plugins/*.so \ + ${includedir}/c++/${BINV} \ + ${prefix}/${TARGET_SYS}/bin/* \ + ${prefix}/${TARGET_SYS}/lib/* \ + ${prefix}/${TARGET_SYS}${target_includedir}/* \ +" +INSANE_SKIP:${PN} += "dev-so" + +FILES:${PN}-doc = "\ + ${infodir} \ + ${mandir} \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \ +" + +EXEEXT = "" + +# Compute how to get from libexecdir to bindir in python (easier than shell) +BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}" +# linker plugin path +LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${libdir}/bfd-plugins"))}" + +do_install () { + ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h ) + oe_runmake 'DESTDIR=${D}' install-host + + # Cleanup some of the ${libdir}{,exec}/gcc stuff ... + rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools + rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools + rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude + + # We care about g++ not c++ + rm -f ${D}${bindir}/*c++ + + # We don't care about the gcc-<version> copies + rm -f ${D}${bindir}/*gcc-${BINV}* + + # Cleanup empty directories which are not shipped + # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted + # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686 + local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}" + for i in $empty_dirs; do + [ -d $i ] && rmdir --ignore-fail-on-non-empty $i + done + + # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are + # found. + dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/ + install -d $dest + suffix=${EXEEXT} + for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do + if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then + continue + fi + + ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix + done + + # libquadmath headers need to be available in the gcc libexec dir + install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ + cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ + cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ + + # install LTO linker plugins where binutils tools can find it + install -d ${D}${libdir}/bfd-plugins + ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so + + chown -R root:root ${D} + + cross_canadian_bindirlinks + + for i in linux ${CANADIANEXTRAOS} + do + for v in ${CANADIANEXTRAVENDOR} + do + d=${D}${bindir}/../${TARGET_ARCH}$v-$i + install -d $d + for j in ${TARGET_PREFIX}gcc${EXEEXT} ${TARGET_PREFIX}g++${EXEEXT} + do + p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,` + case $i in + *musl*) + rm -rf $d/$p + echo "#!/usr/bin/env sh" > $d/$p + echo "exec \`dirname \$0\`/../${TARGET_SYS}/$j -mmusl \$@" >> $d/$p + chmod 0755 $d/$p + ;; + *) + ;; + esac + done + done + done +} + +ELFUTILS = "nativesdk-elfutils" +DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib nativesdk-zstd" +RDEPENDS:${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}" + +SYSTEMHEADERS = "${target_includedir}/" +SYSTEMLIBS = "${target_base_libdir}/" +SYSTEMLIBS1 = "${target_libdir}/" + +EXTRA_OECONF += "--enable-poison-system-directories" + +# gcc 4.7 needs -isystem +export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb new file mode 100644 index 00000000..bf53c5cd --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb @@ -0,0 +1,5 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require gcc-cross-canadian.inc + + + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc b/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc new file mode 100644 index 00000000..a540fb24 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc @@ -0,0 +1,163 @@ +inherit cross + +INHIBIT_DEFAULT_DEPS = "1" +EXTRADEPENDS = "" +DEPENDS = "virtual/${TARGET_PREFIX}binutils ${EXTRADEPENDS} ${NATIVEDEPS}" +PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" +python () { + if d.getVar("TARGET_OS").startswith("linux"): + d.setVar("EXTRADEPENDS", "linux-libc-headers") +} + +PN = "gcc-cross-${TARGET_ARCH}" + +# Ignore how TARGET_ARCH is computed. +TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" + +require gcc-configure-common.inc + +# While we want the 'gnu' hash style, we explicitly set it to sysv here to +# ensure that any recipe which doesn't obey our LDFLAGS (which also set it to +# gnu) will hit a QA failure. +LINKER_HASH_STYLE ?= "sysv" + +EXTRA_OECONF += "--enable-poison-system-directories=error" +EXTRA_OECONF:append:sh4 = " \ + --with-multilib-list= \ + --enable-incomplete-targets \ +" + +EXTRA_OECONF += "\ + --with-system-zlib \ +" + +EXTRA_OECONF:append:libc-baremetal = " --without-headers" +EXTRA_OECONF:remove:libc-baremetal = "--enable-threads=posix" +EXTRA_OECONF:remove:libc-newlib = "--enable-threads=posix" + +EXTRA_OECONF_PATHS = "\ + --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \ + --with-sysroot=/not/exist \ + --with-build-sysroot=${STAGING_DIR_TARGET} \ +" + +ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}" + + +do_configure:prepend () { + install -d ${RECIPE_SYSROOT}${target_includedir} + touch ${RECIPE_SYSROOT}${target_includedir}/limits.h +} + +do_compile () { + export CC="${BUILD_CC}" + export AR_FOR_TARGET="${TARGET_SYS}-ar" + export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib" + export LD_FOR_TARGET="${TARGET_SYS}-ld" + export NM_FOR_TARGET="${TARGET_SYS}-nm" + export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc" + export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}" + export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}" + export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" + export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" + + # Prevent native/host sysroot path from being used in configargs.h header, + # as it will be rewritten when used by other sysroots preventing support + # for gcc plugins + oe_runmake configure-gcc + sed -i 's@${STAGING_DIR_TARGET}@/host@g' ${B}/gcc/configargs.h + sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/configargs.h + + # Prevent sysroot/workdir paths from being used in checksum-options. + # checksum-options is used to generate a checksum which is embedded into + # the output binary. + oe_runmake TARGET-gcc=checksum-options all-gcc + sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options + sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/checksum-options + + oe_runmake all-host configure-target-libgcc + (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h) +} + +INHIBIT_PACKAGE_STRIP = "1" + +# Compute how to get from libexecdir to bindir in python (easier than shell) +BINRELPATH = "${@os.path.relpath(d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_SYS}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}" +# linker plugin path +LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/bfd-plugins"))}" + +do_install () { + ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h ) + oe_runmake 'DESTDIR=${D}' install-host + + install -d ${D}${target_base_libdir} + install -d ${D}${target_libdir} + + # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77 + # gfortran is fully backwards compatible. This is a safe and practical solution. + if [ -n "${@d.getVar('FORTRAN')}" ]; then + ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true + fortsymlinks="g77 gfortran" + fi + + # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are + # found. These need to be relative paths so they work in different locations. + dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/ + install -d $dest + for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip gcc cpp $fortsymlinks; do + ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t + ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t + done + + # Remove things we don't need but keep share/java + for d in info man share/doc share/locale share/man share/info; do + rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d + done + + # libquadmath headers need to be available in the gcc libexec dir + install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ + cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ + cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ + + find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f + + # install LTO linker plugins where binutils tools can find it + install -d ${D}${libdir}/bfd-plugins + ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so +} + +do_package[noexec] = "1" +do_packagedata[noexec] = "1" +do_package_write_ipk[noexec] = "1" +do_package_write_rpm[noexec] = "1" +do_package_write_deb[noexec] = "1" + +inherit chrpath + +python gcc_stash_builddir_fixrpaths() { + # rewrite rpaths, breaking hardlinks as required + process_dir("/", d.getVar("BUILDDIRSTASH"), d, break_hardlinks = True) +} + +BUILDDIRSTASH = "${WORKDIR}/stashed-builddir/build" +do_gcc_stash_builddir[dirs] = "${B}" +do_gcc_stash_builddir[cleandirs] = "${BUILDDIRSTASH}" +do_gcc_stash_builddir[postfuncs] += "gcc_stash_builddir_fixrpaths" +do_gcc_stash_builddir () { + dest=${BUILDDIRSTASH} + hardlinkdir . $dest + # Makefile does move-if-change which can end up with 'timestamp' as file contents so break links to those files + rm $dest/gcc/include/*.h + cp gcc/include/*.h $dest/gcc/include/ + sysroot-relativelinks.py $dest +} +addtask do_gcc_stash_builddir after do_compile before do_install +SSTATETASKS += "do_gcc_stash_builddir" +do_gcc_stash_builddir[sstate-inputdirs] = "${BUILDDIRSTASH}" +do_gcc_stash_builddir[sstate-outputdirs] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}" +do_gcc_stash_builddir[sstate-fixmedir] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}" + +python do_gcc_stash_builddir_setscene () { + sstate_setscene(d) +} +addtask do_gcc_stash_builddir_setscene diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb new file mode 100644 index 00000000..b43cca0c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb @@ -0,0 +1,3 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require gcc-cross.inc + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc new file mode 100644 index 00000000..bd65b1fe --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc @@ -0,0 +1,12 @@ +inherit crosssdk + +PN = "gcc-crosssdk-${SDK_SYS}" + +SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include" +SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/" +SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/" + +GCCMULTILIB = "--disable-multilib" + +DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}" +PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb new file mode 100644 index 00000000..40a6c4fe --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb @@ -0,0 +1,2 @@ +require recipes-devtools/gcc/gcc-cross_${PV}.bb +require gcc-crosssdk.inc diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc b/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc new file mode 100644 index 00000000..2dbbc23c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc @@ -0,0 +1,249 @@ +# following code modifies these definitions in the gcc config +# MULTILIB_OPTIONS +# MULTILIB_DIRNAMES +# MULTILIB_OSDIRNAMES +# GLIBC_DYNAMIC_LINKER32 +# GLIBC_DYNAMIC_LINKER64 +# GLIBC_DYNAMIC_LINKERX32 +# GLIBC_DYNAMIC_LINKERN32 +# For more information on use of these variables look at these files in the gcc source code +# gcc/config/i386/t-linux64 +# gcc/config/mips/t-linux64 +# gcc/config/rs6000/t-linux64 +# gcc/config/i386/linux64.h +# gcc/config/mips/linux64.h +# gcc/config/rs6000/linux64.h + +MULTILIB_OPTION_WHITELIST ??= "-m32 -m64 -mx32 -mabi=n32 -mabi=32 -mabi=64" + +python gcc_multilib_setup() { + import re + import shutil + import glob + + srcdir = d.getVar('S') + builddir = d.getVar('B') + src_conf_dir = '%s/gcc/config' % srcdir + build_conf_dir = '%s/gcc/config' % builddir + + bb.utils.remove(build_conf_dir, True) + ml_globs = ('%s/*/t-linux64' % src_conf_dir, + '%s/*/linux64.h' % src_conf_dir, + '%s/aarch64/t-aarch64' % src_conf_dir, + '%s/aarch64/aarch64.h' % src_conf_dir, + '%s/aarch64/aarch64-linux.h' % src_conf_dir, + '%s/aarch64/aarch64-cores.def' % src_conf_dir, + '%s/arm/linux-eabi.h' % src_conf_dir, + '%s/*/linux.h' % src_conf_dir, + '%s/linux.h' % src_conf_dir) + + # copy the target multilib config files to ${B} + for ml_glob in ml_globs: + for fn in glob.glob(ml_glob): + rel_path = os.path.relpath(fn, src_conf_dir) + parent_dir = os.path.dirname(rel_path) + bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir)) + bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path)) + + pn = d.getVar('PN') + multilibs = (d.getVar('MULTILIB_VARIANTS') or '').split() + if not multilibs and pn != "nativesdk-gcc": + return + + mlprefix = d.getVar('MLPREFIX') + + if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')) and pn != "nativesdk-gcc": + return + + + def write_config(root, files, options, dirnames, osdirnames): + for ml_conf_file in files: + with open(root + '/' + ml_conf_file, 'r') as f: + filelines = f.readlines() + # recreate multilib configuration variables + substs = [ + (r'^(\s*(MULTILIB_OPTIONS\s*=).*)$', r'\2 %s' % '/'.join(options)), + (r'^(\s*MULTILIB_OPTIONS\s*\+=.*)$', ''), + (r'^(\s*(MULTILIB_DIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(dirnames)), + (r'^(\s*MULTILIB_DIRNAMES\s*\+=.*)$', ''), + (r'^(\s*(MULTILIB_OSDIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(osdirnames)), + (r'^(\s*MULTILIB_OSDIRNAMES\s*\+=.*)$', ''), + ] + + for (i, line) in enumerate(filelines): + for subst in substs: + line = re.sub(subst[0], subst[1], line) + filelines[i] = line + + with open(root + '/' + ml_conf_file, 'w') as f: + f.write(''.join(filelines)) + + def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32): + def wrap_libdir(libdir): + if libdir.find('SYSTEMLIBS_DIR') != -1: + return '"%r"' + else: + return '"/%s/"' % libdir + + for ml_conf_file in files: + fn = root + '/' + ml_conf_file + if not os.path.exists(fn): + continue + with open(fn, 'r') as f: + filelines = f.readlines() + + # replace lines like + # #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2" + # by + # #define GLIBC_DYNAMIC_LINKER32 "/lib/" "ld-linux.so.2" + # this is needed to put the correct dynamic loader path in the generated binaries + substs = [ + (r'^(#define\s*GLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir32) + r'\3'), + (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\"\S+\")$', + r'\1' + wrap_libdir(libdir64) + r'\3'), + (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*\"\S+\"\s*)(\S+)(\s*\"\S+\"\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir64) + r'\3' + wrap_libdir(libdir64) + r'\5'), + (r'^(#define\s*GLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir32) + r'\3'), + (r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdirx32) + r'\3'), + (r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdirn32) + r'\3'), + (r'^(#define\s*UCLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir32) + r'\3'), + (r'^(#define\s*UCLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir64) + r'\3'), + (r'^(#define\s*UCLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdirn32) + r'\3'), + (r'^(#define\s*UCLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdirx32) + r'\3'), + (r'^(#define\s*UCLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir32) + r'\3'), + (r'^(#define\s*MUSL_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir32) + r'\3'), + (r'^(#define\s*MUSL_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir64) + r'\3'), + (r'^(#define\s*MUSL_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdirx32) + r'\3'), + (r'^(#define\s*MUSL_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$', + r'\1' + wrap_libdir(libdir32) + r'\3'), + ] + + for (i, line) in enumerate(filelines): + for subst in substs: + line = re.sub(subst[0], subst[1], line) + filelines[i] = line + + with open(root + '/' + ml_conf_file, 'w') as f: + f.write(''.join(filelines)) + + + gcc_target_config_files = { + 'x86_64' : ['gcc/config/i386/t-linux64'], + 'i586' : ['gcc/config/i386/t-linux64'], + 'i686' : ['gcc/config/i386/t-linux64'], + 'mips' : ['gcc/config/mips/t-linux64'], + 'mips64' : ['gcc/config/mips/t-linux64'], + 'powerpc' : ['gcc/config/rs6000/t-linux64'], + 'powerpc64' : ['gcc/config/rs6000/t-linux64'], + 'aarch64' : ['gcc/config/aarch64/t-aarch64'], + 'arm' : ['gcc/config/aarch64/t-aarch64'], + } + + gcc_header_config_files = { + 'x86_64' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'], + 'i586' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'], + 'i686' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'], + 'mips' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'], + 'mips64' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'], + 'powerpc' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'], + 'powerpc64' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'], + 'aarch64' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'], + 'arm' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'], + } + + libdir32 = 'SYSTEMLIBS_DIR' + libdir64 = 'SYSTEMLIBS_DIR' + libdirx32 = 'SYSTEMLIBS_DIR' + libdirn32 = 'SYSTEMLIBS_DIR' + + + target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL') if mlprefix + else d.getVar('TARGET_ARCH')) + if pn == "nativesdk-gcc": + header_config_files = gcc_header_config_files[d.getVar("SDK_ARCH")] + write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32) + return + + if target_arch not in gcc_target_config_files: + bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch) + return + + target_config_files = gcc_target_config_files[target_arch] + header_config_files = gcc_header_config_files[target_arch] + + ml_list = ['DEFAULTTUNE_MULTILIB_ORIGINAL' if mlprefix else 'DEFAULTTUNE'] + mltunes = [('DEFAULTTUNE:virtclass-multilib-%s' % ml) for ml in multilibs] + if mlprefix: + mlindex = 0 + for ml in multilibs: + if mlprefix == ml + '-': + break + mlindex += 1 + + ml_list.extend(mltunes[:mlindex] + ['DEFAULTTUNE'] + mltunes[(mlindex + 1):]) + else: + ml_list.extend(mltunes) + + options = [] + dirnames = [] + osdirnames = [] + optsets = [] + + for ml in ml_list: + tune = d.getVar(ml) + if not tune: + bb.warn("%s doesn't have a corresponding tune. Skipping..." % ml) + continue + tune_parameters = get_tune_parameters(tune, d) + + tune_baselib = tune_parameters['baselib'] + if not tune_baselib: + bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune) + continue + + if tune_baselib == 'lib64': + libdir64 = tune_baselib + elif tune_baselib == 'libx32': + libdirx32 = tune_baselib + elif tune_baselib == 'lib32': + libdirn32 = tune_baselib + elif tune_baselib == 'lib': + libdir32 = tune_baselib + else: + bb.error('Unknown libdir (%s) of the tune : %s' % (tune_baselib, tune)) + + # take out '-' mcpu='s and march='s from parameters + opts = [] + whitelist = (d.getVar("MULTILIB_OPTION_WHITELIST") or "").split() + for i in d.expand(tune_parameters['ccargs']).split(): + if i in whitelist: + # Need to strip '-' from option + opts.append(i[1:]) + options.append(" ".join(opts)) + + if tune_baselib == 'lib': + dirnames.append('32') # /lib => 32bit lib + else: + dirnames.append(tune_baselib.replace('lib', '')) + osdirnames.append('../' + tune_baselib) + + write_config(builddir, target_config_files, options, dirnames, osdirnames) + write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32) +} + +gcc_multilib_setup[cleandirs] = "${B}/gcc/config" +gcc_multilib_setup[vardepsexclude] = "SDK_ARCH" + +EXTRACONFFUNCS += "gcc_multilib_setup" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc b/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc new file mode 100644 index 00000000..8bb58631 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc @@ -0,0 +1,310 @@ +require gcc-configure-common.inc + +SUMMARY = "Runtime libraries from GCC" + +# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPLv3" +# All gcc-runtime packages are now covered by the runtime exception. +LICENSE = "GPL-3.0-with-GCC-exception" + +CXXFLAGS:remove = "-fvisibility-inlines-hidden" + +EXTRA_OECONF_PATHS = "\ + --with-gxx-include-dir=${includedir}/c++/${BINV} \ + --with-sysroot=/not/exist \ + --with-build-sysroot=${STAGING_DIR_TARGET} \ +" + +EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu" +EXTRA_OECONF:append = " --cache-file=${B}/config.cache" +EXTRA_OECONF:append:libc-newlib = " --with-newlib --with-target-subdir" +EXTRA_OECONF:append:libc-baremetal = " --with-target-subdir" + +# Disable ifuncs for libatomic on arm conflicts -march/-mcpu +EXTRA_OECONF:append:arm = " libat_cv_have_ifunc=no " +EXTRA_OECONF:append:armeb = " libat_cv_have_ifunc=no " + +DISABLE_STATIC:class-nativesdk ?= "" + +# Newlib does not support symbol versioning on libsdtcc++ +SYMVERS_CONF:libc-newlib = "" + +# Building with thumb enabled on armv6t fails +ARM_INSTRUCTION_SET:armv6 = "arm" + +RUNTIMELIBITM = "libitm" +RUNTIMELIBITM:arc = "" +RUNTIMELIBITM:mipsarch = "" +RUNTIMELIBITM:nios2 = "" +RUNTIMELIBITM:microblaze = "" +RUNTIMELIBITM:riscv32 = "" +RUNTIMELIBITM:riscv64 = "" +RUNTIMELIBITM:loongarch64 = "" +RUNTIMELIBSSP ?= "" +RUNTIMELIBSSP:mingw32 ?= "libssp" + +RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \ + ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \ +" +# Only build libstdc++ for newlib +RUNTIMETARGET:libc-newlib = "libstdc++-v3" + +# libiberty +# libgfortran needs separate recipe due to libquadmath dependency + +do_configure () { + export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib" + # libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure + # tests. Create a dummy empty lib for the purposes of configure. + mkdir -p ${WORKDIR}/dummylib + ${CC} -x c /dev/null -c -o ${WORKDIR}/dummylib/dummylib.o + ${AR} rcs ${WORKDIR}/dummylib/libstdc++.a ${WORKDIR}/dummylib/dummylib.o + for d in libgcc ${RUNTIMETARGET}; do + echo "Configuring $d" + rm -rf ${B}/${TARGET_SYS}/$d/ + mkdir -p ${B}/${TARGET_SYS}/$d/ + cd ${B}/${TARGET_SYS}/$d/ + chmod a+x ${S}/$d/configure + ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} + if [ "$d" = "libgcc" ]; then + (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h) + fi + done +} +EXTRACONFFUNCS += "extract_stashed_builddir" +do_configure[depends] += "${COMPILERDEP}" + +do_compile () { + for d in libgcc ${RUNTIMETARGET}; do + cd ${B}/${TARGET_SYS}/$d/ + oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ + done +} + +do_install () { + for d in ${RUNTIMETARGET}; do + cd ${B}/${TARGET_SYS}/$d/ + oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install + done + if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then + install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include + mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include + rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include + fi + rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir + rm -rf ${D}${infodir}/libitm.info ${D}${infodir}/dir + rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir + if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then + rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude + fi + if [ -d ${D}${infodir} ]; then + rmdir --ignore-fail-on-non-empty -p ${D}${infodir} + fi +} + +do_install:append:class-target () { + if [ "${TARGET_OS}" = "linux-gnuspe" ]; then + ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux + fi + + if [ "${TARGET_OS}" = "linux-gnun32" ]; then + if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then + mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux + ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/32 + elif [ "${MULTILIB_VARIANTS}" != "" ]; then + mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux + ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32 + else + ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux + fi + elif [ "${TARGET_OS}" = "linux-gnux32" ]; then + if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then + mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux + ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/x32 + elif [ "${MULTILIB_VARIANTS}" != "" ]; then + mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux + ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32 + else + ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux + fi + elif [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then + mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS} + ln -s ../${TARGET_SYS}/bits ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/bits + ln -s ../${TARGET_SYS}/ext ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/ext + fi + + if [ "${TARGET_ARCH}" == "x86_64" -a "${MULTILIB_VARIANTS}" != "" ];then + ln -sf ../${X86ARCH32}${TARGET_VENDOR}-${TARGET_OS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}/32 + fi + + if [ "${TCLIBC}" != "glibc" ]; then + case "${TARGET_OS}" in + "linux-musl" | "linux-*spe") extra_target_os="linux";; + "linux-musleabi") extra_target_os="linux-gnueabi";; + *) extra_target_os="linux";; + esac + ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os + fi + chown -R root:root ${D} +} + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc" +PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs" + +#BBCLASSEXTEND = "nativesdk" + +PACKAGES = "\ + ${PN}-dbg \ + libstdc++ \ + libstdc++-precompile-dev \ + libstdc++-dev \ + libstdc++-staticdev \ + libg2c \ + libg2c-dev \ + libssp \ + libssp-dev \ + libssp-staticdev \ + libquadmath \ + libquadmath-dev \ + libquadmath-staticdev \ + libgomp \ + libgomp-dev \ + libgomp-staticdev \ + libatomic \ + libatomic-dev \ + libatomic-staticdev \ + libitm \ + libitm-dev \ + libitm-staticdev \ +" +# The base package doesn't exist, so we clear the recommends. +RRECOMMENDS:${PN}-dbg = "" + +# include python debugging scripts +FILES:${PN}-dbg += "\ + ${libdir}/libstdc++.*-gdb.py \ + ${datadir}/gcc-${BINV}/python/libstdcxx \ +" + +FILES:libg2c = "${target_libdir}/libg2c.so.*" +SUMMARY:libg2c = "Companion runtime library for g77" +FILES:libg2c-dev = "\ + ${libdir}/libg2c.so \ + ${libdir}/libg2c.a \ + ${libdir}/libfrtbegin.a \ +" +SUMMARY:libg2c-dev = "Companion runtime library for g77 - development files" + +FILES:libstdc++ = "${libdir}/libstdc++.so.*" +SUMMARY:libstdc++ = "GNU standard C++ library" +FILES:libstdc++-dev = "\ + ${includedir}/c++/ \ + ${libdir}/libstdc++.so \ + ${libdir}/libstdc++*.la \ + ${libdir}/libsupc++.la \ +" +SUMMARY:libstdc++-dev = "GNU standard C++ library - development files" +FILES:libstdc++-staticdev = "\ + ${libdir}/libstdc++*.a \ + ${libdir}/libsupc++.a \ +" +SUMMARY:libstdc++-staticdev = "GNU standard C++ library - static development files" + +FILES:libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch" +SUMMARY:libstdc++-precompile-dev = "GNU standard C++ library - precompiled header files" + +FILES:libssp = "${libdir}/libssp.so.*" +SUMMARY:libssp = "GNU stack smashing protection library" +FILES:libssp-dev = "\ + ${libdir}/libssp*.so \ + ${libdir}/libssp*_nonshared.a \ + ${libdir}/libssp*.la \ + ${libdir}/${TARGET_SYS}/${BINV}/include/ssp \ +" +SUMMARY:libssp-dev = "GNU stack smashing protection library - development files" +FILES:libssp-staticdev = "${libdir}/libssp*.a" +SUMMARY:libssp-staticdev = "GNU stack smashing protection library - static development files" + +FILES:libquadmath = "${libdir}/libquadmath*.so.*" +SUMMARY:libquadmath = "GNU quad-precision math library" +FILES:libquadmath-dev = "\ + ${libdir}/${TARGET_SYS}/${BINV}/include/quadmath* \ + ${libdir}/libquadmath*.so \ + ${libdir}/libquadmath.la \ +" +SUMMARY:libquadmath-dev = "GNU quad-precision math library - development files" +FILES:libquadmath-staticdev = "${libdir}/libquadmath.a" +SUMMARY:libquadmath-staticdev = "GNU quad-precision math library - static development files" + +FILES:libgomp = "${libdir}/libgomp*${SOLIBS}" +SUMMARY:libgomp = "GNU OpenMP parallel programming library" +FILES:libgomp-dev = "\ + ${libdir}/libgomp*${SOLIBSDEV} \ + ${libdir}/libgomp*.la \ + ${libdir}/libgomp.spec \ + ${libdir}/${TARGET_SYS}/${BINV}/include/acc_prof.h \ + ${libdir}/${TARGET_SYS}/${BINV}/include/omp.h \ + ${libdir}/${TARGET_SYS}/${BINV}/include/openacc.h \ +" +SUMMARY:libgomp-dev = "GNU OpenMP parallel programming library - development files" +FILES:libgomp-staticdev = "${libdir}/libgomp*.a" +SUMMARY:libgomp-staticdev = "GNU OpenMP parallel programming library - static development files" + +FILES:libatomic = "${libdir}/libatomic.so.*" +SUMMARY:libatomic = "GNU C++11 atomics support library" +FILES:libatomic-dev = "\ + ${libdir}/libatomic.so \ + ${libdir}/libatomic.la \ +" +SUMMARY:libatomic-dev = "GNU C++11 atomics support library - development files" +FILES:libatomic-staticdev = "${libdir}/libatomic.a" +SUMMARY:libatomic-staticdev = "GNU C++11 atomics support library - static development files" + +FILES:libitm = "${libdir}/libitm.so.*" +SUMMARY:libitm = "GNU transactional memory support library" +FILES:libitm-dev = "\ + ${libdir}/libitm.so \ + ${libdir}/libitm.la \ + ${libdir}/libitm.spec \ +" +SUMMARY:libitm-dev = "GNU transactional memory support library - development files" +FILES:libitm-staticdev = "${libdir}/libitm.a" +SUMMARY:libitm-staticdev = "GNU transactional memory support library - static development files" + +require gcc-testsuite.inc + +EXTRA_OEMAKE:prepend:task-check = "${PARALLEL_MAKE} " + +MAKE_CHECK_TARGETS ??= "check-gcc ${@" ".join("check-target-" + i for i in d.getVar("RUNTIMETARGET").split())}" +# prettyprinters and xmethods require gdb tooling +MAKE_CHECK_IGNORE ??= "prettyprinters.exp xmethods.exp" +MAKE_CHECK_RUNTESTFLAGS ??= "${MAKE_CHECK_BOARDARGS} --ignore '${MAKE_CHECK_IGNORE}'" + +# specific host and target dependencies required for test suite running +do_check[depends] += "dejagnu-native:do_populate_sysroot expect-native:do_populate_sysroot" +do_check[depends] += "virtual/libc:do_populate_sysroot" +# only depend on qemu if targeting linux user execution +do_check[depends] += "${@'qemu-native:do_populate_sysroot' if "user" in d.getVar('TOOLCHAIN_TEST_TARGET') else ''}" +# extend the recipe sysroot to include the built libraries (for qemu usermode) +do_check[prefuncs] += "extend_recipe_sysroot" +do_check[prefuncs] += "check_prepare" +do_check[dirs] = "${WORKDIR}/dejagnu ${B}" +do_check[nostamp] = "1" +do_check() { + export DEJAGNU="${WORKDIR}/dejagnu/site.exp" + + # HACK: this works around the configure setting CXX with -nostd* args + sed -i 's#-nostdinc++ -L${WORKDIR}/dummylib##g' $(find ${B} -name testsuite_flags | head -1) + + if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then + # qemu user has issues allocating large amounts of memory + export G_SLICE=always-malloc + # no test should need more that 10G of memory, this prevents tests like pthread7-rope from leaking memory + ulimit -m 4194304 + ulimit -v 10485760 + fi + + oe_runmake -i ${MAKE_CHECK_TARGETS} RUNTESTFLAGS="${MAKE_CHECK_RUNTESTFLAGS}" +} +addtask check after do_compile do_populate_sysroot + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb new file mode 100644 index 00000000..dd430b57 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb @@ -0,0 +1,2 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require gcc-runtime.inc diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc new file mode 100644 index 00000000..f6aa9c99 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc @@ -0,0 +1,120 @@ +require gcc-configure-common.inc + +LICENSE = "NCSA | MIT" + +LIC_FILES_CHKSUM = "\ + file://libsanitizer/LICENSE.TXT;md5=0249c37748936faf5b1efd5789587909 \ +" + +EXTRA_OECONF_PATHS = "\ + --with-sysroot=/not/exist \ + --with-build-sysroot=${STAGING_DIR_TARGET} \ +" + +do_configure () { + rm -rf ${B}/${TARGET_SYS}/libsanitizer/ + mkdir -p ${B}/${TARGET_SYS}/libsanitizer/ + cd ${B}/${TARGET_SYS}/libsanitizer/ + chmod a+x ${S}/libsanitizer/configure + relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/${TARGET_SYS}/libsanitizer")} + $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} + # Easiest way to stop bad RPATHs getting into the library since we have a + # broken libtool here + sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libsanitizer/libtool + # Link to the sysroot's libstdc++ instead of one gcc thinks it just built + sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/${TARGET_SYS}/libsanitizer/*/Makefile +} +EXTRACONFFUNCS += "extract_stashed_builddir" +do_configure[depends] += "${COMPILERDEP}" + +do_compile () { + cd ${B}/${TARGET_SYS}/libsanitizer/ + oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ +} + +do_install () { + cd ${B}/${TARGET_SYS}/libsanitizer/ + oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install + if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then + install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include + mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include + rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include + fi + if [ -d ${D}${infodir} ]; then + rmdir --ignore-fail-on-non-empty -p ${D}${infodir} + fi + chown -R root:root ${D} +} + +INHIBIT_DEFAULT_DEPS = "1" +ALLOW_EMPTY:${PN} = "1" +DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc" + +# used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized] +DEBUG_OPTIMIZATION:append = " -Wno-error" + +#BBCLASSEXTEND = "nativesdk" + +PACKAGES = "${PN} ${PN}-dbg" +PACKAGES += "libasan libubsan liblsan libtsan" +PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev" +PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev" + +RDEPENDS:libasan += "libstdc++" +RDEPENDS:libubsan += "libstdc++" +RDEPENDS:liblsan += "libstdc++" +RDEPENDS:libtsan += "libstdc++" +RDEPENDS:libasan-dev += "${PN}" +RDEPENDS:libubsan-dev += "${PN}" +RDEPENDS:liblsan-dev += "${PN}" +RDEPENDS:libtsan-dev += "${PN}" +RRECOMMENDS:${PN} += "libasan libubsan" +RRECOMMENDS:${PN}:append:x86 = " liblsan" +RRECOMMENDS:${PN}:append:x86-64 = " liblsan libtsan" +RRECOMMENDS:${PN}:append:powerpc64 = " liblsan libtsan" +RRECOMMENDS:${PN}:append:aarch64 = " liblsan libtsan" + +do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" +do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" +do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" + +# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported +COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux' +# musl is currently broken entirely +COMPATIBLE_HOST:libc-musl = 'null' + +FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*" +FILES:libasan-dev += "\ + ${libdir}/libasan_preinit.o \ + ${libdir}/libasan.so \ + ${libdir}/libhwasan.so \ + ${libdir}/libasan.la \ +" +FILES:libasan-staticdev += "${libdir}/libasan.a \ + ${libdir}/libhwasan.a \ +" + +FILES:libubsan += "${libdir}/libubsan.so.*" +FILES:libubsan-dev += "\ + ${libdir}/libubsan.so \ + ${libdir}/libubsan.la \ +" +FILES:libubsan-staticdev += "${libdir}/libubsan.a" + +FILES:liblsan += "${libdir}/liblsan.so.*" +FILES:liblsan-dev += "\ + ${libdir}/liblsan.so \ + ${libdir}/liblsan.la \ + ${libdir}/liblsan_preinit.o \ +" +FILES:liblsan-staticdev += "${libdir}/liblsan.a" + +FILES:libtsan += "${libdir}/libtsan.so.*" +FILES:libtsan-dev += "\ + ${libdir}/libtsan.so \ + ${libdir}/libtsan.la \ + ${libdir}/libtsan_*.o \ +" +FILES:libtsan-staticdev += "${libdir}/libtsan.a" + +FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb new file mode 100644 index 00000000..8bda2cca --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb @@ -0,0 +1,7 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require gcc-sanitizers.inc + +# Building with thumb enabled on armv4t armv5t fails with +# sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8' +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc b/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc new file mode 100644 index 00000000..03f520b0 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc @@ -0,0 +1,21 @@ +do_fetch() { + : +} +do_fetch[noexec] = "1" +deltask do_unpack +deltask do_patch + +SRC_URI = "" + +do_configure[depends] += "gcc-source-${PV}:do_preconfigure" +do_populate_lic[depends] += "gcc-source-${PV}:do_unpack" +do_deploy_source_date_epoch[depends] += "gcc-source-${PV}:do_deploy_source_date_epoch" + +# Copy the SDE from the shared workdir to the recipe workdir +do_deploy_source_date_epoch () { + sde_file=${SDE_FILE} + sde_file=${sde_file#${WORKDIR}/} + mkdir -p ${SDE_DEPLOYDIR} $(dirname ${SDE_FILE}) + cp -p $(dirname ${S})/$sde_file ${SDE_DEPLOYDIR} + cp -p $(dirname ${S})/$sde_file ${SDE_FILE} +} diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source.inc b/meta-microblaze/recipes-devtools/gcc/gcc-source.inc new file mode 100644 index 00000000..265bcf4b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-source.inc @@ -0,0 +1,45 @@ +deltask do_configure +deltask do_compile +deltask do_install +deltask do_populate_sysroot +deltask do_populate_lic +RM_WORK_EXCLUDE += "${PN}" + +inherit nopackages + +PN = "gcc-source-${PV}" +WORKDIR = "${TMPDIR}/work-shared/gcc-${PV}-${PR}" +SSTATE_SWSPEC = "sstate:gcc::${PV}:${PR}::${SSTATE_VERSION}:" + +STAMP = "${STAMPS_DIR}/work-shared/gcc-${PV}-${PR}" +STAMPCLEAN = "${STAMPS_DIR}/work-shared/gcc-${PV}-*" + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS = "" +PACKAGES = "" +TARGET_ARCH = "allarch" +TARGET_AS_ARCH = "none" +TARGET_CC_ARCH = "none" +TARGET_LD_ARCH = "none" +TARGET_OS = "linux" +baselib = "lib" +PACKAGE_ARCH = "all" + +B = "${WORKDIR}/build" + +# This needs to be Python to avoid lots of shell variables becoming dependencies. +python do_preconfigure () { + import subprocess + cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize') + subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) + cmd = d.expand("sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure") + subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) + + # Easiest way to stop bad RPATHs getting into the library since we have a + # broken libtool here (breaks cross-canadian and target at least) + cmd = d.expand("sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${S}/libcc1/configure") + subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) +} +addtask do_preconfigure after do_patch +do_preconfigure[depends] += "gnu-config-native:do_populate_sysroot autoconf-native:do_populate_sysroot" + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source_12.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.%.bbappend new file mode 100644 index 00000000..42bcd174 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.%.bbappend @@ -0,0 +1,59 @@ +# Add MicroBlaze Patches (only when using MicroBlaze) +FILESEXTRAPATHS:append := ":${THISDIR}/gcc-12" + +SRC_URI += " \ + file://0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch \ + file://0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch \ + file://0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch \ + file://0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch \ + file://0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch \ + file://0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch \ + file://0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch \ + file://0008-Patch-microblaze-Fix-atomic-side-effects.patch \ + file://0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch \ + file://0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch \ + file://0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch \ + file://0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch \ + file://0013-Patch-microblaze-Removed-moddi3-routinue.patch \ + file://0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch \ + file://0015-Patch-microblaze-Add-optimized-lshrsi3.patch \ + file://0016-Patch-microblaze-Add-cbranchsi4_reg.patch \ + file://0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch \ + file://0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch \ + file://0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch \ + file://0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch \ + file://0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch \ + file://0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch \ + file://0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch \ + file://0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch \ + file://0025-Fixing-the-issue-with-the-builtin_alloc.patch \ + file://0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch \ + file://0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch \ + file://0028-Intial-commit-for-64bit-MB-sources.patch \ + file://0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch \ + file://0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch \ + file://0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch \ + file://0032-Patch-MicroBlaze-Fixed-issues-like.patch \ + file://0033-Patch-MicroBlaze.patch \ + file://0034-Added-double-arith-instructions.patch \ + file://0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch \ + file://0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch \ + file://0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch \ + file://0038-fixing-the-typo-errors-in-umodsi3-file.patch \ + file://0039-fixing-the-32bit-LTO-related-issue9-1014024.patch \ + file://0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch \ + file://0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch \ + file://0042-fixing-the-long-long-long-mingw-toolchain-issue.patch \ + file://0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch \ + file://0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch \ + file://0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch \ + file://0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch \ + file://0047-Added-new-MB-64-single-register-arithmetic-instructi.patch \ + file://0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch \ + file://0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch \ + file://0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch \ + file://0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch \ + file://0052-Patch-MicroBlaze.patch \ + file://0053-patch-microblaze64-Add-Zero_extended-instructions.patch \ + file://microblaze-mulitlib-hack.patch \ +" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb new file mode 100644 index 00000000..b890fa33 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb @@ -0,0 +1,4 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require recipes-devtools/gcc/gcc-source.inc + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-target.inc b/meta-microblaze/recipes-devtools/gcc/gcc-target.inc new file mode 100644 index 00000000..7dac3ef4 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-target.inc @@ -0,0 +1,259 @@ +GCCMULTILIB = "--enable-multilib" +require gcc-configure-common.inc + +EXTRA_OECONF_PATHS = "\ + --with-build-sysroot=${STAGING_DIR_TARGET} \ +" + +EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu" + +# Configure gcc running on the target to default to an architecture which will +# be compatible with that of gcc-runtime (which is cross compiled to be target +# specific). For example, for ARM, ARMv6+ adds atomic instructions that may +# affect the ABI in the gcc-runtime libs. Since we can't rely on gcc on the +# target to always be passed -march etc, its built-in default needs to be safe. + +ARMFPARCHEXT ?= "" + +EXTRA_OECONF:append:armv6:class-target = " --with-arch=armv6${ARMFPARCHEXT}" +EXTRA_OECONF:append:armv7a:class-target = " --with-arch=armv7-a${ARMFPARCHEXT}" +EXTRA_OECONF:append:armv7ve:class-target = " --with-arch=armv7ve${ARMFPARCHEXT}" +EXTRA_OECONF:append:arc:class-target = " --with-cpu=${TUNE_PKGARCH}" +EXTRA_OECONF:append:x86-64:class-target = " ${@get_gcc_x86_64_arch_setting(bb, d)}" + +# libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is +# set in subdir gcc, so subdir libcc1 can't use it, export it here to +# fix the problem. +export gcc_cv_objdump = "${TARGET_PREFIX}objdump" + +EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}" + +PACKAGES = "\ + ${PN} ${PN}-plugins ${PN}-symlinks \ + g++ g++-symlinks \ + cpp cpp-symlinks \ + g77 g77-symlinks \ + gfortran gfortran-symlinks \ + gcov gcov-symlinks \ + ${PN}-doc \ + ${PN}-dev \ + ${PN}-dbg \ +" + +FILES:${PN} = "\ + ${bindir}/${TARGET_PREFIX}gcc* \ + ${bindir}/${TARGET_PREFIX}lto* \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/g++-mapper-server \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/include \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \ + ${libdir}/bfd-plugins/*.so \ +" +INSANE_SKIP:${PN} += "dev-so" +RRECOMMENDS:${PN} += "\ + libssp \ + libssp-dev \ +" +RDEPENDS:${PN} += "cpp" + +FILES:${PN}-dev = "\ + ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \ +" +FILES:${PN}-symlinks = "\ + ${bindir}/cc \ + ${bindir}/gcc \ + ${bindir}/gccbug \ +" + +FILES:${PN}-plugins = "\ + ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \ +" +ALLOW_EMPTY:${PN}-plugins = "1" + +FILES:g77 = "\ + ${bindir}/${TARGET_PREFIX}g77 \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \ +" +FILES:g77-symlinks = "\ + ${bindir}/g77 \ + ${bindir}/f77 \ +" +RRECOMMENDS:g77 = "\ + libg2c \ + libg2c-dev \ +" + +FILES:gfortran = "\ + ${bindir}/${TARGET_PREFIX}gfortran \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \ +" +RRECOMMENDS:gfortran = "\ + libquadmath \ + libquadmath-dev \ +" +FILES:gfortran-symlinks = "\ + ${bindir}/gfortran \ + ${bindir}/f95" + +FILES:cpp = "\ + ${bindir}/${TARGET_PREFIX}cpp* \ + ${base_libdir}/cpp \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1" +FILES:cpp-symlinks = "${bindir}/cpp" + +FILES:gcov = "${bindir}/${TARGET_PREFIX}gcov* \ + ${bindir}/${TARGET_PREFIX}gcov-tool* \ +" +FILES:gcov-symlinks = "${bindir}/gcov \ + ${bindir}/gcov-tool \ +" + +FILES:g++ = "\ + ${bindir}/${TARGET_PREFIX}g++* \ + ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \ +" +FILES:g++-symlinks = "\ + ${bindir}/c++ \ + ${bindir}/g++ \ +" +RRECOMMENDS:g++ = "\ + libstdc++ \ + libstdc++-dev \ + libatomic \ + libatomic-dev \ +" + +FILES:${PN}-doc = "\ + ${infodir} \ + ${mandir} \ + ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \ +" + +do_compile () { + # Prevent full target sysroot path from being used in configargs.h header, + # as it will be rewritten when used by other sysroots preventing support + # for gcc plugins. Additionally the path is embeddeded into the output + # binary, this prevents building a reproducible binary. + oe_runmake configure-gcc + sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/configargs.h + sed -i 's@${STAGING_DIR_HOST}@/@g' ${B}/gcc/configargs.h + + # Prevent sysroot/workdir paths from being used in checksum-options. + # checksum-options is used to generate a checksum which is embedded into + # the output binary. + oe_runmake TARGET-gcc=checksum-options all-gcc + sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options + sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/checksum-options + + oe_runmake all-host +} + +do_install () { + oe_runmake 'DESTDIR=${D}' install-host + + # Add unwind.h, it comes from libgcc which we don't want to build again + install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ + + # Info dir listing isn't interesting at this point so remove it if it exists. + if [ -e "${D}${infodir}/dir" ]; then + rm -f ${D}${infodir}/dir + fi + + # Cleanup some of the ${libdir}{,exec}/gcc stuff ... + rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools + rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools + rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la + rmdir ${D}${includedir} + rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude + + # Hack around specs file assumptions + test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs + + # Cleanup manpages.. + rm -rf ${D}${mandir}/man7 + + # Don't package details about the build host + rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/auto-build.h + rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/bconfig.h + + cd ${D}${bindir} + + # We care about g++ not c++ + rm -f *c++* + + # We don't care about the gcc-<version> ones for this + rm -f *gcc-?*.?* + + # Not sure why we end up with these but we don't want them... + rm -f ${TARGET_PREFIX}${TARGET_PREFIX}* + + # Symlinks so we can use these trivially on the target + if [ -e ${TARGET_PREFIX}g77 ]; then + ln -sf ${TARGET_PREFIX}g77 g77 || true + ln -sf g77 f77 || true + fi + if [ -e ${TARGET_PREFIX}gfortran ]; then + ln -sf ${TARGET_PREFIX}gfortran gfortran || true + ln -sf gfortran f95 || true + fi + ln -sf ${TARGET_PREFIX}g++ g++ + ln -sf ${TARGET_PREFIX}gcc gcc + ln -sf ${TARGET_PREFIX}cpp cpp + ln -sf ${TARGET_PREFIX}gcov gcov + ln -sf ${TARGET_PREFIX}gcov-tool gcov-tool + install -d ${D}${base_libdir} + ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp + ln -sf g++ c++ + ln -sf gcc cc + install -d ${D}${libdir}/bfd-plugins + ln -sf ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so + chown -R root:root ${D} +} + +do_install:append () { + # + # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header + # files and places the modified files into + # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the + # build not deterministic. The following code prunes all those headers + # except those under include-fixed/linux, *limits.h and README, yielding + # the same include-fixed folders no matter what sysroot + + include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed" + for f in $(find ${include_fixed} -type f); do + case $f in + */include-fixed/linux/*) + continue + ;; + */include-fixed/*limits.h) + continue + ;; + */include-fixed/README) + continue + ;; + *) + # remove file and directory if empty + bbdebug 2 "Pruning $f" + rm $f + find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \; + ;; + esac + done +} + +# Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross +# and one from here. These can confuse gcc cross where includes use #include_next +# and builds track file dependencies (e.g. perl and its makedepends code). +# For determinism we don't install this ever and rely on the copy from gcc-cross. +# [YOCTO #7287] +SYSROOT_DIRS_IGNORE += "${libdir}/gcc" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc b/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc new file mode 100644 index 00000000..f68fec58 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc @@ -0,0 +1,107 @@ +inherit qemu + +TOOLCHAIN_TEST_TARGET ??= "user" +TOOLCHAIN_TEST_HOST ??= "localhost" +TOOLCHAIN_TEST_HOST_USER ??= "root" +TOOLCHAIN_TEST_HOST_PORT ??= "2222" + +MAKE_CHECK_BOARDFLAGS ??= "" +MAKE_CHECK_BOARDARGS ??= "--target_board=${TOOLCHAIN_TEST_TARGET}${MAKE_CHECK_BOARDFLAGS}" + +python () { + # Provide the targets compiler args via targets options. This allows dejagnu to + # correctly mark incompatible tests as UNSUPPORTED (e.g. needs soft-float + # but running on hard-float target). + # + # These options are called "multilib_flags" within the gcc test suite. Most + # architectures handle these options in a sensible way such that tests that + # are incompatible with the provided multilib are marked as UNSUPPORTED. + # + # Note: multilib flags are added to the compile command after the args + # provided by any test (through dg-options), CFLAGS_FOR_TARGET is always + # added to the compile command before any other args but is not interpted + # as options like multilib flags. + # + # i686, x86-64 and aarch64 are special, since most toolchains built for + # these targets don't do multilib the tests do not get correctly marked as + # UNSUPPORTED. More importantly the test suite itself does not handle + # overriding the multilib flags where it could (like other archs do). As + # such do not pass the target compiler args for these targets. + args = d.getVar("TUNE_CCARGS").split() + if d.getVar("TUNE_ARCH") in ["i686", "x86_64", "aarch64"]: + args = [] + d.setVar("MAKE_CHECK_BOARDFLAGS", ("/" + "/".join(args)) if len(args) != 0 else "") +} + +python check_prepare() { + def generate_qemu_linux_user_config(d): + content = [] + content.append('load_generic_config "sim"') + content.append('load_base_board_description "basic-sim"') + content.append('process_multilib_options ""') + + # qemu args + qemu_binary = qemu_target_binary(d) + if not qemu_binary: + bb.fatal("Missing target qemu linux-user binary") + + args = [] + # QEMU_OPTIONS is not always valid due to -cross recipe + args += ["-r", d.getVar("OLDEST_KERNEL")] + # enable all valid instructions, since the test suite itself does not + # limit itself to the target cpu options. + # - valid for x86*, powerpc, arm, arm64 + if qemu_binary.lstrip("qemu-") in ["x86_64", "i386", "ppc", "arm", "aarch64"]: + args += ["-cpu", "max"] + + sysroot = d.getVar("RECIPE_SYSROOT") + args += ["-L", sysroot] + # lib paths are static here instead of using $libdir since this is used by a -cross recipe + libpaths = [sysroot + "/usr/lib", sysroot + "/lib"] + args += ["-E", "LD_LIBRARY_PATH={0}".format(":".join(libpaths))] + + content.append('set_board_info is_simulator 1') + content.append('set_board_info sim "{0}"'.format(qemu_binary)) + content.append('set_board_info sim,options "{0}"'.format(" ".join(args))) + + # target build/test config + content.append('set_board_info target_install {%s}' % d.getVar("TARGET_SYS")) + content.append('set_board_info ldscript ""') + #content.append('set_board_info needs_status_wrapper 1') # qemu-linux-user return codes work, and abort works fine + content.append('set_board_info gcc,stack_size 16834') + content.append('set_board_info gdb,nosignals 1') + content.append('set_board_info gcc,timeout 60') + + return "\n".join(content) + + def generate_remote_ssh_linux_config(d): + content = [] + content.append('load_generic_config "unix"') + content.append('process_multilib_options ""') + content.append("set_board_info hostname {0}".format(d.getVar("TOOLCHAIN_TEST_HOST"))) + content.append("set_board_info username {0}".format(d.getVar("TOOLCHAIN_TEST_HOST_USER"))) + + port = d.getVar("TOOLCHAIN_TEST_HOST_PORT") + content.append("set_board_info rsh_prog \"/usr/bin/ssh -p {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port)) + content.append("set_board_info rcp_prog \"/usr/bin/scp -P {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port)) + + return "\n".join(content) + + dejagnudir = d.expand("${WORKDIR}/dejagnu") + if not os.path.isdir(dejagnudir): + os.makedirs(dejagnudir) + + # write out target qemu board config + with open(os.path.join(dejagnudir, "user.exp"), "w") as f: + f.write(generate_qemu_linux_user_config(d)) + + # write out target ssh board config + with open(os.path.join(dejagnudir, "ssh.exp"), "w") as f: + f.write(generate_remote_ssh_linux_config(d)) + + # generate site.exp to provide boards + with open(os.path.join(dejagnudir, "site.exp"), "w") as f: + f.write("lappend boards_dir {0}\n".format(dejagnudir)) + f.write("set CFLAGS_FOR_TARGET \"{0}\"\n".format(d.getVar("TOOLCHAIN_OPTIONS"))) +} + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch new file mode 100644 index 00000000..66e582ca --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch @@ -0,0 +1,39 @@ +From 31f94ef5b43a984a98f0eebd2dcf1b53aa1d7bce Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 08:37:11 +0400 +Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +Upstream-Status: Inappropriate [embedded specific] +--- + configure | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 5dcaab14ae9..f76310a36bb 100755 +--- a/configure ++++ b/configure +@@ -10165,7 +10165,7 @@ fi + # for target_alias and gcc doesn't manage it consistently. + target_configargs="--cache-file=./config.cache ${target_configargs}" + +-FLAGS_FOR_TARGET= ++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET" + case " $target_configdirs " in + *" newlib "*) + case " $target_configargs " in +diff --git a/configure.ac b/configure.ac +index 85977482aee..8b9097c7a45 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3346,7 +3346,7 @@ fi + # for target_alias and gcc doesn't manage it consistently. + target_configargs="--cache-file=./config.cache ${target_configargs}" + +-FLAGS_FOR_TARGET= ++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET" + case " $target_configdirs " in + *" newlib "*) + case " $target_configargs " in diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch new file mode 100644 index 00000000..5aa635b3 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch @@ -0,0 +1,239 @@ +From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 8 Mar 2021 16:04:20 -0800 +Subject: [PATCH] gcc: poison-system-directories + +Add /sw/include and /opt/include based on the original +zecke-no-host-includes.patch patch. The original patch checked for +/usr/include, /sw/include and /opt/include and then triggered a failure and +aborted. + +Instead, we add the two missing items to the current scan. If the user +wants this to be a failure, they can add "-Werror=poison-system-directories". + +Upstream-Status: Pending +Signed-off-by: Mark Hatle <mark.hatle@windriver.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/common.opt | 4 ++++ + gcc/config.in | 10 ++++++++++ + gcc/configure | 19 +++++++++++++++++++ + gcc/configure.ac | 16 ++++++++++++++++ + gcc/doc/invoke.texi | 9 +++++++++ + gcc/gcc.cc | 15 ++++++++++++--- + gcc/incpath.cc | 21 +++++++++++++++++++++ + 7 files changed, 91 insertions(+), 3 deletions(-) + +diff --git a/gcc/common.opt b/gcc/common.opt +index 8a0dafc52..0357868e2 100644 +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -710,6 +710,10 @@ Wreturn-local-addr + Common Var(warn_return_local_addr) Init(1) Warning + Warn about returning a pointer/reference to a local or temporary variable. + ++Wpoison-system-directories ++Common Var(flag_poison_system_directories) Init(1) Warning ++Warn for -I and -L options using system directories if cross compiling ++ + Wshadow + Common Var(warn_shadow) Warning + Warn when one variable shadows another. Same as -Wshadow=global. +diff --git a/gcc/config.in b/gcc/config.in +index 64c27c9cf..a693cb8a8 100644 +--- a/gcc/config.in ++++ b/gcc/config.in +@@ -230,6 +230,16 @@ + #endif + + ++/* Define to warn for use of native system header directories */ ++#ifndef USED_FOR_TARGET ++#undef ENABLE_POISON_SYSTEM_DIRECTORIES ++#endif ++/* Define to warn for use of native system header directories */ ++#ifndef USED_FOR_TARGET ++#undef POISON_BY_DEFAULT ++#endif ++ ++ + /* Define if you want all operations on RTL (the basic data structure of the + optimizer and back end) to be checked for dynamic type safety at runtime. + This is quite expensive. */ +diff --git a/gcc/configure b/gcc/configure +index 2b83acfb0..8bb97578c 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -1023,6 +1023,7 @@ enable_maintainer_mode + enable_link_mutex + enable_link_serialization + enable_version_specific_runtime_libs ++enable_poison_system_directories + enable_plugin + enable_host_shared + enable_libquadmath_support +@@ -1785,6 +1786,8 @@ Optional Features: + --enable-version-specific-runtime-libs + specify that runtime libraries should be installed + in a compiler-specific directory ++ --enable-poison-system-directories ++ warn for use of native system header directories + --enable-plugin enable plugin support + --enable-host-shared build host code as shared libraries + --disable-libquadmath-support +@@ -31996,6 +31999,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then : + fi + + ++# Check whether --enable-poison-system-directories was given. ++if test "${enable_poison_system_directories+set}" = set; then : ++ enableval=$enable_poison_system_directories; ++else ++ enable_poison_system_directories=no ++fi ++ ++if test "x${enable_poison_system_directories}" != "xno"; then ++ ++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h ++if test "$enable_poison_system_directories" = "error"; then ++$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h ++fi ++ ++fi ++ + # Substitute configuration variables + + +diff --git a/gcc/configure.ac b/gcc/configure.ac +index daf2a708c..6155b83a7 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -7435,6 +7435,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs, + [specify that runtime libraries should be + installed in a compiler-specific directory])]) + ++AC_ARG_ENABLE([poison-system-directories], ++ AS_HELP_STRING([--enable-poison-system-directories], ++ [warn for use of native system header directories (no/yes/error)]),, ++ [enable_poison_system_directories=no]) ++AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories]) ++if test "x${enable_poison_system_directories}" != "xno"; then ++ AC_MSG_NOTICE([poisoned directories enabled]) ++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], ++ [1], ++ [Define to warn for use of native system header directories]) ++ if test $enable_poison_system_directories = "error"; then ++ AC_MSG_NOTICE([poisoned directories are fatal]) ++ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors]) ++ fi ++fi ++ + # Substitute configuration variables + AC_SUBST(subdirs) + AC_SUBST(srcdir) +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index ff6c338be..a8ebfa59a 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}. + -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol + -Wparentheses -Wno-pedantic-ms-format @gol + -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol ++-Wno-poison-system-directories @gol + -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol + -Wrestrict -Wno-return-local-addr -Wreturn-type @gol + -Wno-scalar-storage-order -Wsequence-point @gol +@@ -8029,6 +8030,14 @@ made up of data only and thus requires no special treatment. But, for + most targets, it is made up of code and thus requires the stack to be + made executable in order for the program to work properly. + ++@item -Wno-poison-system-directories ++@opindex Wno-poison-system-directories ++Do not warn for @option{-I} or @option{-L} options using system ++directories such as @file{/usr/include} when cross compiling. This ++option is intended for use in chroot environments when such ++directories contain the correct headers and libraries for the target ++system rather than the host. ++ + @item -Wfloat-equal + @opindex Wfloat-equal + @opindex Wno-float-equal +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index beefde7f6..4e6557b3c 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -1162,6 +1162,8 @@ proper position among the other output files. */ + "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ + "%X %{o*} %{e*} %{N} %{n} %{r}\ + %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ ++ %{Wno-poison-system-directories:--no-poison-system-directories} \ ++ %{Werror=poison-system-directories:--error-poison-system-directories} \ + %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ + VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ + %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ +@@ -1257,8 +1259,11 @@ static const char *cpp_unique_options = + static const char *cpp_options = + "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ + %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\ +- %{!fno-working-directory:-fworking-directory}}} %{O*}\ +- %{undef} %{save-temps*:-fpch-preprocess}"; ++ %{!fno-working-directory:-fworking-directory}}} %{O*}" ++#ifdef POISON_BY_DEFAULT ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}" ++#endif ++ " %{undef} %{save-temps*:-fpch-preprocess}"; + + /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al. + +@@ -1287,7 +1292,11 @@ static const char *cc1_options = + %{coverage:-fprofile-arcs -ftest-coverage}\ + %{fprofile-arcs|fprofile-generate*|coverage:\ + %{!fprofile-update=single:\ +- %{pthread:-fprofile-update=prefer-atomic}}}"; ++ %{pthread:-fprofile-update=prefer-atomic}}}" ++#ifdef POISON_BY_DEFAULT ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}" ++#endif ++ ; + + static const char *asm_options = + "%{-target-help:%:print-asm-header()} " +diff --git a/gcc/incpath.cc b/gcc/incpath.cc +index 622204a38..5ac03c086 100644 +--- a/gcc/incpath.cc ++++ b/gcc/incpath.cc +@@ -26,6 +26,7 @@ + #include "intl.h" + #include "incpath.h" + #include "cppdefault.h" ++#include "diagnostic-core.h" + + /* Microsoft Windows does not natively support inodes. + VMS has non-numeric inodes. */ +@@ -399,6 +400,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose) + } + fprintf (stderr, _("End of search list.\n")); + } ++ ++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES ++ if (flag_poison_system_directories) ++ { ++ struct cpp_dir *p; ++ ++ for (p = heads[INC_QUOTE]; p; p = p->next) ++ { ++ if ((!strncmp (p->name, "/usr/include", 12)) ++ || (!strncmp (p->name, "/usr/local/include", 18)) ++ || (!strncmp (p->name, "/usr/X11R6/include", 18)) ++ || (!strncmp (p->name, "/sw/include", 11)) ++ || (!strncmp (p->name, "/opt/include", 12))) ++ warning (OPT_Wpoison_system_directories, ++ "include location \"%s\" is unsafe for " ++ "cross-compilation", ++ p->name); ++ } ++ } ++#endif + } + + /* Use given -I paths for #include "..." but not #include <...>, and diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch new file mode 100644 index 00000000..e83f05b8 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch @@ -0,0 +1,134 @@ +From 34b861e7a4cfd7b1f0d2c0f8cf9bb0b0b81eb61a Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 09:10:06 +0400 +Subject: [PATCH] 64-bit multilib hack. + +GCC has internal multilib handling code but it assumes a very specific rigid directory +layout. The build system implementation of multilib layout is very generic and allows +complete customisation of the library directories. + +This patch is a partial solution to allow any custom directories to be passed into gcc +and handled correctly. It forces gcc to use the base_libdir (which is the current +directory, "."). We need to do this for each multilib that is configured as we don't +know which compiler options may be being passed into the compiler. Since we have a compiler +per mulitlib at this point that isn't an issue. + +The one problem is the target compiler is only going to work for the default multlilib at +this point. Ideally we'd figure out which multilibs were being enabled with which paths +and be able to patch these entries with a complete set of correct paths but this we +don't have such code at this point. This is something the target gcc recipe should do +and override these platform defaults in its build config. + +Do same for riscv64, aarch64 & arc + +RP 15/8/11 + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com> +Signed-off-by: Mark Hatle <mark.hatle@windriver.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/config/aarch64/t-aarch64-linux | 8 ++++---- + gcc/config/arc/t-multilib-linux | 4 ++-- + gcc/config/i386/t-linux64 | 6 ++---- + gcc/config/mips/t-linux64 | 10 +++------- + gcc/config/riscv/t-linux | 6 ++++-- + gcc/config/rs6000/t-linux64 | 5 ++--- + 6 files changed, 17 insertions(+), 22 deletions(-) + +diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux +index d0cd546002a..f4056d68372 100644 +--- a/gcc/config/aarch64/t-aarch64-linux ++++ b/gcc/config/aarch64/t-aarch64-linux +@@ -21,8 +21,8 @@ + LIB1ASMSRC = aarch64/lib1funcs.asm + LIB1ASMFUNCS = _aarch64_sync_cache_range + +-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be) +-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu) +-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu) ++#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be) ++#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu) ++#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu) + +-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) ++#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) +diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux +index ecb9ae6859f..12a164028d4 100644 +--- a/gcc/config/arc/t-multilib-linux ++++ b/gcc/config/arc/t-multilib-linux +@@ -16,9 +16,9 @@ + # along with GCC; see the file COPYING3. If not see + # <http://www.gnu.org/licenses/>. + +-MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400 ++#MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400 + +-MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400 ++#MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400 + + # Aliases: + MULTILIB_MATCHES += mcpu?arc700=mA7 +diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64 +index 5526ad0e6cc..fa51c88912b 100644 +--- a/gcc/config/i386/t-linux64 ++++ b/gcc/config/i386/t-linux64 +@@ -32,7 +32,5 @@ + # + comma=, + MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG)) +-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS))) +-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu) +-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu) +-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) ++MULTILIB_DIRNAMES = . . ++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) +diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64 +index 2fdd8e00407..04f2099250f 100644 +--- a/gcc/config/mips/t-linux64 ++++ b/gcc/config/mips/t-linux64 +@@ -17,10 +17,6 @@ + # <http://www.gnu.org/licenses/>. + + MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64 +-MULTILIB_DIRNAMES = n32 32 64 +-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el) +-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft) +-MULTILIB_OSDIRNAMES = \ +- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ +- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ +- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) ++MULTILIB_DIRNAMES = . . . ++MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ++ +diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux +index 216d2776a18..e4d817621fc 100644 +--- a/gcc/config/riscv/t-linux ++++ b/gcc/config/riscv/t-linux +@@ -1,3 +1,5 @@ + # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/ +-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) +-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) ++#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) ++MULTILIB_DIRNAMES := . . ++#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) ++MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) +diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 +index 47e0efd5764..05f5a3f188e 100644 +--- a/gcc/config/rs6000/t-linux64 ++++ b/gcc/config/rs6000/t-linux64 +@@ -26,10 +26,9 @@ + # MULTILIB_OSDIRNAMES according to what is found on the target. + + MULTILIB_OPTIONS := m64/m32 +-MULTILIB_DIRNAMES := 64 32 ++MULTILIB_DIRNAMES := . . + MULTILIB_EXTRA_OPTS := +-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu) +-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) ++MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) + + rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc + $(COMPILE) $< diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch new file mode 100644 index 00000000..e8f21634 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch @@ -0,0 +1,64 @@ +From 7f40f8321fb999e9b34d948724517d3fb0d26820 Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Thu, 28 Oct 2021 11:33:40 +0100 +Subject: [PATCH] Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these + errors. + +If CXXFLAGS contains something unsupported by the build CXX, we see build failures (e.g. using -fmacro-prefix-map for the target). + +2021-10-28 Richard Purdie <richard.purdie@linuxfoundation.org> + +ChangeLog: + + * Makefile.in: Regenerate. + * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides + +Upstream-Status: Pending [should be submittable] + +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Makefile.in | 2 ++ + Makefile.tpl | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/Makefile.in b/Makefile.in +index 593495e1650..1d9c83cc566 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -176,6 +176,7 @@ BUILD_EXPORTS = \ + # built for the build system to override those in BASE_FLAGS_TO_PASS. + EXTRA_BUILD_FLAGS = \ + CFLAGS="$(CFLAGS_FOR_BUILD)" \ ++ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ + LDFLAGS="$(LDFLAGS_FOR_BUILD)" + + # This is the list of directories to built for the host system. +@@ -207,6 +208,7 @@ HOST_EXPORTS = \ + CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ + CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ + CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ ++ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \ + LD="$(LD)"; export LD; \ +diff --git a/Makefile.tpl b/Makefile.tpl +index ef58fac2b9a..bab04f335c2 100644 +--- a/Makefile.tpl ++++ b/Makefile.tpl +@@ -179,6 +179,7 @@ BUILD_EXPORTS = \ + # built for the build system to override those in BASE_FLAGS_TO_PASS. + EXTRA_BUILD_FLAGS = \ + CFLAGS="$(CFLAGS_FOR_BUILD)" \ ++ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ + LDFLAGS="$(LDFLAGS_FOR_BUILD)" + + # This is the list of directories to built for the host system. +@@ -210,6 +211,7 @@ HOST_EXPORTS = \ + CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ + CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ + CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ ++ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \ + LD="$(LD)"; export LD; \ diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch new file mode 100644 index 00000000..e34eb2cf --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch @@ -0,0 +1,92 @@ +From 5455fc1de74897a27c1199dc5611ec02243e24af Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 09:17:25 +0400 +Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B} + +Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that +the source can be shared between gcc-cross-initial, +gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build. + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +Upstream-Status: Pending + +While compiling gcc-crosssdk-initial-x86_64 on some host, there is +occasionally failure that test the existance of default.h doesn't +work, the reason is tm_include_list='** defaults.h' rather than +tm_include_list='** ./defaults.h' + +So we add the test condition for this situation. +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> +--- + gcc/Makefile.in | 2 +- + gcc/configure | 4 ++-- + gcc/configure.ac | 4 ++-- + gcc/mkconfig.sh | 4 ++-- + 4 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/gcc/Makefile.in b/gcc/Makefile.in +index 31ff95500c9..a8277254696 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -553,7 +553,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ + TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ + + xmake_file=@xmake_file@ +-tmake_file=@tmake_file@ ++tmake_file=@tmake_file@ ./t-oe + TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@ + TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@ + TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@ +diff --git a/gcc/configure b/gcc/configure +index dc2d59701ad..3fc0e2f5813 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -13381,8 +13381,8 @@ for f in $tm_file; do + tm_include_list="${tm_include_list} $f" + ;; + defaults.h ) +- tm_file_list="${tm_file_list} \$(srcdir)/$f" +- tm_include_list="${tm_include_list} $f" ++ tm_file_list="${tm_file_list} ./$f" ++ tm_include_list="${tm_include_list} ./$f" + ;; + * ) + tm_file_list="${tm_file_list} \$(srcdir)/config/$f" +diff --git a/gcc/configure.ac b/gcc/configure.ac +index 36ce78924de..46de496b256 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -2332,8 +2332,8 @@ for f in $tm_file; do + tm_include_list="${tm_include_list} $f" + ;; + defaults.h ) +- tm_file_list="${tm_file_list} \$(srcdir)/$f" +- tm_include_list="${tm_include_list} $f" ++ tm_file_list="${tm_file_list} ./$f" ++ tm_include_list="${tm_include_list} ./$f" + ;; + * ) + tm_file_list="${tm_file_list} \$(srcdir)/config/$f" +diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh +index 91cc43f69ff..8de33713cd8 100644 +--- a/gcc/mkconfig.sh ++++ b/gcc/mkconfig.sh +@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then + if [ $# -ge 1 ]; then + echo '#ifdef IN_GCC' >> ${output}T + for file in "$@"; do +- if test x"$file" = x"defaults.h"; then ++ if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then + postpone_defaults_h="yes" + else + echo "# include \"$file\"" >> ${output}T +@@ -106,7 +106,7 @@ esac + + # If we postponed including defaults.h, add the #include now. + if test x"$postpone_defaults_h" = x"yes"; then +- echo "# include \"defaults.h\"" >> ${output}T ++ echo "# include \"./defaults.h\"" >> ${output}T + fi + + # Add multiple inclusion protection guard, part two. diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch new file mode 100644 index 00000000..b08aecc7 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch @@ -0,0 +1,53 @@ +From abc3b82ab24169277f2090e9df1ceac3573142be Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 09:22:00 +0400 +Subject: [PATCH] cpp: honor sysroot. + +Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile +preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location +rather than the --sysroot option specified on the commandline. If access to that directory is +permission denied (unreadable), gcc will error. + +This happens when ccache is in use due to the fact it uses preprocessed source files. + +The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix, +-isystem, -isysroot happen and the correct sysroot is used. + +[YOCTO #2074] + +RP 2012/04/13 + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +Upstream-Status: Pending +--- + gcc/cp/lang-specs.h | 2 +- + gcc/gcc.cc | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h +index f35c9fab76b..19ddc98ce7f 100644 +--- a/gcc/cp/lang-specs.h ++++ b/gcc/cp/lang-specs.h +@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3. If not see + {".ii", "@c++-cpp-output", 0, 0, 0}, + {"@c++-cpp-output", + "%{!E:%{!M:%{!MM:" +- " cc1plus -fpreprocessed %i %(cc1_options) %2" ++ " cc1plus -fpreprocessed %i %I %(cc1_options) %2" + " %{!fsyntax-only:" + " %{fmodule-only:%{!S:-o %g.s%V}}" + " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}" +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index ce161d3c853..aa4cf92fb78 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -1476,7 +1476,7 @@ static const struct compiler default_compilers[] = + %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, + {".i", "@cpp-output", 0, 0, 0}, + {"@cpp-output", +- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, ++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {".s", "@assembler", 0, 0, 0}, + {"@assembler", + "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0}, diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch new file mode 100644 index 00000000..b59eed57 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch @@ -0,0 +1,403 @@ +From 4de00af67b57b5440bdf61ab364ad959ad0aeee7 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 09:24:50 +0400 +Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER + relative to SYSTEMLIBS_DIR + +This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER +relative to SYSTEMLIBS_DIR which can be set in generated headers +This breaks the assumption of hardcoded multilib in gcc +Change is only for the supported architectures in OE including +SH, sparc, alpha for possible future support (if any) + +Removes the do_headerfix task in metadata + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +Upstream-Status: Inappropriate [OE configuration] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/config/aarch64/aarch64-linux.h | 4 ++-- + gcc/config/alpha/linux-elf.h | 4 ++-- + gcc/config/arm/linux-eabi.h | 6 +++--- + gcc/config/arm/linux-elf.h | 2 +- + gcc/config/i386/linux.h | 4 ++-- + gcc/config/i386/linux64.h | 12 ++++++------ + gcc/config/linux.h | 8 ++++---- + gcc/config/loongarch/gnu-user.h | 4 ++-- + gcc/config/microblaze/linux.h | 4 ++-- + gcc/config/mips/linux.h | 18 +++++++++--------- + gcc/config/nios2/linux.h | 4 ++-- + gcc/config/riscv/linux.h | 4 ++-- + gcc/config/rs6000/linux64.h | 15 +++++---------- + gcc/config/rs6000/sysv4.h | 4 ++-- + gcc/config/s390/linux.h | 8 ++++---- + gcc/config/sh/linux.h | 4 ++-- + gcc/config/sparc/linux.h | 2 +- + gcc/config/sparc/linux64.h | 4 ++-- + 18 files changed, 53 insertions(+), 58 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h +index 5e4553d79f5..877e8841eb2 100644 +--- a/gcc/config/aarch64/aarch64-linux.h ++++ b/gcc/config/aarch64/aarch64-linux.h +@@ -21,10 +21,10 @@ + #ifndef GCC_AARCH64_LINUX_H + #define GCC_AARCH64_LINUX_H + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + + #undef MUSL_DYNAMIC_LINKER +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + + #undef ASAN_CC1_SPEC + #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" +diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h +index 17f16a55910..0a7be38fa63 100644 +--- a/gcc/config/alpha/linux-elf.h ++++ b/gcc/config/alpha/linux-elf.h +@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see + #define EXTRA_SPECS \ + { "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" +-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" ++#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0" + #if DEFAULT_LIBC == LIBC_UCLIBC + #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" + #elif DEFAULT_LIBC == LIBC_GLIBC +diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h +index 50cc0bc6d08..17c18b27145 100644 +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -65,8 +65,8 @@ + GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */ + + #undef GLIBC_DYNAMIC_LINKER +-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3" +-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3" ++#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3" ++#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3" + #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT + + #define GLIBC_DYNAMIC_LINKER \ +@@ -89,7 +89,7 @@ + #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" + #endif + #define MUSL_DYNAMIC_LINKER \ +- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1" ++ SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1" + + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ +diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h +index df3da67c4f0..37456e9d5a4 100644 +--- a/gcc/config/arm/linux-elf.h ++++ b/gcc/config/arm/linux-elf.h +@@ -60,7 +60,7 @@ + + #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" + + #define LINUX_TARGET_LINK_SPEC "%{h*} \ + %{static:-Bstatic} \ +diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h +index 5d99ee56d5b..a76022c9ccc 100644 +--- a/gcc/config/i386/linux.h ++++ b/gcc/config/i386/linux.h +@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see + <http://www.gnu.org/licenses/>. */ + + #define GNU_USER_LINK_EMULATION "elf_i386" +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" + + #undef MUSL_DYNAMIC_LINKER +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" ++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1" +diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h +index 8681e36f10d..ddce49b6b60 100644 +--- a/gcc/config/i386/linux64.h ++++ b/gcc/config/i386/linux64.h +@@ -27,13 +27,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #define GNU_USER_LINK_EMULATION64 "elf_x86_64" + #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64" + +-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" +-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" +-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" ++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2" ++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2" ++#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2" + + #undef MUSL_DYNAMIC_LINKER32 +-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" ++#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1" + #undef MUSL_DYNAMIC_LINKER64 +-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1" ++#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1" + #undef MUSL_DYNAMIC_LINKERX32 +-#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" ++#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1" +diff --git a/gcc/config/linux.h b/gcc/config/linux.h +index 74f70793d90..4ce173384ef 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -99,10 +99,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + GLIBC_DYNAMIC_LINKER must be defined for each target using them, or + GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets + supporting both 32-bit and 64-bit compilation. */ +-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" +-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" +-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" +-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0" ++#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0" ++#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0" ++#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0" ++#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0" + #define BIONIC_DYNAMIC_LINKER "/system/bin/linker" + #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" + #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" +diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h +index 664dc9206ad..082bd7cfc6f 100644 +--- a/gcc/config/loongarch/gnu-user.h ++++ b/gcc/config/loongarch/gnu-user.h +@@ -31,11 +31,11 @@ along with GCC; see the file COPYING3. If not see + + #undef GLIBC_DYNAMIC_LINKER + #define GLIBC_DYNAMIC_LINKER \ +- "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1" ++ SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1" + + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER \ +- "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1" ++ SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1" + + #undef GNU_USER_TARGET_LINK_SPEC + #define GNU_USER_TARGET_LINK_SPEC \ +diff --git a/gcc/config/microblaze/linux.h b/gcc/config/microblaze/linux.h +index 5b1a365eda4..2e63df1ae9c 100644 +--- a/gcc/config/microblaze/linux.h ++++ b/gcc/config/microblaze/linux.h +@@ -28,7 +28,7 @@ + #undef TLS_NEEDS_GOT + #define TLS_NEEDS_GOT 1 + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "/ld.so.1" + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" + + #if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */ +@@ -38,7 +38,7 @@ + #endif + + #undef MUSL_DYNAMIC_LINKER +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1" ++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1" + + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ +diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h +index 230b7789bb8..d96d134bfcf 100644 +--- a/gcc/config/mips/linux.h ++++ b/gcc/config/mips/linux.h +@@ -22,29 +22,29 @@ along with GCC; see the file COPYING3. If not see + #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32" + + #define GLIBC_DYNAMIC_LINKER32 \ +- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}" ++ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}" + #define GLIBC_DYNAMIC_LINKER64 \ +- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}" ++ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}" + #define GLIBC_DYNAMIC_LINKERN32 \ +- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}" ++ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}" + + #undef UCLIBC_DYNAMIC_LINKER32 + #define UCLIBC_DYNAMIC_LINKER32 \ +- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}" ++ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}" + #undef UCLIBC_DYNAMIC_LINKER64 + #define UCLIBC_DYNAMIC_LINKER64 \ +- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}" ++ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}" + #define UCLIBC_DYNAMIC_LINKERN32 \ +- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}" ++ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}" + + #undef MUSL_DYNAMIC_LINKER32 + #define MUSL_DYNAMIC_LINKER32 \ +- "/lib/ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" ++ SYSTEMLIBS_DIR "ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" + #undef MUSL_DYNAMIC_LINKER64 + #define MUSL_DYNAMIC_LINKER64 \ +- "/lib/ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" ++ SYSTEMLIBS_DIR "ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" + #define MUSL_DYNAMIC_LINKERN32 \ +- "/lib/ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" ++ SYSTEMLIBS_DIR "ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" + + #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" + #define GNU_USER_DYNAMIC_LINKERN32 \ +diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h +index f5dd813acad..7a13e1c9799 100644 +--- a/gcc/config/nios2/linux.h ++++ b/gcc/config/nios2/linux.h +@@ -29,8 +29,8 @@ + #undef CPP_SPEC + #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1" +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-nios2.so.1" ++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-nios2.so.1" + + #undef LINK_SPEC + #define LINK_SPEC LINK_SPEC_ENDIAN \ +diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h +index 38803723ba9..d5ef8a96a19 100644 +--- a/gcc/config/riscv/linux.h ++++ b/gcc/config/riscv/linux.h +@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see + GNU_USER_TARGET_OS_CPP_BUILTINS(); \ + } while (0) + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1" + + #define MUSL_ABI_SUFFIX \ + "%{mabi=ilp32:-sf}" \ +@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see + "%{mabi=lp64d:}" + + #undef MUSL_DYNAMIC_LINKER +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" ++#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" + + /* Because RISC-V only has word-sized atomics, it requries libatomic where + others do not. So link libatomic by default, as needed. */ +diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h +index b2a7afabc73..364c1a5b155 100644 +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -339,24 +339,19 @@ extern int dot_symbols; + #undef LINK_OS_DEFAULT_SPEC + #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" + +-#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1" +- ++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1" + #ifdef LINUX64_DEFAULT_ABI_ELFv2 +-#define GLIBC_DYNAMIC_LINKER64 \ +-"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \ +-":%(dynamic_linker_prefix)/lib64/ld64.so.2}" ++#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}" + #else +-#define GLIBC_DYNAMIC_LINKER64 \ +-"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \ +-":%(dynamic_linker_prefix)/lib64/ld64.so.1}" ++#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}" + #endif + + #undef MUSL_DYNAMIC_LINKER32 + #define MUSL_DYNAMIC_LINKER32 \ +- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" ++ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" + #undef MUSL_DYNAMIC_LINKER64 + #define MUSL_DYNAMIC_LINKER64 \ +- "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" ++ SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" + + #undef DEFAULT_ASM_ENDIAN + #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) +diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h +index 7e2519de5d4..a73954d9de5 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -779,10 +779,10 @@ GNU_USER_TARGET_CC1_SPEC + + #define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","") + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1" + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER \ +- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" ++ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" + + #ifndef GNU_USER_DYNAMIC_LINKER + #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER +diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h +index d7b7e7a7b02..0139b4d06ca 100644 +--- a/gcc/config/s390/linux.h ++++ b/gcc/config/s390/linux.h +@@ -72,13 +72,13 @@ along with GCC; see the file COPYING3. If not see + #define MULTILIB_DEFAULTS { "m31" } + #endif + +-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1" +-#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1" ++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1" ++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1" + + #undef MUSL_DYNAMIC_LINKER32 +-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1" ++#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-s390.so.1" + #undef MUSL_DYNAMIC_LINKER64 +-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1" ++#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-s390x.so.1" + + #undef LINK_SPEC + #define LINK_SPEC \ +diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h +index d96d077c99e..7d27f9893ee 100644 +--- a/gcc/config/sh/linux.h ++++ b/gcc/config/sh/linux.h +@@ -61,10 +61,10 @@ along with GCC; see the file COPYING3. If not see + + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER \ +- "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \ ++ SYSTEMLIBS_DIR "ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \ + "%{mfdpic:-fdpic}.so.1" + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" + + #undef SUBTARGET_LINK_EMUL_SUFFIX + #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}" +diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h +index 6a809e9092d..60603765ad6 100644 +--- a/gcc/config/sparc/linux.h ++++ b/gcc/config/sparc/linux.h +@@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); + When the -shared link option is used a final link is not being + done. */ + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" + + #undef LINK_SPEC + #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ +diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h +index d08a2ef96fe..e6955da0a5b 100644 +--- a/gcc/config/sparc/linux64.h ++++ b/gcc/config/sparc/linux64.h +@@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see + When the -shared link option is used a final link is not being + done. */ + +-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" +-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2" ++#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2" ++#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2" + + #ifdef SPARC_BI_ARCH + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch new file mode 100644 index 00000000..c9bc38cc --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch @@ -0,0 +1,39 @@ +From 5117519c1897a49b09fe7fff213b9c2ea15d37f5 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 09:29:11 +0400 +Subject: [PATCH] libtool + +libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64 +when running on am x86_64 build host. + +This patch stops this speading to libdir in the libstdc++.la file within libtool. +Arguably, it shouldn't be passing this into libtool in the first place but +for now this resolves the nastiest problems this causes. + +func_normal_abspath would resolve an empty path to `pwd` so we need +to filter the zero case. + +RP 2012/8/24 + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +Upstream-Status: Pending +--- + ltmain.sh | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ltmain.sh b/ltmain.sh +index 70990740b6c..ee938056bef 100644 +--- a/ltmain.sh ++++ b/ltmain.sh +@@ -6359,6 +6359,10 @@ func_mode_link () + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" ++ if test -n "$install_libdir"; then ++ func_normal_abspath "$install_libdir" ++ install_libdir=$func_normal_abspath_result ++ fi + + oldlibs= + if test -z "$rpath"; then diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch new file mode 100644 index 00000000..dd67b115 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch @@ -0,0 +1,40 @@ +From 32129f9682d0d27fc67af10f077ad2768935cbe6 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 09:30:32 +0400 +Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI. + +The LINK_SPEC for linux gets overwritten by linux-eabi.h which +means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result +the option is not passed to linker when chosing march=armv4 +This patch redefines this in linux-eabi.h and reinserts it +for eabi defaulting toolchains. + +We might want to send it upstream. + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +Upstream-Status: Pending +--- + gcc/config/arm/linux-eabi.h | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h +index 17c18b27145..8eacb099317 100644 +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -91,10 +91,14 @@ + #define MUSL_DYNAMIC_LINKER \ + SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1" + ++/* For armv4 we pass --fix-v4bx to linker to support EABI */ ++#undef TARGET_FIX_V4BX_SPEC ++#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}" ++ + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ + #undef LINK_SPEC +-#define LINK_SPEC EABI_LINK_SPEC \ ++#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC \ + LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \ + LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch new file mode 100644 index 00000000..45edc62e --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch @@ -0,0 +1,99 @@ +From bf85b8bbcb4b77725d4c22c1bb25a29f6ff21038 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 29 Mar 2013 09:33:04 +0400 +Subject: [PATCH] Use the multilib config files from ${B} instead of using the + ones from ${S} + +Use the multilib config files from ${B} instead of using the ones from ${S} +so that the source can be shared between gcc-cross-initial, +gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build. + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Constantin Musca <constantinx.musca@intel.com> + +Upstream-Status: Inappropriate [configuration] +--- + gcc/configure | 22 ++++++++++++++++++---- + gcc/configure.ac | 22 ++++++++++++++++++---- + 2 files changed, 36 insertions(+), 8 deletions(-) + +diff --git a/gcc/configure b/gcc/configure +index 3fc0e2f5813..2f0f0e057a9 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -13361,10 +13361,20 @@ done + tmake_file_= + for f in ${tmake_file} + do +- if test -f ${srcdir}/config/$f +- then +- tmake_file_="${tmake_file_} \$(srcdir)/config/$f" +- fi ++ case $f in ++ */t-linux64 ) ++ if test -f ./config/$f ++ then ++ tmake_file_="${tmake_file_} ./config/$f" ++ fi ++ ;; ++ * ) ++ if test -f ${srcdir}/config/$f ++ then ++ tmake_file_="${tmake_file_} \$(srcdir)/config/$f" ++ fi ++ ;; ++ esac + done + tmake_file="${tmake_file_}${omp_device_property_tmake_file}" + +@@ -13375,6 +13385,10 @@ tm_file_list="options.h" + tm_include_list="options.h insn-constants.h" + for f in $tm_file; do + case $f in ++ */linux64.h ) ++ tm_file_list="${tm_file_list} ./config/$f" ++ tm_include_list="${tm_include_list} ./config/$f" ++ ;; + ./* ) + f=`echo $f | sed 's/^..//'` + tm_file_list="${tm_file_list} $f" +diff --git a/gcc/configure.ac b/gcc/configure.ac +index 46de496b256..6155b83a732 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -2312,10 +2312,20 @@ done + tmake_file_= + for f in ${tmake_file} + do +- if test -f ${srcdir}/config/$f +- then +- tmake_file_="${tmake_file_} \$(srcdir)/config/$f" +- fi ++ case $f in ++ */t-linux64 ) ++ if test -f ./config/$f ++ then ++ tmake_file_="${tmake_file_} ./config/$f" ++ fi ++ ;; ++ * ) ++ if test -f ${srcdir}/config/$f ++ then ++ tmake_file_="${tmake_file_} \$(srcdir)/config/$f" ++ fi ++ ;; ++ esac + done + tmake_file="${tmake_file_}${omp_device_property_tmake_file}" + +@@ -2326,6 +2336,10 @@ tm_file_list="options.h" + tm_include_list="options.h insn-constants.h" + for f in $tm_file; do + case $f in ++ */linux64.h ) ++ tm_file_list="${tm_file_list} ./config/$f" ++ tm_include_list="${tm_include_list} ./config/$f" ++ ;; + ./* ) + f=`echo $f | sed 's/^..//'` + tm_file_list="${tm_file_list} $f" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch new file mode 100644 index 00000000..352c6eec --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch @@ -0,0 +1,28 @@ +From e5463727ff028cee5e452da38f5b4c44d52e412e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 20 Feb 2015 09:39:38 +0000 +Subject: [PATCH] Avoid using libdir from .la which usually points to a host + path + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Jonathan Liu <net147@gmail.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ltmain.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/ltmain.sh b/ltmain.sh +index ee938056bef..9ebc7e3d1e0 100644 +--- a/ltmain.sh ++++ b/ltmain.sh +@@ -5628,6 +5628,9 @@ func_mode_link () + absdir="$abs_ladir" + libdir="$abs_ladir" + else ++ # Instead of using libdir from .la which usually points to a host path, ++ # use the path the .la is contained in. ++ libdir="$abs_ladir" + dir="$libdir" + absdir="$libdir" + fi diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch new file mode 100644 index 00000000..f52e21ed --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch @@ -0,0 +1,55 @@ +From 710d1325474e708e6b34eebe09f3f130420af293 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 31 Jan 2023 22:03:38 -0800 +Subject: [PATCH] aarch64: Fix include paths when S != B + +aarch64.h gets copied into build directory when built out of tree, in +this case build uses this file but does not find the includes inside it +since they are not found in any of include paths specified in compiler +cmdline. + +Fixes build errors like + +% g++ -c -isystem/mnt/b/yoe/master/build/tmp/work/x86_64-linux/gcc-cross-aarch64/13.0.1-r0/recipe-sysroot-native/usr/include -O2 -pipe -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/build -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/../include -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/../libcpp/include -o build/gencheck.o ../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/gencheck.cc +In file included from ./tm.h:34, + from ../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/gencheck.cc:23: +./config/aarch64/aarch64.h:164:10: fatal error: aarch64-option-extensions.def: No such file or directory + 164 | #include "aarch64-option-extensions.def" + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +compilation terminated. + +See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105144 + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/config/aarch64/aarch64.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index 155cace6afe..07d68958908 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -161,8 +161,8 @@ + enum class aarch64_feature : unsigned char { + #define AARCH64_OPT_EXTENSION(A, IDENT, C, D, E, F) IDENT, + #define AARCH64_ARCH(A, B, IDENT, D, E) IDENT, +-#include "aarch64-option-extensions.def" +-#include "aarch64-arches.def" ++#include "config/aarch64/aarch64-option-extensions.def" ++#include "config/aarch64/aarch64-arches.def" + }; + + /* Define unique flags for each of the above. */ +@@ -171,8 +171,8 @@ enum class aarch64_feature : unsigned char { + = aarch64_feature_flags (1) << int (aarch64_feature::IDENT); + #define AARCH64_OPT_EXTENSION(A, IDENT, C, D, E, F) HANDLE (IDENT) + #define AARCH64_ARCH(A, B, IDENT, D, E) HANDLE (IDENT) +-#include "aarch64-option-extensions.def" +-#include "aarch64-arches.def" ++#include "config/aarch64/aarch64-option-extensions.def" ++#include "config/aarch64/aarch64-arches.def" + #undef HANDLE + + #endif diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch new file mode 100644 index 00000000..b05be59c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch @@ -0,0 +1,28 @@ +From e8e8a0ab572cfceb9758f99599c0db4c962e49c0 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 20 Feb 2015 09:39:38 +0000 +Subject: [PATCH] Avoid using libdir from .la which usually points to a host + path + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Jonathan Liu <net147@gmail.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ltmain.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/ltmain.sh b/ltmain.sh +index ee938056bef..9ebc7e3d1e0 100644 +--- a/ltmain.sh ++++ b/ltmain.sh +@@ -5628,6 +5628,9 @@ func_mode_link () + absdir="$abs_ladir" + libdir="$abs_ladir" + else ++ # Instead of using libdir from .la which usually points to a host path, ++ # use the path the .la is contained in. ++ libdir="$abs_ladir" + dir="$libdir" + absdir="$libdir" + fi diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch new file mode 100644 index 00000000..61e61ecc --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch @@ -0,0 +1,113 @@ +From 612801d426e75ff997cfabda380dbe52c2cbc532 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 20 Feb 2015 10:25:11 +0000 +Subject: [PATCH] Ensure target gcc headers can be included + +There are a few headers installed as part of the OpenEmbedded +gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe +built for the target architecture, these are within the target +sysroot and not cross/nativesdk; thus they weren't able to be +found by gcc with the existing search paths. Add support for +picking up these headers under the sysroot supplied on the gcc +command line in order to resolve this. + +Extend target gcc headers search to musl too + +Upstream-Status: Pending + +Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/Makefile.in | 2 ++ + gcc/config/linux.h | 8 ++++++++ + gcc/config/rs6000/sysv4.h | 8 ++++++++ + gcc/cppdefault.cc | 4 ++++ + 4 files changed, 22 insertions(+) + +diff --git a/gcc/Makefile.in b/gcc/Makefile.in +index a8277254696..07fa63b6640 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -632,6 +632,7 @@ libexecdir = @libexecdir@ + + # Directory in which the compiler finds libraries etc. + libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix) ++libsubdir_target = $(target_noncanonical)/$(version) + # Directory in which the compiler finds executables + libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix) + # Directory in which all plugin resources are installed +@@ -3024,6 +3025,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\" + + PREPROCESSOR_DEFINES = \ + -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ ++ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \ + -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \ + -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ + -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \ +diff --git a/gcc/config/linux.h b/gcc/config/linux.h +index 4ce173384ef..8a3cd4f2d34 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -170,6 +170,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #define INCLUDE_DEFAULTS_MUSL_TOOL + #endif + ++#ifdef GCC_INCLUDE_SUBDIR_TARGET ++#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ ++ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET ++#endif ++ + #ifdef NATIVE_SYSTEM_HEADER_DIR + #define INCLUDE_DEFAULTS_MUSL_NATIVE \ + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ +@@ -196,6 +203,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + INCLUDE_DEFAULTS_MUSL_PREFIX \ + INCLUDE_DEFAULTS_MUSL_CROSS \ + INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ +diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h +index a73954d9de5..e5dd6538358 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -994,6 +994,13 @@ ncrtn.o%s" + #define INCLUDE_DEFAULTS_MUSL_TOOL + #endif + ++#ifdef GCC_INCLUDE_SUBDIR_TARGET ++#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ ++ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET ++#endif ++ + #ifdef NATIVE_SYSTEM_HEADER_DIR + #define INCLUDE_DEFAULTS_MUSL_NATIVE \ + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ +@@ -1020,6 +1027,7 @@ ncrtn.o%s" + INCLUDE_DEFAULTS_MUSL_PREFIX \ + INCLUDE_DEFAULTS_MUSL_CROSS \ + INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ +diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc +index 7888300f277..52cf14e92f8 100644 +--- a/gcc/cppdefault.cc ++++ b/gcc/cppdefault.cc +@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[] + /* This is the dir for gcc's private headers. */ + { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, + #endif ++#ifdef GCC_INCLUDE_SUBDIR_TARGET ++ /* This is the dir for gcc's private headers under the specified sysroot. */ ++ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 }, ++#endif + #ifdef LOCAL_INCLUDE_DIR + /* /usr/local/include comes before the fixincluded header files. */ + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch new file mode 100644 index 00000000..94308b2a --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch @@ -0,0 +1,35 @@ +From 9ae49e7b88c208ab79ec9c2fc4a2fa8a3f1e85bb Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 3 Mar 2015 08:21:19 +0000 +Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix + is provided + +http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html + +Upstream-Status: Submitted + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ltmain.sh | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/ltmain.sh b/ltmain.sh +index 9ebc7e3d1e0..7ea79fa8be6 100644 +--- a/ltmain.sh ++++ b/ltmain.sh +@@ -6004,12 +6004,13 @@ func_mode_link () + fi + else + # We cannot seem to hardcode it, guess we'll fake it. ++ # Default if $libdir is not relative to the prefix: + add_dir="-L$libdir" +- # Try looking first in the location we're being installed to. ++ + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) +- add_dir="$add_dir -L$inst_prefix_dir$libdir" ++ add_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch new file mode 100644 index 00000000..ce9635ce --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch @@ -0,0 +1,51 @@ +From bf918db7117f41d3c04162095641165ca241707d Mon Sep 17 00:00:00 2001 +From: Robert Yang <liezhi.yang@windriver.com> +Date: Sun, 5 Jul 2015 20:25:18 -0700 +Subject: [PATCH] libcc1: fix libcc1's install path and rpath + +* Install libcc1.so and libcc1plugin.so into + $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version), as what we + had done to lto-plugin. +* Fix bad RPATH iussue: + gcc-5.2.0: package gcc-plugins contains bad RPATH /patht/to/tmp/sysroots/qemux86-64/usr/lib64/../lib64 in file + /path/to/gcc/5.2.0-r0/packages-split/gcc-plugins/usr/lib64/gcc/x86_64-poky-linux/5.2.0/plugin/libcc1plugin.so.0.0.0 + [rpaths] + +Upstream-Status: Inappropriate [OE configuration] + +Signed-off-by: Robert Yang <liezhi.yang@windriver.com> +--- + libcc1/Makefile.am | 4 ++-- + libcc1/Makefile.in | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am +index 6e3a34ff7e2..3f3f6391aba 100644 +--- a/libcc1/Makefile.am ++++ b/libcc1/Makefile.am +@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ + $(Wc)$(libiberty_normal))) + libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty)) + +-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin +-cc1libdir = $(libdir)/$(libsuffix) ++cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version) ++plugindir = $(cc1libdir) + + if ENABLE_PLUGIN + plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la +diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in +index f8f590d71e9..56462492045 100644 +--- a/libcc1/Makefile.in ++++ b/libcc1/Makefile.in +@@ -396,8 +396,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ + $(Wc)$(libiberty_normal))) + + libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty)) +-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin +-cc1libdir = $(libdir)/$(libsuffix) ++cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version) ++plugindir = $(cc1libdir) + @ENABLE_PLUGIN_TRUE@plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la + @ENABLE_PLUGIN_TRUE@cc1lib_LTLIBRARIES = libcc1.la + shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \ diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch new file mode 100644 index 00000000..3b547195 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch @@ -0,0 +1,510 @@ +From 4fbbd40d7db89cdbeaf93df1e1da692b1f80a5bc Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 7 Dec 2015 23:39:54 +0000 +Subject: [PATCH] handle sysroot support for nativesdk-gcc + +Being able to build a nativesdk gcc is useful, particularly in cases +where the host compiler may be of an incompatible version (or a 32 +bit compiler is needed). + +Sadly, building nativesdk-gcc is not straight forward. We install +nativesdk-gcc into a relocatable location and this means that its +library locations can change. "Normal" sysroot support doesn't help +in this case since the values of paths like "libdir" change, not just +base root directory of the system. + +In order to handle this we do two things: + +a) Add %r into spec file markup which can be used for injected paths + such as SYSTEMLIBS_DIR (see gcc_multilib_setup()). +b) Add other paths which need relocation into a .gccrelocprefix section + which the relocation code will notice and adjust automatically. + +Upstream-Status: Inappropriate +RP 2015/7/28 + +Extend the gccrelocprefix support to musl config too, this ensures +that gcc will get right bits in SDK installations + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +Added PREFIXVAR and EXEC_PREFIXVAR to support runtime relocation. Without +these as part of the gccrelocprefix the system can't do runtime relocation +if the executable is moved. (These paths were missed in the original +implementation.) + +Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> +--- + gcc/c-family/c-opts.cc | 4 +-- + gcc/config/linux.h | 24 +++++++-------- + gcc/config/rs6000/sysv4.h | 24 +++++++-------- + gcc/cppdefault.cc | 63 ++++++++++++++++++++++++--------------- + gcc/cppdefault.h | 13 ++++---- + gcc/gcc.cc | 20 +++++++++---- + gcc/incpath.cc | 12 ++++---- + gcc/prefix.cc | 6 ++-- + 8 files changed, 94 insertions(+), 72 deletions(-) + +diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc +index a341a061758..83b0bef4dbb 100644 +--- a/gcc/c-family/c-opts.cc ++++ b/gcc/c-family/c-opts.cc +@@ -1458,8 +1458,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain) + size_t prefix_len, suffix_len; + + suffix_len = strlen (suffix); +- prefix = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR; +- prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len; ++ prefix = iprefix ? iprefix : GCC_INCLUDE_DIRVAR; ++ prefix_len = iprefix ? strlen (iprefix) : strlen(GCC_INCLUDE_DIRVAR) - 7; + + path = (char *) xmalloc (prefix_len + suffix_len + 1); + memcpy (path, prefix, prefix_len); +diff --git a/gcc/config/linux.h b/gcc/config/linux.h +index 8a3cd4f2d34..58143dff731 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -134,53 +134,53 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + * Unfortunately, this is mostly duplicated from cppdefault.cc */ + #if DEFAULT_LIBC == LIBC_MUSL + #define INCLUDE_DEFAULTS_MUSL_GPP \ +- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ +- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ +- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, + + #ifdef LOCAL_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_LOCAL \ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 }, + #else + #define INCLUDE_DEFAULTS_MUSL_LOCAL + #endif + + #ifdef PREFIX_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_PREFIX \ +- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_PREFIX + #endif + + #ifdef CROSS_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_CROSS \ +- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_CROSS + #endif + + #ifdef TOOL_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_TOOL \ +- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_TOOL + #endif + + #ifdef GCC_INCLUDE_SUBDIR_TARGET + #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ +- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0}, ++ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET + #endif + + #ifdef NATIVE_SYSTEM_HEADER_DIR + #define INCLUDE_DEFAULTS_MUSL_NATIVE \ +- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ +- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 }, + #else + #define INCLUDE_DEFAULTS_MUSL_NATIVE + #endif +@@ -205,7 +205,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + INCLUDE_DEFAULTS_MUSL_TOOL \ + INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ +- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ + } + #endif +diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h +index e5dd6538358..b496849b792 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -958,53 +958,53 @@ ncrtn.o%s" + /* Include order changes for musl, same as in generic linux.h. */ + #if DEFAULT_LIBC == LIBC_MUSL + #define INCLUDE_DEFAULTS_MUSL_GPP \ +- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ +- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ +- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, + + #ifdef LOCAL_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_LOCAL \ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 }, + #else + #define INCLUDE_DEFAULTS_MUSL_LOCAL + #endif + + #ifdef PREFIX_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_PREFIX \ +- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_PREFIX + #endif + + #ifdef CROSS_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_CROSS \ +- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_CROSS + #endif + + #ifdef TOOL_INCLUDE_DIR + #define INCLUDE_DEFAULTS_MUSL_TOOL \ +- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_TOOL + #endif + + #ifdef GCC_INCLUDE_SUBDIR_TARGET + #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ +- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0}, ++ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0}, + #else + #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET + #endif + + #ifdef NATIVE_SYSTEM_HEADER_DIR + #define INCLUDE_DEFAULTS_MUSL_NATIVE \ +- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ +- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 }, + #else + #define INCLUDE_DEFAULTS_MUSL_NATIVE + #endif +@@ -1029,7 +1029,7 @@ ncrtn.o%s" + INCLUDE_DEFAULTS_MUSL_TOOL \ + INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ +- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ + } + #endif +diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc +index 52cf14e92f8..d8977afc05e 100644 +--- a/gcc/cppdefault.cc ++++ b/gcc/cppdefault.cc +@@ -35,6 +35,30 @@ + # undef CROSS_INCLUDE_DIR + #endif + ++static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR; ++char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR; ++static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR; ++static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR; ++static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET; ++#ifdef LOCAL_INCLUDE_DIR ++static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR; ++#endif ++#ifdef PREFIX_INCLUDE_DIR ++static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR; ++#endif ++#ifdef FIXED_INCLUDE_DIR ++static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR; ++#endif ++#ifdef CROSS_INCLUDE_DIR ++static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR; ++#endif ++#ifdef TOOL_INCLUDE_DIR ++static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR; ++#endif ++#ifdef NATIVE_SYSTEM_HEADER_DIR ++static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR; ++#endif ++ + const struct default_include cpp_include_defaults[] + #ifdef INCLUDE_DEFAULTS + = INCLUDE_DEFAULTS; +@@ -42,17 +66,17 @@ const struct default_include cpp_include_defaults[] + = { + #ifdef GPLUSPLUS_INCLUDE_DIR + /* Pick up GNU C++ generic include files. */ +- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, ++ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, + #endif + #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR + /* Pick up GNU C++ target-dependent include files. */ +- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, ++ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, + #endif + #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR + /* Pick up GNU C++ backward and deprecated include files. */ +- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, + #endif + #ifdef GPLUSPLUS_LIBCXX_INCLUDE_DIR +@@ -62,23 +86,23 @@ const struct default_include cpp_include_defaults[] + #endif + #ifdef GCC_INCLUDE_DIR + /* This is the dir for gcc's private headers. */ +- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, ++ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 }, + #endif + #ifdef GCC_INCLUDE_SUBDIR_TARGET + /* This is the dir for gcc's private headers under the specified sysroot. */ +- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 }, ++ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 }, + #endif + #ifdef LOCAL_INCLUDE_DIR + /* /usr/local/include comes before the fixincluded header files. */ +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, +- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, ++ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 }, + #endif + #ifdef PREFIX_INCLUDE_DIR +- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 }, ++ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 }, + #endif + #ifdef FIXED_INCLUDE_DIR + /* This is the dir for fixincludes. */ +- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, ++ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0, + /* A multilib suffix needs adding if different multilibs use + different headers. */ + #ifdef SYSROOT_HEADERS_SUFFIX_SPEC +@@ -90,33 +114,24 @@ const struct default_include cpp_include_defaults[] + #endif + #ifdef CROSS_INCLUDE_DIR + /* One place the target system's headers might be. */ +- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, ++ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 }, + #endif + #ifdef TOOL_INCLUDE_DIR + /* Another place the target system's headers might be. */ +- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 }, ++ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 }, + #endif + #ifdef NATIVE_SYSTEM_HEADER_DIR + /* /usr/include comes dead last. */ +- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 }, +- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 }, ++ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 }, ++ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 }, + #endif + { 0, 0, 0, 0, 0, 0 } + }; + #endif /* no INCLUDE_DEFAULTS */ + +-#ifdef GCC_INCLUDE_DIR +-const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR; +-const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8; +-#else +-const char cpp_GCC_INCLUDE_DIR[] = ""; +-const size_t cpp_GCC_INCLUDE_DIR_len = 0; +-#endif +- + /* The configured prefix. */ +-const char cpp_PREFIX[] = PREFIX; +-const size_t cpp_PREFIX_len = sizeof PREFIX - 1; +-const char cpp_EXEC_PREFIX[] = STANDARD_EXEC_PREFIX; ++char PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX; ++char EXEC_PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX; + + /* This value is set by cpp_relocated at runtime */ + const char *gcc_exec_prefix; +diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h +index fb97c0b5814..6267150facc 100644 +--- a/gcc/cppdefault.h ++++ b/gcc/cppdefault.h +@@ -33,7 +33,8 @@ + + struct default_include + { +- const char *const fname; /* The name of the directory. */ ++ const char *fname; /* The name of the directory. */ ++ + const char *const component; /* The component containing the directory + (see update_path in prefix.cc) */ + const char cplusplus; /* When this is non-zero, we should only +@@ -55,17 +56,13 @@ struct default_include + }; + + extern const struct default_include cpp_include_defaults[]; +-extern const char cpp_GCC_INCLUDE_DIR[]; +-extern const size_t cpp_GCC_INCLUDE_DIR_len; ++extern char GCC_INCLUDE_DIRVAR[] __attribute__ ((section (".gccrelocprefix"))); + + /* The configure-time prefix, i.e., the value supplied as the argument + to --prefix=. */ +-extern const char cpp_PREFIX[]; ++extern char PREFIXVAR[] __attribute__ ((section (".gccrelocprefix"))); + /* The length of the configure-time prefix. */ +-extern const size_t cpp_PREFIX_len; +-/* The configure-time execution prefix. This is typically the lib/gcc +- subdirectory of cpp_PREFIX. */ +-extern const char cpp_EXEC_PREFIX[]; ++extern char EXEC_PREFIXVAR[] __attribute__ ((section (".gccrelocprefix"))); + /* The run-time execution prefix. This is typically the lib/gcc + subdirectory of the actual installation. */ + extern const char *gcc_exec_prefix; +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index aa4cf92fb78..5569a39a14a 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL; + #endif + static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT; + ++static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR; ++ + /* Nonzero means pass the updated target_system_root to the compiler. */ + + static int target_system_root_changed; +@@ -575,6 +577,7 @@ or with constant text in a single argument. + %G process LIBGCC_SPEC as a spec. + %R Output the concatenation of target_system_root and + target_sysroot_suffix. ++ %r Output the base path target_relocatable_prefix + %S process STARTFILE_SPEC as a spec. A capital S is actually used here. + %E process ENDFILE_SPEC as a spec. A capital E is actually used here. + %C process CPP_SPEC as a spec. +@@ -1627,10 +1630,10 @@ static const char *gcc_libexec_prefix; + gcc_exec_prefix is set because, in that case, we know where the + compiler has been installed, and use paths relative to that + location instead. */ +-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX; +-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX; +-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX; +-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; ++static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX; ++static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX; ++static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX; ++static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; + + /* For native compilers, these are well-known paths containing + components that may be provided by the system. For cross +@@ -1638,9 +1641,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; + static const char *md_exec_prefix = MD_EXEC_PREFIX; + static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; + static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; +-static const char *const standard_startfile_prefix_1 ++static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix"))) + = STANDARD_STARTFILE_PREFIX_1; +-static const char *const standard_startfile_prefix_2 ++static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix"))) + = STANDARD_STARTFILE_PREFIX_2; + + /* A relative path to be used in finding the location of tools +@@ -6676,6 +6679,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) + } + break; + ++ case 'r': ++ obstack_grow (&obstack, target_relocatable_prefix, ++ strlen (target_relocatable_prefix)); ++ break; ++ + case 'S': + value = do_spec_1 (startfile_spec, 0, NULL); + if (value != 0) +diff --git a/gcc/incpath.cc b/gcc/incpath.cc +index c80f100f476..5ac03c08693 100644 +--- a/gcc/incpath.cc ++++ b/gcc/incpath.cc +@@ -135,7 +135,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, + int relocated = cpp_relocated (); + size_t len; + +- if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0) ++ if (iprefix && (len = strlen(GCC_INCLUDE_DIRVAR) - 7) != 0) + { + /* Look for directories that start with the standard prefix. + "Translate" them, i.e. replace /usr/local/lib/gcc... with +@@ -150,7 +150,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, + now. */ + if (sysroot && p->add_sysroot) + continue; +- if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len)) ++ if (!filename_ncmp (p->fname, GCC_INCLUDE_DIRVAR, len)) + { + char *str = concat (iprefix, p->fname + len, NULL); + if (p->multilib == 1 && imultilib) +@@ -191,7 +191,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, + free (sysroot_no_trailing_dir_separator); + } + else if (!p->add_sysroot && relocated +- && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len)) ++ && !filename_ncmp (p->fname, PREFIXVAR, strlen(PREFIXVAR))) + { + static const char *relocated_prefix; + char *ostr; +@@ -208,12 +208,12 @@ add_standard_paths (const char *sysroot, const char *iprefix, + dummy = concat (gcc_exec_prefix, "dummy", NULL); + relocated_prefix + = make_relative_prefix (dummy, +- cpp_EXEC_PREFIX, +- cpp_PREFIX); ++ EXEC_PREFIXVAR, ++ PREFIXVAR); + free (dummy); + } + ostr = concat (relocated_prefix, +- p->fname + cpp_PREFIX_len, ++ p->fname + strlen(PREFIXVAR), + NULL); + str = update_path (ostr, p->component); + free (ostr); +diff --git a/gcc/prefix.cc b/gcc/prefix.cc +index 096ed5afa3d..2526f0ecc39 100644 +--- a/gcc/prefix.cc ++++ b/gcc/prefix.cc +@@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see + #include "prefix.h" + #include "common/common-target.h" + +-static const char *std_prefix = PREFIX; ++char PREFIXVAR1[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX; ++ ++static const char *std_prefix = PREFIXVAR1; + + static const char *get_key_value (char *); + static char *translate_name (char *); +@@ -212,7 +214,7 @@ translate_name (char *name) + prefix = getenv (key); + + if (prefix == 0) +- prefix = PREFIX; ++ prefix = PREFIXVAR1; + + /* We used to strip trailing DIR_SEPARATORs here, but that can + sometimes yield a result with no separator when one was coded diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch new file mode 100644 index 00000000..9b05da64 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch @@ -0,0 +1,99 @@ +From 33a1f07a4417247dc24819d4e583ca09f56d5a7b Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 7 Dec 2015 23:41:45 +0000 +Subject: [PATCH] Search target sysroot gcc version specific dirs with + multilib. + +We install the gcc libraries (such as crtbegin.p) into +<sysroot><libdir>/<target-sys>/5.2.0/ +which is a default search path for GCC (aka multi_suffix in the +code below). <target-sys> is 'machine' in gcc's terminology. We use +these directories so that multiple gcc versions could in theory +co-exist on target. + +We only want to build one gcc-cross-canadian per arch and have this work +for all multilibs. <target-sys> can be handled by mapping the multilib +<target-sys> to the one used by gcc-cross-canadian, e.g. +mips64-polkmllib32-linux +is symlinked to by mips64-poky-linux. + +The default gcc search path in the target sysroot for a "lib64" mutlilib +is: + +<sysroot>/lib32/mips64-poky-linux/5.2.0/ +<sysroot>/lib32/../lib64/ +<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/ +<sysroot>/usr/lib32/../lib64/ +<sysroot>/lib32/ +<sysroot>/usr/lib32/ + +which means that the lib32 crtbegin.o will be found and the lib64 ones +will not which leads to compiler failures. + +This patch injects a multilib version of that path first so the lib64 +binaries can be found first. With this change the search path becomes: + +<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/ +<sysroot>/lib32/mips64-poky-linux/5.2.0/ +<sysroot>/lib32/../lib64/ +<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/ +<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/ +<sysroot>/usr/lib32/../lib64/ +<sysroot>/lib32/ +<sysroot>/usr/lib32/ + +Upstream-Status: Pending +RP 2015/7/31 + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/gcc.cc | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index 5569a39a14a..4598f6cd7c9 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -2817,7 +2817,7 @@ for_each_path (const struct path_prefix *paths, + if (path == NULL) + { + len = paths->max_len + extra_space + 1; +- len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len); ++ len += MAX ((suffix_len + multi_os_dir_len), multiarch_len); + path = XNEWVEC (char, len); + } + +@@ -2829,6 +2829,33 @@ for_each_path (const struct path_prefix *paths, + /* Look first in MACHINE/VERSION subdirectory. */ + if (!skip_multi_dir) + { ++ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir)) ++ { ++ const char *this_multi; ++ size_t this_multi_len; ++ ++ if (pl->os_multilib) ++ { ++ this_multi = multi_os_dir; ++ this_multi_len = multi_os_dir_len; ++ } ++ else ++ { ++ this_multi = multi_dir; ++ this_multi_len = multi_dir_len; ++ } ++ ++ /* Look in multilib MACHINE/VERSION subdirectory first */ ++ if (this_multi_len) ++ { ++ memcpy (path + len, this_multi, this_multi_len + 1); ++ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1); ++ ret = callback (path, callback_info); ++ if (ret) ++ break; ++ } ++ } ++ + memcpy (path + len, multi_suffix, suffix_len + 1); + ret = callback (path, callback_info); + if (ret) diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch new file mode 100644 index 00000000..56793e03 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch @@ -0,0 +1,84 @@ +From d7dc2861840e88a4592817a398a054a886c3f3ee Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 27 Jun 2017 18:10:54 -0700 +Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets + +when -fstack-protector options are enabled we need to +link with ssp_shared on musl since it does not provide +the __stack_chk_fail_local() so essentially it provides +libssp but not libssp_nonshared something like +TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED + where-as for glibc the needed symbols +are already present in libc_nonshared library therefore +we do not need any library helper on glibc based systems +but musl needs the libssp_noshared from gcc + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/config/linux.h | 7 +++++++ + gcc/config/rs6000/linux.h | 10 ++++++++++ + gcc/config/rs6000/linux64.h | 10 ++++++++++ + 3 files changed, 27 insertions(+) + +diff --git a/gcc/config/linux.h b/gcc/config/linux.h +index 58143dff731..d2409ccac26 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -208,6 +208,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ + } ++#ifdef TARGET_LIBC_PROVIDES_SSP ++#undef LINK_SSP_SPEC ++#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ ++ "|fstack-protector-strong|fstack-protector-explicit" \ ++ ":-lssp_nonshared}" ++#endif ++ + #endif + + #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ +diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h +index 8c9039ac1e5..259cd485973 100644 +--- a/gcc/config/rs6000/linux.h ++++ b/gcc/config/rs6000/linux.h +@@ -99,6 +99,16 @@ + " -m elf32ppclinux") + #endif + ++/* link libssp_nonshared.a with musl */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#ifdef TARGET_LIBC_PROVIDES_SSP ++#undef LINK_SSP_SPEC ++#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ ++ "|fstack-protector-strong|fstack-protector-explicit" \ ++ ":-lssp_nonshared}" ++#endif ++#endif ++ + #undef LINK_OS_LINUX_SPEC + #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \ + %{!static-pie: \ +diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h +index 364c1a5b155..e33d9ae98e0 100644 +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -372,6 +372,16 @@ extern int dot_symbols; + " -m elf64ppc") + #endif + ++/* link libssp_nonshared.a with musl */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#ifdef TARGET_LIBC_PROVIDES_SSP ++#undef LINK_SSP_SPEC ++#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ ++ "|fstack-protector-strong|fstack-protector-explicit" \ ++ ":-lssp_nonshared}" ++#endif ++#endif ++ + #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \ + %{!static-pie: \ + %{rdynamic:-export-dynamic} \ diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch new file mode 100644 index 00000000..bb1699be --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch @@ -0,0 +1,39 @@ +From bf0d7c463e1fab62804556099b56319fe94be1eb Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 6 Jun 2018 12:10:22 -0700 +Subject: [PATCH] Re-introduce spe commandline options + +This should ensure that we keep accepting +spe options + +Upstream-Status: Inappropriate [SPE port is removed from rs600 port] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/config/rs6000/rs6000.opt | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt +index 4931d781c4e..3fb87b6f7d5 100644 +--- a/gcc/config/rs6000/rs6000.opt ++++ b/gcc/config/rs6000/rs6000.opt +@@ -348,6 +348,19 @@ mdebug= + Target RejectNegative Joined + -mdebug= Enable debug output. + ++; PPC SPE ABI ++mspe ++Target Var(rs6000_spe) Save ++Generate SPE SIMD instructions on E500. ++ ++mabi=spe ++Target RejectNegative Var(rs6000_spe_abi) Save ++Use the SPE ABI extensions. ++ ++mabi=no-spe ++Target RejectNegative Var(rs6000_spe_abi, 0) ++Do not use the SPE ABI extensions. ++ + ; Altivec ABI + mabi=altivec + Target RejectNegative Var(rs6000_altivec_abi) Save diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch new file mode 100644 index 00000000..f3709208 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch @@ -0,0 +1,83 @@ +From a32c75b37209d6836eaaa943dc6b1207acba5d27 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy <nsz@port70.net> +Date: Sat, 24 Oct 2015 20:09:53 +0000 +Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of + symver + +Adapter from + +https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html + +This fix was debated but hasnt been applied gcc upstream since +they expect musl to support '@' in symbol versioning which is +a sun/gnu versioning extention. This patch however avoids the +need for the '@' symbols at all + +libgcc/Changelog: + +2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com> + + * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add. + (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove. + + * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER. + +gcc/Changelog: + +2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com> + + * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init + call __cpu_indicator_init_local instead of __cpu_indicator_init. + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/config/i386/i386-expand.cc | 4 ++-- + libgcc/config/i386/cpuinfo.c | 6 +++--- + libgcc/config/i386/t-linux | 2 +- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc +index 68978ef8dc2..0c71f36b572 100644 +--- a/gcc/config/i386/i386-expand.cc ++++ b/gcc/config/i386/i386-expand.cc +@@ -12321,10 +12321,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, + { + case IX86_BUILTIN_CPU_INIT: + { +- /* Make it call __cpu_indicator_init in libgcc. */ ++ /* Make it call __cpu_indicator_init_local in libgcc.a. */ + tree call_expr, fndecl, type; + type = build_function_type_list (integer_type_node, NULL_TREE); +- fndecl = build_fn_decl ("__cpu_indicator_init", type); ++ fndecl = build_fn_decl ("__cpu_indicator_init_local", type); + call_expr = build_call_expr (fndecl, 0); + return expand_expr (call_expr, target, mode, EXPAND_NORMAL); + } +diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c +index dab1d98060f..cf824b4114a 100644 +--- a/libgcc/config/i386/cpuinfo.c ++++ b/libgcc/config/i386/cpuinfo.c +@@ -63,7 +63,7 @@ __cpu_indicator_init (void) + __cpu_features2); + } + +-#if defined SHARED && defined USE_ELF_SYMVER +-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0"); +-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0"); ++#ifndef SHARED ++int __cpu_indicator_init_local (void) ++ __attribute__ ((weak, alias ("__cpu_indicator_init"))); + #endif +diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux +index 8506a635790..564296f788e 100644 +--- a/libgcc/config/i386/t-linux ++++ b/libgcc/config/i386/t-linux +@@ -3,5 +3,5 @@ + # t-slibgcc-elf-ver and t-linux + SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver + +-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS) ++HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS) + CRTSTUFF_T_CFLAGS += $(CET_FLAGS) diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch new file mode 100644 index 00000000..f5f04ae3 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch @@ -0,0 +1,182 @@ +From 4efc42b99c96b026f560b0918de7e237ac3dc8d1 Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Tue, 10 Mar 2020 08:26:53 -0700 +Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining + reproducibility + +Inserting line numbers into generated code means its not always reproducible wth +differing versions of host gcc. Void the issue by not adding these. + +Upstream-Status: Inappropriate [OE Reproducibility specific] + +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/gengtype.cc | 6 +++--- + gcc/genmodes.cc | 32 ++++++++++++++++---------------- + 2 files changed, 19 insertions(+), 19 deletions(-) + +diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc +index 386ae1b0506..9762e914296 100644 +--- a/gcc/gengtype.cc ++++ b/gcc/gengtype.cc +@@ -1006,7 +1006,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt, + /* Create a fake field with the given type and name. NEXT is the next + field in the chain. */ + #define create_field(next,type,name) \ +- create_field_all (next,type,name, 0, this_file, __LINE__) ++ create_field_all (next,type,name, 0, this_file, 0) + + /* Like create_field, but the field is only valid when condition COND + is true. */ +@@ -1039,7 +1039,7 @@ create_optional_field_ (pair_p next, type_p type, const char *name, + } + + #define create_optional_field(next,type,name,cond) \ +- create_optional_field_(next,type,name,cond,__LINE__) ++ create_optional_field_(next,type,name,cond,0) + + /* Reverse a linked list of 'struct pair's in place. */ + pair_p +@@ -5238,7 +5238,7 @@ main (int argc, char **argv) + /* These types are set up with #define or else outside of where + we can see them. We should initialize them before calling + read_input_list. */ +-#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__; \ ++#define POS_HERE(Call) do { pos.file = this_file; pos.line = 0; \ + Call;} while (0) + POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos)); + POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos)); +diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc +index 59850bb070a..e187f8542a1 100644 +--- a/gcc/genmodes.cc ++++ b/gcc/genmodes.cc +@@ -440,7 +440,7 @@ complete_all_modes (void) + } + + /* For each mode in class CLASS, construct a corresponding complex mode. */ +-#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, __LINE__) ++#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, 0) + static void + make_complex_modes (enum mode_class cl, + const char *file, unsigned int line) +@@ -499,7 +499,7 @@ make_complex_modes (enum mode_class cl, + having as many components as necessary. ORDER is the sorting order + of the mode, with smaller numbers indicating a higher priority. */ + #define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \ +- make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, __LINE__) ++ make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, 0) + #define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0) + static void ATTRIBUTE_UNUSED + make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width, +@@ -552,7 +552,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width, + BYTESIZE bytes in total. */ + #define VECTOR_BOOL_MODE(NAME, COUNT, COMPONENT, BYTESIZE) \ + make_vector_bool_mode (#NAME, COUNT, #COMPONENT, BYTESIZE, \ +- __FILE__, __LINE__) ++ __FILE__, 0) + static void ATTRIBUTE_UNUSED + make_vector_bool_mode (const char *name, unsigned int count, + const char *component, unsigned int bytesize, +@@ -574,7 +574,7 @@ make_vector_bool_mode (const char *name, unsigned int count, + /* Input. */ + + #define _SPECIAL_MODE(C, N) \ +- make_special_mode (MODE_##C, #N, __FILE__, __LINE__) ++ make_special_mode (MODE_##C, #N, __FILE__, 0) + #define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N) + #define CC_MODE(N) _SPECIAL_MODE (CC, N) + +@@ -587,7 +587,7 @@ make_special_mode (enum mode_class cl, const char *name, + + #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y) + #define FRACTIONAL_INT_MODE(N, B, Y) \ +- make_int_mode (#N, B, Y, __FILE__, __LINE__) ++ make_int_mode (#N, B, Y, __FILE__, 0) + + static void + make_int_mode (const char *name, +@@ -628,16 +628,16 @@ make_opaque_mode (const char *name, + } + + #define FRACT_MODE(N, Y, F) \ +- make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, __LINE__) ++ make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, 0) + + #define UFRACT_MODE(N, Y, F) \ +- make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, __LINE__) ++ make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, 0) + + #define ACCUM_MODE(N, Y, I, F) \ +- make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, __LINE__) ++ make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, 0) + + #define UACCUM_MODE(N, Y, I, F) \ +- make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, __LINE__) ++ make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, 0) + + /* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT, + FILE, and LINE. */ +@@ -658,7 +658,7 @@ make_fixed_point_mode (enum mode_class cl, + + #define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F) + #define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \ +- make_float_mode (#N, B, Y, #F, __FILE__, __LINE__) ++ make_float_mode (#N, B, Y, #F, __FILE__, 0) + + static void + make_float_mode (const char *name, +@@ -675,7 +675,7 @@ make_float_mode (const char *name, + #define DECIMAL_FLOAT_MODE(N, Y, F) \ + FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F) + #define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F) \ +- make_decimal_float_mode (#N, B, Y, #F, __FILE__, __LINE__) ++ make_decimal_float_mode (#N, B, Y, #F, __FILE__, 0) + + static void + make_decimal_float_mode (const char *name, +@@ -690,7 +690,7 @@ make_decimal_float_mode (const char *name, + } + + #define RESET_FLOAT_FORMAT(N, F) \ +- reset_float_format (#N, #F, __FILE__, __LINE__) ++ reset_float_format (#N, #F, __FILE__, 0) + static void ATTRIBUTE_UNUSED + reset_float_format (const char *name, const char *format, + const char *file, unsigned int line) +@@ -711,7 +711,7 @@ reset_float_format (const char *name, const char *format, + + /* __intN support. */ + #define INT_N(M,PREC) \ +- make_int_n (#M, PREC, __FILE__, __LINE__) ++ make_int_n (#M, PREC, __FILE__, 0) + static void ATTRIBUTE_UNUSED + make_int_n (const char *m, int bitsize, + const char *file, unsigned int line) +@@ -740,7 +740,7 @@ make_int_n (const char *m, int bitsize, + /* Partial integer modes are specified by relation to a full integer + mode. */ + #define PARTIAL_INT_MODE(M,PREC,NAME) \ +- make_partial_integer_mode (#M, #NAME, PREC, __FILE__, __LINE__) ++ make_partial_integer_mode (#M, #NAME, PREC, __FILE__, 0) + static void ATTRIBUTE_UNUSED + make_partial_integer_mode (const char *base, const char *name, + unsigned int precision, +@@ -767,7 +767,7 @@ make_partial_integer_mode (const char *base, const char *name, + /* A single vector mode can be specified by naming its component + mode and the number of components. */ + #define VECTOR_MODE_WITH_PREFIX(PREFIX, C, M, N, ORDER) \ +- make_vector_mode (MODE_##C, #PREFIX, #M, N, ORDER, __FILE__, __LINE__); ++ make_vector_mode (MODE_##C, #PREFIX, #M, N, ORDER, __FILE__, 0); + #define VECTOR_MODE(C, M, N) VECTOR_MODE_WITH_PREFIX(V, C, M, N, 0); + static void ATTRIBUTE_UNUSED + make_vector_mode (enum mode_class bclass, +@@ -814,7 +814,7 @@ make_vector_mode (enum mode_class bclass, + + /* Adjustability. */ + #define _ADD_ADJUST(A, M, X, C1, C2) \ +- new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, __LINE__) ++ new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, 0) + + #define ADJUST_NUNITS(M, X) _ADD_ADJUST (nunits, M, X, RANDOM, RANDOM) + #define ADJUST_BYTESIZE(M, X) _ADD_ADJUST (bytesize, M, X, RANDOM, RANDOM) diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch new file mode 100644 index 00000000..cb8969b1 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch @@ -0,0 +1,42 @@ +From c3870d073eb9e5d82f9d3067d0fa15038b69713a Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 13 May 2020 15:10:38 -0700 +Subject: [PATCH] libatomic: Do not enforce march on aarch64 + +OE passes the right options via gcc compiler cmdline via TUNE_CCARGS +this can conflict between -mcpu settings and -march setting here, since +-mcpu will translate into an appropriate -march, lets depend on that +instead of setting it explicitly + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + libatomic/Makefile.am | 1 - + libatomic/Makefile.in | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am +index c6c8d81c56a..d959a5d040e 100644 +--- a/libatomic/Makefile.am ++++ b/libatomic/Makefile.am +@@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS))) + ## On a target-specific basis, include alternates to be selected by IFUNC. + if HAVE_IFUNC + if ARCH_AARCH64_LINUX +-IFUNC_OPTIONS = -march=armv8-a+lse + libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS))) + libatomic_la_SOURCES += atomic_16.S + +diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in +index a0fa3dfc8cc..e70d389874a 100644 +--- a/libatomic/Makefile.in ++++ b/libatomic/Makefile.in +@@ -447,7 +447,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files))) + libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \ + _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_3) \ + $(am__append_4) $(am__append_5) +-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse + @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64 + @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586 + @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 -mcx16 diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch new file mode 100644 index 00000000..11f42c59 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch @@ -0,0 +1,31 @@ +From 7bd6e631e4a5273f5ecc41a5a48830a1342e5926 Mon Sep 17 00:00:00 2001 +From: Andrei Gherzan <andrei.gherzan@huawei.com> +Date: Wed, 22 Dec 2021 12:49:25 +0100 +Subject: [PATCH] Fix install path of linux64.h + +We add linux64.h to tm includes[1] as a relative path to B. This patch +adapts the install path of linux64.h to match the include in tm.h. + +[1] 0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch + +Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> + +Upstream-Status: Inappropriate [configuration] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/Makefile.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/gcc/Makefile.in b/gcc/Makefile.in +index 065ce7e9a5b..d4c723968aa 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -3738,6 +3738,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype + "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \ + | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \ + base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \ ++ */linux64.h ) \ ++ base=`dirname $$path`;;\ + *) base=`basename $$path` ;; \ + esac; \ + dest=$(plugin_includedir)/$$base; \ diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch new file mode 100644 index 00000000..2f016598 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch @@ -0,0 +1,42 @@ +From 52931ec7a708b58d68e69ce9eb99001ae9f099dd Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 13 May 2020 15:10:38 -0700 +Subject: [PATCH] libatomic: Do not enforce march on aarch64 + +OE passes the right options via gcc compiler cmdline via TUNE_CCARGS +this can conflict between -mcpu settings and -march setting here, since +-mcpu will translate into an appropriate -march, lets depend on that +instead of setting it explicitly + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + libatomic/Makefile.am | 1 - + libatomic/Makefile.in | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am +index d88515e4a03..e0e2f8b442a 100644 +--- a/libatomic/Makefile.am ++++ b/libatomic/Makefile.am +@@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS))) + ## On a target-specific basis, include alternates to be selected by IFUNC. + if HAVE_IFUNC + if ARCH_AARCH64_LINUX +-IFUNC_OPTIONS = -march=armv8-a+lse + libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS))) + endif + if ARCH_ARM_LINUX +diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in +index 80d25653dc7..7377689ab34 100644 +--- a/libatomic/Makefile.in ++++ b/libatomic/Makefile.in +@@ -434,7 +434,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files))) + libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \ + _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \ + $(am__append_3) $(am__append_4) +-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse + @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64 + @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586 + @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 -mcx16 diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch new file mode 100644 index 00000000..ad826901 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch @@ -0,0 +1,28 @@ +From 4623d87d779853a2862ee92a15a41fded81eddb8 Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Sat, 20 Aug 2022 09:04:14 -0700 +Subject: [PATCH] Avoid hardcoded build paths into ppc libgcc + +Avoid encoding build paths into sources used for floating point on powerpc. +(MACHINE=qemuppc bitbake libgcc). + +Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599882.html] +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + libgcc/config/rs6000/t-float128 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128 +index b09b5664af0..513e63748f1 100644 +--- a/libgcc/config/rs6000/t-float128 ++++ b/libgcc/config/rs6000/t-float128 +@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL) + $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep) + @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \ + echo "Create $@"; \ +- (echo "/* file created from $$src */"; \ ++ (echo "/* file created from `basename $$src` */"; \ + echo; \ + sed -f $(fp128_sed) < $$src) > $@ + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch new file mode 100644 index 00000000..555be623 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch @@ -0,0 +1,31 @@ +From 3e67c9c77e46132c252911bf1e5e4222dfd3aa34 Mon Sep 17 00:00:00 2001 +From: Andrei Gherzan <andrei.gherzan@huawei.com> +Date: Wed, 22 Dec 2021 12:49:25 +0100 +Subject: [PATCH] Fix install path of linux64.h + +We add linux64.h to tm includes[1] as a relative path to B. This patch +adapts the install path of linux64.h to match the include in tm.h. + +[1] 0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch + +Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> + +Upstream-Status: Inappropriate [configuration] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gcc/Makefile.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/gcc/Makefile.in b/gcc/Makefile.in +index 07fa63b6640..0def7394454 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -3706,6 +3706,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype + "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \ + | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \ + base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \ ++ */linux64.h ) \ ++ base=`dirname $$path`;;\ + *) base=`basename $$path` ;; \ + esac; \ + dest=$(plugin_includedir)/$$base; \ diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch new file mode 100644 index 00000000..bbe2f18f --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch @@ -0,0 +1,92 @@ +From 9234cdca6ee88badfc00297e72f13dac4e540c79 Mon Sep 17 00:00:00 2001 +From: Nick Clifton <nickc@redhat.com> +Date: Fri, 1 Jul 2022 15:58:52 +0100 +Subject: [PATCH] Add a recursion limit to the demangle_const function in the + Rust demangler. + +libiberty/ + PR demangler/105039 + * rust-demangle.c (demangle_const): Add recursion limit. + +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9234cdca6ee88badfc00297e72f13dac4e540c79] +--- + libiberty/rust-demangle.c | 29 ++++++++++++++++++++--------- + 1 file changed, 20 insertions(+), 9 deletions(-) + +diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c +index bb58d900e27..36afcfae278 100644 +--- a/libiberty/rust-demangle.c ++++ b/libiberty/rust-demangle.c +@@ -126,7 +126,7 @@ parse_integer_62 (struct rust_demangler *rdm) + return 0; + + x = 0; +- while (!eat (rdm, '_')) ++ while (!eat (rdm, '_') && !rdm->errored) + { + c = next (rdm); + x *= 62; +@@ -1148,6 +1148,15 @@ demangle_const (struct rust_demangler *rdm) + if (rdm->errored) + return; + ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ { ++ ++ rdm->recursion; ++ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) ++ /* FIXME: There ought to be a way to report ++ that the recursion limit has been reached. */ ++ goto fail_return; ++ } ++ + if (eat (rdm, 'B')) + { + backref = parse_integer_62 (rdm); +@@ -1158,7 +1167,7 @@ demangle_const (struct rust_demangler *rdm) + demangle_const (rdm); + rdm->next = old_next; + } +- return; ++ goto pass_return; + } + + ty_tag = next (rdm); +@@ -1167,7 +1176,7 @@ demangle_const (struct rust_demangler *rdm) + /* Placeholder. */ + case 'p': + PRINT ("_"); +- return; ++ goto pass_return; + + /* Unsigned integer types. */ + case 'h': +@@ -1200,18 +1209,20 @@ demangle_const (struct rust_demangler *rdm) + break; + + default: +- rdm->errored = 1; +- return; ++ goto fail_return; + } + +- if (rdm->errored) +- return; +- +- if (rdm->verbose) ++ if (!rdm->errored && rdm->verbose) + { + PRINT (": "); + PRINT (basic_type (ty_tag)); + } ++ ++ fail_return: ++ rdm->errored = 1; ++ pass_return: ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ -- rdm->recursion; + } + + static void +-- +2.31.1 + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch b/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch new file mode 100644 index 00000000..f3485858 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch @@ -0,0 +1,19 @@ +Avoid encoding build paths into sources used for floating point on powerpc. +(MACHINE=qemuppc bitbake libgcc). + +Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599882.html] +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> + +Index: gcc-12.1.0/libgcc/config/rs6000/t-float128 +=================================================================== +--- gcc-12.1.0.orig/libgcc/config/rs6000/t-float128 ++++ gcc-12.1.0/libgcc/config/rs6000/t-float128 +@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS += + $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep) + @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \ + echo "Create $@"; \ +- (echo "/* file created from $$src */"; \ ++ (echo "/* file created from `basename $$src` */"; \ + echo; \ + sed -f $(fp128_sed) < $$src) > $@ + diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch b/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch new file mode 100644 index 00000000..7f1a2dee --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch @@ -0,0 +1,63 @@ +Relative paths don't work with -fdebug-prefix-map and friends. This +can lead to paths which the user wanted to be remapped being missed. +Setting -fdebug-prefix-map to work with a relative path isn't practical +either. + +Instead, call gcc's realpath function on the incomming path name before +comparing it with the remapping. This means other issues like symlinks +are also accounted for and leads to a more consistent remapping experience. + +Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599885.html] +[Also https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599884.html] +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> + + +Index: gcc-12.1.0/gcc/file-prefix-map.cc +=================================================================== +--- gcc-12.1.0.orig/gcc/file-prefix-map.cc ++++ gcc-12.1.0/gcc/file-prefix-map.cc +@@ -70,19 +70,28 @@ remap_filename (file_prefix_map *maps, c + file_prefix_map *map; + char *s; + const char *name; ++ char *realname; + size_t name_len; + ++ if (lbasename (filename) == filename) ++ return filename; ++ ++ realname = lrealpath (filename); ++ + for (map = maps; map; map = map->next) +- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) ++ if (filename_ncmp (realname, map->old_prefix, map->old_len) == 0) + break; +- if (!map) ++ if (!map) { ++ free (realname); + return filename; +- name = filename + map->old_len; ++ } ++ name = realname + map->old_len; + name_len = strlen (name) + 1; + + s = (char *) ggc_alloc_atomic (name_len + map->new_len); + memcpy (s, map->new_prefix, map->new_len); + memcpy (s + map->new_len, name, name_len); ++ free (realname); + return s; + } + +Index: gcc-12.1.0/libcpp/macro.cc +=================================================================== +--- gcc-12.1.0.orig/libcpp/macro.cc ++++ gcc-12.1.0/libcpp/macro.cc +@@ -563,7 +563,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + if (!name) + abort (); + } +- if (pfile->cb.remap_filename) ++ if (pfile->cb.remap_filename && !pfile->state.in_directive) + name = pfile->cb.remap_filename (name); + len = strlen (name); + buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); diff --git a/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb new file mode 100644 index 00000000..c1996ab1 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb @@ -0,0 +1,14 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require gcc-target.inc + +# Building with thumb enabled on armv4t armv5t fails with +# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs +# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" + +ARMFPARCHEXT:armv6 = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}" +ARMFPARCHEXT:armv7a = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}" +ARMFPARCHEXT:armv7ve = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}" + +#BBCLASSEXTEND = "nativesdk" diff --git a/meta-microblaze/recipes-devtools/gcc/gcc_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc new file mode 100644 index 00000000..ac0a5a7b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc @@ -0,0 +1,163 @@ +BPN = "libgcc" + +require gcc-configure-common.inc + +INHIBIT_DEFAULT_DEPS = "1" + +do_configure () { + install -d ${D}${base_libdir} ${D}${libdir} + mkdir -p ${B}/${BPN} + mkdir -p ${B}/${TARGET_SYS}/${BPN}/ + cd ${B}/${BPN} + chmod a+x ${S}/${BPN}/configure + ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} +} +EXTRACONFFUNCS += "extract_stashed_builddir" +do_configure[depends] += "${COMPILERDEP}" + +do_compile () { + cd ${B}/${BPN} + oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/ +} + +do_install () { + cd ${B}/${BPN} + oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/ install + + # Move libgcc_s into /lib + mkdir -p ${D}${base_libdir} + if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then + mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir} + else + mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true + fi + + # install the runtime in /usr/lib/ not in /usr/lib/gcc on target + # so that cross-gcc can find it in the sysroot + + mv ${D}${libdir}/gcc/* ${D}${libdir} + rm -rf ${D}${libdir}/gcc/ + # unwind.h is installed here which is shipped in gcc-cross + # as well as target gcc and they are identical so we dont + # ship one with libgcc here + rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include +} + +do_install:append:libc-baremetal () { + if [ "${base_libdir}" != "${libdir}" ]; then + rmdir ${D}${base_libdir} + fi +} +do_install:append:libc-newlib () { + if [ "${base_libdir}" != "${libdir}" ]; then + rmdir ${D}${base_libdir} + fi +} + +# No rpm package is actually created but -dev depends on it, avoid dnf error +DEV_PKG_DEPENDENCY:libc-baremetal = "" +DEV_PKG_DEPENDENCY:libc-newlib = "" + +#BBCLASSEXTEND = "nativesdk" + +addtask multilib_install after do_install before do_package do_populate_sysroot +# this makes multilib gcc files findable for target gcc +# e.g. +# /usr/lib/i586-pokymllib32-linux/4.7/ +# by creating this symlink to it +# /usr/lib64/x86_64-poky-linux/4.7/32 + +fakeroot python do_multilib_install() { + import re + + multilibs = d.getVar('MULTILIB_VARIANTS') + if not multilibs or bb.data.inherits_class('nativesdk', d): + return + + binv = d.getVar('BINV') + + mlprefix = d.getVar('MLPREFIX') + if ('%slibgcc' % mlprefix) != d.getVar('PN'): + return + + if mlprefix: + orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL') + orig_tune_params = get_tune_parameters(orig_tune, d) + orig_tune_baselib = orig_tune_params['baselib'] + orig_tune_bitness = orig_tune_baselib.replace('lib', '') + if not orig_tune_bitness: + orig_tune_bitness = '32' + + src = '../../../' + orig_tune_baselib + '/' + \ + d.getVar('TARGET_SYS_MULTILIB_ORIGINAL') + '/' + binv + '/' + + dest = d.getVar('D') + d.getVar('libdir') + '/' + \ + d.getVar('TARGET_SYS') + '/' + binv + '/' + orig_tune_bitness + + if os.path.lexists(dest): + os.unlink(dest) + os.symlink(src, dest) + return + + + for ml in multilibs.split(): + tune = d.getVar('DEFAULTTUNE:virtclass-multilib-' + ml) + if not tune: + bb.warn('DEFAULTTUNE:virtclass-multilib-%s is not defined. Skipping...' % ml) + continue + + tune_parameters = get_tune_parameters(tune, d) + tune_baselib = tune_parameters['baselib'] + if not tune_baselib: + bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune) + continue + + tune_arch = tune_parameters['arch'] + tune_bitness = tune_baselib.replace('lib', '') + if not tune_bitness: + tune_bitness = '32' # /lib => 32bit lib + + tune_abiextension = tune_parameters['abiextension'] + if tune_abiextension: + libcextension = '-gnu' + tune_abiextension + else: + libcextension = '' + + src = '../../../' + tune_baselib + '/' + \ + tune_arch + d.getVar('TARGET_VENDOR') + 'ml' + ml + \ + '-' + d.getVar('TARGET_OS') + libcextension + '/' + binv + '/' + + dest = d.getVar('D') + d.getVar('libdir') + '/' + \ + d.getVar('TARGET_SYS') + '/' + binv + '/' + tune_bitness + + if os.path.lexists(dest): + os.unlink(dest) + os.symlink(src, dest) +} + +def get_original_os(d): + vendoros = d.expand('${TARGET_ARCH}${ORIG_TARGET_VENDOR}-${TARGET_OS}') + for suffix in [d.getVar('ABIEXTENSION'), d.getVar('LIBCEXTENSION')]: + if suffix and vendoros.endswith(suffix): + vendoros = vendoros[:-len(suffix)] + # Arm must use linux-gnueabi not linux as only the former is accepted by gcc + if vendoros.startswith("arm-") and not vendoros.endswith("-gnueabi"): + vendoros = vendoros + "-gnueabi" + return vendoros + +ORIG_TARGET_VENDOR := "${TARGET_VENDOR}" +BASETARGET_SYS = "${@get_original_os(d)}" + +addtask extra_symlinks after do_multilib_install before do_package do_populate_sysroot +fakeroot python do_extra_symlinks() { + if bb.data.inherits_class('nativesdk', d): + return + + targetsys = d.getVar('BASETARGET_SYS') + + if targetsys != d.getVar('TARGET_SYS'): + dest = d.getVar('D') + d.getVar('libdir') + '/' + targetsys + src = d.getVar('TARGET_SYS') + if not os.path.lexists(dest) and os.path.lexists(d.getVar('D') + d.getVar('libdir')): + os.symlink(src, dest) +} diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc b/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc new file mode 100644 index 00000000..8251e3c2 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc @@ -0,0 +1,58 @@ +# +# Notes on the way the OE cross toolchain now works +# +# We need a libgcc to build glibc. Tranditionally we therefore built +# a non-threaded and non-shared compiler (gcc-cross-initial), then use +# that to build libgcc-initial which is used to build glibc which we can +# then build gcc-cross and libgcc against. +# +# We were able to drop the glibc dependency from gcc-cross, with two tweaks: + +# a) specify the minimum glibc version to support in a configure option +# b) create a dummy limits.h file so that later when glibc creates one, +# the headers structure has support for it. We can do this with a simple +# empty file +# +# Once gcc-cross is libc independent, we can use it to build both +# libgcc-initial and then later libgcc. +# +# libgcc-initial is tricky as we need to imitate the non-threaded and +# non-shared case. We can do that by hacking the threading mode back to +# "single" even if gcc reports "posix" and disable libc presence for the +# libgcc-intial build. We have to create the dummy limits.h to avoid +# compiler errors from a missing header. +# +# glibc will fail to link with libgcc-initial due to a missing "exception +# handler" capable libgcc (libgcc_eh.a). Since we know glibc doesn't need +# any exception handler, we can safely symlink to libgcc.a. +# + +require libgcc-common.inc + +DEPENDS = "virtual/${TARGET_PREFIX}gcc" + +LICENSE = "GPL-3.0-with-GCC-exception" + +PACKAGES = "" + +EXTRA_OECONF += "--disable-shared" + +inherit nopackages + +# We really only want this built by things that need it, not any recrdeptask +deltask do_build + +do_configure:prepend () { + install -d ${STAGING_INCDIR} + touch ${STAGING_INCDIR}/limits.h + sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars + sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile +} + +do_configure:append () { + sed -i -e 's#thread_header = .*#thread_header = gthr-single.h#' ${B}/${BPN}/Makefile +} + +do_install:append () { + ln -s libgcc.a ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc_eh.a +} diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb new file mode 100644 index 00000000..a259082b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb @@ -0,0 +1,5 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require libgcc-initial.inc + +# Building with thumb enabled on armv6t fails +ARM_INSTRUCTION_SET:armv6 = "arm" diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc.inc b/meta-microblaze/recipes-devtools/gcc/libgcc.inc new file mode 100644 index 00000000..84a2d930 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgcc.inc @@ -0,0 +1,53 @@ +require libgcc-common.inc + +DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ virtual/${MLPREFIX}libc" + +do_install:append:class-target () { + if [ "${TCLIBC}" != "glibc" ]; then + case "${TARGET_OS}" in + "linux-musl" | "linux-*spe") extra_target_os="linux";; + "linux-musleabi") extra_target_os="linux-gnueabi";; + *) extra_target_os="linux";; + esac + if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then + ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os + fi + fi + if [ -n "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" ]; then + case "${TARGET_OS}" in + "linux-musleabi") extra_target_os="linux-musleabihf";; + "linux-gnueabi") extra_target_os="linux-gnueabihf";; + esac + if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then + ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os + fi + fi +} + +PACKAGES = "\ + ${PN} \ + ${PN}-dev \ + ${PN}-dbg \ +" + +# All libgcc source is marked with the exception. +# +LICENSE:${PN} = "GPL-3.0-with-GCC-exception" +LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception" +LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception" + + +FILES:${PN}-dev = "\ + ${base_libdir}/libgcc*.so \ + ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \ + ${libdir}/${TARGET_SYS}/${BINV}* \ + ${libdir}/${TARGET_ARCH}${TARGET_VENDOR}* \ +" + +do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata" + +INSANE_SKIP:${PN}-dev = "staticdev" + diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb new file mode 100644 index 00000000..f88963b0 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb @@ -0,0 +1,5 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require libgcc.inc + +# Building with thumb enabled on armv6t fails +ARM_INSTRUCTION_SET:armv6 = "arm" diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/libgcc_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgcc_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran.inc b/meta-microblaze/recipes-devtools/gcc/libgfortran.inc new file mode 100644 index 00000000..99fdd89c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgfortran.inc @@ -0,0 +1,88 @@ +require gcc-configure-common.inc + +EXTRA_OECONF_PATHS = "\ + --with-sysroot=/not/exist \ + --with-build-sysroot=${STAGING_DIR_TARGET} \ +" + +# An arm hard float target like raspberrypi4 won't build +# as CFLAGS don't make it to the fortran compiler otherwise +# (the configure script sets FC to $GFORTRAN unconditionally) +export GFORTRAN = "${FC}" + +do_configure () { + for target in libbacktrace libgfortran + do + rm -rf ${B}/${TARGET_SYS}/$target/ + mkdir -p ${B}/${TARGET_SYS}/$target/ + cd ${B}/${TARGET_SYS}/$target/ + chmod a+x ${S}/$target/configure + relpath=${@os.path.relpath("${S}", "${B}/${TARGET_SYS}")} + ../$relpath/$target/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} + # Easiest way to stop bad RPATHs getting into the library since we have a + # broken libtool here + sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/$target/libtool + done +} +EXTRACONFFUNCS += "extract_stashed_builddir" +do_configure[depends] += "${COMPILERDEP}" + +do_compile () { + for target in libbacktrace libgfortran + do + cd ${B}/${TARGET_SYS}/$target/ + oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$target/ + done +} + +do_install () { + cd ${B}/${TARGET_SYS}/libgfortran/ + oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/ install + if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then + rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude + fi + if [ -d ${D}${infodir} ]; then + rmdir --ignore-fail-on-non-empty -p ${D}${infodir} + fi + chown -R root:root ${D} +} + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS = "gcc-runtime gcc-cross-${TARGET_ARCH}" + +#BBCLASSEXTEND = "nativesdk" + +PACKAGES = "\ + ${PN}-dbg \ + libgfortran \ + libgfortran-dev \ + libgfortran-staticdev \ +" + +LICENSE:${PN} = "GPL-3.0-with-GCC-exception" +LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception" +LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception" + +FILES:${PN} = "${libdir}/libgfortran.so.*" +FILES:${PN}-dev = "\ + ${libdir}/libgfortran*.so \ + ${libdir}/libgfortran.spec \ + ${libdir}/libgfortran.la \ + ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \ + ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single* \ + ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude/ \ + ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ \ +" +FILES:${PN}-staticdev = "${libdir}/libgfortran.a" + +INSANE_SKIP:${MLPREFIX}libgfortran-dev = "staticdev" + +do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata" + +python __anonymous () { + f = d.getVar("FORTRAN") + if "fortran" not in f: + raise bb.parse.SkipRecipe("libgfortran needs fortran support to be enabled in the compiler") +} diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb new file mode 100644 index 00000000..71dd8b4b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb @@ -0,0 +1,3 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require libgfortran.inc + diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/libgfortran_13.%.bbappend new file mode 100644 index 00000000..d1df2061 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/libgfortran_13.%.bbappend @@ -0,0 +1 @@ +require microblaze-block.inc diff --git a/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc b/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc new file mode 100644 index 00000000..67c40845 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc @@ -0,0 +1 @@ +COMPATIBLE_HOST:microblaze = "^$" diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-common.inc b/meta-microblaze/recipes-devtools/gdb/gdb-common.inc new file mode 100644 index 00000000..925b0c2f --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-common.inc @@ -0,0 +1,66 @@ +SUMMARY = "GNU debugger" +HOMEPAGE = "http://www.gnu.org/software/gdb/" +DESCRIPTION = "GDB, the GNU Project debugger, allows you to see what is going on inside another program while it executes -- or what another program was doing at the moment it crashed." +SECTION = "devel" +DEPENDS = "expat gmp zlib ncurses virtual/libiconv ${LTTNGUST} bison-native" + +LTTNGUST = "lttng-ust" +LTTNGUST:arc = "" +LTTNGUST:aarch64 = "" +LTTNGUST:mipsarch = "" +LTTNGUST:sh4 = "" + +inherit autotools texinfo + +UPSTREAM_CHECK_GITTAGREGEX = "gdb\-(?P<pver>.+)\-release" + +B = "${WORKDIR}/build-${TARGET_SYS}" + +EXPAT = "--with-expat --with-libexpat-prefix=${STAGING_DIR_HOST}" + +EXTRA_OECONF = "--disable-gdbtk --disable-x --disable-werror \ + --with-curses --disable-multilib --disable-sim \ + --without-guile \ + ${GDBPROPREFIX} ${EXPAT} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)} \ + --disable-rpath \ + --disable-gas --disable-binutils \ + --disable-ld --disable-gold \ + --disable-gprof \ + --with-libgmp-prefix=${STAGING_EXECPREFIXDIR} \ +" + +PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}" +# Use --without-system-readline to compile with readline 5. +PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline" +PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python3,python3 python3-codecs" +PACKAGECONFIG[babeltrace] = "--with-babeltrace,--without-babeltrace,babeltrace" +# ncurses is already a hard DEPENDS, but would be added here if it weren't +PACKAGECONFIG[tui] = "--enable-tui,--disable-tui" +PACKAGECONFIG[xz] = "--with-lzma --with-liblzma-prefix=${STAGING_DIR_HOST},--without-lzma,xz" +PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils" + +GDBPROPREFIX = "--program-prefix=''" + +DISABLE_STATIC = "" + +do_configure () { + # override this function to avoid the autoconf/automake/aclocal/autoheader + # calls for now + (cd ${S} && gnu-configize) || die "failure in running gnu-configize" + oe_runconf +} + +# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the +# right bits installed by binutils. Same for bfd.info -- also from binutils. +do_install:append() { + rm -rf ${D}${libdir} + rm -rf ${D}${includedir} + rm -rf ${D}${datadir}/locale + rm -f ${D}${infodir}/bfd.info +} + +RRECOMMENDS:gdb:append:linux = " glibc-thread-db " +RRECOMMENDS:gdb:append:linux-gnueabi = " glibc-thread-db " +RRECOMMENDS:gdbserver:append:linux = " glibc-thread-db " +RRECOMMENDS:gdbserver:append:linux-gnueabi = " glibc-thread-db " diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc new file mode 100644 index 00000000..c463574b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc @@ -0,0 +1,44 @@ +inherit cross-canadian +inherit python3-dir +inherit pkgconfig + +SUMMARY = "GNU debugger (cross-canadian gdb for ${TARGET_ARCH} target)" +PN = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}" +BPN = "gdb" + +DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext nativesdk-gmp \ + virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc" + +GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'" + +# Overrides PACKAGECONFIG variables in gdb-common.inc +PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}" +PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,nativesdk-python3, \ + nativesdk-python3-core \ + nativesdk-python3-codecs nativesdk-python3-netclient \ + " +PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,nativesdk-readline" +PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, nativesdk-elfutils" + +SSTATE_ALLOW_OVERLAP_FILES += "${STAGING_DATADIR}/gdb" + +do_configure:prepend() { +cat > ${WORKDIR}/python << EOF +#! /bin/sh +case "\$2" in + --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;; + --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;; + --exec-prefix) echo "${exec_prefix}" ;; + *) exit 1 ;; +esac +exit 0 +EOF + chmod +x ${WORKDIR}/python +} + +# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the +# right bits installed by binutils. +do_install:append() { + rm -rf ${D}${exec_prefix}/lib + cross_canadian_bindirlinks +} diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend new file mode 100644 index 00000000..33fbe158 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend @@ -0,0 +1,4 @@ +MICROBLAZEPATCHES = "" +MICROBLAZEPATCHES:microblaze = "gdb-microblaze.inc" + +require ${MICROBLAZEPATCHES} diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_12.1.bb b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_12.1.bb new file mode 100644 index 00000000..4ab2b715 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_12.1.bb @@ -0,0 +1,3 @@ +require gdb-common.inc +require gdb-cross-canadian.inc +require gdb.inc diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc new file mode 100644 index 00000000..b418f3a3 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc @@ -0,0 +1,31 @@ +require gdb-common.inc + +DEPENDS = "expat-native gmp-native ncurses-native flex-native bison-native" + +inherit python3native pkgconfig + +# Overrides PACKAGECONFIG variables in gdb-common.inc +PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}" +PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3-native" +PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline-native" +PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils-native" + +do_compile:prepend() { + export STAGING_LIBDIR="${STAGING_LIBDIR_NATIVE}" + export STAGING_INCDIR="${STAGING_INCDIR_NATIVE}" +} + +#EXTRA_OEMAKE += "LDFLAGS='${BUILD_LDFLAGS}'" + +GDBPROPREFIX = "" + +PN = "gdb-cross-${TARGET_ARCH}" +BPN = "gdb" + +# Ignore how TARGET_ARCH is computed. +TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" + +inherit cross +inherit gettext + +datadir .= "/gdb-${TARGET_SYS}${TARGET_VENDOR}-${TARGET_OS}" diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross_%.bbappend b/meta-microblaze/recipes-devtools/gdb/gdb-cross_%.bbappend new file mode 100644 index 00000000..33fbe158 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross_%.bbappend @@ -0,0 +1,4 @@ +MICROBLAZEPATCHES = "" +MICROBLAZEPATCHES:microblaze = "gdb-microblaze.inc" + +require ${MICROBLAZEPATCHES} diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross_12.1.bb b/meta-microblaze/recipes-devtools/gdb/gdb-cross_12.1.bb new file mode 100644 index 00000000..3b654a2f --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross_12.1.bb @@ -0,0 +1,2 @@ +require gdb-cross.inc +require gdb.inc diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc new file mode 100644 index 00000000..5eae0577 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc @@ -0,0 +1,16 @@ +# MicroBlaze does not support LTTng UST +LTTNGUST:microblaze = "" + +# Add MicroBlaze patches +FILESEXTRAPATHS:append := ":${THISDIR}/gdb" + +SRC_URI:append:microblaze = " \ + file://0001-Add-initial-port-of-linux-gdbserver.patch \ + file://0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch \ + file://0003-Fix-debug-message-when-register-is-unavailable.patch \ + file://0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch \ + file://0005-Patch-microblaze-Adding-64-bit-MB-support.patch \ + file://0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch \ + file://0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch \ + file://0008-Patch-MicroBlaze.patch \ + " diff --git a/meta-microblaze/recipes-devtools/gdb/gdb.inc b/meta-microblaze/recipes-devtools/gdb/gdb.inc new file mode 100644 index 00000000..a5dc5545 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb.inc @@ -0,0 +1,20 @@ +LICENSE = "GPL-2.0-only & GPL-3.0-only & LGPL-2.0-only & LGPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ + file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \ + file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674" + +SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \ + file://0001-make-man-install-relative-to-DESTDIR.patch \ + file://0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \ + file://0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \ + file://0004-Dont-disable-libreadline.a-when-using-disable-static.patch \ + file://0005-use-asm-sgidefs.h.patch \ + file://0006-Change-order-of-CFLAGS.patch \ + file://0007-resolve-restrict-keyword-conflict.patch \ + file://0008-Fix-invalid-sigprocmask-call.patch \ + file://0009-gdbserver-ctrl-c-handling.patch \ + file://readline-8.2.patch \ + file://0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ + " +SRC_URI[sha256sum] = "0e1793bf8f2b54d53f46dea84ccfd446f48f81b297b28c4f7fc017b818d69fed" diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch index cb2eec18..050bdde5 100644 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch @@ -1,10 +1,8 @@ -From 2112c9ded01ddd08f0e31e5ce23eecac6c04e8c4 Mon Sep 17 00:00:00 2001 -From: David Holsgrove <david.holsgrove@petalogix.com> -Date: Mon, 6 Feb 2012 10:28:29 +1000 -Subject: [PATCH 06/16] [Patch, microblaze]: Add initial port of linux - gdbserver - -add gdb_proc_service_h to gdbserver microblaze-linux +From baac387700a72407b3994bfd0a03825112c9745f Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 10 Oct 2022 15:07:22 +0530 +Subject: [PATCH 1/8] Add initial port of linux gdbserver add + gdb_proc_service_h to gdbserver microblaze-linux gdbserver needs to initialise the microblaze registers @@ -12,7 +10,6 @@ other archs use this step to run a *_arch_setup() to carry out all architecture specific setup - may need to add in future * add linux-ptrace.o to gdbserver configure - * gdb/configure.tgt: Set build_gdbserver=yes * Update breakpoint opcode * fix segfault on connecting gdbserver * add microblaze_linux_memory_remove_breakpoint @@ -20,108 +17,368 @@ architecture specific setup - may need to add in future * add set_gdbarch_fetch_tls_load_module_address * Force reading of r0 as 0, prevent stores +Upstream-Status: Pending + Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> -Upstream-Status: Pending +Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> --- - gdb/configure.host | 3 + - gdb/configure.tgt | 1 + - gdb/gdbserver/Makefile.in | 4 + - gdb/gdbserver/configure.srv | 6 + - gdb/gdbserver/linux-microblaze-low.c | 228 +++++++++++++++++++++++++++++++++++ - gdb/microblaze-linux-tdep.c | 25 +++- - gdb/microblaze-tdep.c | 45 ++++++- - gdb/microblaze-tdep.h | 3 +- - gdb/regformats/reg-microblaze.dat | 39 ++++++ - 9 files changed, 348 insertions(+), 6 deletions(-) - create mode 100644 gdb/gdbserver/linux-microblaze-low.c + gdb/configure.host | 2 + + gdb/features/Makefile | 1 + + gdb/features/microblaze-linux.xml | 13 ++ + gdb/microblaze-linux-tdep.c | 29 ++- + gdb/microblaze-tdep.c | 35 +++- + gdb/microblaze-tdep.h | 4 +- + gdb/regformats/microblaze-linux.dat | 64 +++++++ + gdb/regformats/reg-microblaze.dat | 41 +++++ + gdbserver/Makefile.in | 1 + + gdbserver/configure.srv | 10 ++ + gdbserver/linux-microblaze-low.cc | 269 ++++++++++++++++++++++++++++ + 11 files changed, 466 insertions(+), 3 deletions(-) + create mode 100644 gdb/features/microblaze-linux.xml + create mode 100644 gdb/regformats/microblaze-linux.dat create mode 100644 gdb/regformats/reg-microblaze.dat + create mode 100644 gdbserver/linux-microblaze-low.cc diff --git a/gdb/configure.host b/gdb/configure.host -index 15a8288..76cc5fe 100644 +index da71675b201..877537d06ef 100644 --- a/gdb/configure.host +++ b/gdb/configure.host -@@ -59,6 +59,7 @@ i[34567]86*) gdb_host_cpu=i386 ;; +@@ -61,6 +61,7 @@ i[34567]86*) gdb_host_cpu=i386 ;; + loongarch*) gdb_host_cpu=loongarch ;; m68*) gdb_host_cpu=m68k ;; - m88*) gdb_host_cpu=m88k ;; mips*) gdb_host_cpu=mips ;; +microblaze*) gdb_host_cpu=microblaze ;; powerpc* | rs6000) gdb_host_cpu=powerpc ;; sparcv9 | sparc64) gdb_host_cpu=sparc ;; s390*) gdb_host_cpu=s390 ;; -@@ -133,6 +134,8 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu) +@@ -127,6 +128,7 @@ m68*-*-openbsd*) gdb_host=obsd ;; + + m88*-*-openbsd*) gdb_host=obsd ;; + ++microblaze*-*linux*) gdb_host=linux ;; + mips*-*-linux*) gdb_host=linux ;; + mips*-*-netbsdaout* | mips*-*-knetbsd*-gnu) gdb_host=nbsd ;; - mips64*-*-openbsd*) gdb_host=obsd64 ;; +diff --git a/gdb/features/Makefile b/gdb/features/Makefile +index 68e17d0085d..fc3196864c9 100644 +--- a/gdb/features/Makefile ++++ b/gdb/features/Makefile +@@ -46,6 +46,7 @@ + # List of .dat files to create in ../regformats/ + WHICH = mips-linux mips-dsp-linux \ + mips64-linux mips64-dsp-linux \ ++ microblaze-linux \ + nios2-linux \ + or1k-linux \ + rs6000/powerpc-32 \ +diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml +new file mode 100644 +index 00000000000..688a3f83d1e +--- /dev/null ++++ b/gdb/features/microblaze-linux.xml +@@ -0,0 +1,13 @@ ++<?xml version="1.0"?> ++<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. ++ ++ Copying and distribution of this file, with or without modification, ++ are permitted in any medium without royalty provided the copyright ++ notice and this notice are preserved. --> ++ ++<!DOCTYPE target SYSTEM "gdb-target.dtd"> ++<target> ++ <architecture>microblaze</architecture> ++ <osabi>GNU/Linux</osabi> ++ <xi:include href="microblaze-core.xml"/> ++</target> +diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c +index daa7ddf7e4d..5748556a556 100644 +--- a/gdb/microblaze-linux-tdep.c ++++ b/gdb/microblaze-linux-tdep.c +@@ -37,6 +37,22 @@ + #include "tramp-frame.h" + #include "linux-tdep.h" -+microblaze*-*linux*) gdb_host=linux ;; -+ - powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) - gdb_host=aix ;; - powerpc*-*-freebsd*) gdb_host=fbsd ;; -diff --git a/gdb/configure.tgt b/gdb/configure.tgt -index 9297c56..3a7951a 100644 ---- a/gdb/configure.tgt -+++ b/gdb/configure.tgt -@@ -343,6 +343,7 @@ microblaze*-linux-*|microblaze*-*-linux*) - gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o glibc-tdep.o \ - monitor.o dsrec.o solib-svr4.o symfile-mem.o linux-tdep.o" - gdb_sim=../sim/microblaze/libsim.a -+ build_gdbserver=yes - ;; - microblaze*-*-*) - # Target: Xilinx MicroBlaze running standalone -diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in -index f773fa2..a11ace1 100644 ---- a/gdb/gdbserver/Makefile.in -+++ b/gdb/gdbserver/Makefile.in -@@ -148,6 +148,7 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \ - $(srcdir)/linux-ia64-low.c $(srcdir)/linux-low.c \ - $(srcdir)/linux-m32r-low.c \ - $(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \ -+ $(srcdir)/linux-microblaze-low.c \ - $(srcdir)/linux-nios2-low.c \ - $(srcdir)/linux-ppc-low.c \ - $(srcdir)/linux-s390-low.c \ -@@ -329,6 +330,7 @@ clean: - rm -f arm-with-iwmmxt.c - rm -f arm-with-vfpv2.c arm-with-vfpv3.c arm-with-neon.c - rm -f mips-linux.c mips64-linux.c -+ rm -f microblaze-linux.c - rm -f nios2-linux.c - rm -f powerpc-32.c powerpc-32l.c powerpc-64l.c powerpc-e500l.c - rm -f powerpc-altivec32l.c powerpc-cell32l.c powerpc-vsx32l.c -@@ -612,6 +614,8 @@ reg-m68k.c : $(srcdir)/../regformats/reg-m68k.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-m68k.dat reg-m68k.c - reg-cf.c : $(srcdir)/../regformats/reg-cf.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-cf.dat reg-cf.c -+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c - mips-linux.c : $(srcdir)/../regformats/mips-linux.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/mips-linux.dat mips-linux.c - mips-dsp-linux.c : $(srcdir)/../regformats/mips-dsp-linux.dat $(regdat_sh) -diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv -index cc4f53d..359c756 100644 ---- a/gdb/gdbserver/configure.srv -+++ b/gdb/gdbserver/configure.srv -@@ -198,6 +198,12 @@ case "${target}" in - srv_linux_usrregs=yes ++static int microblaze_debug_flag = 0; ++ ++static void ++microblaze_debug (const char *fmt, ...) ++{ ++ if (microblaze_debug_flag) ++ { ++ va_list args; ++ ++ va_start (args, fmt); ++ printf_unfiltered ("MICROBLAZE LINUX: "); ++ vprintf_unfiltered (fmt, args); ++ va_end (args); ++ } ++} ++ + static int + microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) +@@ -50,13 +66,20 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + /* Determine appropriate breakpoint contents and size for this address. */ + bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); + ++ /* Make sure we see the memory breakpoints. */ ++ scoped_restore restore_memory ++ = make_scoped_restore_show_memory_breakpoints (1); ++ + val = target_read_memory (addr, old_contents, bplen); + + /* If our breakpoint is no longer at the address, this means that the + program modified the code on us, so it is wrong to put back the + old value. */ + if (val == 0 && memcmp (bp, old_contents, bplen) == 0) +- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); ++ { ++ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); ++ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); ++ } + + return val; + } +@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info, + /* Trampolines. */ + tramp_frame_prepend_unwinder (gdbarch, + µblaze_linux_sighandler_tramp_frame); ++ ++ /* Enable TLS support. */ ++ set_gdbarch_fetch_tls_load_module_address (gdbarch, ++ svr4_fetch_objfile_link_map); + } + + void _initialize_microblaze_linux_tdep (); +diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c +index 3d5dd669341..3e8e8fe35b9 100644 +--- a/gdb/microblaze-tdep.c ++++ b/gdb/microblaze-tdep.c +@@ -128,7 +128,38 @@ microblaze_fetch_instruction (CORE_ADDR pc) + constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; + + typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint; +- ++static int ++microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, ++ struct bp_target_info *bp_tgt) ++{ ++ CORE_ADDR addr = bp_tgt->placed_address; ++ const unsigned char *bp; ++ int val; ++ int bplen; ++ gdb_byte old_contents[BREAKPOINT_MAX]; ++ ++ /* Determine appropriate breakpoint contents and size for this address. */ ++ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); ++ if (bp == NULL) ++ error (_("Software breakpoints not implemented for this target.")); ++ ++ /* Make sure we see the memory breakpoints. */ ++ scoped_restore restore_memory ++ = make_scoped_restore_show_memory_breakpoints (1); ++ ++ val = target_read_memory (addr, old_contents, bplen); ++ ++ /* If our breakpoint is no longer at the address, this means that the ++ program modified the code on us, so it is wrong to put back the ++ old value. */ ++ if (val == 0 && memcmp (bp, old_contents, bplen) == 0) ++ { ++ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); ++ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); ++ } ++ ++ return val; ++} + + /* Allocate and initialize a frame cache. */ + +@@ -716,6 +747,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + microblaze_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + microblaze_breakpoint::bp_from_kind); ++ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); + + set_gdbarch_frame_args_skip (gdbarch, 8); + +@@ -756,4 +788,5 @@ When non-zero, microblaze specific debugging is enabled."), + NULL, + &setdebuglist, &showdebuglist); + ++ + } +diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h +index 4d90e8785dc..53fcb2297e6 100644 +--- a/gdb/microblaze-tdep.h ++++ b/gdb/microblaze-tdep.h +@@ -118,6 +118,8 @@ struct microblaze_frame_cache + + /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. + Only used for native debugging. */ +-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60} ++#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} ++#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} ++ + + #endif /* microblaze-tdep.h */ +diff --git a/gdb/regformats/microblaze-linux.dat b/gdb/regformats/microblaze-linux.dat +new file mode 100644 +index 00000000000..b5b49f485cd +--- /dev/null ++++ b/gdb/regformats/microblaze-linux.dat +@@ -0,0 +1,64 @@ ++# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro: ++# Generated from: microblaze-linux.xml ++name:microblaze_linux ++xmltarget:microblaze-linux.xml ++expedite:r1,rpc ++32:r0 ++32:r1 ++32:r2 ++32:r3 ++32:r4 ++32:r5 ++32:r6 ++32:r7 ++32:r8 ++32:r9 ++32:r10 ++32:r11 ++32:r12 ++32:r13 ++32:r14 ++32:r15 ++32:r16 ++32:r17 ++32:r18 ++32:r19 ++32:r20 ++32:r21 ++32:r22 ++32:r23 ++32:r24 ++32:r25 ++32:r26 ++32:r27 ++32:r28 ++32:r29 ++32:r30 ++32:r31 ++32:rpc ++32:rmsr ++32:rear ++32:resr ++32:rfsr ++32:rbtr ++32:rpvr0 ++32:rpvr1 ++32:rpvr2 ++32:rpvr3 ++32:rpvr4 ++32:rpvr5 ++32:rpvr6 ++32:rpvr7 ++32:rpvr8 ++32:rpvr9 ++32:rpvr10 ++32:rpvr11 ++32:redr ++32:rpid ++32:rzpr ++32:rtlbx ++32:rtlbsx ++32:rtlblo ++32:rtlbhi ++32:slr ++32:shr +diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat +new file mode 100644 +index 00000000000..bd8a4384424 +--- /dev/null ++++ b/gdb/regformats/reg-microblaze.dat +@@ -0,0 +1,41 @@ ++name:microblaze ++expedite:r1,pc ++32:r0 ++32:r1 ++32:r2 ++32:r3 ++32:r4 ++32:r5 ++32:r6 ++32:r7 ++32:r8 ++32:r9 ++32:r10 ++32:r11 ++32:r12 ++32:r13 ++32:r14 ++32:r15 ++32:r16 ++32:r17 ++32:r18 ++32:r19 ++32:r20 ++32:r21 ++32:r22 ++32:r23 ++32:r24 ++32:r25 ++32:r26 ++32:r27 ++32:r28 ++32:r29 ++32:r30 ++32:r31 ++32:pc ++32:msr ++32:ear ++32:esr ++32:fsr ++32:slr ++32:shr +diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in +index 47648b8d962..55a5f5b81ae 100644 +--- a/gdbserver/Makefile.in ++++ b/gdbserver/Makefile.in +@@ -178,6 +178,7 @@ SFILES = \ + $(srcdir)/linux-ia64-low.cc \ + $(srcdir)/linux-low.cc \ + $(srcdir)/linux-m68k-low.cc \ ++ $(srcdir)/linux-microblaze-low.cc \ + $(srcdir)/linux-mips-low.cc \ + $(srcdir)/linux-nios2-low.cc \ + $(srcdir)/linux-or1k-low.cc \ +diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv +index 6e09b0eeb79..1817f1f04fb 100644 +--- a/gdbserver/configure.srv ++++ b/gdbserver/configure.srv +@@ -145,6 +145,16 @@ case "${gdbserver_host}" in + srv_linux_regsets=yes srv_linux_thread_db=yes ;; -+ microblaze*-*-linux*) srv_regobj=microblaze-linux.o -+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o" -+ srv_linux_usrregs=yes -+ srv_linux_regsets=yes -+ srv_linux_thread_db=yes -+ ;; - nios2*-*-linux*) srv_regobj="nios2-linux.o" - srv_tgtobj="$srv_linux_obj linux-nios2-low.o" - srv_xmlfiles="nios2-linux.xml" -diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c ++ ++microblaze*-*-linux*) srv_regobj="microblaze-linux.o" ++ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o" ++ srv_xmlfiles="microblaze-linux.xml" ++ srv_xmlfiles="${srv_xmlfiles} microblaze-core.xml" ++ srv_linux_usrregs=yes ++ srv_linux_regsets=yes ++ srv_linux_thread_db=yes ++ ;; ++ + mips*-*-linux*) srv_regobj="mips-linux.o" + srv_regobj="${srv_regobj} mips-dsp-linux.o" + srv_regobj="${srv_regobj} mips64-linux.o" +diff --git a/gdbserver/linux-microblaze-low.cc b/gdbserver/linux-microblaze-low.cc new file mode 100644 -index 0000000..279df9f +index 00000000000..bf9eecc41ab --- /dev/null -+++ b/gdb/gdbserver/linux-microblaze-low.c -@@ -0,0 +1,228 @@ ++++ b/gdbserver/linux-microblaze-low.cc +@@ -0,0 +1,269 @@ +/* GNU/Linux/Microblaze specific low level interface, for the remote server for + GDB. + Copyright (C) 1995-2013 Free Software Foundation, Inc. @@ -144,12 +401,17 @@ index 0000000..279df9f +#include "server.h" +#include "linux-low.h" + ++#include "elf/common.h" ++#include "nat/gdb_ptrace.h" ++#include <endian.h> ++ +#include <asm/ptrace.h> +#include <sys/procfs.h> +#include <sys/ptrace.h> + +#include "gdb_proc_service.h" + ++ +static int microblaze_regmap[] = + {PT_GPR(0), PT_GPR(1), PT_GPR(2), PT_GPR(3), + PT_GPR(4), PT_GPR(5), PT_GPR(6), PT_GPR(7), @@ -163,14 +425,46 @@ index 0000000..279df9f + PT_FSR + }; + -+#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0]) ++ ++ ++class microblaze_target : public linux_process_target ++{ ++public: ++ ++ const regs_info *get_regs_info () override; ++ ++ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; ++ // CORE_ADDR microblaze_reinsert_addr (regcache *regcache); ++ ++protected: ++ ++ void low_arch_setup () override; ++ ++ bool low_cannot_fetch_register (int regno) override; ++ ++ bool low_cannot_store_register (int regno) override; ++ ++ // bool low_supports_breakpoints () override; ++ ++ CORE_ADDR low_get_pc (regcache *regcache) override; ++ ++ void low_set_pc (regcache *regcache, CORE_ADDR newpc) override; ++ ++ bool low_breakpoint_at (CORE_ADDR pc) override; ++}; ++ ++/* The singleton target ops object. */ ++ ++static microblaze_target the_microblaze_target; ++ ++#define microblaze_num_regs (sizeof (microblaze_regmap) / sizeof (microblaze_regmap[0])) + +/* Defined in auto-generated file microblaze-linux.c. */ -+void init_registers_microblaze (void); -+extern const struct target_desc *tdesc_microblaze; ++void init_registers_microblaze_linux (void); ++extern const struct target_desc *tdesc_microblaze_linux; + -+static int -+microblaze_cannot_store_register (int regno) ++bool ++microblaze_target::low_cannot_store_register (int regno) +{ + if (microblaze_regmap[regno] == -1 || regno == 0) + return 1; @@ -178,14 +472,14 @@ index 0000000..279df9f + return 0; +} + -+static int -+microblaze_cannot_fetch_register (int regno) ++bool ++microblaze_target::low_cannot_fetch_register (int regno) +{ + return 0; +} + -+static CORE_ADDR -+microblaze_get_pc (struct regcache *regcache) ++CORE_ADDR ++microblaze_target::low_get_pc (struct regcache *regcache) +{ + unsigned long pc; + @@ -193,8 +487,8 @@ index 0000000..279df9f + return (CORE_ADDR) pc; +} + -+static void -+microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc) ++void ++microblaze_target::low_set_pc (struct regcache *regcache, CORE_ADDR pc) +{ + unsigned long newpc = pc; + @@ -206,27 +500,37 @@ index 0000000..279df9f +static const unsigned long microblaze_breakpoint = 0xba0c0018; +#define microblaze_breakpoint_len 4 + -+static int -+microblaze_breakpoint_at (CORE_ADDR where) ++/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ ++ ++const gdb_byte * ++microblaze_target::sw_breakpoint_from_kind (int kind, int *size) ++{ ++ *size = microblaze_breakpoint_len; ++ return (const gdb_byte *) µblaze_breakpoint; ++} ++ ++bool ++microblaze_target::low_breakpoint_at (CORE_ADDR where) +{ + unsigned long insn; + -+ (*the_target->read_memory) (where, (unsigned char *) &insn, 4); ++ read_memory (where, (unsigned char *) &insn, 4); + if (insn == microblaze_breakpoint) + return 1; + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} -+ -+static CORE_ADDR -+microblaze_reinsert_addr (struct regcache *regcache) ++#if 0 ++CORE_ADDR ++microblaze_target::microblaze_reinsert_addr (struct regcache *regcache) +{ + unsigned long pc; + collect_register_by_name (regcache, "r15", &pc); + return pc; +} -+ ++#endif ++#if 0 +#ifdef HAVE_PTRACE_GETREGS + +static void @@ -281,15 +585,25 @@ index 0000000..279df9f +} + +#endif /* HAVE_PTRACE_GETREGS */ ++#endif + +static struct regset_info microblaze_regsets[] = { ++#if 0 +#ifdef HAVE_PTRACE_GETREGS + { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset }, -+ { 0, 0, 0, -1, -1, NULL, NULL }, ++ { 0, 0, 0, -1, GENERAL_REGS, NULL, NULL }, +#endif /* HAVE_PTRACE_GETREGS */ -+ { 0, 0, 0, -1, -1, NULL, NULL } ++#endif ++ { 0, 0, 0, -1, GENERAL_REGS, NULL, NULL }, ++ NULL_REGSET +}; + ++static struct usrregs_info microblaze_usrregs_info = ++ { ++ microblaze_num_regs, ++ microblaze_regmap, ++ }; ++ +static struct regsets_info microblaze_regsets_info = + { + microblaze_regsets, /* regsets */ @@ -297,257 +611,43 @@ index 0000000..279df9f + NULL, /* disabled_regsets */ + }; + -+static struct usrregs_info microblaze_usrregs_info = -+ { -+ microblaze_num_regs, -+ microblaze_regmap, -+ }; -+ -+static struct regs_info regs_info = ++static struct regs_info microblaze_regs_info = + { + NULL, /* regset_bitmap */ + µblaze_usrregs_info, + µblaze_regsets_info + }; + -+static const struct regs_info * -+microblaze_regs_info (void) ++const regs_info * ++microblaze_target::get_regs_info (void) +{ -+ return ®s_info; ++ return µblaze_regs_info; +} + -+static void -+microblaze_arch_setup (void) ++/* Support for hardware single step. */ ++ ++static int ++microblaze_supports_hardware_single_step (void) +{ -+ current_process ()->tdesc = tdesc_microblaze; ++ return 1; +} + -+struct linux_target_ops the_low_target = { -+ microblaze_arch_setup, -+ microblaze_regs_info, -+ microblaze_cannot_fetch_register, -+ microblaze_cannot_store_register, -+ NULL, /* fetch_register */ -+ microblaze_get_pc, -+ microblaze_set_pc, -+ (const unsigned char *) µblaze_breakpoint, -+ microblaze_breakpoint_len, -+ microblaze_reinsert_addr, -+ 0, -+ microblaze_breakpoint_at, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ microblaze_collect_ptrace_register, -+ microblaze_supply_ptrace_register, -+}; + +void -+initialize_low_arch (void) ++microblaze_target::low_arch_setup (void) +{ -+ init_registers_microblaze (); -+ -+ initialize_regsets_info (µblaze_regsets_info); ++ current_process ()->tdesc = tdesc_microblaze_linux; +} -\ No newline at end of file -diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c -index 7e6b61b..cf58e21 100644 ---- a/gdb/microblaze-linux-tdep.c -+++ b/gdb/microblaze-linux-tdep.c -@@ -38,6 +38,22 @@ - #include "tramp-frame.h" - #include "linux-tdep.h" - -+static int microblaze_debug_flag = 0; + -+static void -+microblaze_debug (const char *fmt, ...) -+{ -+ if (microblaze_debug_flag) -+ { -+ va_list args; ++linux_process_target *the_linux_target = &the_microblaze_target; + -+ va_start (args, fmt); -+ printf_unfiltered ("MICROBLAZE LINUX: "); -+ vprintf_unfiltered (fmt, args); -+ va_end (args); -+ } -+} -+ - static int - microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, - struct bp_target_info *bp_tgt) -@@ -47,20 +63,27 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, - int val; - int bplen; - gdb_byte old_contents[BREAKPOINT_MAX]; -+ struct cleanup *cleanup; - - /* Determine appropriate breakpoint contents and size for this address. */ - bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); - if (bp == NULL) - error (_("Software breakpoints not implemented for this target.")); - -+ /* Make sure we see the memory breakpoints. */ -+ cleanup = make_show_memory_breakpoints_cleanup (1); - val = target_read_memory (addr, old_contents, bplen); - - /* If our breakpoint is no longer at the address, this means that the - program modified the code on us, so it is wrong to put back the - old value. */ - if (val == 0 && memcmp (bp, old_contents, bplen) == 0) -- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); -+ { -+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); -+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); -+ } - -+ do_cleanups (cleanup); - return val; - } - -diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c -index 50b68d2..1c6dbfe 100644 ---- a/gdb/microblaze-tdep.c -+++ b/gdb/microblaze-tdep.c -@@ -164,6 +164,39 @@ microblaze_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - return sp; - } - -+static int -+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, -+ struct bp_target_info *bp_tgt) ++void ++initialize_low_arch (void) +{ -+ CORE_ADDR addr = bp_tgt->placed_address; -+ const unsigned char *bp; -+ int val; -+ int bplen; -+ gdb_byte old_contents[BREAKPOINT_MAX]; -+ struct cleanup *cleanup; -+ -+ /* Determine appropriate breakpoint contents and size for this address. */ -+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); -+ if (bp == NULL) -+ error (_("Software breakpoints not implemented for this target.")); -+ -+ /* Make sure we see the memory breakpoints. */ -+ cleanup = make_show_memory_breakpoints_cleanup (1); -+ val = target_read_memory (addr, old_contents, bplen); -+ -+ /* If our breakpoint is no longer at the address, this means that the -+ program modified the code on us, so it is wrong to put back the -+ old value. */ -+ if (val == 0 && memcmp (bp, old_contents, bplen) == 0) -+ { -+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); -+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); -+ } -+ -+ do_cleanups (cleanup); -+ return val; ++ init_registers_microblaze_linux (); ++ initialize_regsets_info (µblaze_regsets_info); +} + - static const gdb_byte * - microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, - int *len) -@@ -291,8 +324,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, - - for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE) - { -- //insn = microblaze_fetch_instruction (addr); -- insn = insn_block[(addr - func_addr) / INST_WORD_SIZE]; -+ insn = microblaze_fetch_instruction (addr); -+ //insn = insn_block[(addr - func_addr) / INST_WORD_SIZE]; - op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm); - microblaze_debug ("%s %08lx op=%x r%d r%d imm=%d\n", paddress (gdbarch, addr), insn, op, rd, ra, imm); - -@@ -724,13 +757,15 @@ microblaze_software_single_step (struct frame_info *frame) - rb = get_frame_register_unsigned (frame, lrb); - else - rb = 0; -+ - stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch); -- microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address); -+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address); -+ - if (unconditionalbranch) - stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */ - if (targetvalid && (stepbreaks[0].valid == FALSE || - (stepbreaks[0].address != stepbreaks[1].address)) -- && (stepbreaks[1].address != pc)) { -+ && (stepbreaks[1].address != pc)) { - stepbreaks[1].valid = TRUE; - } else { - stepbreaks[1].valid = FALSE; -@@ -900,6 +935,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - /* Stack grows downward. */ - set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - -+ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); -+ - set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc); - set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); - -diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h -index fec24b9..98aa0f5 100644 ---- a/gdb/microblaze-tdep.h -+++ b/gdb/microblaze-tdep.h -@@ -129,7 +129,8 @@ enum microblaze_regnum - - /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. - Only used for native debugging. */ --#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60} -+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} -+#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} - - extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset, - struct regcache *regcache, -diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat -new file mode 100644 -index 0000000..a5dd0a0 ---- /dev/null -+++ b/gdb/regformats/reg-microblaze.dat -@@ -0,0 +1,39 @@ -+name:microblaze -+expedite:r1,pc -+32:r0 -+32:r1 -+32:r2 -+32:r3 -+32:r4 -+32:r5 -+32:r6 -+32:r7 -+32:r8 -+32:r9 -+32:r10 -+32:r11 -+32:r12 -+32:r13 -+32:r14 -+32:r15 -+32:r16 -+32:r17 -+32:r18 -+32:r19 -+32:r20 -+32:r21 -+32:r22 -+32:r23 -+32:r24 -+32:r25 -+32:r26 -+32:r27 -+32:r28 -+32:r29 -+32:r30 -+32:r31 -+32:pc -+32:msr -+32:ear -+32:esr -+32:fsr -- -1.9.0 +2.37.1 (Apple Git-137.1) diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch new file mode 100644 index 00000000..16d6cf19 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch @@ -0,0 +1,28 @@ +From 8eca28eddcda4ce8a345ca031f43ff1ed6f37089 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 2 Mar 2015 02:27:55 +0000 +Subject: [PATCH 1/9] make man install relative to DESTDIR + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + sim/common/Make-common.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in +index 74e5dad3049..9e95c224ba4 100644 +--- a/sim/common/Make-common.in ++++ b/sim/common/Make-common.in +@@ -70,7 +70,7 @@ tooldir = $(libdir)/$(target_alias) + datadir = @datadir@ + datarootdir = @datarootdir@ + mandir = @mandir@ +-man1dir = $(mandir)/man1 ++man1dir = $(DESTDIR)$(mandir)/man1 + infodir = @infodir@ + includedir = @includedir@ + +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch new file mode 100644 index 00000000..f7af2a62 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch @@ -0,0 +1,303 @@ +From 7da397cae8c0f8826184d6e12fda9ccd11f92753 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 10 Oct 2022 16:37:53 +0530 +Subject: [PATCH 2/8] [Patch,MicroBlaze]: Initial port of core reading support + Added support for reading notes in linux core dumps Support for reading of + PRSTATUS and PSINFO information for rebuilding ".reg" sections of core dumps + at run time. + +Upstream-Status: Pending + +Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> +Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> +Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> +--- + bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++ + gdb/configure.tgt | 2 +- + gdb/microblaze-linux-tdep.c | 17 +++++++- + gdb/microblaze-tdep.c | 48 +++++++++++++++++++++ + gdb/microblaze-tdep.h | 28 +++++++++++++ + 5 files changed, 177 insertions(+), 2 deletions(-) + +diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c +index d09b3f7095d..d3b3c66cf00 100644 +--- a/bfd/elf32-microblaze.c ++++ b/bfd/elf32-microblaze.c +@@ -713,6 +713,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name) + return _bfd_elf_is_local_label_name (abfd, name); + } + ++/* Support for core dump NOTE sections. */ ++static bool ++microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) ++{ ++ int offset; ++ unsigned int size; ++ ++ switch (note->descsz) ++ { ++ default: ++ return false; ++ ++ case 228: /* Linux/MicroBlaze */ ++ /* pr_cursig */ ++ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); ++ ++ /* pr_pid */ ++ elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24); ++ ++ /* pr_reg */ ++ offset = 72; ++ size = 50 * 4; ++ ++ break; ++ } ++ ++ /* Make a ".reg/999" section. */ ++ return _bfd_elfcore_make_pseudosection (abfd, ".reg", ++ size, note->descpos + offset); ++} ++ ++static bool ++microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) ++{ ++ switch (note->descsz) ++ { ++ default: ++ return false; ++ ++ case 128: /* Linux/MicroBlaze elf_prpsinfo */ ++ elf_tdata (abfd)->core->program ++ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); ++ elf_tdata (abfd)->core->command ++ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); ++ } ++ ++ /* Note that for some reason, a spurious space is tacked ++ onto the end of the args in some (at least one anyway) ++ implementations, so strip it off if it exists. */ ++ ++ { ++ char *command = elf_tdata (abfd)->core->command; ++ int n = strlen (command); ++ ++ if (0 < n && command[n - 1] == ' ') ++ command[n - 1] = '\0'; ++ } ++ ++ return true; ++} ++ ++/* The microblaze linker (like many others) needs to keep track of ++ the number of relocs that it decides to copy as dynamic relocs in ++ check_relocs for each symbol. This is so that it can later discard ++ them if they are found to be unnecessary. We store the information ++ in a field extending the regular ELF linker hash table. */ ++ ++struct elf32_mb_dyn_relocs ++{ ++ struct elf32_mb_dyn_relocs *next; ++ ++ /* The input section of the reloc. */ ++ asection *sec; ++ ++ /* Total number of relocs copied for the input section. */ ++ bfd_size_type count; ++ ++ /* Number of pc-relative relocs copied for the input section. */ ++ bfd_size_type pc_count; ++}; ++ + /* ELF linker hash entry. */ + + struct elf32_mb_link_hash_entry +@@ -3434,4 +3515,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, + #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections + #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook + ++#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus ++#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo ++ + #include "elf32-target.h" +diff --git a/gdb/configure.tgt b/gdb/configure.tgt +index 0705ccf32b8..7ea186481f3 100644 +--- a/gdb/configure.tgt ++++ b/gdb/configure.tgt +@@ -400,7 +400,7 @@ mep-*-*) + + microblaze*-linux-*|microblaze*-*-linux*) + # Target: Xilinx MicroBlaze running Linux +- gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o solib-svr4.o \ ++ gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o solib-svr4.o glibc-tdep.o \ + symfile-mem.o linux-tdep.o" + ;; + microblaze*-*-*) +diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c +index 5748556a556..d6197c49dfd 100644 +--- a/gdb/microblaze-linux-tdep.c ++++ b/gdb/microblaze-linux-tdep.c +@@ -36,6 +36,7 @@ + #include "frame-unwind.h" + #include "tramp-frame.h" + #include "linux-tdep.h" ++#include "glibc-tdep.h" + + static int microblaze_debug_flag = 0; + +@@ -135,11 +136,14 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame = + microblaze_linux_sighandler_cache_init + }; + +- + static void + microblaze_linux_init_abi (struct gdbarch_info info, + struct gdbarch *gdbarch) + { ++ struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch); ++ ++ tdep->sizeof_gregset = 200; ++ + linux_init_abi (info, gdbarch, 0); + + set_gdbarch_memory_remove_breakpoint (gdbarch, +@@ -153,6 +157,17 @@ microblaze_linux_init_abi (struct gdbarch_info info, + tramp_frame_prepend_unwinder (gdbarch, + µblaze_linux_sighandler_tramp_frame); + ++ /* BFD target for core files. */ ++ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ++ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); ++ else ++ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); ++ ++ ++ /* Shared library handling. */ ++ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); ++ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); ++ + /* Enable TLS support. */ + set_gdbarch_fetch_tls_load_module_address (gdbarch, + svr4_fetch_objfile_link_map); +diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c +index 3e8e8fe35b9..ccd37d085d6 100644 +--- a/gdb/microblaze-tdep.c ++++ b/gdb/microblaze-tdep.c +@@ -666,6 +666,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) + tdesc_microblaze_with_stack_protect); + } + ++void ++microblaze_supply_gregset (const struct regset *regset, ++ struct regcache *regcache, ++ int regnum, const void *gregs) ++{ ++ const unsigned int *regs = (const unsigned int *)gregs; ++ if (regnum >= 0) ++ regcache->raw_supply (regnum, regs + regnum); ++ ++ if (regnum == -1) { ++ int i; ++ ++ for (i = 0; i < 50; i++) { ++ regcache->raw_supply (i, regs + i); ++ } ++ } ++} ++ ++ ++/* Return the appropriate register set for the core section identified ++ by SECT_NAME and SECT_SIZE. */ ++ ++static void ++microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch, ++ iterate_over_regset_sections_cb *cb, ++ void *cb_data, ++ const struct regcache *regcache) ++{ ++ struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch); ++ ++ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data); ++ ++ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data); ++} ++ ++ ++ + static struct gdbarch * + microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + { +@@ -718,6 +755,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + microblaze_gdbarch_tdep *tdep = new microblaze_gdbarch_tdep; + gdbarch = gdbarch_alloc (&info, tdep); + ++ tdep->gregset = NULL; ++ tdep->sizeof_gregset = 0; ++ tdep->fpregset = NULL; ++ tdep->sizeof_fpregset = 0; + set_gdbarch_long_double_bit (gdbarch, 128); + + set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); +@@ -766,6 +807,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); + if (tdesc_data != NULL) + tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data)); ++ //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer); ++ ++ /* If we have register sets, enable the generic core file support. */ ++ if (tdep->gregset) { ++ set_gdbarch_iterate_over_regset_sections (gdbarch, ++ microblaze_iterate_over_regset_sections); ++ } + + return gdbarch; + } +diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h +index 53fcb2297e6..2e853d84d72 100644 +--- a/gdb/microblaze-tdep.h ++++ b/gdb/microblaze-tdep.h +@@ -23,8 +23,23 @@ + #include "gdbarch.h" + + /* Microblaze architecture-specific information. */ ++struct microblaze_gregset ++{ ++ microblaze_gregset() {} ++ unsigned int gregs[32]; ++ unsigned int fpregs[32]; ++ unsigned int pregs[16]; ++}; ++ + struct microblaze_gdbarch_tdep : gdbarch_tdep + { ++ int dummy; // declare something. ++ ++ /* Register sets. */ ++ struct regset *gregset; ++ size_t sizeof_gregset; ++ struct regset *fpregset; ++ size_t sizeof_fpregset; + }; + + /* Register numbers. */ +@@ -121,5 +136,18 @@ struct microblaze_frame_cache + #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} + #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} + ++extern void microblaze_supply_gregset (const struct regset *regset, ++ struct regcache *regcache, ++ int regnum, const void *gregs); ++extern void microblaze_collect_gregset (const struct regset *regset, ++ const struct regcache *regcache, ++ int regnum, void *gregs); ++extern void microblaze_supply_fpregset (struct regcache *regcache, ++ int regnum, const void *fpregs); ++extern void microblaze_collect_fpregset (const struct regcache *regcache, ++ int regnum, void *fpregs); ++ ++extern const struct regset * microblaze_regset_from_core_section (struct gdbarch *gdbarch, ++ const char *sect_name, size_t sect_size); + + #endif /* microblaze-tdep.h */ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch new file mode 100644 index 00000000..8d263de8 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch @@ -0,0 +1,35 @@ +From 37d3afd2eaa95c89ad7cb5d0079b017752e4d0ea Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 23 Mar 2016 06:30:09 +0000 +Subject: [PATCH 2/9] mips-linux-nat: Define _ABIO32 if not defined + +This helps building gdb on mips64 on musl, since +musl does not provide sgidefs.h this define is +only defined when GCC is using o32 ABI, in that +case gcc emits it as built-in define and hence +it works ok for mips32 + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gdb/mips-linux-nat.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c +index 20e12b6889e..6adc61235aa 100644 +--- a/gdb/mips-linux-nat.c ++++ b/gdb/mips-linux-nat.c +@@ -41,6 +41,10 @@ + #ifndef PTRACE_GET_THREAD_AREA + #define PTRACE_GET_THREAD_AREA 25 + #endif ++/* musl does not define and relies on compiler built-in macros for it */ ++#ifndef _ABIO32 ++#define _ABIO32 1 ++#endif + + class mips_linux_nat_target final : public linux_nat_trad_target + { +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch new file mode 100644 index 00000000..d8ba6fca --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch @@ -0,0 +1,50 @@ +From 6ecb1de66a6a5f55e69c9b108a3d5a85b0ebf315 Mon Sep 17 00:00:00 2001 +From: Nathan Rossi <nathan.rossi@petalogix.com> +Date: Tue, 8 May 2012 18:11:17 +1000 +Subject: [PATCH 3/8] Fix debug message when register is unavailable + +Upstream-Status: Pending + +Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> + +Conflicts: + gdb/frame.c +--- + gdb/frame.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/gdb/frame.c b/gdb/frame.c +index ce95cf8343b..c49ab9feab2 100644 +--- a/gdb/frame.c ++++ b/gdb/frame.c +@@ -1261,13 +1261,20 @@ frame_unwind_register_value (frame_info *next_frame, int regnum) + else + { + int i; +- gdb::array_view<const gdb_byte> buf = value_contents (value); +- +- fprintf_unfiltered (&debug_file, " bytes="); +- fprintf_unfiltered (&debug_file, "["); +- for (i = 0; i < register_size (gdbarch, regnum); i++) +- fprintf_unfiltered (&debug_file, "%02x", buf[i]); +- fprintf_unfiltered (&debug_file, "]"); ++ const gdb_byte *buf = NULL; ++ if (value_entirely_available(value)) { ++ gdb::array_view<const gdb_byte> buf = value_contents (value); ++ } ++ ++ fprintf_unfiltered (gdb_stdlog, " bytes="); ++ fprintf_unfiltered (gdb_stdlog, "["); ++ if (buf != NULL) { ++ for (i = 0; i < register_size (gdbarch, regnum); i++) ++ fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]); ++ } else { ++ fprintf_unfiltered (gdb_stdlog, "unavailable"); ++ } ++ fprintf_unfiltered (gdb_stdlog, "]"); + } + } + +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch new file mode 100644 index 00000000..7e09404b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch @@ -0,0 +1,52 @@ +From e689eec672ee8c53b3adb2ade2b5deb9b7cd99d4 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 30 Apr 2016 18:32:14 -0700 +Subject: [PATCH 3/9] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gdb/nat/ppc-linux.h | 6 ++++++ + gdbserver/linux-ppc-low.cc | 6 ++++++ + 2 files changed, 12 insertions(+) + +diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h +index 1094f6b0be3..d8588a646c2 100644 +--- a/gdb/nat/ppc-linux.h ++++ b/gdb/nat/ppc-linux.h +@@ -18,7 +18,13 @@ + #ifndef NAT_PPC_LINUX_H + #define NAT_PPC_LINUX_H + ++#if !defined(__GLIBC__) ++# define pt_regs uapi_pt_regs ++#endif + #include <asm/ptrace.h> ++#if !defined(__GLIBC__) ++# undef pt_regs ++#endif + #include <asm/cputable.h> + + /* This sometimes isn't defined. */ +diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc +index 08824887003..69afbae5359 100644 +--- a/gdbserver/linux-ppc-low.cc ++++ b/gdbserver/linux-ppc-low.cc +@@ -23,7 +23,13 @@ + #include "elf/common.h" + #include <sys/uio.h> + #include <elf.h> ++#if !defined(__GLIBC__) ++# define pt_regs uapi_pt_regs ++#endif + #include <asm/ptrace.h> ++#if !defined(__GLIBC__) ++# undef pt_regs ++#endif + + #include "arch/ppc-linux-common.h" + #include "arch/ppc-linux-tdesc.h" +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Dont-disable-libreadline.a-when-using-disable-static.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Dont-disable-libreadline.a-when-using-disable-static.patch new file mode 100644 index 00000000..a1e85e91 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Dont-disable-libreadline.a-when-using-disable-static.patch @@ -0,0 +1,50 @@ +From 15ee6a626242efb8f367be49c13e00d0b72317f0 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 30 Apr 2016 15:25:03 -0700 +Subject: [PATCH 4/9] Dont disable libreadline.a when using --disable-static + +If gdb is configured with --disable-static then this is dutifully passed to +readline which then disables libreadline.a, which causes a problem when gdb +tries to link against that. + +To ensure that readline always builds static libraries, pass --enable-static to +the sub-configure. + +Upstream-Status: Pending +Signed-off-by: Ross Burton <ross.burton@intel.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Makefile.def | 3 ++- + Makefile.in | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/Makefile.def b/Makefile.def +index acdcd625ed6..78fc31e1199 100644 +--- a/Makefile.def ++++ b/Makefile.def +@@ -120,7 +120,8 @@ host_modules= { module= libiconv; + missing= install-html; + missing= install-info; }; + host_modules= { module= m4; }; +-host_modules= { module= readline; }; ++host_modules= { module= readline; ++ extra_configure_flags='--enable-static';}; + host_modules= { module= sid; }; + host_modules= { module= sim; }; + host_modules= { module= texinfo; no_install= true; }; +diff --git a/Makefile.in b/Makefile.in +index 3aacd2daac9..aa58adada4a 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -32791,7 +32791,7 @@ configure-readline: + $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ +- --target=${target_alias} \ ++ --target=${target_alias} --enable-static \ + || exit 1 + @endif readline + +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch new file mode 100644 index 00000000..08b0ae17 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch @@ -0,0 +1,836 @@ +From 8d05b79cda7617f228fa4bb6e5147689b662699e Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 10 Oct 2022 18:53:46 +0530 +Subject: [PATCH 4/8] [Patch,MicroBlaze] : MicroBlaze native gdb port. + +signed-off-by : Mahesh Bodapati <mbodapat@amd.com> +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gdb/Makefile.in | 2 + + gdb/configure.nat | 4 + + gdb/features/microblaze-linux.c | 79 +++++++ + gdb/microblaze-linux-nat.c | 366 ++++++++++++++++++++++++++++++++ + gdb/microblaze-linux-tdep.c | 2 + + gdb/microblaze-linux-tdep.h | 24 +++ + gdb/microblaze-tdep.c | 151 ++++++++++++- + gdb/microblaze-tdep.h | 15 +- + 8 files changed, 629 insertions(+), 14 deletions(-) + create mode 100755 gdb/features/microblaze-linux.c + create mode 100755 gdb/microblaze-linux-nat.c + create mode 100644 gdb/microblaze-linux-tdep.h + +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +index aecab41eeb8..fb63e1662c1 100644 +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -1374,6 +1374,7 @@ HFILES_NO_SRCDIR = \ + memory-map.h \ + memrange.h \ + microblaze-tdep.h \ ++ microblaze-linux-tdep.h \ + mips-linux-tdep.h \ + mips-netbsd-tdep.h \ + mips-tdep.h \ +@@ -2249,6 +2250,7 @@ ALLDEPFILES = \ + m68k-linux-nat.c \ + m68k-linux-tdep.c \ + m68k-tdep.c \ ++ microblaze-linux-nat.c \ + microblaze-linux-tdep.c \ + microblaze-tdep.c \ + mingw-hdep.c \ +diff --git a/gdb/configure.nat b/gdb/configure.nat +index b45519fd116..256c666e760 100644 +--- a/gdb/configure.nat ++++ b/gdb/configure.nat +@@ -270,6 +270,10 @@ case ${gdb_host} in + # Host: Motorola m68k running GNU/Linux. + NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o" + ;; ++ microblaze) ++ # Host: Microblaze running GNU/Linux. ++ NATDEPFILES="${NATDEPFILES} microblaze-linux-nat.o" ++ ;; + mips) + # Host: Linux/MIPS + NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \ +diff --git a/gdb/features/microblaze-linux.c b/gdb/features/microblaze-linux.c +new file mode 100755 +index 00000000000..267e12f6d59 +--- /dev/null ++++ b/gdb/features/microblaze-linux.c +@@ -0,0 +1,79 @@ ++/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: ++ Original: microblaze.xml */ ++ ++#include "defs.h" ++#include "osabi.h" ++#include "target-descriptions.h" ++ ++struct target_desc *tdesc_microblaze_linux; ++static void ++initialize_tdesc_microblaze_linux (void) ++{ ++ target_desc_up result = allocate_target_description (); ++ struct tdesc_feature *feature; ++ set_tdesc_architecture (result.get(), bfd_scan_arch ("microblaze")); ++ set_tdesc_osabi (result.get(), osabi_from_tdesc_string ("GNU/Linux")); ++ ++ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze.core"); ++ tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); ++ ++ tdesc_microblaze_linux = result.release(); ++} +diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c +new file mode 100755 +index 00000000000..6b9daa23120 +--- /dev/null ++++ b/gdb/microblaze-linux-nat.c +@@ -0,0 +1,366 @@ ++/* Native-dependent code for GNU/Linux MicroBlaze.
++ Copyright (C) 2021 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++#include "defs.h"
++#include "arch-utils.h"
++#include "dis-asm.h"
++#include "frame.h"
++#include "trad-frame.h"
++#include "symtab.h"
++#include "value.h"
++#include "gdbcmd.h"
++#include "breakpoint.h"
++#include "inferior.h"
++#include "gdbthread.h"
++#include "gdbcore.h"
++#include "regcache.h"
++#include "regset.h"
++#include "target.h"
++#include "frame.h"
++#include "frame-base.h"
++#include "frame-unwind.h"
++#include "osabi.h"
++#include "gdbsupport/gdb_assert.h"
++#include <string.h>
++#include "target-descriptions.h"
++#include "opcodes/microblaze-opcm.h"
++#include "opcodes/microblaze-dis.h"
++#include "gregset.h"
++
++#include "linux-nat.h"
++#include "linux-tdep.h"
++#include "target-descriptions.h"
++
++#include <sys/user.h>
++#include <sys/ioctl.h>
++#include <sys/uio.h>
++#include "gdbsupport/gdb_wait.h"
++#include <fcntl.h>
++#include <sys/procfs.h>
++#include "nat/gdb_ptrace.h"
++#include "nat/linux-ptrace.h"
++#include "inf-ptrace.h"
++#include <algorithm>
++#include <unordered_map>
++#include <list>
++#include <sys/ptrace.h>
++
++/* Prototypes for supply_gregset etc. */
++#include "gregset.h"
++
++#include "microblaze-tdep.h"
++#include "microblaze-linux-tdep.h"
++#include "inferior.h"
++
++#include "elf/common.h"
++
++#include "auxv.h"
++#include "linux-tdep.h"
++
++#include <sys/ptrace.h>
++
++
++//int have_ptrace_getsetregs=1;
++
++/* MicroBlaze Linux native additions to the default linux support. */
++
++class microblaze_linux_nat_target final : public linux_nat_target
++{
++public:
++ /* Add our register access methods. */
++ void fetch_registers (struct regcache *regcache, int regnum) override;
++ void store_registers (struct regcache *regcache, int regnum) override;
++
++ /* Read suitable target description. */
++ const struct target_desc *read_description () override;
++};
++
++static microblaze_linux_nat_target the_microblaze_linux_nat_target;
++
++static int
++microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
++{
++ int u_addr = -1;
++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
++ * interface, and not the wordsize of the program's ABI. */
++ int wordsize = sizeof (long);
++
++ /* General purpose registers occupy 1 slot each in the buffer. */
++ if (regno >= MICROBLAZE_R0_REGNUM
++ && regno <= MICROBLAZE_FSR_REGNUM)
++ u_addr = ((regno - MICROBLAZE_R0_REGNUM)* wordsize);
++
++ return u_addr;
++}
++
++/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1)
++ from regset GREGS into REGCACHE. */
++
++static void
++supply_gregset_regnum (struct regcache *regcache, const prgregset_t *gregs,
++ int regnum)
++{
++ int i;
++ const elf_greg_t *regp = *gregs;
++ /* Access all registers */
++ if (regnum == -1)
++ {
++ /* We fill the general purpose registers. */
++ for (i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++)
++ regcache->raw_supply (i, regp + i);
++
++ /* Supply MICROBLAZE_PC_REGNUM from index 32. */
++ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32);
++
++ /* Fill the inaccessible zero register with zero. */
++ regcache->raw_supply_zeroed (0);
++ }
++ else if (regnum == MICROBLAZE_R0_REGNUM)
++ regcache->raw_supply_zeroed (0);
++ else if (regnum == MICROBLAZE_PC_REGNUM)
++ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32);
++ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM)
++ regcache->raw_supply (regnum, regp + regnum);
++}
++
++/* Copy all general purpose registers from regset GREGS into REGCACHE. */
++
++void
++supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
++{
++ supply_gregset_regnum (regcache, gregs, -1);
++}
++
++/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1)
++ from REGCACHE into regset GREGS. */
++
++void
++fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
++{
++ elf_greg_t *regp = *gregs;
++ if (regnum == -1)
++ {
++ /* We fill the general purpose registers. */
++ for (int i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++)
++ regcache->raw_collect (i, regp + i);
++
++ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32);
++ }
++ else if (regnum == MICROBLAZE_R0_REGNUM)
++ /* Nothing to do here. */
++ ;
++ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM)
++ regcache->raw_collect (regnum, regp + regnum);
++ else if (regnum == MICROBLAZE_PC_REGNUM)
++ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32);
++}
++
++/* Transfering floating-point registers between GDB, inferiors and cores.
++ Since MicroBlaze floating-point registers are the same as GPRs these do
++ nothing. */
++
++void
++supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
++{
++}
++
++void
++fill_fpregset (const struct regcache *regcache,
++ gdb_fpregset_t *fpregs, int regno)
++{
++}
++
++
++static void
++fetch_register (struct regcache *regcache, int tid, int regno)
++{
++ struct gdbarch *gdbarch = regcache->arch ();
++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++ /* This isn't really an address. But ptrace thinks of it as one. */
++ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
++ int bytes_transferred;
++ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
++
++ if (regaddr == -1)
++ {
++ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
++ regcache->raw_supply (regno, buf);
++ return;
++ }
++
++ /* Read the raw register using sizeof(long) sized chunks. On a
++ * 32-bit platform, 64-bit floating-point registers will require two
++ * transfers. */
++ for (bytes_transferred = 0;
++ bytes_transferred < register_size (gdbarch, regno);
++ bytes_transferred += sizeof (long))
++ {
++ long l;
++
++ errno = 0;
++ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
++ if (errno == EIO)
++ {
++ printf("ptrace io error\n");
++ }
++ regaddr += sizeof (long);
++ if (errno != 0)
++ {
++ char message[128];
++ sprintf (message, "reading register %s (#%d)",
++ gdbarch_register_name (gdbarch, regno), regno);
++ perror_with_name (message);
++ }
++ memcpy (&buf[bytes_transferred], &l, sizeof (l));
++ }
++
++ /* Now supply the register. Keep in mind that the regcache's idea
++ * of the register's size may not be a multiple of sizeof
++ * (long). */
++ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
++ {
++ /* Little-endian values are always found at the left end of the
++ * bytes transferred. */
++ regcache->raw_supply (regno, buf);
++ }
++ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
++ {
++ /* Big-endian values are found at the right end of the bytes
++ * transferred. */
++ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
++ regcache->raw_supply (regno, buf + padding);
++ }
++ else
++ internal_error (__FILE__, __LINE__,
++ _("fetch_register: unexpected byte order: %d"),
++ gdbarch_byte_order (gdbarch));
++}
++
++
++/* This is a wrapper for the fetch_all_gp_regs function. It is
++ * responsible for verifying if this target has the ptrace request
++ * that can be used to fetch all general-purpose registers at one
++ * shot. If it doesn't, then we should fetch them using the
++ * old-fashioned way, which is to iterate over the registers and
++ * request them one by one. */
++static void
++fetch_gp_regs (struct regcache *regcache, int tid)
++{
++ int i;
++/* If we've hit this point, it doesn't really matter which
++ architecture we are using. We just need to read the
++ registers in the "old-fashioned way". */
++ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
++ fetch_register (regcache, tid, i);
++}
++
++/* Return a target description for the current target. */
++
++const struct target_desc *
++microblaze_linux_nat_target::read_description ()
++{
++ return tdesc_microblaze_linux;
++}
++
++/* Fetch REGNUM (or all registers if REGNUM == -1) from the target
++ into REGCACHE using PTRACE_GETREGSET. */
++
++void
++microblaze_linux_nat_target::fetch_registers (struct regcache * regcache,
++ int regno)
++{
++ /* Get the thread id for the ptrace call. */
++ int tid = regcache->ptid ().lwp ();
++//int tid = get_ptrace_pid (regcache->ptid());
++#if 1
++ if (regno == -1)
++#endif
++ fetch_gp_regs (regcache, tid);
++#if 1
++ else
++ fetch_register (regcache, tid, regno);
++#endif
++}
++
++
++/* Store REGNUM (or all registers if REGNUM == -1) to the target
++ from REGCACHE using PTRACE_SETREGSET. */
++
++void
++microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno)
++{
++ int tid;
++
++ tid = get_ptrace_pid (regcache->ptid ());
++
++ struct gdbarch *gdbarch = regcache->arch ();
++ /* This isn't really an address. But ptrace thinks of it as one. */
++ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
++ int i;
++ size_t bytes_to_transfer;
++ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
++
++ if (regaddr == -1)
++ return;
++
++ /* First collect the register. Keep in mind that the regcache's
++ * idea of the register's size may not be a multiple of sizeof
++ * (long). */
++ memset (buf, 0, sizeof buf);
++ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
++ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
++ {
++ /* Little-endian values always sit at the left end of the buffer. */
++ regcache->raw_collect (regno, buf);
++ }
++ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
++ {
++ /* Big-endian values sit at the right end of the buffer. */
++ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
++ regcache->raw_collect (regno, buf + padding);
++ }
++
++ for (i = 0; i < bytes_to_transfer; i += sizeof (long))
++ {
++ long l;
++
++ memcpy (&l, &buf[i], sizeof (l));
++ errno = 0;
++ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
++ regaddr += sizeof (long);
++
++ if (errno != 0)
++ {
++ char message[128];
++ sprintf (message, "writing register %s (#%d)",
++ gdbarch_register_name (gdbarch, regno), regno);
++ perror_with_name (message);
++ }
++ }
++}
++
++void _initialize_microblaze_linux_nat (void);
++
++void
++_initialize_microblaze_linux_nat (void)
++{
++ /* Register the target. */
++ linux_target = &the_microblaze_linux_nat_target;
++ add_inf_child_target (linux_target);
++}
+diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c +index d6197c49dfd..fc52adffb72 100644 +--- a/gdb/microblaze-linux-tdep.c ++++ b/gdb/microblaze-linux-tdep.c +@@ -37,6 +37,7 @@ + #include "tramp-frame.h" + #include "linux-tdep.h" + #include "glibc-tdep.h" ++#include "features/microblaze-linux.c" + + static int microblaze_debug_flag = 0; + +@@ -179,4 +180,5 @@ _initialize_microblaze_linux_tdep () + { + gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX, + microblaze_linux_init_abi); ++ initialize_tdesc_microblaze_linux (); + } +diff --git a/gdb/microblaze-linux-tdep.h b/gdb/microblaze-linux-tdep.h +new file mode 100644 +index 00000000000..a2c744e2961 +--- /dev/null ++++ b/gdb/microblaze-linux-tdep.h +@@ -0,0 +1,24 @@ ++/* Target-dependent code for GNU/Linux on OpenRISC. ++ ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see <http://www.gnu.org/licenses/>. */ ++#ifndef MICROBLAZE_LINUX_TDEP_H ++#define MICROBLAZE_LINUX_TDEP_H ++ /* Target descriptions. */ ++ extern struct target_desc *tdesc_microblaze_linux; ++ ++#endif /* MICROBLAZE_LINUX_TDEP_H */ +diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c +index ccd37d085d6..ccb6b730d64 100644 +--- a/gdb/microblaze-tdep.c ++++ b/gdb/microblaze-tdep.c +@@ -285,6 +285,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, + cache->frameless_p = 0; /* Frame found. */ + save_hidden_pointer_found = 0; + non_stack_instruction_found = 0; ++ cache->register_offsets[rd] = -imm; + continue; + } + else if (IS_SPILL_SP(op, rd, ra)) +@@ -431,15 +432,17 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) + if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end)) + { + sal = find_pc_line (func_start, 0); +- +- if (sal.end < func_end +- && start_pc <= sal.end) ++ ++ if (sal.line !=0 && sal.end <= func_end && start_pc <= sal.end) { + start_pc = sal.end; ++ microblaze_debug("start_pc is %d\t sal.end is %d\t func_end is %d\t",start_pc,sal.end,func_end); ++ } + } + + ostart_pc = microblaze_analyze_prologue (gdbarch, func_start, 0xffffffffUL, + &cache); + ++ + if (ostart_pc > start_pc) + return ostart_pc; + return start_pc; +@@ -453,6 +456,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) + struct microblaze_frame_cache *cache; + struct gdbarch *gdbarch = get_frame_arch (next_frame); + int rn; ++ CORE_ADDR current_pc; + + if (*this_cache) + return (struct microblaze_frame_cache *) *this_cache; +@@ -466,10 +470,17 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) + cache->register_offsets[rn] = -1; + + /* Call for side effects. */ +- get_frame_func (next_frame); +- +- cache->pc = get_frame_address_in_block (next_frame); +- ++ cache->pc = get_frame_func (next_frame); ++ ++// cache->pc = get_frame_address_in_block (next_frame); ++ current_pc = get_frame_pc (next_frame); ++ if (cache->pc) ++ microblaze_analyze_prologue (gdbarch, cache->pc, current_pc, cache); ++ ++ cache->saved_sp = cache->base + cache->framesize; ++ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM] = cache->base; ++ cache->register_offsets[MICROBLAZE_SP_REGNUM] = cache->saved_sp; ++ + return cache; + } + +@@ -494,6 +505,25 @@ microblaze_frame_prev_register (struct frame_info *this_frame, + struct microblaze_frame_cache *cache = + microblaze_frame_cache (this_frame, this_cache); + ++if ((regnum == MICROBLAZE_SP_REGNUM && ++ cache->register_offsets[MICROBLAZE_SP_REGNUM]) ++ || (regnum == MICROBLAZE_FP_REGNUM && ++ cache->register_offsets[MICROBLAZE_SP_REGNUM])) ++ ++ return frame_unwind_got_constant (this_frame, regnum, ++ cache->register_offsets[MICROBLAZE_SP_REGNUM]); ++ ++if (regnum == MICROBLAZE_PC_REGNUM) ++{ ++ regnum = 15; ++ return frame_unwind_got_memory (this_frame, regnum, ++ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]); ++ ++} ++if (regnum == MICROBLAZE_SP_REGNUM) ++ regnum = 1; ++#if 0 ++ + if (cache->frameless_p) + { + if (regnum == MICROBLAZE_PC_REGNUM) +@@ -506,7 +536,9 @@ microblaze_frame_prev_register (struct frame_info *this_frame, + else + return trad_frame_get_prev_register (this_frame, cache->saved_regs, + regnum); +- ++#endif ++ return trad_frame_get_prev_register (this_frame, cache->saved_regs, ++ regnum); + } + + static const struct frame_unwind microblaze_frame_unwind = +@@ -622,7 +654,106 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) + return (TYPE_LENGTH (type) == 16); + } + +- ++#if 1 ++static std::vector<CORE_ADDR> ++microblaze_software_single_step (struct regcache *regcache) ++{ ++ struct gdbarch *arch = regcache->arch (); ++ //struct gdbarch_tdep *tdep = gdbarch_tdep (arch); ++ static int le_breakp[] = MICROBLAZE_BREAKPOINT_LE; ++ static int be_breakp[] = MICROBLAZE_BREAKPOINT; ++ enum bfd_endian byte_order = gdbarch_byte_order (arch); ++ int *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp; ++// std::vector<CORE_ADDR> ret = NULL; ++ ++ /* Save the address and the values of the next_pc and the target */ ++ static struct sstep_breaks ++ { ++ CORE_ADDR address; ++ bfd_boolean valid; ++ /* Shadow contents. */ ++ char data[INST_WORD_SIZE]; ++ } stepbreaks[2]; ++ int ii; ++ ++ CORE_ADDR pc; ++ std::vector<CORE_ADDR> next_pcs; ++ long insn; ++ enum microblaze_instr minstr; ++ bfd_boolean isunsignednum; ++ enum microblaze_instr_type insn_type; ++ short delay_slots; ++ int imm; ++ bfd_boolean immfound = FALSE; ++ ++ /* Set a breakpoint at the next instruction */ ++ /* If the current instruction is an imm, set it at the inst after */ ++ /* If the instruction has a delay slot, skip the delay slot */ ++ pc = regcache_read_pc (regcache); ++ insn = microblaze_fetch_instruction (pc); ++ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots); ++ if (insn_type == immediate_inst) ++ { ++ int rd, ra, rb; ++ immfound = TRUE; ++ minstr = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm); ++ pc = pc + INST_WORD_SIZE; ++ insn = microblaze_fetch_instruction (pc); ++ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots); ++ } ++ stepbreaks[0].address = pc + (delay_slots * INST_WORD_SIZE) + INST_WORD_SIZE; ++ if (insn_type != return_inst) { ++ stepbreaks[0].valid = TRUE; ++ } else { ++ stepbreaks[0].valid = FALSE; ++ } ++ ++ microblaze_debug ("single-step insn_type=%x insn=%x\n", insn_type, insn); ++ /* Now check for branch or return instructions */ ++ if (insn_type == branch_inst || insn_type == return_inst) { ++ int limm; ++ int lrd, lra, lrb; ++ int ra, rb; ++ bfd_boolean targetvalid; ++ bfd_boolean unconditionalbranch; ++ microblaze_decode_insn(insn, &lrd, &lra, &lrb, &limm); ++ if (lra >= 0 && lra < MICROBLAZE_NUM_REGS) ++ ra = regcache_raw_get_unsigned(regcache, lra); ++ else ++ ra = 0; ++ if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS) ++ rb = regcache_raw_get_unsigned(regcache, lrb); ++ else ++ rb = 0; ++ stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch); ++ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address); ++ if (unconditionalbranch) ++ stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */ ++ if (targetvalid && (stepbreaks[0].valid == FALSE || ++ (stepbreaks[0].address != stepbreaks[1].address)) ++ && (stepbreaks[1].address != pc)) { ++ stepbreaks[1].valid = TRUE; ++ } else { ++ stepbreaks[1].valid = FALSE; ++ } ++ } else { ++ stepbreaks[1].valid = FALSE; ++ } ++ ++ /* Insert the breakpoints */ ++ for (ii = 0; ii < 2; ++ii) ++ { ++ ++ /* ignore invalid breakpoint. */ ++ if (stepbreaks[ii].valid) { ++ // VEC_safe_push (CORE_ADDR, next_pcs, stepbreaks[ii].address);; ++ next_pcs.push_back (stepbreaks[ii].address); ++ } ++ } ++ return next_pcs; ++} ++#endif ++ + static int dwarf2_to_reg_map[78] = + { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ + 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */ +@@ -790,6 +921,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + microblaze_breakpoint::bp_from_kind); + set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); + ++ set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); ++ + set_gdbarch_frame_args_skip (gdbarch, 8); + + set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); +diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h +index 2e853d84d72..2415acfe7b6 100644 +--- a/gdb/microblaze-tdep.h ++++ b/gdb/microblaze-tdep.h +@@ -60,11 +60,11 @@ enum microblaze_regnum + MICROBLAZE_R12_REGNUM, + MICROBLAZE_R13_REGNUM, + MICROBLAZE_R14_REGNUM, +- MICROBLAZE_R15_REGNUM, ++ MICROBLAZE_R15_REGNUM,MICROBLAZE_PREV_PC_REGNUM = MICROBLAZE_R15_REGNUM, + MICROBLAZE_R16_REGNUM, + MICROBLAZE_R17_REGNUM, + MICROBLAZE_R18_REGNUM, +- MICROBLAZE_R19_REGNUM, ++ MICROBLAZE_R19_REGNUM,MICROBLAZE_FP_REGNUM = MICROBLAZE_R19_REGNUM, + MICROBLAZE_R20_REGNUM, + MICROBLAZE_R21_REGNUM, + MICROBLAZE_R22_REGNUM, +@@ -77,7 +77,8 @@ enum microblaze_regnum + MICROBLAZE_R29_REGNUM, + MICROBLAZE_R30_REGNUM, + MICROBLAZE_R31_REGNUM, +- MICROBLAZE_PC_REGNUM, ++ MICROBLAZE_MAX_GPR_REGS, ++ MICROBLAZE_PC_REGNUM=32, + MICROBLAZE_MSR_REGNUM, + MICROBLAZE_EAR_REGNUM, + MICROBLAZE_ESR_REGNUM, +@@ -102,17 +103,21 @@ enum microblaze_regnum + MICROBLAZE_RTLBSX_REGNUM, + MICROBLAZE_RTLBLO_REGNUM, + MICROBLAZE_RTLBHI_REGNUM, +- MICROBLAZE_SLR_REGNUM, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_SLR_REGNUM, ++ MICROBLAZE_SLR_REGNUM, + MICROBLAZE_SHR_REGNUM, +- MICROBLAZE_NUM_REGS ++ MICROBLAZE_NUM_REGS, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_NUM_REGS + }; + ++/* Big enough to hold the size of the largest register in bytes. */ ++#define MICROBLAZE_MAX_REGISTER_SIZE 64 ++ + struct microblaze_frame_cache + { + /* Base address. */ + CORE_ADDR base; + CORE_ADDR pc; + ++ CORE_ADDR saved_sp; + /* Do we have a frame? */ + int frameless_p; + +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch new file mode 100644 index 00000000..6eea28fe --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch @@ -0,0 +1,5789 @@ +From 6aadc445a00275c37112e431c6a29f5a331e6e16 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Thu, 31 Jan 2019 14:36:00 +0530 +Subject: [PATCH 5/8] [Patch, microblaze]: Adding 64 bit MB support Added new + architecture to Microblaze 64-bit support to GDB Signed-off-by :Nagaraju + Mekala <nmekala@xilix.com> Signed-off-by :Mahesh Bodapati + <mbodapat@xilinx.com> + +Conflicts: + gdb/Makefile.in + +Conflicts: + bfd/cpu-microblaze.c + gdb/microblaze-tdep.c + ld/Makefile.am + ld/Makefile.in + opcodes/microblaze-dis.c + +Conflicts: + bfd/configure + gas/config/tc-microblaze.c + ld/Makefile.in + opcodes/microblaze-opcm.h + +Conflicts: + gdb/microblaze-tdep.c + +Conflicts: + bfd/elf32-microblaze.c + gas/config/tc-microblaze.c + gdb/features/Makefile + gdb/features/microblaze-with-stack-protect.c + gdb/microblaze-tdep.c + gdb/regformats/microblaze-with-stack-protect.dat + gdbserver/linux-microblaze-low.c + include/elf/common.h +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + bfd/Makefile.am | 2 + + bfd/Makefile.in | 3 + + bfd/archures.c | 2 + + bfd/bfd-in2.h | 31 +- + bfd/config.bfd | 4 + + bfd/configure | 2 + + bfd/cpu-microblaze.c | 55 +- + bfd/elf32-microblaze.c | 162 +- + bfd/elf64-microblaze.c | 3810 +++++++++++++++++ + bfd/libbfd.h | 3 + + bfd/reloc.c | 20 + + bfd/targets.c | 6 + + gdb/features/Makefile | 2 + + gdb/features/microblaze-core.xml | 6 +- + gdb/features/microblaze-stack-protect.xml | 4 +- + gdb/features/microblaze-with-stack-protect.c | 8 +- + gdb/features/microblaze.c | 6 +- + gdb/features/microblaze64-core.xml | 69 + + gdb/features/microblaze64-stack-protect.xml | 12 + + .../microblaze64-with-stack-protect.c | 79 + + .../microblaze64-with-stack-protect.xml | 12 + + gdb/features/microblaze64.c | 77 + + gdb/features/microblaze64.xml | 11 + + gdb/microblaze-linux-tdep.c | 36 +- + gdb/microblaze-tdep.c | 126 +- + gdb/microblaze-tdep.h | 4 +- + include/elf/common.h | 1 + + include/elf/microblaze.h | 4 + + opcodes/microblaze-dis.c | 51 +- + opcodes/microblaze-opc.h | 180 +- + opcodes/microblaze-opcm.h | 36 +- + 31 files changed, 4729 insertions(+), 95 deletions(-) + create mode 100755 bfd/elf64-microblaze.c + create mode 100644 gdb/features/microblaze64-core.xml + create mode 100644 gdb/features/microblaze64-stack-protect.xml + create mode 100644 gdb/features/microblaze64-with-stack-protect.c + create mode 100644 gdb/features/microblaze64-with-stack-protect.xml + create mode 100644 gdb/features/microblaze64.c + create mode 100644 gdb/features/microblaze64.xml + +diff --git a/bfd/Makefile.am b/bfd/Makefile.am +index b9a3f8207ac..2ddd7891661 100644 +--- a/bfd/Makefile.am ++++ b/bfd/Makefile.am +@@ -571,6 +571,7 @@ BFD64_BACKENDS = \ + elf64-riscv.lo \ + elfxx-riscv.lo \ + elf64-s390.lo \ ++ elf64-microblaze.lo \ + elf64-sparc.lo \ + elf64-tilegx.lo \ + elf64-x86-64.lo \ +@@ -608,6 +609,7 @@ BFD64_BACKENDS_CFILES = \ + elf64-nfp.c \ + elf64-ppc.c \ + elf64-s390.c \ ++ elf64-microblaze.c \ + elf64-sparc.c \ + elf64-tilegx.c \ + elf64-x86-64.c \ +diff --git a/bfd/Makefile.in b/bfd/Makefile.in +index 934dd4bc066..7efb10f111d 100644 +--- a/bfd/Makefile.in ++++ b/bfd/Makefile.in +@@ -1040,6 +1040,7 @@ BFD64_BACKENDS = \ + elf64-riscv.lo \ + elfxx-riscv.lo \ + elf64-s390.lo \ ++ elf64-microblaze.lo \ + elf64-sparc.lo \ + elf64-tilegx.lo \ + elf64-x86-64.lo \ +@@ -1077,6 +1078,7 @@ BFD64_BACKENDS_CFILES = \ + elf64-nfp.c \ + elf64-ppc.c \ + elf64-s390.c \ ++ elf64-microblaze.c \ + elf64-sparc.c \ + elf64-tilegx.c \ + elf64-x86-64.c \ +@@ -1664,6 +1666,7 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@ +diff --git a/bfd/archures.c b/bfd/archures.c +index fac9fe82a08..1790c741c58 100644 +--- a/bfd/archures.c ++++ b/bfd/archures.c +@@ -524,6 +524,8 @@ DESCRIPTION + . bfd_arch_lm32, {* Lattice Mico32. *} + .#define bfd_mach_lm32 1 + . bfd_arch_microblaze,{* Xilinx MicroBlaze. *} ++.#define bfd_mach_microblaze 1 ++.#define bfd_mach_microblaze64 2 + . bfd_arch_tilepro, {* Tilera TILEPro. *} + . bfd_arch_tilegx, {* Tilera TILE-Gx. *} + .#define bfd_mach_tilepro 1 +diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h +index c0b563aec02..ccaeecb9476 100644 +--- a/bfd/bfd-in2.h ++++ b/bfd/bfd-in2.h +@@ -1903,6 +1903,8 @@ enum bfd_architecture + bfd_arch_lm32, /* Lattice Mico32. */ + #define bfd_mach_lm32 1 + bfd_arch_microblaze,/* Xilinx MicroBlaze. */ ++#define bfd_mach_microblaze 1 ++#define bfd_mach_microblaze64 2 + bfd_arch_tilepro, /* Tilera TILEPro. */ + bfd_arch_tilegx, /* Tilera TILE-Gx. */ + #define bfd_mach_tilepro 1 +@@ -5443,16 +5445,41 @@ value relative to the read-write small data area anchor */ + expressions of the form "Symbol Op Symbol" */ + BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, + +-/* This is a 64 bit reloc that stores the 32 bit pc relative ++/* This is a 32 bit reloc that stores the 32 bit pc relative + value in two words (with an imm instruction). No relocation is + done here - only used for relaxing */ +- BFD_RELOC_MICROBLAZE_64_NONE, ++ BFD_RELOC_MICROBLAZE_32_NONE, ++ ++/* This is a 64 bit reloc that stores the 32 bit pc relative ++ * +value in two words (with an imml instruction). No relocation is ++ * +done here - only used for relaxing */ ++ BFD_RELOC_MICROBLAZE_64_PCREL, ++ ++/* This is a 64 bit reloc that stores the 32 bit relative ++ * +value in two words (with an imml instruction). No relocation is ++ * +done here - only used for relaxing */ ++ BFD_RELOC_MICROBLAZE_64, ++ ++/* This is a 64 bit reloc that stores the 32 bit relative ++ * +value in two words (with an imml instruction). No relocation is ++ * +done here - only used for relaxing */ ++ BFD_RELOC_MICROBLAZE_EA64, ++ ++/* This is a 64 bit reloc that stores the 32 bit pc relative ++ * +value in two words (with an imm instruction). No relocation is ++ * +done here - only used for relaxing */ ++ BFD_RELOC_MICROBLAZE_64_NONE, + + /* This is a 64 bit reloc that stores the 32 bit pc relative + value in two words (with an imm instruction). The relocation is + PC-relative GOT offset */ + BFD_RELOC_MICROBLAZE_64_GOTPC, + ++/* This is a 64 bit reloc that stores the 32 bit pc relative ++value in two words (with an imml instruction). The relocation is ++PC-relative GOT offset */ ++ BFD_RELOC_MICROBLAZE_64_GPC, ++ + /* This is a 64 bit reloc that stores the 32 bit pc relative + value in two words (with an imm instruction). The relocation is + GOT offset */ +diff --git a/bfd/config.bfd b/bfd/config.bfd +index 872685cfb72..5e9ba3d9805 100644 +--- a/bfd/config.bfd ++++ b/bfd/config.bfd +@@ -860,11 +860,15 @@ case "${targ}" in + microblazeel*-*) + targ_defvec=microblaze_elf32_le_vec + targ_selvecs=microblaze_elf32_vec ++ targ64_selvecs=microblaze_elf64_vec ++ targ64_selvecs=microblaze_elf64_le_vec + ;; + + microblaze*-*) + targ_defvec=microblaze_elf32_vec + targ_selvecs=microblaze_elf32_le_vec ++ targ64_selvecs=microblaze_elf64_vec ++ targ64_selvecs=microblaze_elf64_le_vec + ;; + + #ifdef BFD64 +diff --git a/bfd/configure b/bfd/configure +index 0ef4c206fb0..b7547c6777c 100755 +--- a/bfd/configure ++++ b/bfd/configure +@@ -13547,6 +13547,8 @@ do + rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;; + s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; + s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; ++ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; ++ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; + score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;; + score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;; + sh_coff_vec) tb="$tb coff-sh.lo $coff" ;; +diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c +index 0c1d2b1aa69..106f78229b5 100644 +--- a/bfd/cpu-microblaze.c ++++ b/bfd/cpu-microblaze.c +@@ -23,13 +23,30 @@ + #include "bfd.h" + #include "libbfd.h" + +-const bfd_arch_info_type bfd_microblaze_arch = ++const bfd_arch_info_type bfd_microblaze_arch[] = ++{ ++#if BFD_DEFAULT_TARGET_SIZE == 64 ++{ ++ 64, /* 32 bits in a word. */ ++ 64, /* 32 bits in an address. */ ++ 8, /* 8 bits in a byte. */ ++ bfd_arch_microblaze, /* Architecture. */ ++ bfd_mach_microblaze64, /* 64 bit Machine */ ++ "microblaze", /* Architecture name. */ ++ "MicroBlaze", /* Printable name. */ ++ 3, /* Section align power. */ ++ false, /* Is this the default architecture ? */ ++ bfd_default_compatible, /* Architecture comparison function. */ ++ bfd_default_scan, /* String to architecture conversion. */ ++ bfd_arch_default_fill, /* Default fill. */ ++ &bfd_microblaze_arch[1] /* Next in list. */ ++}, + { + 32, /* Bits in a word. */ + 32, /* Bits in an address. */ + 8, /* Bits in a byte. */ + bfd_arch_microblaze, /* Architecture number. */ +- 0, /* Machine number - 0 for now. */ ++ bfd_mach_microblaze, /* Machine number - 0 for now. */ + "microblaze", /* Architecture name. */ + "MicroBlaze", /* Printable name. */ + 3, /* Section align power. */ +@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch = + bfd_arch_default_fill, /* Default fill. */ + NULL, /* Next in list. */ + 0 /* Maximum offset of a reloc from the start of an insn. */ ++} ++#else ++{ ++ 32, /* 32 bits in a word. */ ++ 32, /* 32 bits in an address. */ ++ 8, /* 8 bits in a byte. */ ++ bfd_arch_microblaze, /* Architecture. */ ++ bfd_mach_microblaze, /* 32 bit Machine */ ++ "microblaze", /* Architecture name. */ ++ "MicroBlaze", /* Printable name. */ ++ 3, /* Section align power. */ ++ true, /* Is this the default architecture ? */ ++ bfd_default_compatible, /* Architecture comparison function. */ ++ bfd_default_scan, /* String to architecture conversion. */ ++ bfd_arch_default_fill, /* Default fill. */ ++ &bfd_microblaze_arch[1] /* Next in list. */ ++}, ++{ ++ 64, /* 32 bits in a word. */ ++ 64, /* 32 bits in an address. */ ++ 8, /* 8 bits in a byte. */ ++ bfd_arch_microblaze, /* Architecture. */ ++ bfd_mach_microblaze64, /* 64 bit Machine */ ++ "microblaze", /* Architecture name. */ ++ "MicroBlaze", /* Printable name. */ ++ 3, /* Section align power. */ ++ false, /* Is this the default architecture ? */ ++ bfd_default_compatible, /* Architecture comparison function. */ ++ bfd_default_scan, /* String to architecture conversion. */ ++ bfd_arch_default_fill, /* Default fill. */ ++ NULL, /* Next in list. */ ++ 0 ++} ++#endif + }; +diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c +index d3b3c66cf00..053c1b432f9 100644 +--- a/bfd/elf32-microblaze.c ++++ b/bfd/elf32-microblaze.c +@@ -114,6 +114,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = + 0x0000ffff, /* Dest Mask. */ + true), /* PC relative offset? */ + ++ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_IMML_64", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ + /* A 64 bit relocation. Table entry not really used. */ + HOWTO (R_MICROBLAZE_64, /* Type. */ + 0, /* Rightshift. */ +@@ -174,7 +188,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = + 0x0000ffff, /* Dest Mask. */ + false), /* PC relative offset? */ + +- /* This reloc does nothing. Used for relaxation. */ ++ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 32, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_bitfield, /* Complain on overflow. */ ++ NULL, /* Special Function. */ ++ "R_MICROBLAZE_32_NONE",/* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* This reloc does nothing. Used for relaxation. */ + HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ + 0, /* Rightshift. */ + 3, /* Size (0 = byte, 1 = short, 2 = long). */ +@@ -264,6 +292,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = + 0x0000ffff, /* Dest Mask. */ + true), /* PC relative offset? */ + ++ /* A 64 bit GOTPC relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc, /* Special Function. */ ++ "R_MICROBLAZE_GPC_64", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ + /* A 64 bit GOT relocation. Table-entry not really used. */ + HOWTO (R_MICROBLAZE_GOT_64, /* Type. */ + 0, /* Rightshift. */ +@@ -560,6 +603,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, + case BFD_RELOC_NONE: + microblaze_reloc = R_MICROBLAZE_NONE; + break; ++ case BFD_RELOC_MICROBLAZE_32_NONE: ++ microblaze_reloc = R_MICROBLAZE_32_NONE; ++ break; + case BFD_RELOC_MICROBLAZE_64_NONE: + microblaze_reloc = R_MICROBLAZE_64_NONE; + break; +@@ -600,9 +646,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, + case BFD_RELOC_VTABLE_ENTRY: + microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; + break; ++ case BFD_RELOC_MICROBLAZE_64: ++ microblaze_reloc = R_MICROBLAZE_IMML_64; ++ break; + case BFD_RELOC_MICROBLAZE_64_GOTPC: + microblaze_reloc = R_MICROBLAZE_GOTPC_64; + break; ++ case BFD_RELOC_MICROBLAZE_64_GPC: ++ microblaze_reloc = R_MICROBLAZE_GPC_64; ++ break; + case BFD_RELOC_MICROBLAZE_64_GOT: + microblaze_reloc = R_MICROBLAZE_GOT_64; + break; +@@ -1507,9 +1559,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, + relocation += addend; + relocation -= dtprel_base(info); + bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, +- contents + offset + 2); ++ contents + offset + endian); + bfd_put_16 (input_bfd, relocation & 0xffff, +- contents + offset + 2 + INST_WORD_SIZE); ++ contents + offset + endian + INST_WORD_SIZE); + break; + case (int) R_MICROBLAZE_TEXTREL_64: + case (int) R_MICROBLAZE_TEXTREL_32_LO: +@@ -1523,7 +1575,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, + if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0) + { + relocation += addend; +- if (r_type == R_MICROBLAZE_32) ++ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64) + bfd_put_32 (input_bfd, relocation, contents + offset); + else + { +@@ -1925,8 +1977,7 @@ microblaze_elf_relax_section (bfd *abfd, + else + symval += irel->r_addend; + +- if ((symval & 0xffff8000) == 0 +- || (symval & 0xffff8000) == 0xffff8000) ++ if ((symval & 0xffff8000) == 0) + { + /* We can delete this instruction. */ + sec->relax[sec->relax_count].addr = irel->r_offset; +@@ -1990,21 +2041,51 @@ microblaze_elf_relax_section (bfd *abfd, + irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); + } + break; ++ case R_MICROBLAZE_IMML_64: ++ { ++ /* This was a PC-relative instruction that was ++ completely resolved. */ ++ int sfix, efix; ++ unsigned int val; ++ bfd_vma target_address; ++ target_address = irel->r_addend + irel->r_offset; ++ sfix = calc_fixup (irel->r_offset, 0, sec); ++ efix = calc_fixup (target_address, 0, sec); ++ ++ /* Validate the in-band val. */ ++ val = bfd_get_32 (abfd, contents + irel->r_offset); ++ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { ++ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); ++ } ++ irel->r_addend -= (efix - sfix); ++ /* Should use HOWTO. */ ++ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset, ++ irel->r_addend); ++ } ++ break; + case R_MICROBLAZE_NONE: ++ case R_MICROBLAZE_32_NONE: + { + /* This was a PC-relative instruction that was + completely resolved. */ + int sfix, efix; ++ unsigned int val; + bfd_vma target_address; + target_address = irel->r_addend + irel->r_offset; + sfix = calc_fixup (irel->r_offset, 0, sec); + efix = calc_fixup (target_address, 0, sec); ++ ++ /* Validate the in-band val. */ ++ val = bfd_get_32 (abfd, contents + irel->r_offset); ++ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { ++ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); ++ } + irel->r_addend -= (efix - sfix); + /* Should use HOWTO. */ + microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, + irel->r_addend); +- } +- break; ++ } ++ break; + case R_MICROBLAZE_64_NONE: + { + /* This was a PC-relative 64-bit instruction that was +@@ -2015,8 +2096,8 @@ microblaze_elf_relax_section (bfd *abfd, + sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec); + efix = calc_fixup (target_address, 0, sec); + irel->r_addend -= (efix - sfix); +- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset +- + INST_WORD_SIZE, irel->r_addend); ++ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset, ++ irel->r_addend); + } + break; + } +@@ -2046,9 +2127,50 @@ microblaze_elf_relax_section (bfd *abfd, + irelscanend = irelocs + o->reloc_count; + for (irelscan = irelocs; irelscan < irelscanend; irelscan++) + { +- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) +- { +- isym = isymbuf + ELF32_R_SYM (irelscan->r_info); ++ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) ++ { ++ unsigned int val; ++ ++ isym = isymbuf + ELF32_R_SYM (irelscan->r_info); ++ ++ /* hax: We only do the following fixup for debug location lists. */ ++ if (strcmp(".debug_loc", o->name)) ++ continue; ++ ++ /* This was a PC-relative instruction that was completely resolved. */ ++ if (ocontents == NULL) ++ { ++ if (elf_section_data (o)->this_hdr.contents != NULL) ++ ocontents = elf_section_data (o)->this_hdr.contents; ++ else ++ { ++ /* We always cache the section contents. ++ Perhaps, if info->keep_memory is FALSE, we ++ should free them, if we are permitted to. */ ++ ++ if (o->rawsize == 0) ++ o->rawsize = o->size; ++ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); ++ if (ocontents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, o, ocontents, ++ (file_ptr) 0, ++ o->rawsize)) ++ goto error_return; ++ elf_section_data (o)->this_hdr.contents = ocontents; ++ } ++ } ++ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); ++ if (val != irelscan->r_addend) { ++ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend); ++ } ++ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); ++ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, ++ irelscan->r_addend); ++ } ++ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64) ++ { ++ isym = isymbuf + ELF32_R_SYM (irelscan->r_info); + + /* Look at the reloc only if the value has been resolved. */ + if (isym->st_shndx == shndx +@@ -2105,7 +2227,7 @@ microblaze_elf_relax_section (bfd *abfd, + elf_section_data (o)->this_hdr.contents = ocontents; + } + } +- irelscan->r_addend -= calc_fixup (irel->r_addend ++ irelscan->r_addend -= calc_fixup (irelscan->r_addend + + isym->st_value, + 0, + sec); +@@ -3445,6 +3567,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd, + return true; + } + ++ ++static bool ++elf_microblaze_object_p (bfd *abfd) ++{ ++ /* Set the right machine number for an s390 elf32 file. */ ++ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze); ++} ++ + /* Hook called by the linker routine which adds symbols from an object + file. We use it to put .comm items in .sbss, and not .bss. */ + +@@ -3514,8 +3644,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd, + #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol + #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections + #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook +- +-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus +-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo ++#define elf_backend_object_p elf_microblaze_object_p + + #include "elf32-target.h" +diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c +new file mode 100755 +index 00000000000..6cd9753a592 +--- /dev/null ++++ b/bfd/elf64-microblaze.c +@@ -0,0 +1,3810 @@ ++/* Xilinx MicroBlaze-specific support for 32-bit ELF ++ ++ Copyright (C) 2009-2021 Free Software Foundation, Inc. ++ ++ This file is part of BFD, the Binary File Descriptor library. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the ++ Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, ++ Boston, MA 02110-1301, USA. */ ++ ++ ++#include "sysdep.h" ++#include "bfd.h" ++#include "bfdlink.h" ++#include "libbfd.h" ++#include "elf-bfd.h" ++#include "elf/microblaze.h" ++#include <assert.h> ++ ++#define USE_RELA /* Only USE_REL is actually significant, but this is ++ here are a reminder... */ ++#define INST_WORD_SIZE 4 ++ ++static int ro_small_data_pointer = 0; ++static int rw_small_data_pointer = 0; ++ ++static reloc_howto_type * microblaze_elf_howto_table [(int) R_MICROBLAZE_max]; ++ ++static reloc_howto_type microblaze_elf_howto_raw[] = ++{ ++ /* This reloc does nothing. */ ++ HOWTO (R_MICROBLAZE_NONE, /* Type. */ ++ 0, /* Rightshift. */ ++ 0, /* Size. */ ++ 0, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ NULL, /* Special Function. */ ++ "R_MICROBLAZE_NONE", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* A standard 32 bit relocation. */ ++ HOWTO (R_MICROBLAZE_32, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 32, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_bitfield, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_32", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0xffffffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* A standard PCREL 32 bit relocation. */ ++ HOWTO (R_MICROBLAZE_32_PCREL,/* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 32, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_bitfield, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_32_PCREL", /* Name. */ ++ true, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0xffffffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* A 64 bit PCREL relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_64_PCREL,/* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_64_PCREL", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* The low half of a PCREL 32 bit relocation. */ ++ HOWTO (R_MICROBLAZE_32_PCREL_LO, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_signed, /* Complain on overflow. */ ++ bfd_elf_generic_reloc, /* Special Function. */ ++ "R_MICROBLAZE_32_PCREL_LO", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 64, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_IMML_64", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0xffffffffffffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* A 64 bit relocation. Table entry not really used. */ ++ HOWTO (R_MICROBLAZE_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_64", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* The low half of a 32 bit relocation. */ ++ HOWTO (R_MICROBLAZE_32_LO, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_signed, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_32_LO", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* Read-only small data section relocation. */ ++ HOWTO (R_MICROBLAZE_SRO32, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_bitfield, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_SRO32", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* Read-write small data area relocation. */ ++ HOWTO (R_MICROBLAZE_SRW32, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_bitfield, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_SRW32", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* This reloc does nothing. Used for relaxation. */ ++ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 32, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_bitfield, /* Complain on overflow. */ ++ NULL, /* Special Function. */ ++ "R_MICROBLAZE_32_NONE",/* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* This reloc does nothing. Used for relaxation. */ ++ HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ ++ 0, /* Rightshift. */ ++ 0, /* Size. */ ++ 0, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ NULL, /* Special Function. */ ++ "R_MICROBLAZE_64_NONE",/* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* Symbol Op Symbol relocation. */ ++ HOWTO (R_MICROBLAZE_32_SYM_OP_SYM, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 32, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_bitfield, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_32_SYM_OP_SYM", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0xffffffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* GNU extension to record C++ vtable hierarchy. */ ++ HOWTO (R_MICROBLAZE_GNU_VTINHERIT, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 0, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont,/* Complain on overflow. */ ++ NULL, /* Special Function. */ ++ "R_MICROBLAZE_GNU_VTINHERIT", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* GNU extension to record C++ vtable member usage. */ ++ HOWTO (R_MICROBLAZE_GNU_VTENTRY, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 0, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont,/* Complain on overflow. */ ++ _bfd_elf_rel_vtable_reloc_fn, /* Special Function. */ ++ "R_MICROBLAZE_GNU_VTENTRY", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* A 64 bit GOTPC relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_GOTPC_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc, /* Special Function. */ ++ "R_MICROBLAZE_GOTPC_64", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* A 64 bit TEXTPCREL relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_TEXTPCREL_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc, /* Special Function. */ ++ "R_MICROBLAZE_TEXTPCREL_64", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* A 64 bit GOTPC relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc, /* Special Function. */ ++ "R_MICROBLAZE_GPC_64", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* A 64 bit GOT relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_GOT_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_GOT_64",/* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* A 64 bit TEXTREL relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_TEXTREL_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_TEXTREL_64",/* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* A 64 bit PLT relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_PLT_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_PLT_64",/* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_REL, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_REL", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_JUMP_SLOT,/* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_JUMP_SLOT", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_GLOB_DAT,/* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ true, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_GLOB_DAT", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ true), /* PC relative offset? */ ++ ++ /* A 64 bit GOT relative relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_GOTOFF_64, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_GOTOFF_64", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* A 32 bit GOT relative relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_GOTOFF_32, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc, /* Special Function. */ ++ "R_MICROBLAZE_GOTOFF_32", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* COPY relocation. Table-entry not really used. */ ++ HOWTO (R_MICROBLAZE_COPY, /* Type. */ ++ 0, /* Rightshift. */ ++ 4, /* Size. */ ++ 16, /* Bitsize. */ ++ false, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_dont, /* Complain on overflow. */ ++ bfd_elf_generic_reloc,/* Special Function. */ ++ "R_MICROBLAZE_COPY", /* Name. */ ++ false, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0x0000ffff, /* Dest Mask. */ ++ false), /* PC relative offset? */ ++ ++ /* Marker relocs for TLS. */ ++ HOWTO (R_MICROBLAZE_TLS, ++ 0, /* rightshift */ ++ 2, /* size (0 = byte, 1 = short, 2 = long) */ ++ 32, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_MICROBLAZE_TLS", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0x0000ffff, /* dst_mask */ ++ false), /* pcrel_offset */ ++ ++ HOWTO (R_MICROBLAZE_TLSGD, ++ 0, /* rightshift */ ++ 4, /* size */ ++ 32, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_MICROBLAZE_TLSGD", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0x0000ffff, /* dst_mask */ ++ false), /* pcrel_offset */ ++ ++ HOWTO (R_MICROBLAZE_TLSLD, ++ 0, /* rightshift */ ++ 2, /* size (0 = byte, 1 = short, 2 = long) */ ++ 32, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_MICROBLAZE_TLSLD", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0x0000ffff, /* dst_mask */ ++ false), /* pcrel_offset */ ++ ++ /* Computes the load module index of the load module that contains the ++ definition of its TLS sym. */ ++ HOWTO (R_MICROBLAZE_TLSDTPMOD32, ++ 0, /* rightshift */ ++ 2, /* size (0 = byte, 1 = short, 2 = long) */ ++ 32, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_MICROBLAZE_TLSDTPMOD32", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0x0000ffff, /* dst_mask */ ++ false), /* pcrel_offset */ ++ ++ /* Computes a dtv-relative displacement, the difference between the value ++ of sym+add and the base address of the thread-local storage block that ++ contains the definition of sym, minus 0x8000. Used for initializing GOT */ ++ HOWTO (R_MICROBLAZE_TLSDTPREL32, ++ 0, /* rightshift */ ++ 4, /* size */ ++ 32, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_MICROBLAZE_TLSDTPREL32", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0x0000ffff, /* dst_mask */ ++ false), /* pcrel_offset */ ++ ++ /* Computes a dtv-relative displacement, the difference between the value ++ of sym+add and the base address of the thread-local storage block that ++ contains the definition of sym, minus 0x8000. */ ++ HOWTO (R_MICROBLAZE_TLSDTPREL64, ++ 0, /* rightshift */ ++ 4, /* size */ ++ 32, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_MICROBLAZE_TLSDTPREL64", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0x0000ffff, /* dst_mask */ ++ false), /* pcrel_offset */ ++ ++ /* Computes a tp-relative displacement, the difference between the value of ++ sym+add and the value of the thread pointer (r13). */ ++ HOWTO (R_MICROBLAZE_TLSGOTTPREL32, ++ 0, /* rightshift */ ++ 4, /* size */ ++ 32, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_MICROBLAZE_TLSGOTTPREL32", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0x0000ffff, /* dst_mask */ ++ false), /* pcrel_offset */ ++ ++ /* Computes a tp-relative displacement, the difference between the value of ++ sym+add and the value of the thread pointer (r13). */ ++ HOWTO (R_MICROBLAZE_TLSTPREL32, ++ 0, /* rightshift */ ++ 4, /* size */ ++ 32, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_MICROBLAZE_TLSTPREL32", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0x0000ffff, /* dst_mask */ ++ false), /* pcrel_offset */ ++ ++}; ++ ++#ifndef NUM_ELEM ++#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0]) ++#endif ++ ++/* Initialize the microblaze_elf_howto_table, so that linear accesses can be done. */ ++ ++static void ++microblaze_elf_howto_init (void) ++{ ++ unsigned int i; ++ ++ for (i = NUM_ELEM (microblaze_elf_howto_raw); i--;) ++ { ++ unsigned int type; ++ ++ type = microblaze_elf_howto_raw[i].type; ++ ++ BFD_ASSERT (type < NUM_ELEM (microblaze_elf_howto_table)); ++ ++ microblaze_elf_howto_table [type] = & microblaze_elf_howto_raw [i]; ++ } ++} ++ ++static reloc_howto_type * ++microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, ++ bfd_reloc_code_real_type code) ++{ ++ enum elf_microblaze_reloc_type microblaze_reloc = R_MICROBLAZE_NONE; ++ ++ switch (code) ++ { ++ case BFD_RELOC_NONE: ++ microblaze_reloc = R_MICROBLAZE_NONE; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_NONE: ++ microblaze_reloc = R_MICROBLAZE_32_NONE; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_NONE: ++ microblaze_reloc = R_MICROBLAZE_64_NONE; ++ break; ++ case BFD_RELOC_32: ++ microblaze_reloc = R_MICROBLAZE_32; ++ break; ++ /* RVA is treated the same as 64 */ ++ case BFD_RELOC_RVA: ++ microblaze_reloc = R_MICROBLAZE_IMML_64; ++ break; ++ case BFD_RELOC_32_PCREL: ++ microblaze_reloc = R_MICROBLAZE_32_PCREL; ++ break; ++ case BFD_RELOC_64_PCREL: ++ microblaze_reloc = R_MICROBLAZE_64_PCREL; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_LO_PCREL: ++ microblaze_reloc = R_MICROBLAZE_32_PCREL_LO; ++ break; ++ case BFD_RELOC_64: ++ microblaze_reloc = R_MICROBLAZE_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_LO: ++ microblaze_reloc = R_MICROBLAZE_32_LO; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_ROSDA: ++ microblaze_reloc = R_MICROBLAZE_SRO32; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_RWSDA: ++ microblaze_reloc = R_MICROBLAZE_SRW32; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: ++ microblaze_reloc = R_MICROBLAZE_32_SYM_OP_SYM; ++ break; ++ case BFD_RELOC_VTABLE_INHERIT: ++ microblaze_reloc = R_MICROBLAZE_GNU_VTINHERIT; ++ break; ++ case BFD_RELOC_VTABLE_ENTRY: ++ microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; ++ break; ++ case BFD_RELOC_MICROBLAZE_EA64: ++ microblaze_reloc = R_MICROBLAZE_IMML_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_GOTPC: ++ microblaze_reloc = R_MICROBLAZE_GOTPC_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_GPC: ++ microblaze_reloc = R_MICROBLAZE_GPC_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_GOT: ++ microblaze_reloc = R_MICROBLAZE_GOT_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_TEXTPCREL: ++ microblaze_reloc = R_MICROBLAZE_TEXTPCREL_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_TEXTREL: ++ microblaze_reloc = R_MICROBLAZE_TEXTREL_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_PLT: ++ microblaze_reloc = R_MICROBLAZE_PLT_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_GOTOFF: ++ microblaze_reloc = R_MICROBLAZE_GOTOFF_64; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_GOTOFF: ++ microblaze_reloc = R_MICROBLAZE_GOTOFF_32; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_TLSGD: ++ microblaze_reloc = R_MICROBLAZE_TLSGD; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_TLSLD: ++ microblaze_reloc = R_MICROBLAZE_TLSLD; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_TLSDTPREL: ++ microblaze_reloc = R_MICROBLAZE_TLSDTPREL32; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_TLSDTPREL: ++ microblaze_reloc = R_MICROBLAZE_TLSDTPREL64; ++ break; ++ case BFD_RELOC_MICROBLAZE_32_TLSDTPMOD: ++ microblaze_reloc = R_MICROBLAZE_TLSDTPMOD32; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL: ++ microblaze_reloc = R_MICROBLAZE_TLSGOTTPREL32; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_TLSTPREL: ++ microblaze_reloc = R_MICROBLAZE_TLSTPREL32; ++ break; ++ case BFD_RELOC_MICROBLAZE_COPY: ++ microblaze_reloc = R_MICROBLAZE_COPY; ++ break; ++ default: ++ return (reloc_howto_type *) NULL; ++ } ++ ++ if (!microblaze_elf_howto_table [R_MICROBLAZE_32]) ++ /* Initialize howto table if needed. */ ++ microblaze_elf_howto_init (); ++ ++ return microblaze_elf_howto_table [(int) microblaze_reloc]; ++}; ++ ++static reloc_howto_type * ++microblaze_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, ++ const char *r_name) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < NUM_ELEM (microblaze_elf_howto_raw); i++) ++ if (microblaze_elf_howto_raw[i].name != NULL ++ && strcasecmp (microblaze_elf_howto_raw[i].name, r_name) == 0) ++ return µblaze_elf_howto_raw[i]; ++ ++ return NULL; ++} ++ ++/* Set the howto pointer for a RCE ELF reloc. */ ++ ++static bool ++microblaze_elf_info_to_howto (bfd * abfd, ++ arelent * cache_ptr, ++ Elf_Internal_Rela * dst) ++{ ++ unsigned int r_type; ++ ++ if (!microblaze_elf_howto_table [R_MICROBLAZE_32]) ++ /* Initialize howto table if needed. */ ++ microblaze_elf_howto_init (); ++ ++ r_type = ELF64_R_TYPE (dst->r_info); ++ if (r_type >= R_MICROBLAZE_max) ++ { ++ /* xgettext:c-format */ ++ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), ++ abfd, r_type); ++ bfd_set_error (bfd_error_bad_value); ++ return false; ++ } ++ ++ cache_ptr->howto = microblaze_elf_howto_table [r_type]; ++ return true; ++} ++ ++struct _microblaze_elf_section_data ++{ ++ struct bfd_elf_section_data elf; ++ /* Count of used relaxation table entries. */ ++ size_t relax_count; ++ /* Relaxation table. */ ++ struct relax_table *relax; ++}; ++ ++#define microblaze_elf_section_data(sec) \ ++ ((struct _microblaze_elf_section_data *) elf_section_data (sec)) ++ ++static bool ++microblaze_elf_new_section_hook (bfd *abfd, asection *sec) ++{ ++ if (!sec->used_by_bfd) ++ { ++ struct _microblaze_elf_section_data *sdata; ++ size_t amt = sizeof (*sdata); ++ ++ sdata = bfd_zalloc (abfd, amt); ++ if (sdata == NULL) ++ return false; ++ sec->used_by_bfd = sdata; ++ } ++ ++ return _bfd_elf_new_section_hook (abfd, sec); ++} ++ ++/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */ ++ ++static bool ++microblaze_elf_is_local_label_name (bfd *abfd, const char *name) ++{ ++ if (name[0] == 'L' && name[1] == '.') ++ return true; ++ ++ if (name[0] == '$' && name[1] == 'L') ++ return true; ++ ++ /* With gcc, the labels go back to starting with '.', so we accept ++ the generic ELF local label syntax as well. */ ++ return _bfd_elf_is_local_label_name (abfd, name); ++} ++ ++/* The microblaze linker (like many others) needs to keep track of ++ the number of relocs that it decides to copy as dynamic relocs in ++ check_relocs for each symbol. This is so that it can later discard ++ them if they are found to be unnecessary. We store the information ++ in a field extending the regular ELF linker hash table. */ ++ ++struct elf64_mb_dyn_relocs ++{ ++ struct elf64_mb_dyn_relocs *next; ++ ++ /* The input section of the reloc. */ ++ asection *sec; ++ ++ /* Total number of relocs copied for the input section. */ ++ bfd_size_type count; ++ ++ /* Number of pc-relative relocs copied for the input section. */ ++ bfd_size_type pc_count; ++}; ++ ++/* ELF linker hash entry. */ ++ ++struct elf64_mb_link_hash_entry ++{ ++ struct elf_link_hash_entry elf; ++ ++ /* Track dynamic relocs copied for this symbol. */ ++ struct elf64_mb_dyn_relocs *dyn_relocs; ++ ++ /* TLS Reference Types for the symbol; Updated by check_relocs */ ++#define TLS_GD 1 /* GD reloc. */ ++#define TLS_LD 2 /* LD reloc. */ ++#define TLS_TPREL 4 /* TPREL reloc, => IE. */ ++#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */ ++#define TLS_TLS 16 /* Any TLS reloc. */ ++ unsigned char tls_mask; ++ ++}; ++ ++#define IS_TLS_GD(x) (x == (TLS_TLS | TLS_GD)) ++#define IS_TLS_LD(x) (x == (TLS_TLS | TLS_LD)) ++#define IS_TLS_DTPREL(x) (x == (TLS_TLS | TLS_DTPREL)) ++#define IS_TLS_NONE(x) (x == 0) ++ ++#define elf64_mb_hash_entry(ent) ((struct elf64_mb_link_hash_entry *)(ent)) ++ ++/* ELF linker hash table. */ ++ ++struct elf64_mb_link_hash_table ++{ ++ struct elf_link_hash_table elf; ++ ++ /* Short-cuts to get to dynamic linker sections. */ ++ asection *sgot; ++ asection *sgotplt; ++ asection *srelgot; ++ asection *splt; ++ asection *srelplt; ++ asection *sdynbss; ++ asection *srelbss; ++ ++ /* Small local sym to section mapping cache. */ ++ struct sym_cache sym_sec; ++ ++ /* TLS Local Dynamic GOT Entry */ ++ union { ++ bfd_signed_vma refcount; ++ bfd_vma offset; ++ } tlsld_got; ++}; ++ ++/* Nonzero if this section has TLS related relocations. */ ++#define has_tls_reloc sec_flg0 ++ ++/* Get the ELF linker hash table from a link_info structure. */ ++ ++#define elf64_mb_hash_table(p) \ ++ ((is_elf_hash_table ((p)->hash) \ ++ && elf_hash_table_id (elf_hash_table (p)) == MICROBLAZE_ELF_DATA) \ ++ ? (struct elf64_mb_link_hash_table *) (p)->hash : NULL) ++ ++/* Create an entry in a microblaze ELF linker hash table. */ ++ ++static struct bfd_hash_entry * ++link_hash_newfunc (struct bfd_hash_entry *entry, ++ struct bfd_hash_table *table, ++ const char *string) ++{ ++ /* Allocate the structure if it has not already been allocated by a ++ subclass. */ ++ if (entry == NULL) ++ { ++ entry = bfd_hash_allocate (table, ++ sizeof (struct elf64_mb_link_hash_entry)); ++ if (entry == NULL) ++ return entry; ++ } ++ ++ /* Call the allocation method of the superclass. */ ++ entry = _bfd_elf_link_hash_newfunc (entry, table, string); ++ if (entry != NULL) ++ { ++ struct elf64_mb_link_hash_entry *eh; ++ ++ eh = (struct elf64_mb_link_hash_entry *) entry; ++ eh->tls_mask = 0; ++ } ++ ++ return entry; ++} ++ ++/* Create a mb ELF linker hash table. */ ++ ++static struct bfd_link_hash_table * ++microblaze_elf_link_hash_table_create (bfd *abfd) ++{ ++ struct elf64_mb_link_hash_table *ret; ++ size_t amt = sizeof (struct elf64_mb_link_hash_table); ++ ++ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt); ++ if (ret == NULL) ++ return NULL; ++ ++ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc, ++ sizeof (struct elf64_mb_link_hash_entry), ++ MICROBLAZE_ELF_DATA)) ++ { ++ free (ret); ++ return NULL; ++ } ++ ++ return &ret->elf.root; ++} ++ ++/* Set the values of the small data pointers. */ ++ ++static void ++microblaze_elf_final_sdp (struct bfd_link_info *info) ++{ ++ struct bfd_link_hash_entry *h; ++ ++ h = bfd_link_hash_lookup (info->hash, RO_SDA_ANCHOR_NAME, false, false, true); ++ if (h != (struct bfd_link_hash_entry *) NULL ++ && h->type == bfd_link_hash_defined) ++ ro_small_data_pointer = (h->u.def.value ++ + h->u.def.section->output_section->vma ++ + h->u.def.section->output_offset); ++ ++ h = bfd_link_hash_lookup (info->hash, RW_SDA_ANCHOR_NAME, false, false, true); ++ if (h != (struct bfd_link_hash_entry *) NULL ++ && h->type == bfd_link_hash_defined) ++ rw_small_data_pointer = (h->u.def.value ++ + h->u.def.section->output_section->vma ++ + h->u.def.section->output_offset); ++} ++ ++static bfd_vma ++dtprel_base (struct bfd_link_info *info) ++{ ++ /* If tls_sec is NULL, we should have signalled an error already. */ ++ if (elf_hash_table (info)->tls_sec == NULL) ++ return 0; ++ return elf_hash_table (info)->tls_sec->vma; ++} ++ ++/* The size of the thread control block. */ ++#define TCB_SIZE 8 ++ ++/* Output a simple dynamic relocation into SRELOC. */ ++ ++static void ++microblaze_elf_output_dynamic_relocation (bfd *output_bfd, ++ asection *sreloc, ++ unsigned long reloc_index, ++ unsigned long indx, ++ int r_type, ++ bfd_vma offset, ++ bfd_vma addend) ++{ ++ ++ Elf_Internal_Rela rel; ++ ++ rel.r_info = ELF64_R_INFO (indx, r_type); ++ rel.r_offset = offset; ++ rel.r_addend = addend; ++ ++ bfd_elf64_swap_reloca_out (output_bfd, &rel, ++ (sreloc->contents + reloc_index * sizeof (Elf64_External_Rela))); ++} ++ ++/* This code is taken from elf64-m32r.c ++ There is some attempt to make this function usable for many architectures, ++ both USE_REL and USE_RELA ['twould be nice if such a critter existed], ++ if only to serve as a learning tool. ++ ++ The RELOCATE_SECTION function is called by the new ELF backend linker ++ to handle the relocations for a section. ++ ++ The relocs are always passed as Rela structures; if the section ++ actually uses Rel structures, the r_addend field will always be ++ zero. ++ ++ This function is responsible for adjust the section contents as ++ necessary, and (if using Rela relocs and generating a ++ relocatable output file) adjusting the reloc addend as ++ necessary. ++ ++ This function does not have to worry about setting the reloc ++ address or the reloc symbol index. ++ ++ LOCAL_SYMS is a pointer to the swapped in local symbols. ++ ++ LOCAL_SECTIONS is an array giving the section in the input file ++ corresponding to the st_shndx field of each local symbol. ++ ++ The global hash table entry for the global symbols can be found ++ via elf_sym_hashes (input_bfd). ++ ++ When generating relocatable output, this function must handle ++ STB_LOCAL/STT_SECTION symbols specially. The output symbol is ++ going to be the section symbol corresponding to the output ++ section, which means that the addend must be adjusted ++ accordingly. */ ++ ++static int ++microblaze_elf_relocate_section (bfd *output_bfd, ++ struct bfd_link_info *info, ++ bfd *input_bfd, ++ asection *input_section, ++ bfd_byte *contents, ++ Elf_Internal_Rela *relocs, ++ Elf_Internal_Sym *local_syms, ++ asection **local_sections) ++{ ++ struct elf64_mb_link_hash_table *htab; ++ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; ++ struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); ++ Elf_Internal_Rela *rel, *relend; ++ int endian = (bfd_little_endian (output_bfd)) ? 0 : 2; ++ /* Assume success. */ ++ bool ret = true; ++ asection *sreloc; ++ bfd_vma *local_got_offsets; ++ unsigned int tls_type; ++ ++ if (!microblaze_elf_howto_table[R_MICROBLAZE_max-1]) ++ microblaze_elf_howto_init (); ++ ++ htab = elf64_mb_hash_table (info); ++ if (htab == NULL) ++ return false; ++ ++ local_got_offsets = elf_local_got_offsets (input_bfd); ++ ++ sreloc = elf_section_data (input_section)->sreloc; ++ ++ rel = relocs; ++ relend = relocs + input_section->reloc_count; ++ for (; rel < relend; rel++) ++ { ++ int r_type; ++ reloc_howto_type *howto; ++ unsigned long r_symndx; ++ bfd_vma addend = rel->r_addend; ++ bfd_vma offset = rel->r_offset; ++ struct elf_link_hash_entry *h; ++ Elf_Internal_Sym *sym; ++ asection *sec; ++ const char *sym_name; ++ bfd_reloc_status_type r = bfd_reloc_ok; ++ const char *errmsg = NULL; ++ bool unresolved_reloc = false; ++ ++ h = NULL; ++ r_type = ELF64_R_TYPE (rel->r_info); ++ tls_type = 0; ++ ++ if (r_type < 0 || r_type >= (int) R_MICROBLAZE_max) ++ { ++ /* xgettext:c-format */ ++ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), ++ input_bfd, (int) r_type); ++ bfd_set_error (bfd_error_bad_value); ++ ret = false; ++ continue; ++ } ++ ++ howto = microblaze_elf_howto_table[r_type]; ++ r_symndx = ELF64_R_SYM (rel->r_info); ++ ++ if (bfd_link_relocatable (info)) ++ { ++ /* This is a relocatable link. We don't have to change ++ anything, unless the reloc is against a section symbol, ++ in which case we have to adjust according to where the ++ section symbol winds up in the output section. */ ++ sec = NULL; ++ if (r_symndx >= symtab_hdr->sh_info) ++ /* External symbol. */ ++ continue; ++ ++ /* Local symbol. */ ++ sym = local_syms + r_symndx; ++ sym_name = "<local symbol>"; ++ /* STT_SECTION: symbol is associated with a section. */ ++ if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) ++ /* Symbol isn't associated with a section. Nothing to do. */ ++ continue; ++ ++ sec = local_sections[r_symndx]; ++ addend += sec->output_offset + sym->st_value; ++#ifndef USE_REL ++ /* This can't be done for USE_REL because it doesn't mean anything ++ and elf_link_input_bfd asserts this stays zero. */ ++ /* rel->r_addend = addend; */ ++#endif ++ ++#ifndef USE_REL ++ /* Addends are stored with relocs. We're done. */ ++ continue; ++#else /* USE_REL */ ++ /* If partial_inplace, we need to store any additional addend ++ back in the section. */ ++ if (!howto->partial_inplace) ++ continue; ++ /* ??? Here is a nice place to call a special_function like handler. */ ++ r = _bfd_relocate_contents (howto, input_bfd, addend, ++ contents + offset); ++#endif /* USE_REL */ ++ } ++ else ++ { ++ bfd_vma relocation; ++ bool resolved_to_zero; ++ ++ /* This is a final link. */ ++ sym = NULL; ++ sec = NULL; ++ unresolved_reloc = false; ++ ++ if (r_symndx < symtab_hdr->sh_info) ++ { ++ /* Local symbol. */ ++ sym = local_syms + r_symndx; ++ sec = local_sections[r_symndx]; ++ if (sec == 0) ++ continue; ++ sym_name = "<local symbol>"; ++ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); ++ /* r_addend may have changed if the reference section was ++ a merge section. */ ++ addend = rel->r_addend; ++ } ++ else ++ { ++ /* External symbol. */ ++ bool warned ATTRIBUTE_UNUSED; ++ bool ignored ATTRIBUTE_UNUSED; ++ ++ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, ++ r_symndx, symtab_hdr, sym_hashes, ++ h, sec, relocation, ++ unresolved_reloc, warned, ignored); ++ sym_name = h->root.root.string; ++ } ++ ++ /* Sanity check the address. */ ++ if (offset > bfd_get_section_limit (input_bfd, input_section)) ++ { ++ r = bfd_reloc_outofrange; ++ goto check_reloc; ++ } ++ ++ resolved_to_zero = (h != NULL ++ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)); ++ ++ switch ((int) r_type) ++ { ++ case (int) R_MICROBLAZE_SRO32 : ++ { ++ const char *name; ++ ++ /* Only relocate if the symbol is defined. */ ++ if (sec) ++ { ++ name = bfd_section_name (sec); ++ ++ if (strcmp (name, ".sdata2") == 0 ++ || strcmp (name, ".sbss2") == 0) ++ { ++ if (ro_small_data_pointer == 0) ++ microblaze_elf_final_sdp (info); ++ if (ro_small_data_pointer == 0) ++ { ++ ret = false; ++ r = bfd_reloc_undefined; ++ goto check_reloc; ++ } ++ ++ /* At this point `relocation' contains the object's ++ address. */ ++ relocation -= ro_small_data_pointer; ++ /* Now it contains the offset from _SDA2_BASE_. */ ++ r = _bfd_final_link_relocate (howto, input_bfd, ++ input_section, ++ contents, offset, ++ relocation, addend); ++ } ++ else ++ { ++ _bfd_error_handler ++ /* xgettext:c-format */ ++ (_("%pB: the target (%s) of an %s relocation" ++ " is in the wrong section (%pA)"), ++ input_bfd, ++ sym_name, ++ microblaze_elf_howto_table[(int) r_type]->name, ++ sec); ++ /*bfd_set_error (bfd_error_bad_value); ??? why? */ ++ ret = false; ++ continue; ++ } ++ } ++ } ++ break; ++ ++ case (int) R_MICROBLAZE_SRW32 : ++ { ++ const char *name; ++ ++ /* Only relocate if the symbol is defined. */ ++ if (sec) ++ { ++ name = bfd_section_name (sec); ++ ++ if (strcmp (name, ".sdata") == 0 ++ || strcmp (name, ".sbss") == 0) ++ { ++ if (rw_small_data_pointer == 0) ++ microblaze_elf_final_sdp (info); ++ if (rw_small_data_pointer == 0) ++ { ++ ret = false; ++ r = bfd_reloc_undefined; ++ goto check_reloc; ++ } ++ ++ /* At this point `relocation' contains the object's ++ address. */ ++ relocation -= rw_small_data_pointer; ++ /* Now it contains the offset from _SDA_BASE_. */ ++ r = _bfd_final_link_relocate (howto, input_bfd, ++ input_section, ++ contents, offset, ++ relocation, addend); ++ } ++ else ++ { ++ _bfd_error_handler ++ /* xgettext:c-format */ ++ (_("%pB: the target (%s) of an %s relocation" ++ " is in the wrong section (%pA)"), ++ input_bfd, ++ sym_name, ++ microblaze_elf_howto_table[(int) r_type]->name, ++ sec); ++ /*bfd_set_error (bfd_error_bad_value); ??? why? */ ++ ret = false; ++ continue; ++ } ++ } ++ } ++ break; ++ ++ case (int) R_MICROBLAZE_32_SYM_OP_SYM: ++ break; /* Do nothing. */ ++ ++ case (int) R_MICROBLAZE_GOTPC_64: ++ relocation = (htab->elf.sgotplt->output_section->vma ++ + htab->elf.sgotplt->output_offset); ++ relocation -= (input_section->output_section->vma ++ + input_section->output_offset ++ + offset + INST_WORD_SIZE); ++ relocation += addend; ++ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, ++ contents + offset + endian); ++ bfd_put_16 (input_bfd, relocation & 0xffff, ++ contents + offset + endian + INST_WORD_SIZE); ++ break; ++ ++ case (int) R_MICROBLAZE_TEXTPCREL_64: ++ relocation = input_section->output_section->vma; ++ relocation -= (input_section->output_section->vma ++ + input_section->output_offset ++ + offset + INST_WORD_SIZE); ++ relocation += addend; ++ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, ++ contents + offset + endian); ++ bfd_put_16 (input_bfd, relocation & 0xffff, ++ contents + offset + endian + INST_WORD_SIZE); ++ break; ++ ++ case (int) R_MICROBLAZE_PLT_64: ++ { ++ bfd_vma immediate; ++ if (htab->elf.splt != NULL && h != NULL ++ && h->plt.offset != (bfd_vma) -1) ++ { ++ relocation = (htab->elf.splt->output_section->vma ++ + htab->elf.splt->output_offset ++ + h->plt.offset); ++ unresolved_reloc = false; ++ immediate = relocation - (input_section->output_section->vma ++ + input_section->output_offset ++ + offset + INST_WORD_SIZE); ++ bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff, ++ contents + offset + endian); ++ bfd_put_16 (input_bfd, immediate & 0xffff, ++ contents + offset + endian + INST_WORD_SIZE); ++ } ++ else ++ { ++ relocation -= (input_section->output_section->vma ++ + input_section->output_offset ++ + offset + INST_WORD_SIZE); ++ immediate = relocation; ++ bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff, ++ contents + offset + endian); ++ bfd_put_16 (input_bfd, immediate & 0xffff, ++ contents + offset + endian + INST_WORD_SIZE); ++ } ++ break; ++ } ++ ++ case (int) R_MICROBLAZE_TLSGD: ++ tls_type = (TLS_TLS | TLS_GD); ++ goto dogot; ++ case (int) R_MICROBLAZE_TLSLD: ++ tls_type = (TLS_TLS | TLS_LD); ++ /* Fall through. */ ++ dogot: ++ case (int) R_MICROBLAZE_GOT_64: ++ { ++ bfd_vma *offp; ++ bfd_vma off, off2; ++ unsigned long indx; ++ bfd_vma static_value; ++ ++ bool need_relocs = false; ++ if (htab->elf.sgot == NULL) ++ abort (); ++ ++ indx = 0; ++ offp = NULL; ++ ++ /* 1. Identify GOT Offset; ++ 2. Compute Static Values ++ 3. Process Module Id, Process Offset ++ 4. Fixup Relocation with GOT offset value. */ ++ ++ /* 1. Determine GOT Offset to use : TLS_LD, global, local */ ++ if (IS_TLS_LD (tls_type)) ++ offp = &htab->tlsld_got.offset; ++ else if (h != NULL) ++ { ++ if (htab->elf.sgotplt != NULL ++ && h->got.offset != (bfd_vma) -1) ++ offp = &h->got.offset; ++ else ++ abort (); ++ } ++ else ++ { ++ if (local_got_offsets == NULL) ++ abort (); ++ offp = &local_got_offsets[r_symndx]; ++ } ++ ++ if (!offp) ++ abort (); ++ ++ off = (*offp) & ~1; ++ off2 = off; ++ ++ if (IS_TLS_LD(tls_type) || IS_TLS_GD(tls_type)) ++ off2 = off + 4; ++ ++ /* Symbol index to use for relocs */ ++ if (h != NULL) ++ { ++ bool dyn = ++ elf_hash_table (info)->dynamic_sections_created; ++ ++ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, ++ bfd_link_pic (info), ++ h) ++ && (!bfd_link_pic (info) ++ || !SYMBOL_REFERENCES_LOCAL (info, h))) ++ indx = h->dynindx; ++ } ++ ++ /* Need to generate relocs ? */ ++ if ((bfd_link_pic (info) || indx != 0) ++ && (h == NULL ++ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ || h->root.type != bfd_link_hash_undefweak)) ++ need_relocs = true; ++ ++ /* 2. Compute/Emit Static value of r-expression */ ++ static_value = relocation + addend; ++ ++ /* 3. Process module-id and offset */ ++ if (! ((*offp) & 1) ) ++ { ++ bfd_vma got_offset; ++ ++ got_offset = (htab->elf.sgot->output_section->vma ++ + htab->elf.sgot->output_offset ++ + off); ++ ++ /* Process module-id */ ++ if (IS_TLS_LD(tls_type)) ++ { ++ if (! bfd_link_pic (info)) ++ bfd_put_32 (output_bfd, 1, ++ htab->elf.sgot->contents + off); ++ else ++ microblaze_elf_output_dynamic_relocation ++ (output_bfd, ++ htab->elf.srelgot, ++ htab->elf.srelgot->reloc_count++, ++ /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32, ++ got_offset, 0); ++ } ++ else if (IS_TLS_GD(tls_type)) ++ { ++ if (! need_relocs) ++ bfd_put_32 (output_bfd, 1, ++ htab->elf.sgot->contents + off); ++ else ++ microblaze_elf_output_dynamic_relocation ++ (output_bfd, ++ htab->elf.srelgot, ++ htab->elf.srelgot->reloc_count++, ++ /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32, ++ got_offset, indx ? 0 : static_value); ++ } ++ ++ /* Process Offset */ ++ if (htab->elf.srelgot == NULL) ++ abort (); ++ ++ got_offset = (htab->elf.sgot->output_section->vma ++ + htab->elf.sgot->output_offset ++ + off2); ++ if (IS_TLS_LD(tls_type)) ++ { ++ /* For LD, offset should be 0 */ ++ *offp |= 1; ++ bfd_put_32 (output_bfd, 0, ++ htab->elf.sgot->contents + off2); ++ } ++ else if (IS_TLS_GD(tls_type)) ++ { ++ *offp |= 1; ++ static_value -= dtprel_base(info); ++ if (need_relocs) ++ microblaze_elf_output_dynamic_relocation ++ (output_bfd, ++ htab->elf.srelgot, ++ htab->elf.srelgot->reloc_count++, ++ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32, ++ got_offset, indx ? 0 : static_value); ++ else ++ bfd_put_32 (output_bfd, static_value, ++ htab->elf.sgot->contents + off2); ++ } ++ else ++ { ++ bfd_put_32 (output_bfd, static_value, ++ htab->elf.sgot->contents + off2); ++ ++ /* Relocs for dyn symbols generated by ++ finish_dynamic_symbols */ ++ if (bfd_link_pic (info) && h == NULL) ++ { ++ *offp |= 1; ++ microblaze_elf_output_dynamic_relocation ++ (output_bfd, ++ htab->elf.srelgot, ++ htab->elf.srelgot->reloc_count++, ++ /* symindex= */ indx, R_MICROBLAZE_REL, ++ got_offset, static_value); ++ } ++ } ++ } ++ ++ /* 4. Fixup Relocation with GOT offset value ++ Compute relative address of GOT entry for applying ++ the current relocation */ ++ relocation = htab->elf.sgot->output_section->vma ++ + htab->elf.sgot->output_offset ++ + off ++ - htab->elf.sgotplt->output_section->vma ++ - htab->elf.sgotplt->output_offset; ++ ++ /* Apply Current Relocation */ ++ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, ++ contents + offset + endian); ++ bfd_put_16 (input_bfd, relocation & 0xffff, ++ contents + offset + endian + INST_WORD_SIZE); ++ ++ unresolved_reloc = false; ++ break; ++ } ++ ++ case (int) R_MICROBLAZE_GOTOFF_64: ++ { ++ bfd_vma immediate; ++ unsigned short lo, high; ++ relocation += addend; ++ relocation -= (htab->elf.sgotplt->output_section->vma ++ + htab->elf.sgotplt->output_offset); ++ /* Write this value into correct location. */ ++ immediate = relocation; ++ lo = immediate & 0x0000ffff; ++ high = (immediate >> 16) & 0x0000ffff; ++ bfd_put_16 (input_bfd, high, contents + offset + endian); ++ bfd_put_16 (input_bfd, lo, ++ contents + offset + INST_WORD_SIZE + endian); ++ break; ++ } ++ ++ case (int) R_MICROBLAZE_GOTOFF_32: ++ { ++ relocation += addend; ++ relocation -= (htab->elf.sgotplt->output_section->vma ++ + htab->elf.sgotplt->output_offset); ++ /* Write this value into correct location. */ ++ bfd_put_32 (input_bfd, relocation, contents + offset); ++ break; ++ } ++ ++ case (int) R_MICROBLAZE_TLSDTPREL64: ++ relocation += addend; ++ relocation -= dtprel_base(info); ++ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, ++ contents + offset + endian); ++ bfd_put_16 (input_bfd, relocation & 0xffff, ++ contents + offset + endian + INST_WORD_SIZE); ++ break; ++ case (int) R_MICROBLAZE_TEXTREL_64: ++ case (int) R_MICROBLAZE_TEXTREL_32_LO: ++ case (int) R_MICROBLAZE_64_PCREL : ++ case (int) R_MICROBLAZE_64: ++ case (int) R_MICROBLAZE_32: ++ case (int) R_MICROBLAZE_IMML_64: ++ { ++ /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols ++ from removed linkonce sections, or sections discarded by ++ a linker script. */ ++ if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0) ++ { ++ relocation += addend; ++ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64) ++ bfd_put_32 (input_bfd, relocation, contents + offset); ++ else if (r_type == R_MICROBLAZE_IMML_64) ++ bfd_put_64 (input_bfd, relocation, contents + offset); ++ else ++ { ++ if (r_type == R_MICROBLAZE_64_PCREL) ++ relocation -= (input_section->output_section->vma ++ + input_section->output_offset ++ + offset + INST_WORD_SIZE); ++ else if (r_type == R_MICROBLAZE_TEXTREL_64 ++ || r_type == R_MICROBLAZE_TEXTREL_32_LO) ++ relocation -= input_section->output_section->vma; ++ ++ if (r_type == R_MICROBLAZE_TEXTREL_32_LO) ++ bfd_put_16 (input_bfd, relocation & 0xffff, ++ contents + offset + endian); ++ ++ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); ++ if ((insn & 0xff000000) == 0xb2000000) ++ { ++ insn &= ~0x00ffffff; ++ insn |= (relocation >> 16) & 0xffffff; ++ bfd_put_32 (input_bfd, insn, ++ contents + offset + endian); ++ } ++ else ++ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, ++ contents + offset + endian); ++ bfd_put_16 (input_bfd, relocation & 0xffff, ++ contents + offset + endian + INST_WORD_SIZE); ++ } ++ break; ++ } ++ ++ if ((bfd_link_pic (info) ++ && (h == NULL ++ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ && !resolved_to_zero) ++ || h->root.type != bfd_link_hash_undefweak) ++ && (!howto->pc_relative ++ || (h != NULL ++ && h->dynindx != -1 ++ && (!info->symbolic ++ || !h->def_regular)))) ++ || (!bfd_link_pic (info) ++ && h != NULL ++ && h->dynindx != -1 ++ && !h->non_got_ref ++ && ((h->def_dynamic ++ && !h->def_regular) ++ || h->root.type == bfd_link_hash_undefweak ++ || h->root.type == bfd_link_hash_undefined))) ++ { ++ Elf_Internal_Rela outrel; ++ bfd_byte *loc; ++ bool skip; ++ ++ /* When generating a shared object, these relocations ++ are copied into the output file to be resolved at run ++ time. */ ++ ++ BFD_ASSERT (sreloc != NULL); ++ ++ skip = false; ++ ++ outrel.r_offset = ++ _bfd_elf_section_offset (output_bfd, info, input_section, ++ rel->r_offset); ++ if (outrel.r_offset == (bfd_vma) -1) ++ skip = true; ++ else if (outrel.r_offset == (bfd_vma) -2) ++ skip = true; ++ outrel.r_offset += (input_section->output_section->vma ++ + input_section->output_offset); ++ ++ if (skip) ++ memset (&outrel, 0, sizeof outrel); ++ /* h->dynindx may be -1 if the symbol was marked to ++ become local. */ ++ else if (h != NULL ++ && ((! info->symbolic && h->dynindx != -1) ++ || !h->def_regular)) ++ { ++ BFD_ASSERT (h->dynindx != -1); ++ outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); ++ outrel.r_addend = addend; ++ } ++ else ++ { ++ if (r_type == R_MICROBLAZE_32 || r_type == R_MICROBLAZE_IMML_64) ++ { ++ outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL); ++ outrel.r_addend = relocation + addend; ++ } ++ else ++ { ++ BFD_FAIL (); ++ _bfd_error_handler ++ (_("%pB: probably compiled without -fPIC?"), ++ input_bfd); ++ bfd_set_error (bfd_error_bad_value); ++ return false; ++ } ++ } ++ ++ loc = sreloc->contents; ++ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela); ++ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); ++ break; ++ } ++ else ++ { ++ relocation += addend; ++ if (r_type == R_MICROBLAZE_32) ++ bfd_put_32 (input_bfd, relocation, contents + offset); ++ else if (r_type == R_MICROBLAZE_IMML_64) ++ bfd_put_64 (input_bfd, relocation, contents + offset + endian); ++ else ++ { ++ if (r_type == R_MICROBLAZE_64_PCREL) ++ { ++ if (!input_section->output_section->vma && ++ !input_section->output_offset && !offset) ++ relocation -= (input_section->output_section->vma ++ + input_section->output_offset ++ + offset); ++ else ++ relocation -= (input_section->output_section->vma ++ + input_section->output_offset + offset + INST_WORD_SIZE); ++ } ++ else if (r_type == R_MICROBLAZE_TEXTREL_64 ++ || r_type == R_MICROBLAZE_TEXTREL_32_LO) ++ relocation -= input_section->output_section->vma; ++ ++ if (r_type == R_MICROBLAZE_TEXTREL_32_LO) ++ { ++ bfd_put_16 (input_bfd, relocation & 0xffff, ++ contents + offset + endian); ++ } ++ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); ++ if ((insn & 0xff000000) == 0xb2000000) ++ { ++ insn &= ~0x00ffffff; ++ insn |= (relocation >> 16) & 0xffffff; ++ bfd_put_32 (input_bfd, insn, ++ contents + offset + endian); ++ } ++ else ++ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, ++ contents + offset + endian); ++ bfd_put_16 (input_bfd, relocation & 0xffff, ++ contents + offset + endian + INST_WORD_SIZE); ++ } ++ break; ++ } ++ } ++ ++ default : ++ r = _bfd_final_link_relocate (howto, input_bfd, input_section, ++ contents, offset, ++ relocation, addend); ++ break; ++ } ++ } ++ ++ check_reloc: ++ ++ if (r != bfd_reloc_ok) ++ { ++ /* FIXME: This should be generic enough to go in a utility. */ ++ const char *name; ++ ++ if (h != NULL) ++ name = h->root.root.string; ++ else ++ { ++ name = (bfd_elf_string_from_elf_section ++ (input_bfd, symtab_hdr->sh_link, sym->st_name)); ++ if (name == NULL || *name == '\0') ++ name = bfd_section_name (sec); ++ } ++ ++ if (errmsg != NULL) ++ goto common_error; ++ ++ switch (r) ++ { ++ case bfd_reloc_overflow: ++ (*info->callbacks->reloc_overflow) ++ (info, (h ? &h->root : NULL), name, howto->name, ++ (bfd_vma) 0, input_bfd, input_section, offset); ++ break; ++ ++ case bfd_reloc_undefined: ++ (*info->callbacks->undefined_symbol) ++ (info, name, input_bfd, input_section, offset, true); ++ break; ++ ++ case bfd_reloc_outofrange: ++ errmsg = _("internal error: out of range error"); ++ goto common_error; ++ ++ case bfd_reloc_notsupported: ++ errmsg = _("internal error: unsupported relocation error"); ++ goto common_error; ++ ++ case bfd_reloc_dangerous: ++ errmsg = _("internal error: dangerous error"); ++ goto common_error; ++ ++ default: ++ errmsg = _("internal error: unknown error"); ++ /* Fall through. */ ++ common_error: ++ (*info->callbacks->warning) (info, errmsg, name, input_bfd, ++ input_section, offset); ++ break; ++ } ++ } ++ } ++ ++ return ret; ++} ++ ++/* Merge backend specific data from an object file to the output ++ object file when linking. ++ ++ Note: We only use this hook to catch endian mismatches. */ ++static bool ++microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd) ++{ ++ /* Check if we have the same endianess. */ ++ if (! _bfd_generic_verify_endian_match (ibfd, obfd)) ++ return false; ++ ++ return true; ++} ++ ++ ++/* Calculate fixup value for reference. */ ++ ++static size_t ++calc_fixup (bfd_vma start, bfd_vma size, asection *sec) ++{ ++ bfd_vma end = start + size; ++ size_t i, fixup = 0; ++ struct _microblaze_elf_section_data *sdata; ++ ++ if (sec == NULL || (sdata = microblaze_elf_section_data (sec)) == NULL) ++ return 0; ++ ++ /* Look for addr in relax table, total fixup value. */ ++ for (i = 0; i < sdata->relax_count; i++) ++ { ++ if (end <= sdata->relax[i].addr) ++ break; ++ if (end != start && start > sdata->relax[i].addr) ++ continue; ++ fixup += sdata->relax[i].size; ++ } ++ return fixup; ++} ++ ++/* Read-modify-write into the bfd, an immediate value into appropriate fields of ++ a 32-bit instruction. */ ++static void ++microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) ++{ ++ unsigned long instr = bfd_get_32 (abfd, bfd_addr); ++ ++ if ((instr & 0xff000000) == 0xb2000000) ++ { ++ instr &= ~0x00ffffff; ++ instr |= (val & 0xffffff); ++ bfd_put_32 (abfd, instr, bfd_addr); ++ } ++ else ++ { ++ instr &= ~0x0000ffff; ++ instr |= (val & 0x0000ffff); ++ bfd_put_32 (abfd, instr, bfd_addr); ++ } ++} ++ ++/* Read-modify-write into the bfd, an immediate value into appropriate fields of ++ two consecutive 32-bit instructions. */ ++static void ++microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) ++{ ++ unsigned long instr_hi; ++ unsigned long instr_lo; ++ ++ instr_hi = bfd_get_32 (abfd, bfd_addr); ++ if ((instr_hi & 0xff000000) == 0xb2000000) ++ { ++ instr_hi &= ~0x00ffffff; ++ instr_hi |= (val >> 16) & 0xffffff; ++ bfd_put_32 (abfd, instr_hi,bfd_addr); ++ } ++ else ++ { ++ instr_hi &= ~0x0000ffff; ++ instr_hi |= ((val >> 16) & 0x0000ffff); ++ bfd_put_32 (abfd, instr_hi, bfd_addr); ++ } ++ instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE); ++ instr_lo &= ~0x0000ffff; ++ instr_lo |= (val & 0x0000ffff); ++ bfd_put_32 (abfd, instr_lo, bfd_addr + INST_WORD_SIZE); ++} ++ ++static bool ++microblaze_elf_relax_section (bfd *abfd, ++ asection *sec, ++ struct bfd_link_info *link_info, ++ bool *again) ++{ ++ Elf_Internal_Shdr *symtab_hdr; ++ Elf_Internal_Rela *internal_relocs; ++ Elf_Internal_Rela *irel, *irelend; ++ bfd_byte *contents = NULL; ++ int rel_count; ++ unsigned int shndx; ++ size_t i, sym_index; ++ asection *o; ++ struct elf_link_hash_entry *sym_hash; ++ Elf_Internal_Sym *isymbuf, *isymend; ++ Elf_Internal_Sym *isym; ++ size_t symcount; ++ size_t offset; ++ bfd_vma src, dest; ++ struct _microblaze_elf_section_data *sdata; ++ ++ /* We only do this once per section. We may be able to delete some code ++ by running multiple passes, but it is not worth it. */ ++ *again = false; ++ ++ /* Only do this for a text section. */ ++ if (bfd_link_relocatable (link_info) ++ || (sec->flags & SEC_RELOC) == 0 ++ || (sec->flags & SEC_CODE) == 0 ++ || sec->reloc_count == 0 ++ || (sdata = microblaze_elf_section_data (sec)) == NULL) ++ return true; ++ ++ BFD_ASSERT ((sec->size > 0) || (sec->rawsize > 0)); ++ ++ /* If this is the first time we have been called for this section, ++ initialize the cooked size. */ ++ if (sec->size == 0) ++ sec->size = sec->rawsize; ++ ++ /* Get symbols for this section. */ ++ symtab_hdr = &elf_tdata (abfd)->symtab_hdr; ++ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; ++ symcount = symtab_hdr->sh_size / sizeof (Elf64_External_Sym); ++ if (isymbuf == NULL) ++ isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, symcount, ++ 0, NULL, NULL, NULL); ++ BFD_ASSERT (isymbuf != NULL); ++ ++ internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory); ++ if (internal_relocs == NULL) ++ goto error_return; ++ ++ sdata->relax_count = 0; ++ sdata->relax = (struct relax_table *) bfd_malloc ((sec->reloc_count + 1) ++ * sizeof (*sdata->relax)); ++ if (sdata->relax == NULL) ++ goto error_return; ++ ++ irelend = internal_relocs + sec->reloc_count; ++ rel_count = 0; ++ for (irel = internal_relocs; irel < irelend; irel++, rel_count++) ++ { ++ bfd_vma symval; ++ if ((ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL) ++ && (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64 ) ++&& (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_TEXTREL_64)) ++ continue; /* Can't delete this reloc. */ ++ ++ /* Get the section contents. */ ++ if (contents == NULL) ++ { ++ if (elf_section_data (sec)->this_hdr.contents != NULL) ++ contents = elf_section_data (sec)->this_hdr.contents; ++ else ++ { ++ contents = (bfd_byte *) bfd_malloc (sec->size); ++ if (contents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, sec, contents, ++ (file_ptr) 0, sec->size)) ++ goto error_return; ++ elf_section_data (sec)->this_hdr.contents = contents; ++ } ++ } ++ ++ /* Get the value of the symbol referred to by the reloc. */ ++ if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info) ++ { ++ /* A local symbol. */ ++ asection *sym_sec; ++ ++ isym = isymbuf + ELF64_R_SYM (irel->r_info); ++ if (isym->st_shndx == SHN_UNDEF) ++ sym_sec = bfd_und_section_ptr; ++ else if (isym->st_shndx == SHN_ABS) ++ sym_sec = bfd_abs_section_ptr; ++ else if (isym->st_shndx == SHN_COMMON) ++ sym_sec = bfd_com_section_ptr; ++ else ++ sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); ++ ++ symval = _bfd_elf_rela_local_sym (abfd, isym, &sym_sec, irel); ++ } ++ else ++ { ++ unsigned long indx; ++ struct elf_link_hash_entry *h; ++ ++ indx = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info; ++ h = elf_sym_hashes (abfd)[indx]; ++ BFD_ASSERT (h != NULL); ++ ++ if (h->root.type != bfd_link_hash_defined ++ && h->root.type != bfd_link_hash_defweak) ++ /* This appears to be a reference to an undefined ++ symbol. Just ignore it--it will be caught by the ++ regular reloc processing. */ ++ continue; ++ ++ symval = (h->root.u.def.value ++ + h->root.u.def.section->output_section->vma ++ + h->root.u.def.section->output_offset); ++ } ++ ++ /* If this is a PC-relative reloc, subtract the instr offset from ++ the symbol value. */ ++ if (ELF64_R_TYPE (irel->r_info) == (int) R_MICROBLAZE_64_PCREL) ++ { ++ symval = symval + irel->r_addend ++ - (irel->r_offset ++ + sec->output_section->vma ++ + sec->output_offset); ++ } ++ else if (ELF64_R_TYPE (irel->r_info) == (int) R_MICROBLAZE_TEXTREL_64) ++ { ++ symval = symval + irel->r_addend - (sec->output_section->vma); ++ } ++ else ++ symval += irel->r_addend; ++ ++ if ((symval & 0xffff8000) == 0 ++ || (symval & 0xffff8000) == 0xffff8000) ++ { ++ /* We can delete this instruction. */ ++ sdata->relax[sdata->relax_count].addr = irel->r_offset; ++ sdata->relax[sdata->relax_count].size = INST_WORD_SIZE; ++ sdata->relax_count++; ++ ++ /* Rewrite relocation type. */ ++ switch ((enum elf_microblaze_reloc_type) ELF64_R_TYPE (irel->r_info)) ++ { ++ case R_MICROBLAZE_64_PCREL: ++ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), ++ (int) R_MICROBLAZE_32_PCREL_LO); ++ break; ++ case R_MICROBLAZE_64: ++ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), ++ (int) R_MICROBLAZE_32_LO); ++ break; ++ case R_MICROBLAZE_TEXTREL_64: ++ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), ++ (int) R_MICROBLAZE_TEXTREL_32_LO); ++ break; ++ default: ++ /* Cannot happen. */ ++ BFD_ASSERT (false); ++ } ++ } ++ } /* Loop through all relocations. */ ++ ++ /* Loop through the relocs again, and see if anything needs to change. */ ++ if (sdata->relax_count > 0) ++ { ++ shndx = _bfd_elf_section_from_bfd_section (abfd, sec); ++ rel_count = 0; ++ sdata->relax[sdata->relax_count].addr = sec->size; ++ ++ for (irel = internal_relocs; irel < irelend; irel++, rel_count++) ++ { ++ bfd_vma nraddr; ++ ++ /* Get the new reloc address. */ ++ nraddr = irel->r_offset - calc_fixup (irel->r_offset, 0, sec); ++ switch ((enum elf_microblaze_reloc_type) ELF64_R_TYPE (irel->r_info)) ++ { ++ default: ++ break; ++ case R_MICROBLAZE_64_PCREL: ++ break; ++ case R_MICROBLAZE_64: ++ case R_MICROBLAZE_32_LO: ++ /* If this reloc is against a symbol defined in this ++ section, we must check the addend to see it will put the value in ++ range to be adjusted, and hence must be changed. */ ++ if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info) ++ { ++ isym = isymbuf + ELF64_R_SYM (irel->r_info); ++ /* Only handle relocs against .text. */ ++ if (isym->st_shndx == shndx ++ && ELF64_ST_TYPE (isym->st_info) == STT_SECTION) ++ irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); ++ } ++ break; ++ case R_MICROBLAZE_IMML_64: ++ { ++ /* This was a PC-relative instruction that was ++ completely resolved. */ ++ int sfix, efix; ++ unsigned int val; ++ bfd_vma target_address; ++ target_address = irel->r_addend + irel->r_offset; ++ sfix = calc_fixup (irel->r_offset, 0, sec); ++ efix = calc_fixup (target_address, 0, sec); ++ ++ /* Validate the in-band val. */ ++ val = bfd_get_64 (abfd, contents + irel->r_offset); ++ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { ++ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); ++ } ++ irel->r_addend -= (efix - sfix); ++ /* Should use HOWTO. */ ++ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset, ++ irel->r_addend); ++ } ++ break; ++ case R_MICROBLAZE_NONE: ++ case R_MICROBLAZE_32_NONE: ++ { ++ /* This was a PC-relative instruction that was ++ completely resolved. */ ++ size_t sfix, efix; ++ unsigned int val; ++ bfd_vma target_address; ++ target_address = irel->r_addend + irel->r_offset; ++ sfix = calc_fixup (irel->r_offset, 0, sec); ++ efix = calc_fixup (target_address, 0, sec); ++ ++ /* Validate the in-band val. */ ++ val = bfd_get_32 (abfd, contents + irel->r_offset); ++ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { ++ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); ++ } ++ irel->r_addend -= (efix - sfix); ++ /* Should use HOWTO. */ ++ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, ++ irel->r_addend); ++ } ++ break; ++ case R_MICROBLAZE_64_NONE: ++ { ++ /* This was a PC-relative 64-bit instruction that was ++ completely resolved. */ ++ size_t sfix, efix; ++ bfd_vma target_address; ++ target_address = irel->r_addend + irel->r_offset + INST_WORD_SIZE; ++ sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec); ++ efix = calc_fixup (target_address, 0, sec); ++ irel->r_addend -= (efix - sfix); ++ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset, ++ irel->r_addend); ++ } ++ break; ++ } ++ irel->r_offset = nraddr; ++ } /* Change all relocs in this section. */ ++ ++ /* Look through all other sections. */ ++ for (o = abfd->sections; o != NULL; o = o->next) ++ { ++ Elf_Internal_Rela *irelocs; ++ Elf_Internal_Rela *irelscan, *irelscanend; ++ bfd_byte *ocontents; ++ ++ if (o == sec ++ || (o->flags & SEC_RELOC) == 0 ++ || o->reloc_count == 0) ++ continue; ++ ++ /* We always cache the relocs. Perhaps, if info->keep_memory is ++ false, we should free them, if we are permitted to. */ ++ ++ irelocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, true); ++ if (irelocs == NULL) ++ goto error_return; ++ ++ ocontents = NULL; ++ irelscanend = irelocs + o->reloc_count; ++ for (irelscan = irelocs; irelscan < irelscanend; irelscan++) ++ { ++ if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) ++ { ++ unsigned int val; ++ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) ++ continue; ++ ++ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); ++ ++ /* hax: We only do the following fixup for debug location lists. */ ++ if (strcmp(".debug_loc", o->name)) ++ continue; ++ ++ /* This was a PC-relative instruction that was completely resolved. */ ++ if (ocontents == NULL) ++ { ++ if (elf_section_data (o)->this_hdr.contents != NULL) ++ ocontents = elf_section_data (o)->this_hdr.contents; ++ else ++ { ++ /* We always cache the section contents. ++ Perhaps, if info->keep_memory is false, we ++ should free them, if we are permitted to. */ ++ ++ if (o->rawsize == 0) ++ o->rawsize = o->size; ++ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); ++ if (ocontents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, o, ocontents, ++ (file_ptr) 0, ++ o->rawsize)) ++ goto error_return; ++ elf_section_data (o)->this_hdr.contents = ocontents; ++ } ++ } ++ ++ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); ++ if (val != irelscan->r_addend) { ++ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend); ++ } ++ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); ++ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, ++ irelscan->r_addend); ++ } ++ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32 ++ || ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64) ++ { ++ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) ++ continue; ++ ++ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); ++ ++ /* Look at the reloc only if the value has been resolved. */ ++ if (isym->st_shndx == shndx ++ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION)) ++ { ++ if (ocontents == NULL) ++ { ++ if (elf_section_data (o)->this_hdr.contents != NULL) ++ ocontents = elf_section_data (o)->this_hdr.contents; ++ else ++ { ++ /* We always cache the section contents. ++ Perhaps, if info->keep_memory is false, we ++ should free them, if we are permitted to. */ ++ if (o->rawsize == 0) ++ o->rawsize = o->size; ++ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); ++ if (ocontents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, o, ocontents, ++ (file_ptr) 0, ++ o->rawsize)) ++ goto error_return; ++ elf_section_data (o)->this_hdr.contents = ocontents; ++ } ++ ++ } ++ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); ++ } ++ else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM) ++ { ++ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) ++ continue; ++ ++ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); ++ ++ /* Look at the reloc only if the value has been resolved. */ ++ if (ocontents == NULL) ++ { ++ if (elf_section_data (o)->this_hdr.contents != NULL) ++ ocontents = elf_section_data (o)->this_hdr.contents; ++ else ++ { ++ /* We always cache the section contents. ++ Perhaps, if info->keep_memory is false, we ++ should free them, if we are permitted to. */ ++ ++ if (o->rawsize == 0) ++ o->rawsize = o->size; ++ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); ++ if (ocontents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, o, ocontents, ++ (file_ptr) 0, ++ o->rawsize)) ++ goto error_return; ++ elf_section_data (o)->this_hdr.contents = ocontents; ++ } ++ } ++ irelscan->r_addend -= calc_fixup (irelscan->r_addend ++ + isym->st_value, ++ 0, ++ sec); ++ } ++ } ++ else if ((ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_PCREL_LO) ++ || (ELF32_R_TYPE (irelscan->r_info) ++ == (int) R_MICROBLAZE_32_LO) ++ || (ELF32_R_TYPE (irelscan->r_info) ++ == (int) R_MICROBLAZE_TEXTREL_32_LO)) ++ { ++ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) ++ continue; ++ ++ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); ++ ++ /* Look at the reloc only if the value has been resolved. */ ++ if (isym->st_shndx == shndx ++ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION)) ++ { ++ bfd_vma immediate; ++ bfd_vma target_address; ++ ++ if (ocontents == NULL) ++ { ++ if (elf_section_data (o)->this_hdr.contents != NULL) ++ ocontents = elf_section_data (o)->this_hdr.contents; ++ else ++ { ++ /* We always cache the section contents. ++ Perhaps, if info->keep_memory is false, we ++ should free them, if we are permitted to. */ ++ if (o->rawsize == 0) ++ o->rawsize = o->size; ++ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); ++ if (ocontents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, o, ocontents, ++ (file_ptr) 0, ++ o->rawsize)) ++ goto error_return; ++ elf_section_data (o)->this_hdr.contents = ocontents; ++ } ++ } ++ ++ unsigned long instr = bfd_get_32 (abfd, ocontents + irelscan->r_offset); ++ immediate = instr & 0x0000ffff; ++ target_address = immediate; ++ offset = calc_fixup (target_address, 0, sec); ++ immediate -= offset; ++ irelscan->r_addend -= offset; ++ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, ++ irelscan->r_addend); ++ } ++ } ++ ++ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64 ++ || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_TEXTREL_64)) ++ { ++ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) ++ continue; ++ ++ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); ++ ++ /* Look at the reloc only if the value has been resolved. */ ++ if (isym->st_shndx == shndx ++ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION)) ++ { ++ bfd_vma immediate; ++ ++ if (ocontents == NULL) ++ { ++ if (elf_section_data (o)->this_hdr.contents != NULL) ++ ocontents = elf_section_data (o)->this_hdr.contents; ++ else ++ { ++ /* We always cache the section contents. ++ Perhaps, if info->keep_memory is false, we ++ should free them, if we are permitted to. */ ++ ++ if (o->rawsize == 0) ++ o->rawsize = o->size; ++ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); ++ if (ocontents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, o, ocontents, ++ (file_ptr) 0, ++ o->rawsize)) ++ goto error_return; ++ elf_section_data (o)->this_hdr.contents = ocontents; ++ } ++ } ++ unsigned long instr_hi = bfd_get_32 (abfd, ocontents ++ + irelscan->r_offset); ++ unsigned long instr_lo = bfd_get_32 (abfd, ocontents ++ + irelscan->r_offset ++ + INST_WORD_SIZE); ++ if ((instr_hi & 0xff000000) == 0xb2000000) ++ immediate = (instr_hi & 0x00ffffff) << 24; ++ else ++ immediate = (instr_hi & 0x0000ffff) << 16; ++ immediate |= (instr_lo & 0x0000ffff); ++ offset = calc_fixup (irelscan->r_addend, 0, sec); ++ immediate -= offset; ++ irelscan->r_addend -= offset; ++ ++ } ++ } ++ else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL) ++ { ++ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) ++ continue; ++ ++ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); ++ ++ /* Look at the reloc only if the value has been resolved. */ ++ if (isym->st_shndx == shndx ++ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION)) ++ { ++ bfd_vma immediate; ++ bfd_vma target_address; ++ ++ if (ocontents == NULL) ++ { ++ if (elf_section_data (o)->this_hdr.contents != NULL) ++ ocontents = elf_section_data (o)->this_hdr.contents; ++ else ++ { ++ /* We always cache the section contents. ++ Perhaps, if info->keep_memory is false, we ++ should free them, if we are permitted to. */ ++ if (o->rawsize == 0) ++ o->rawsize = o->size; ++ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); ++ if (ocontents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, o, ocontents, ++ (file_ptr) 0, ++ o->rawsize)) ++ goto error_return; ++ elf_section_data (o)->this_hdr.contents = ocontents; ++ } ++ } ++ unsigned long instr_hi = bfd_get_32 (abfd, ocontents ++ + irelscan->r_offset); ++ unsigned long instr_lo = bfd_get_32 (abfd, ocontents ++ + irelscan->r_offset ++ + INST_WORD_SIZE); ++ if ((instr_hi & 0xff000000) == 0xb2000000) ++ immediate = (instr_hi & 0x00ffffff) << 24; ++ else ++ immediate = (instr_hi & 0x0000ffff) << 16; ++ immediate |= (instr_lo & 0x0000ffff); ++ target_address = immediate; ++ offset = calc_fixup (target_address, 0, sec); ++ immediate -= offset; ++ irelscan->r_addend -= offset; ++ microblaze_bfd_write_imm_value_64 (abfd, ocontents ++ + irelscan->r_offset, immediate); ++ } ++ } ++ } ++ } ++ ++ /* Adjust the local symbols defined in this section. */ ++ isymend = isymbuf + symtab_hdr->sh_info; ++ for (isym = isymbuf; isym < isymend; isym++) ++ { ++ if (isym->st_shndx == shndx) ++ { ++ isym->st_value -= calc_fixup (isym->st_value, 0, sec); ++ if (isym->st_size) ++ isym->st_size -= calc_fixup (isym->st_value, isym->st_size, sec); ++ } ++ } ++ ++ /* Now adjust the global symbols defined in this section. */ ++ isym = isymbuf + symtab_hdr->sh_info; ++ symcount = (symtab_hdr->sh_size / sizeof (Elf64_External_Sym)) - symtab_hdr->sh_info; ++ for (sym_index = 0; sym_index < symcount; sym_index++) ++ { ++ sym_hash = elf_sym_hashes (abfd)[sym_index]; ++ if ((sym_hash->root.type == bfd_link_hash_defined ++ || sym_hash->root.type == bfd_link_hash_defweak) ++ && sym_hash->root.u.def.section == sec) ++ { ++ sym_hash->root.u.def.value -= calc_fixup (sym_hash->root.u.def.value, ++ 0, sec); ++ if (sym_hash->size) ++ sym_hash->size -= calc_fixup (sym_hash->root.u.def.value, ++ sym_hash->size, sec); ++ } ++ } ++ ++ /* Physically move the code and change the cooked size. */ ++ dest = sdata->relax[0].addr; ++ for (i = 0; i < sdata->relax_count; i++) ++ { ++ size_t len; ++ src = sdata->relax[i].addr + sdata->relax[i].size; ++ len = (sdata->relax[i+1].addr - sdata->relax[i].addr ++ - sdata->relax[i].size); ++ ++ memmove (contents + dest, contents + src, len); ++ sec->size -= sdata->relax[i].size; ++ dest += len; ++ } ++ ++ elf_section_data (sec)->relocs = internal_relocs; ++ ++ elf_section_data (sec)->this_hdr.contents = contents; ++ ++ symtab_hdr->contents = (bfd_byte *) isymbuf; ++ } ++ ++ if (internal_relocs != NULL ++ && elf_section_data (sec)->relocs != internal_relocs) ++ free (internal_relocs); ++ ++ if (contents != NULL ++ && elf_section_data (sec)->this_hdr.contents != contents) ++ { ++ if (! link_info->keep_memory) ++ free (contents); ++ else ++ { ++ /* Cache the section contents for elf_link_input_bfd. */ ++ elf_section_data (sec)->this_hdr.contents = contents; ++ } ++ } ++ ++ if (sdata->relax_count == 0) ++ { ++ *again = false; ++ free (sdata->relax); ++ sdata->relax = NULL; ++ } ++ else ++ *again = true; ++ return true; ++ ++ error_return: ++ if (isymbuf != NULL ++ && symtab_hdr->contents != (unsigned char *) isymbuf) ++ free (isymbuf); ++ if (internal_relocs != NULL ++ && elf_section_data (sec)->relocs != internal_relocs) ++ free (internal_relocs); ++ if (contents != NULL ++ && elf_section_data (sec)->this_hdr.contents != contents) ++ free (contents); ++ free (sdata->relax); ++ sdata->relax = NULL; ++ sdata->relax_count = 0; ++ return false; ++} ++ ++/* Return the section that should be marked against GC for a given ++ relocation. */ ++ ++static asection * ++microblaze_elf_gc_mark_hook (asection *sec, ++ struct bfd_link_info * info, ++ Elf_Internal_Rela * rel, ++ struct elf_link_hash_entry * h, ++ Elf_Internal_Sym * sym) ++{ ++ if (h != NULL) ++ switch (ELF64_R_TYPE (rel->r_info)) ++ { ++ case R_MICROBLAZE_GNU_VTINHERIT: ++ case R_MICROBLAZE_GNU_VTENTRY: ++ return NULL; ++ } ++ ++ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); ++} ++ ++/* Update the got entry reference counts for the section being removed. */ ++ ++static bool ++microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED, ++ struct bfd_link_info * info ATTRIBUTE_UNUSED, ++ asection * sec ATTRIBUTE_UNUSED, ++ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED) ++{ ++ return true; ++} ++ ++/* PIC support. */ ++ ++#define PLT_ENTRY_SIZE 16 ++ ++#define PLT_ENTRY_WORD_0 0xb0000000 /* "imm 0". */ ++#define PLT_ENTRY_WORD_1 0xe9940000 /* "lwi r12,r20,0" - relocated to lwi r12,r20,func@GOT. */ ++#define PLT_ENTRY_WORD_1_NOPIC 0xe9800000 /* "lwi r12,r0,0" - non-PIC object. */ ++#define PLT_ENTRY_WORD_2 0x98186000 /* "brad r12". */ ++#define PLT_ENTRY_WORD_3 0x80000000 /* "nop". */ ++ ++/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up ++ shortcuts to them in our hash table. */ ++ ++static bool ++update_local_sym_info (bfd *abfd, ++ Elf_Internal_Shdr *symtab_hdr, ++ unsigned long r_symndx, ++ unsigned int tls_type) ++{ ++ bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd); ++ unsigned char *local_got_tls_masks; ++ ++ if (local_got_refcounts == NULL) ++ { ++ bfd_size_type size = symtab_hdr->sh_info; ++ ++ size *= (sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks)); ++ local_got_refcounts = bfd_zalloc (abfd, size); ++ if (local_got_refcounts == NULL) ++ return false; ++ elf_local_got_refcounts (abfd) = local_got_refcounts; ++ } ++ ++ local_got_tls_masks = ++ (unsigned char *) (local_got_refcounts + symtab_hdr->sh_info); ++ local_got_tls_masks[r_symndx] |= tls_type; ++ local_got_refcounts[r_symndx] += 1; ++ ++ return true; ++} ++/* Look through the relocs for a section during the first phase. */ ++ ++static bool ++microblaze_elf_check_relocs (bfd * abfd, ++ struct bfd_link_info * info, ++ asection * sec, ++ const Elf_Internal_Rela * relocs) ++{ ++ Elf_Internal_Shdr * symtab_hdr; ++ struct elf_link_hash_entry ** sym_hashes; ++ struct elf_link_hash_entry ** sym_hashes_end; ++ const Elf_Internal_Rela * rel; ++ const Elf_Internal_Rela * rel_end; ++ struct elf64_mb_link_hash_table *htab; ++ asection *sreloc = NULL; ++ ++ if (bfd_link_relocatable (info)) ++ return true; ++ ++ htab = elf64_mb_hash_table (info); ++ if (htab == NULL) ++ return false; ++ ++ symtab_hdr = & elf_tdata (abfd)->symtab_hdr; ++ sym_hashes = elf_sym_hashes (abfd); ++ sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf64_External_Sym); ++ if (!elf_bad_symtab (abfd)) ++ sym_hashes_end -= symtab_hdr->sh_info; ++ ++ rel_end = relocs + sec->reloc_count; ++ ++ for (rel = relocs; rel < rel_end; rel++) ++ { ++ unsigned int r_type; ++ struct elf_link_hash_entry * h; ++ unsigned long r_symndx; ++ unsigned char tls_type = 0; ++ ++ r_symndx = ELF64_R_SYM (rel->r_info); ++ r_type = ELF64_R_TYPE (rel->r_info); ++ ++ if (r_symndx < symtab_hdr->sh_info) ++ h = NULL; ++ else ++ { ++ h = sym_hashes [r_symndx - symtab_hdr->sh_info]; ++ while (h->root.type == bfd_link_hash_indirect ++ || h->root.type == bfd_link_hash_warning) ++ h = (struct elf_link_hash_entry *) h->root.u.i.link; ++ /* PR15323, ref flags aren't set for references in the same ++ object. */ ++ h->root.non_ir_ref_regular = 1; ++ } ++ ++ switch (r_type) ++ { ++ /* This relocation describes the C++ object vtable hierarchy. ++ Reconstruct it for later use during GC. */ ++ case R_MICROBLAZE_GNU_VTINHERIT: ++ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) ++ return false; ++ break; ++ ++ /* This relocation describes which C++ vtable entries are actually ++ used. Record for later use during GC. */ ++ case R_MICROBLAZE_GNU_VTENTRY: ++ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) ++ return false; ++ break; ++ ++ /* This relocation requires .plt entry. */ ++ case R_MICROBLAZE_PLT_64: ++ if (h != NULL) ++ { ++ h->needs_plt = 1; ++ h->plt.refcount += 1; ++ } ++ break; ++ ++ /* This relocation requires .got entry. */ ++ case R_MICROBLAZE_TLSGD: ++ tls_type |= (TLS_TLS | TLS_GD); ++ goto dogottls; ++ case R_MICROBLAZE_TLSLD: ++ tls_type |= (TLS_TLS | TLS_LD); ++ /* Fall through. */ ++ dogottls: ++ sec->has_tls_reloc = 1; ++ /* Fall through. */ ++ case R_MICROBLAZE_GOT_64: ++ if (htab->elf.sgot == NULL) ++ { ++ if (htab->elf.dynobj == NULL) ++ htab->elf.dynobj = abfd; ++ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info)) ++ return false; ++ } ++ if (h != NULL) ++ { ++ h->got.refcount += 1; ++ elf64_mb_hash_entry (h)->tls_mask |= tls_type; ++ } ++ else ++ { ++ if (! update_local_sym_info(abfd, symtab_hdr, r_symndx, tls_type) ) ++ return false; ++ } ++ break; ++ ++ case R_MICROBLAZE_GOTOFF_64: ++ case R_MICROBLAZE_GOTOFF_32: ++ if (htab->elf.sgot == NULL) ++ { ++ if (htab->elf.dynobj == NULL) ++ htab->elf.dynobj = abfd; ++ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info)) ++ return false; ++ } ++ break; ++ ++ case R_MICROBLAZE_64: ++ case R_MICROBLAZE_64_PCREL: ++ case R_MICROBLAZE_32: ++ case R_MICROBLAZE_IMML_64: ++ { ++ if (h != NULL && !bfd_link_pic (info)) ++ { ++ /* we may need a copy reloc. */ ++ h->non_got_ref = 1; ++ ++ /* we may also need a .plt entry. */ ++ h->plt.refcount += 1; ++ if (ELF64_R_TYPE (rel->r_info) != R_MICROBLAZE_64_PCREL) ++ h->pointer_equality_needed = 1; ++ } ++ ++ ++ /* If we are creating a shared library, and this is a reloc ++ against a global symbol, or a non PC relative reloc ++ against a local symbol, then we need to copy the reloc ++ into the shared library. However, if we are linking with ++ -Bsymbolic, we do not need to copy a reloc against a ++ global symbol which is defined in an object we are ++ including in the link (i.e., DEF_REGULAR is set). At ++ this point we have not seen all the input files, so it is ++ possible that DEF_REGULAR is not set now but will be set ++ later (it is never cleared). In case of a weak definition, ++ DEF_REGULAR may be cleared later by a strong definition in ++ a shared library. We account for that possibility below by ++ storing information in the relocs_copied field of the hash ++ table entry. A similar situation occurs when creating ++ shared libraries and symbol visibility changes render the ++ symbol local. ++ ++ If on the other hand, we are creating an executable, we ++ may need to keep relocations for symbols satisfied by a ++ dynamic library if we manage to avoid copy relocs for the ++ symbol. */ ++ ++ if ((bfd_link_pic (info) ++ && (sec->flags & SEC_ALLOC) != 0 ++ && (r_type != R_MICROBLAZE_64_PCREL ++ || (h != NULL ++ && (! info->symbolic ++ || h->root.type == bfd_link_hash_defweak ++ || !h->def_regular)))) ++ || (!bfd_link_pic (info) ++ && (sec->flags & SEC_ALLOC) != 0 ++ && h != NULL ++ && (h->root.type == bfd_link_hash_defweak ++ || !h->def_regular))) ++ { ++ struct elf64_mb_dyn_relocs *p; ++ struct elf64_mb_dyn_relocs **head; ++ ++ /* When creating a shared object, we must copy these ++ relocs into the output file. We create a reloc ++ section in dynobj and make room for the reloc. */ ++ ++ if (sreloc == NULL) ++ { ++ bfd *dynobj; ++ ++ if (htab->elf.dynobj == NULL) ++ htab->elf.dynobj = abfd; ++ dynobj = htab->elf.dynobj; ++ ++ sreloc = _bfd_elf_make_dynamic_reloc_section (sec, dynobj, ++ 2, abfd, 1); ++ if (sreloc == NULL) ++ return false; ++ } ++ ++ /* If this is a global symbol, we count the number of ++ relocations we need for this symbol. */ ++ if (h != NULL) ++ head = &h->dyn_relocs; ++ else ++ { ++ /* Track dynamic relocs needed for local syms too. ++ We really need local syms available to do this ++ easily. Oh well. */ ++ ++ asection *s; ++ Elf_Internal_Sym *isym; ++ void *vpp; ++ ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, ++ abfd, r_symndx); ++ if (isym == NULL) ++ return false; ++ ++ s = bfd_section_from_elf_index (abfd, isym->st_shndx); ++ if (s == NULL) ++ return false; ++ ++ vpp = &elf_section_data (s)->local_dynrel; ++ head = (struct elf64_mb_dyn_relocs **) vpp; ++ } ++ ++ p = *head; ++ if (p == NULL || p->sec != sec) ++ { ++ size_t amt = sizeof *p; ++ p = ((struct elf64_mb_dyn_relocs *) ++ bfd_alloc (htab->elf.dynobj, amt)); ++ if (p == NULL) ++ return false; ++ p->next = *head; ++ *head = p; ++ p->sec = sec; ++ p->count = 0; ++ p->pc_count = 0; ++ } ++ ++ p->count += 1; ++ if (r_type == R_MICROBLAZE_64_PCREL) ++ p->pc_count += 1; ++ } ++ } ++ break; ++ } ++ } ++ ++ return true; ++} ++ ++static bool ++microblaze_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) ++{ ++ struct elf64_mb_link_hash_table *htab; ++ ++ htab = elf64_mb_hash_table (info); ++ if (htab == NULL) ++ return false; ++ ++ if (!htab->sgot && !_bfd_elf_create_got_section (dynobj, info)) ++ return false; ++ ++ if (!_bfd_elf_create_dynamic_sections (dynobj, info)) ++ return false; ++ ++ htab->splt = bfd_get_linker_section (dynobj, ".plt"); ++ htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt"); ++ htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss"); ++ if (!bfd_link_pic (info)) ++ htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss"); ++ ++ if (!htab->splt || !htab->srelplt || !htab->sdynbss ++ || (!bfd_link_pic (info) && !htab->srelbss)) ++ abort (); ++ ++ return true; ++} ++ ++/* Copy the extra info we tack onto an elf_link_hash_entry. */ ++ ++static void ++microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info, ++ struct elf_link_hash_entry *dir, ++ struct elf_link_hash_entry *ind) ++{ ++ struct elf64_mb_link_hash_entry *edir, *eind; ++ ++ edir = (struct elf64_mb_link_hash_entry *) dir; ++ eind = (struct elf64_mb_link_hash_entry *) ind; ++ ++ if (eind->dyn_relocs != NULL) ++ { ++ if (edir->dyn_relocs != NULL) ++ { ++ struct elf64_mb_dyn_relocs **pp; ++ struct elf64_mb_dyn_relocs *p; ++ ++ if (ind->root.type == bfd_link_hash_indirect) ++ abort (); ++ ++ /* Add reloc counts against the weak sym to the strong sym ++ list. Merge any entries against the same section. */ ++ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) ++ { ++ struct elf64_mb_dyn_relocs *q; ++ ++ for (q = edir->dyn_relocs; q != NULL; q = q->next) ++ if (q->sec == p->sec) ++ { ++ q->pc_count += p->pc_count; ++ q->count += p->count; ++ *pp = p->next; ++ break; ++ } ++ if (q == NULL) ++ pp = &p->next; ++ } ++ *pp = edir->dyn_relocs; ++ } ++ ++ edir->dyn_relocs = eind->dyn_relocs; ++ eind->dyn_relocs = NULL; ++ } ++ ++ edir->tls_mask |= eind->tls_mask; ++ ++ _bfd_elf_link_hash_copy_indirect (info, dir, ind); ++} ++ ++static bool ++microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info, ++ struct elf_link_hash_entry *h) ++{ ++ struct elf64_mb_link_hash_table *htab; ++ struct elf64_mb_link_hash_entry * eh; ++ struct elf64_mb_dyn_relocs *p; ++ asection *sdynbss; ++ asection *s, *srel; ++ unsigned int power_of_two; ++ bfd *dynobj; ++ ++ htab = elf64_mb_hash_table (info); ++ if (htab == NULL) ++ return false; ++ ++ /* If this is a function, put it in the procedure linkage table. We ++ will fill in the contents of the procedure linkage table later, ++ when we know the address of the .got section. */ ++ if (h->type == STT_FUNC ++ || h->needs_plt) ++ { ++ if (h->plt.refcount <= 0 ++ || SYMBOL_CALLS_LOCAL (info, h) ++ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT ++ && h->root.type == bfd_link_hash_undefweak)) ++ { ++ /* This case can occur if we saw a PLT reloc in an input ++ file, but the symbol was never referred to by a dynamic ++ object, or if all references were garbage collected. In ++ such a case, we don't actually need to build a procedure ++ linkage table, and we can just do a PC32 reloc instead. */ ++ h->plt.offset = (bfd_vma) -1; ++ h->needs_plt = 0; ++ } ++ ++ return true; ++ } ++ else ++ /* It's possible that we incorrectly decided a .plt reloc was ++ needed for an R_MICROBLAZE_64_PCREL reloc to a non-function sym in ++ check_relocs. We can't decide accurately between function and ++ non-function syms in check-relocs; Objects loaded later in ++ the link may change h->type. So fix it now. */ ++ h->plt.offset = (bfd_vma) -1; ++ ++ /* If this is a weak symbol, and there is a real definition, the ++ processor independent code will have arranged for us to see the ++ real definition first, and we can just use the same value. */ ++ if (h->is_weakalias) ++ { ++ struct elf_link_hash_entry *def = weakdef (h); ++ BFD_ASSERT (def->root.type == bfd_link_hash_defined); ++ h->root.u.def.section = def->root.u.def.section; ++ h->root.u.def.value = def->root.u.def.value; ++ return true; ++ } ++ ++ /* This is a reference to a symbol defined by a dynamic object which ++ is not a function. */ ++ ++ /* If we are creating a shared library, we must presume that the ++ only references to the symbol are via the global offset table. ++ For such cases we need not do anything here; the relocations will ++ be handled correctly by relocate_section. */ ++ if (bfd_link_pic (info)) ++ return true; ++ ++ /* If there are no references to this symbol that do not use the ++ GOT, we don't need to generate a copy reloc. */ ++ if (!h->non_got_ref) ++ return true; ++ ++ /* If -z nocopyreloc was given, we won't generate them either. */ ++ if (info->nocopyreloc) ++ { ++ h->non_got_ref = 0; ++ return true; ++ } ++ ++ eh = (struct elf64_mb_link_hash_entry *) h; ++ for (p = eh->dyn_relocs; p != NULL; p = p->next) ++ { ++ s = p->sec->output_section; ++ if (s != NULL && (s->flags & SEC_READONLY) != 0) ++ break; ++ } ++ ++ /* If we didn't find any dynamic relocs in read-only sections, then ++ we'll be keeping the dynamic relocs and avoiding the copy reloc. */ ++ if (p == NULL) ++ { ++ h->non_got_ref = 0; ++ return true; ++ } ++ ++ /* We must allocate the symbol in our .dynbss section, which will ++ become part of the .bss section of the executable. There will be ++ an entry for this symbol in the .dynsym section. The dynamic ++ object will contain position independent code, so all references ++ from the dynamic object to this symbol will go through the global ++ offset table. The dynamic linker will use the .dynsym entry to ++ determine the address it must put in the global offset table, so ++ both the dynamic object and the regular object will refer to the ++ same memory location for the variable. */ ++ ++ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker ++ to copy the initial value out of the dynamic object and into the ++ runtime process image. */ ++ dynobj = elf_hash_table (info)->dynobj; ++ BFD_ASSERT (dynobj != NULL); ++ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) ++ { ++ htab->srelbss->size += sizeof (Elf64_External_Rela); ++ h->needs_copy = 1; ++ } ++ ++ /* We need to figure out the alignment required for this symbol. I ++ have no idea how ELF linkers handle this. */ ++ power_of_two = bfd_log2 (h->size); ++ if (power_of_two > 3) ++ power_of_two = 3; ++ ++ sdynbss = htab->sdynbss; ++ /* Apply the required alignment. */ ++ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two)); ++ if (power_of_two > sdynbss->alignment_power) ++ { ++ if (! bfd_set_section_alignment (sdynbss, power_of_two)) ++ return false; ++ } ++ ++ /* Define the symbol as being at this point in the section. */ ++ h->root.u.def.section = s; ++ h->root.u.def.value = s->size; ++ ++ /* Increment the section size to make room for the symbol. */ ++ s->size += h->size; ++ return true; ++} ++ ++/* Allocate space in .plt, .got and associated reloc sections for ++ dynamic relocs. */ ++ ++static bool ++allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat) ++{ ++ struct bfd_link_info *info; ++ struct elf64_mb_link_hash_table *htab; ++ struct elf64_mb_link_hash_entry *eh; ++ struct elf64_mb_dyn_relocs *p; ++ ++ if (h->root.type == bfd_link_hash_indirect) ++ return true; ++ ++ info = (struct bfd_link_info *) dat; ++ htab = elf64_mb_hash_table (info); ++ if (htab == NULL) ++ return false; ++ ++ if (htab->elf.dynamic_sections_created ++ && h->plt.refcount > 0) ++ { ++ /* Make sure this symbol is output as a dynamic symbol. ++ Undefined weak syms won't yet be marked as dynamic. */ ++ if (h->dynindx == -1 ++ && !h->forced_local) ++ { ++ if (! bfd_elf_link_record_dynamic_symbol (info, h)) ++ return false; ++ } ++ ++ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h)) ++ { ++ asection *s = htab->elf.splt; ++ ++ /* The first entry in .plt is reserved. */ ++ if (s->size == 0) ++ s->size = PLT_ENTRY_SIZE; ++ ++ h->plt.offset = s->size; ++ ++ /* If this symbol is not defined in a regular file, and we are ++ not generating a shared library, then set the symbol to this ++ location in the .plt. This is required to make function ++ pointers compare as equal between the normal executable and ++ the shared library. */ ++ if (! bfd_link_pic (info) ++ && !h->def_regular) ++ { ++ h->root.u.def.section = s; ++ h->root.u.def.value = h->plt.offset; ++ } ++ ++ /* Make room for this entry. */ ++ s->size += PLT_ENTRY_SIZE; ++ ++ /* We also need to make an entry in the .got.plt section, which ++ will be placed in the .got section by the linker script. */ ++ htab->elf.sgotplt->size += 4; ++ ++ /* We also need to make an entry in the .rel.plt section. */ ++ htab->elf.srelplt->size += sizeof (Elf64_External_Rela); ++ } ++ else ++ { ++ h->plt.offset = (bfd_vma) -1; ++ h->needs_plt = 0; ++ } ++ } ++ else ++ { ++ h->plt.offset = (bfd_vma) -1; ++ h->needs_plt = 0; ++ } ++ ++ eh = (struct elf64_mb_link_hash_entry *) h; ++ if (h->got.refcount > 0) ++ { ++ unsigned int need; ++ asection *s; ++ ++ /* Make sure this symbol is output as a dynamic symbol. ++ Undefined weak syms won't yet be marked as dynamic. */ ++ if (h->dynindx == -1 ++ && !h->forced_local) ++ { ++ if (! bfd_elf_link_record_dynamic_symbol (info, h)) ++ return false; ++ } ++ ++ need = 0; ++ if ((eh->tls_mask & TLS_TLS) != 0) ++ { ++ /* Handle TLS Symbol */ ++ if ((eh->tls_mask & TLS_LD) != 0) ++ { ++ if (!eh->elf.def_dynamic) ++ /* We'll just use htab->tlsld_got.offset. This should ++ always be the case. It's a little odd if we have ++ a local dynamic reloc against a non-local symbol. */ ++ htab->tlsld_got.refcount += 1; ++ else ++ need += 8; ++ } ++ if ((eh->tls_mask & TLS_GD) != 0) ++ need += 8; ++ } ++ else ++ { ++ /* Regular (non-TLS) symbol */ ++ need += 4; ++ } ++ if (need == 0) ++ { ++ h->got.offset = (bfd_vma) -1; ++ } ++ else ++ { ++ s = htab->elf.sgot; ++ h->got.offset = s->size; ++ s->size += need; ++ htab->elf.srelgot->size += need * (sizeof (Elf64_External_Rela) / 4); ++ } ++ } ++ else ++ h->got.offset = (bfd_vma) -1; ++ ++ if (eh->dyn_relocs == NULL) ++ return true; ++ ++ /* In the shared -Bsymbolic case, discard space allocated for ++ dynamic pc-relative relocs against symbols which turn out to be ++ defined in regular objects. For the normal shared case, discard ++ space for pc-relative relocs that have become local due to symbol ++ visibility changes. */ ++ ++ if (bfd_link_pic (info)) ++ { ++ if (h->def_regular ++ && (h->forced_local ++ || info->symbolic)) ++ { ++ struct elf64_mb_dyn_relocs **pp; ++ ++ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) ++ { ++ p->count -= p->pc_count; ++ p->pc_count = 0; ++ if (p->count == 0) ++ *pp = p->next; ++ else ++ pp = &p->next; ++ } ++ } ++ else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) ++ h->dyn_relocs = NULL; ++ } ++ else ++ { ++ /* For the non-shared case, discard space for relocs against ++ symbols which turn out to need copy relocs or are not ++ dynamic. */ ++ ++ if (!h->non_got_ref ++ && ((h->def_dynamic ++ && !h->def_regular) ++ || (htab->elf.dynamic_sections_created ++ && (h->root.type == bfd_link_hash_undefweak ++ || h->root.type == bfd_link_hash_undefined)))) ++ { ++ /* Make sure this symbol is output as a dynamic symbol. ++ Undefined weak syms won't yet be marked as dynamic. */ ++ if (h->dynindx == -1 ++ && !h->forced_local) ++ { ++ if (! bfd_elf_link_record_dynamic_symbol (info, h)) ++ return false; ++ } ++ ++ /* If that succeeded, we know we'll be keeping all the ++ relocs. */ ++ if (h->dynindx != -1) ++ goto keep; ++ } ++ ++ h->dyn_relocs = NULL; ++ ++ keep: ; ++ } ++ ++ /* Finally, allocate space. */ ++ for (p = h->dyn_relocs; p != NULL; p = p->next) ++ { ++ asection *sreloc = elf_section_data (p->sec)->sreloc; ++ sreloc->size += p->count * sizeof (Elf64_External_Rela); ++ } ++ ++ return true; ++} ++ ++/* Set the sizes of the dynamic sections. */ ++ ++static bool ++microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, ++ struct bfd_link_info *info) ++{ ++ struct elf64_mb_link_hash_table *htab; ++ bfd *dynobj; ++ asection *s; ++ bfd *ibfd; ++ ++ htab = elf64_mb_hash_table (info); ++ if (htab == NULL) ++ return false; ++ ++ dynobj = htab->elf.dynobj; ++ BFD_ASSERT (dynobj != NULL); ++ ++ /* Set up .got offsets for local syms, and space for local dynamic ++ relocs. */ ++ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) ++ { ++ bfd_signed_vma *local_got; ++ bfd_signed_vma *end_local_got; ++ bfd_size_type locsymcount; ++ Elf_Internal_Shdr *symtab_hdr; ++ unsigned char *lgot_masks; ++ asection *srel; ++ ++ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) ++ continue; ++ ++ for (s = ibfd->sections; s != NULL; s = s->next) ++ { ++ struct elf_dyn_relocs *p; ++ ++ for (p = ((struct elf64_mb_dyn_relocs *) ++ elf_section_data (s)->local_dynrel); ++ p != NULL; ++ p = p->next) ++ { ++ if (!bfd_is_abs_section (p->sec) ++ && bfd_is_abs_section (p->sec->output_section)) ++ { ++ /* Input section has been discarded, either because ++ it is a copy of a linkonce section or due to ++ linker script /DISCARD/, so we'll be discarding ++ the relocs too. */ ++ } ++ else if (p->count != 0) ++ { ++ srel = elf_section_data (p->sec)->sreloc; ++ srel->size += p->count * sizeof (Elf64_External_Rela); ++ if ((p->sec->output_section->flags & SEC_READONLY) != 0) ++ info->flags |= DF_TEXTREL; ++ } ++ } ++ } ++ ++ local_got = elf_local_got_refcounts (ibfd); ++ if (!local_got) ++ continue; ++ ++ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; ++ locsymcount = symtab_hdr->sh_info; ++ end_local_got = local_got + locsymcount; ++ lgot_masks = (unsigned char *) end_local_got; ++ s = htab->elf.sgot; ++ srel = htab->elf.srelgot; ++ ++ for (; local_got < end_local_got; ++local_got, ++lgot_masks) ++ { ++ if (*local_got > 0) ++ { ++ unsigned int need = 0; ++ if ((*lgot_masks & TLS_TLS) != 0) ++ { ++ if ((*lgot_masks & TLS_GD) != 0) ++ need += 8; ++ if ((*lgot_masks & TLS_LD) != 0) ++ htab->tlsld_got.refcount += 1; ++ } ++ else ++ need += 4; ++ ++ if (need == 0) ++ { ++ *local_got = (bfd_vma) -1; ++ } ++ else ++ { ++ *local_got = s->size; ++ s->size += need; ++ if (bfd_link_pic (info)) ++ srel->size += need * (sizeof (Elf64_External_Rela) / 4); ++ } ++ } ++ else ++ *local_got = (bfd_vma) -1; ++ } ++ } ++ ++ /* Allocate global sym .plt and .got entries, and space for global ++ sym dynamic relocs. */ ++ elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info); ++ ++ if (htab->tlsld_got.refcount > 0) ++ { ++ htab->tlsld_got.offset = htab->elf.sgot->size; ++ htab->elf.sgot->size += 8; ++ if (bfd_link_pic (info)) ++ htab->elf.srelgot->size += sizeof (Elf64_External_Rela); ++ } ++ else ++ htab->tlsld_got.offset = (bfd_vma) -1; ++ ++ if (elf_hash_table (info)->dynamic_sections_created) ++ { ++ /* Make space for the trailing nop in .plt. */ ++ if (htab->elf.splt->size > 0) ++ htab->elf.splt->size += 4; ++ } ++ ++ /* The check_relocs and adjust_dynamic_symbol entry points have ++ determined the sizes of the various dynamic sections. Allocate ++ memory for them. */ ++ for (s = dynobj->sections; s != NULL; s = s->next) ++ { ++ const char *name; ++ bool strip = false; ++ ++ if ((s->flags & SEC_LINKER_CREATED) == 0) ++ continue; ++ ++ /* It's OK to base decisions on the section name, because none ++ of the dynobj section names depend upon the input files. */ ++ name = bfd_section_name (s); ++ ++ if (startswith (name, ".rela")) ++ { ++ if (s->size == 0) ++ { ++ /* If we don't need this section, strip it from the ++ output file. This is to handle .rela.bss and ++ .rela.plt. We must create it in ++ create_dynamic_sections, because it must be created ++ before the linker maps input sections to output ++ sections. The linker does that before ++ adjust_dynamic_symbol is called, and it is that ++ function which decides whether anything needs to go ++ into these sections. */ ++ strip = true; ++ } ++ else ++ { ++ /* We use the reloc_count field as a counter if we need ++ to copy relocs into the output file. */ ++ s->reloc_count = 0; ++ } ++ } ++ else if (s != htab->elf.splt ++ && s != htab->elf.sgot ++ && s != htab->elf.sgotplt ++ && s != htab->elf.sdynbss ++ && s != htab->elf.sdynrelro) ++ { ++ /* It's not one of our sections, so don't allocate space. */ ++ continue; ++ } ++ ++ if (strip) ++ { ++ s->flags |= SEC_EXCLUDE; ++ continue; ++ } ++ ++ /* Allocate memory for the section contents. */ ++ /* FIXME: This should be a call to bfd_alloc not bfd_zalloc. ++ Unused entries should be reclaimed before the section's contents ++ are written out, but at the moment this does not happen. Thus in ++ order to prevent writing out garbage, we initialise the section's ++ contents to zero. */ ++ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); ++ if (s->contents == NULL && s->size != 0) ++ return false; ++ } ++ ++ /* ??? Force DF_BIND_NOW? */ ++ info->flags |= DF_BIND_NOW; ++ return _bfd_elf_add_dynamic_tags (output_bfd, info, true); ++} ++ ++/* Finish up dynamic symbol handling. We set the contents of various ++ dynamic sections here. */ ++ ++static bool ++microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, ++ struct bfd_link_info *info, ++ struct elf_link_hash_entry *h, ++ Elf_Internal_Sym *sym) ++{ ++ struct elf64_mb_link_hash_table *htab; ++ struct elf64_mb_link_hash_entry *eh = elf64_mb_hash_entry(h); ++ ++ htab = elf64_mb_hash_table (info); ++ if (htab == NULL) ++ return false; ++ ++ if (h->plt.offset != (bfd_vma) -1) ++ { ++ asection *splt; ++ asection *srela; ++ asection *sgotplt; ++ Elf_Internal_Rela rela; ++ bfd_byte *loc; ++ bfd_vma plt_index; ++ bfd_vma got_offset; ++ bfd_vma got_addr; ++ ++ /* This symbol has an entry in the procedure linkage table. Set ++ it up. */ ++ BFD_ASSERT (h->dynindx != -1); ++ ++ splt = htab->elf.splt; ++ srela = htab->elf.srelplt; ++ sgotplt = htab->elf.sgotplt; ++ BFD_ASSERT (splt != NULL && srela != NULL && sgotplt != NULL); ++ ++ plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; /* first entry reserved. */ ++ got_offset = (plt_index + 3) * 4; /* 3 reserved ??? */ ++ got_addr = got_offset; ++ ++ /* For non-PIC objects we need absolute address of the GOT entry. */ ++ if (!bfd_link_pic (info)) ++ got_addr += sgotplt->output_section->vma + sgotplt->output_offset; ++ ++ /* Fill in the entry in the procedure linkage table. */ ++ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff), ++ splt->contents + h->plt.offset); ++ if (bfd_link_pic (info)) ++ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1 + (got_addr & 0xffff), ++ splt->contents + h->plt.offset + 4); ++ else ++ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1_NOPIC + (got_addr & 0xffff), ++ splt->contents + h->plt.offset + 4); ++ bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD_2, ++ splt->contents + h->plt.offset + 8); ++ bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD_3, ++ splt->contents + h->plt.offset + 12); ++ ++ /* Any additions to the .got section??? */ ++ /* bfd_put_32 (output_bfd, ++ splt->output_section->vma + splt->output_offset + h->plt.offset + 4, ++ sgotplt->contents + got_offset); */ ++ ++ /* Fill in the entry in the .rela.plt section. */ ++ rela.r_offset = (sgotplt->output_section->vma ++ + sgotplt->output_offset ++ + got_offset); ++ rela.r_info = ELF64_R_INFO (h->dynindx, R_MICROBLAZE_JUMP_SLOT); ++ rela.r_addend = 0; ++ loc = srela->contents; ++ loc += plt_index * sizeof (Elf64_External_Rela); ++ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); ++ ++ if (!h->def_regular) ++ { ++ /* Mark the symbol as undefined, rather than as defined in ++ the .plt section. Zero the value. */ ++ sym->st_shndx = SHN_UNDEF; ++ sym->st_value = 0; ++ } ++ } ++ ++ /* h->got.refcount to be checked ? */ ++ if (h->got.offset != (bfd_vma) -1 && ++ ! ((h->got.offset & 1) || ++ IS_TLS_LD(eh->tls_mask) || IS_TLS_GD(eh->tls_mask))) ++ { ++ asection *sgot; ++ asection *srela; ++ bfd_vma offset; ++ ++ /* This symbol has an entry in the global offset table. Set it ++ up. */ ++ ++ sgot = htab->elf.sgot; ++ srela = htab->elf.srelgot; ++ BFD_ASSERT (sgot != NULL && srela != NULL); ++ ++ offset = (sgot->output_section->vma + sgot->output_offset ++ + (h->got.offset &~ (bfd_vma) 1)); ++ ++ /* If this is a -Bsymbolic link, and the symbol is defined ++ locally, we just want to emit a RELATIVE reloc. Likewise if ++ the symbol was forced to be local because of a version file. ++ The entry in the global offset table will already have been ++ initialized in the relocate_section function. */ ++ if (bfd_link_pic (info) ++ && ((info->symbolic && h->def_regular) ++ || h->dynindx == -1)) ++ { ++ asection *sec = h->root.u.def.section; ++ bfd_vma value; ++ ++ value = h->root.u.def.value; ++ if (sec->output_section != NULL) ++ /* PR 21180: If the output section is NULL, then the symbol is no ++ longer needed, and in theory the GOT entry is redundant. But ++ it is too late to change our minds now... */ ++ value += sec->output_section->vma + sec->output_offset; ++ ++ microblaze_elf_output_dynamic_relocation (output_bfd, ++ srela, srela->reloc_count++, ++ /* symindex= */ 0, ++ R_MICROBLAZE_REL, offset, ++ value); ++ } ++ else ++ { ++ microblaze_elf_output_dynamic_relocation (output_bfd, ++ srela, srela->reloc_count++, ++ h->dynindx, ++ R_MICROBLAZE_GLOB_DAT, ++ offset, 0); ++ } ++ ++ bfd_put_32 (output_bfd, (bfd_vma) 0, ++ sgot->contents + (h->got.offset &~ (bfd_vma) 1)); ++ } ++ ++ if (h->needs_copy) ++ { ++ asection *s; ++ Elf_Internal_Rela rela; ++ bfd_byte *loc; ++ ++ /* This symbols needs a copy reloc. Set it up. */ ++ ++ BFD_ASSERT (h->dynindx != -1); ++ ++ rela.r_offset = (h->root.u.def.value ++ + h->root.u.def.section->output_section->vma ++ + h->root.u.def.section->output_offset); ++ rela.r_info = ELF64_R_INFO (h->dynindx, R_MICROBLAZE_COPY); ++ rela.r_addend = 0; ++ if (h->root.u.def.section == htab->elf.sdynrelro) ++ s = htab->elf.sreldynrelro; ++ else ++ s = htab->elf.srelbss; ++ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); ++ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); ++ } ++ ++ /* Mark some specially defined symbols as absolute. */ ++ if (h == htab->elf.hdynamic ++ || h == htab->elf.hgot ++ || h == htab->elf.hplt) ++ sym->st_shndx = SHN_ABS; ++ ++ return true; ++} ++ ++ ++/* Finish up the dynamic sections. */ ++ ++static bool ++microblaze_elf_finish_dynamic_sections (bfd *output_bfd, ++ struct bfd_link_info *info) ++{ ++ bfd *dynobj; ++ asection *sdyn, *sgot; ++ struct elf64_mb_link_hash_table *htab; ++ ++ htab = elf64_mb_hash_table (info); ++ if (htab == NULL) ++ return false; ++ ++ dynobj = htab->elf.dynobj; ++ ++ sdyn = bfd_get_linker_section (dynobj, ".dynamic"); ++ ++ if (htab->elf.dynamic_sections_created) ++ { ++ asection *splt; ++ Elf64_External_Dyn *dyncon, *dynconend; ++ ++ dyncon = (Elf64_External_Dyn *) sdyn->contents; ++ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); ++ for (; dyncon < dynconend; dyncon++) ++ { ++ Elf_Internal_Dyn dyn; ++ asection *s; ++ bool size; ++ ++ bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); ++ ++ switch (dyn.d_tag) ++ { ++ case DT_PLTGOT: ++ s = htab->elf.sgotplt; ++ size = false; ++ break; ++ ++ case DT_PLTRELSZ: ++ s = htab->elf.srelplt; ++ size = true; ++ break; ++ ++ case DT_JMPREL: ++ s = htab->elf.srelplt; ++ size = false; ++ break; ++ ++ default: ++ continue; ++ } ++ ++ if (s == NULL) ++ dyn.d_un.d_val = 0; ++ else ++ { ++ if (!size) ++ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; ++ else ++ dyn.d_un.d_val = s->size; ++ } ++ bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); ++ } ++ ++ splt = htab->elf.splt; ++ BFD_ASSERT (splt != NULL && sdyn != NULL); ++ ++ /* Clear the first entry in the procedure linkage table, ++ and put a nop in the last four bytes. */ ++ if (splt->size > 0) ++ { ++ memset (splt->contents, 0, PLT_ENTRY_SIZE); ++ bfd_put_32 (output_bfd, (bfd_vma) 0x80000000 /* nop. */, ++ splt->contents + splt->size - 4); ++ ++ if (splt->output_section != bfd_abs_section_ptr) ++ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; ++ } ++ } ++ ++ /* Set the first entry in the global offset table to the address of ++ the dynamic section. */ ++ sgot = htab->elf.sgotplt; ++ if (sgot && sgot->size > 0) ++ { ++ if (sdyn == NULL) ++ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); ++ else ++ bfd_put_32 (output_bfd, ++ sdyn->output_section->vma + sdyn->output_offset, ++ sgot->contents); ++ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; ++ } ++ ++ if (htab->elf.sgot && htab->elf.sgot->size > 0) ++ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4; ++ ++ return true; ++} ++ ++/* Hook called by the linker routine which adds symbols from an object ++ file. We use it to put .comm items in .sbss, and not .bss. */ ++ ++static bool ++microblaze_elf_add_symbol_hook (bfd *abfd, ++ struct bfd_link_info *info, ++ Elf_Internal_Sym *sym, ++ const char **namep ATTRIBUTE_UNUSED, ++ flagword *flagsp ATTRIBUTE_UNUSED, ++ asection **secp, ++ bfd_vma *valp) ++{ ++ if (sym->st_shndx == SHN_COMMON ++ && !bfd_link_relocatable (info) ++ && sym->st_size <= elf_gp_size (abfd)) ++ { ++ /* Common symbols less than or equal to -G nn bytes are automatically ++ put into .sbss. */ ++ *secp = bfd_make_section_old_way (abfd, ".sbss"); ++ if (*secp == NULL ++ || !bfd_set_section_flags (*secp, SEC_IS_COMMON | SEC_SMALL_DATA)) ++ return false; ++ ++ *valp = sym->st_size; ++ } ++ ++ return true; ++} ++ ++#define TARGET_LITTLE_SYM microblaze_elf64_le_vec ++#define TARGET_LITTLE_NAME "elf64-microblazeel" ++ ++#define TARGET_BIG_SYM microblaze_elf64_vec ++#define TARGET_BIG_NAME "elf64-microblaze" ++ ++#define ELF_ARCH bfd_arch_microblaze ++#define ELF_TARGET_ID MICROBLAZE_ELF_DATA ++#define ELF_MACHINE_CODE EM_MICROBLAZE ++#define ELF_MACHINE_ALT1 EM_MICROBLAZE_OLD ++#define ELF_MAXPAGESIZE 0x1000 ++#define elf_info_to_howto microblaze_elf_info_to_howto ++#define elf_info_to_howto_rel NULL ++ ++#define bfd_elf64_bfd_reloc_type_lookup microblaze_elf_reloc_type_lookup ++#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name ++#define bfd_elf64_new_section_hook microblaze_elf_new_section_hook ++#define elf_backend_relocate_section microblaze_elf_relocate_section ++#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section ++#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data ++#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup ++ ++#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook ++#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook ++#define elf_backend_check_relocs microblaze_elf_check_relocs ++#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol ++#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create ++#define elf_backend_can_gc_sections 1 ++#define elf_backend_can_refcount 1 ++#define elf_backend_want_got_plt 1 ++#define elf_backend_plt_readonly 1 ++#define elf_backend_got_header_size 12 ++#define elf_backend_want_dynrelro 1 ++#define elf_backend_rela_normal 1 ++#define elf_backend_dtrel_excludes_plt 1 ++ ++#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol ++#define elf_backend_create_dynamic_sections microblaze_elf_create_dynamic_sections ++#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections ++#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol ++#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections ++#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook ++ ++#include "elf64-target.h" +diff --git a/bfd/libbfd.h b/bfd/libbfd.h +index 6e62e556962..ef5568a78b0 100644 +--- a/bfd/libbfd.h ++++ b/bfd/libbfd.h +@@ -2992,6 +2992,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", + "BFD_RELOC_MICROBLAZE_32_ROSDA", + "BFD_RELOC_MICROBLAZE_32_RWSDA", + "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", ++ "BFD_RELOC_MICROBLAZE_32_NONE", + "BFD_RELOC_MICROBLAZE_64_NONE", + "BFD_RELOC_MICROBLAZE_64_GOTPC", + "BFD_RELOC_MICROBLAZE_64_GOT", +@@ -2999,6 +3000,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", + "BFD_RELOC_MICROBLAZE_64_GOTOFF", + "BFD_RELOC_MICROBLAZE_32_GOTOFF", + "BFD_RELOC_MICROBLAZE_COPY", ++ "BFD_RELOC_MICROBLAZE_64", ++ "BFD_RELOC_MICROBLAZE_64_PCREL", + "BFD_RELOC_MICROBLAZE_64_TLS", + "BFD_RELOC_MICROBLAZE_64_TLSGD", + "BFD_RELOC_MICROBLAZE_64_TLSLD", +diff --git a/bfd/reloc.c b/bfd/reloc.c +index 164060361a9..e733e2397f4 100644 +--- a/bfd/reloc.c ++++ b/bfd/reloc.c +@@ -6898,6 +6898,12 @@ ENUM + ENUMDOC + This is a 32 bit reloc for the microblaze to handle + expressions of the form "Symbol Op Symbol" ++ENUM ++ BFD_RELOC_MICROBLAZE_32_NONE ++ENUMDOC ++ This is a 32 bit reloc that stores the 32 bit pc relative ++ value in two words (with an imm instruction). No relocation is ++ done here - only used for relaxing + ENUM + BFD_RELOC_MICROBLAZE_64_NONE + ENUMDOC +@@ -6991,6 +6997,20 @@ ENUMDOC + value in two words (with an imm instruction). The relocation is + relative offset from start of TEXT. + ++ This is a 64 bit reloc that stores 64-bit thread pointer relative offset ++ to two words (uses imml instruction). ++ENUM ++BFD_RELOC_MICROBLAZE_64, ++ENUMDOC ++ This is a 64 bit reloc that stores the 64 bit pc relative ++ value in two words (with an imml instruction). No relocation is ++ done here - only used for relaxing ++ENUM ++BFD_RELOC_MICROBLAZE_64_PCREL, ++ENUMDOC ++ This is a 32 bit reloc that stores the 32 bit pc relative ++ value in two words (with an imml instruction). No relocation is ++ done here - only used for relaxing + ENUM + BFD_RELOC_AARCH64_RELOC_START + ENUMDOC +diff --git a/bfd/targets.c b/bfd/targets.c +index 417743efc0e..333f05c55f4 100644 +--- a/bfd/targets.c ++++ b/bfd/targets.c +@@ -795,6 +795,8 @@ extern const bfd_target mep_elf32_le_vec; + extern const bfd_target metag_elf32_vec; + extern const bfd_target microblaze_elf32_vec; + extern const bfd_target microblaze_elf32_le_vec; ++extern const bfd_target microblaze_elf64_vec; ++extern const bfd_target microblaze_elf64_le_vec; + extern const bfd_target mips_ecoff_be_vec; + extern const bfd_target mips_ecoff_le_vec; + extern const bfd_target mips_ecoff_bele_vec; +@@ -1165,6 +1167,10 @@ static const bfd_target * const _bfd_target_vector[] = + + &metag_elf32_vec, + ++#ifdef BFD64 ++ µblaze_elf64_vec, ++ µblaze_elf64_le_vec, ++#endif + µblaze_elf32_vec, + + &mips_ecoff_be_vec, +diff --git a/gdb/features/Makefile b/gdb/features/Makefile +index fc3196864c9..1bb198abfd3 100644 +--- a/gdb/features/Makefile ++++ b/gdb/features/Makefile +@@ -101,7 +101,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH)) + # to make on the command line. + XMLTOC = \ + microblaze-with-stack-protect.xml \ ++ microblaze64-with-stack-protect.xml \ + microblaze.xml \ ++ microblaze64.xml \ + mips-dsp-linux.xml \ + mips-linux.xml \ + mips64-dsp-linux.xml \ +diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml +index 29fdd6c0a2f..a5c3cce069d 100644 +--- a/gdb/features/microblaze-core.xml ++++ b/gdb/features/microblaze-core.xml +@@ -8,7 +8,7 @@ + <!DOCTYPE feature SYSTEM "gdb-target.dtd"> + <feature name="org.gnu.gdb.microblaze.core"> + <reg name="r0" bitsize="32" regnum="0"/> +- <reg name="r1" bitsize="32" type="data_ptr"/> ++ <reg name="r1" bitsize="32"/> + <reg name="r2" bitsize="32"/> + <reg name="r3" bitsize="32"/> + <reg name="r4" bitsize="32"/> +@@ -39,7 +39,7 @@ + <reg name="r29" bitsize="32"/> + <reg name="r30" bitsize="32"/> + <reg name="r31" bitsize="32"/> +- <reg name="rpc" bitsize="32" type="code_ptr"/> ++ <reg name="rpc" bitsize="32"/> + <reg name="rmsr" bitsize="32"/> + <reg name="rear" bitsize="32"/> + <reg name="resr" bitsize="32"/> +@@ -64,4 +64,6 @@ + <reg name="rtlbsx" bitsize="32"/> + <reg name="rtlblo" bitsize="32"/> + <reg name="rtlbhi" bitsize="32"/> ++ <reg name="slr" bitsize="32"/> ++ <reg name="shr" bitsize="32"/> + </feature> +diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml +index aac51ea471c..722a51f0df5 100644 +--- a/gdb/features/microblaze-stack-protect.xml ++++ b/gdb/features/microblaze-stack-protect.xml +@@ -7,6 +7,6 @@ + + <!DOCTYPE feature SYSTEM "gdb-target.dtd"> + <feature name="org.gnu.gdb.microblaze.stack-protect"> +- <reg name="rslr" bitsize="32"/> +- <reg name="rshr" bitsize="32"/> ++ <reg name="slr" bitsize="32"/> ++ <reg name="shr" bitsize="32"/> + </feature> +diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c +index aa180bf35d5..6a9e74c7a6f 100644 +--- a/gdb/features/microblaze-with-stack-protect.c ++++ b/gdb/features/microblaze-with-stack-protect.c +@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void) + + feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core"); + tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int"); +- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr"); ++ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int"); +@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void) + tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int"); +- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr"); ++ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); +@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void) + tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); + + feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect"); +- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int"); +- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int"); + + tdesc_microblaze_with_stack_protect = result.release (); + } +diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c +index ef2c64c720e..201232dff83 100644 +--- a/gdb/features/microblaze.c ++++ b/gdb/features/microblaze.c +@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void) + + feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core"); + tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int"); +- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr"); ++ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int"); +@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void) + tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int"); +- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr"); ++ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); +@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void) + tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); + + tdesc_microblaze = result.release (); + } +diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml +new file mode 100644 +index 00000000000..96e99e2fb24 +--- /dev/null ++++ b/gdb/features/microblaze64-core.xml +@@ -0,0 +1,69 @@ ++<?xml version="1.0"?> ++<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. ++ ++ Copying and distribution of this file, with or without modification, ++ are permitted in any medium without royalty provided the copyright ++ notice and this notice are preserved. --> ++ ++<!DOCTYPE feature SYSTEM "gdb-target.dtd"> ++<feature name="org.gnu.gdb.microblaze64.core"> ++ <reg name="r0" bitsize="64" regnum="0"/> ++ <reg name="r1" bitsize="64"/> ++ <reg name="r2" bitsize="64"/> ++ <reg name="r3" bitsize="64"/> ++ <reg name="r4" bitsize="64"/> ++ <reg name="r5" bitsize="64"/> ++ <reg name="r6" bitsize="64"/> ++ <reg name="r7" bitsize="64"/> ++ <reg name="r8" bitsize="64"/> ++ <reg name="r9" bitsize="64"/> ++ <reg name="r10" bitsize="64"/> ++ <reg name="r11" bitsize="64"/> ++ <reg name="r12" bitsize="64"/> ++ <reg name="r13" bitsize="64"/> ++ <reg name="r14" bitsize="64"/> ++ <reg name="r15" bitsize="64"/> ++ <reg name="r16" bitsize="64"/> ++ <reg name="r17" bitsize="64"/> ++ <reg name="r18" bitsize="64"/> ++ <reg name="r19" bitsize="64"/> ++ <reg name="r20" bitsize="64"/> ++ <reg name="r21" bitsize="64"/> ++ <reg name="r22" bitsize="64"/> ++ <reg name="r23" bitsize="64"/> ++ <reg name="r24" bitsize="64"/> ++ <reg name="r25" bitsize="64"/> ++ <reg name="r26" bitsize="64"/> ++ <reg name="r27" bitsize="64"/> ++ <reg name="r28" bitsize="64"/> ++ <reg name="r29" bitsize="64"/> ++ <reg name="r30" bitsize="64"/> ++ <reg name="r31" bitsize="64"/> ++ <reg name="rpc" bitsize="64"/> ++ <reg name="rmsr" bitsize="32"/> ++ <reg name="rear" bitsize="64"/> ++ <reg name="resr" bitsize="32"/> ++ <reg name="rfsr" bitsize="32"/> ++ <reg name="rbtr" bitsize="64"/> ++ <reg name="rpvr0" bitsize="32"/> ++ <reg name="rpvr1" bitsize="32"/> ++ <reg name="rpvr2" bitsize="32"/> ++ <reg name="rpvr3" bitsize="32"/> ++ <reg name="rpvr4" bitsize="32"/> ++ <reg name="rpvr5" bitsize="32"/> ++ <reg name="rpvr6" bitsize="32"/> ++ <reg name="rpvr7" bitsize="32"/> ++ <reg name="rpvr8" bitsize="64"/> ++ <reg name="rpvr9" bitsize="64"/> ++ <reg name="rpvr10" bitsize="32"/> ++ <reg name="rpvr11" bitsize="32"/> ++ <reg name="redr" bitsize="32"/> ++ <reg name="rpid" bitsize="32"/> ++ <reg name="rzpr" bitsize="32"/> ++ <reg name="rtlbx" bitsize="32"/> ++ <reg name="rtlbsx" bitsize="32"/> ++ <reg name="rtlblo" bitsize="32"/> ++ <reg name="rtlbhi" bitsize="32"/> ++ <reg name="slr" bitsize="64"/> ++ <reg name="shr" bitsize="64"/> ++</feature> +diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml +new file mode 100644 +index 00000000000..1bbf5fc3cea +--- /dev/null ++++ b/gdb/features/microblaze64-stack-protect.xml +@@ -0,0 +1,12 @@ ++<?xml version="1.0"?> ++<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. ++ ++ Copying and distribution of this file, with or without modification, ++ are permitted in any medium without royalty provided the copyright ++ notice and this notice are preserved. --> ++ ++<!DOCTYPE feature SYSTEM "gdb-target.dtd"> ++<feature name="org.gnu.gdb.microblaze64.stack-protect"> ++ <reg name="slr" bitsize="64"/> ++ <reg name="shr" bitsize="64"/> ++</feature> +diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c +new file mode 100644 +index 00000000000..a4de4666c76 +--- /dev/null ++++ b/gdb/features/microblaze64-with-stack-protect.c +@@ -0,0 +1,79 @@ ++/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: ++ Original: microblaze-with-stack-protect.xml */ ++ ++#include "defs.h" ++#include "osabi.h" ++#include "target-descriptions.h" ++ ++struct target_desc *tdesc_microblaze64_with_stack_protect; ++static void ++initialize_tdesc_microblaze64_with_stack_protect (void) ++{ ++ target_desc_up result = allocate_target_description (); ++ struct tdesc_feature *feature; ++ ++ feature = tdesc_create_feature (result.get() , "org.gnu.gdb.microblaze64.core"); ++ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int"); ++ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); ++ ++ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.stack-protect"); ++ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); ++ ++ tdesc_microblaze64_with_stack_protect = result.release(); ++} +diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml +new file mode 100644 +index 00000000000..0e9f01611f3 +--- /dev/null ++++ b/gdb/features/microblaze64-with-stack-protect.xml +@@ -0,0 +1,12 @@ ++<?xml version="1.0"?> ++<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. ++ ++ Copying and distribution of this file, with or without modification, ++ are permitted in any medium without royalty provided the copyright ++ notice and this notice are preserved. --> ++ ++<!DOCTYPE target SYSTEM "gdb-target.dtd"> ++<target> ++ <xi:include href="microblaze64-core.xml"/> ++ <xi:include href="microblaze64-stack-protect.xml"/> ++</target> +diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c +new file mode 100644 +index 00000000000..8ab7a90dd95 +--- /dev/null ++++ b/gdb/features/microblaze64.c +@@ -0,0 +1,77 @@ ++/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: ++ Original: microblaze.xml */ ++ ++#include "defs.h" ++#include "osabi.h" ++#include "target-descriptions.h" ++ ++struct target_desc *tdesc_microblaze64; ++static void ++initialize_tdesc_microblaze64 (void) ++{ ++ target_desc_up result = allocate_target_description (); ++ struct tdesc_feature *feature; ++ ++ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.core"); ++ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); ++ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); ++ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); ++ ++ tdesc_microblaze64 = result.release(); ++} +diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml +new file mode 100644 +index 00000000000..515d18e65cf +--- /dev/null ++++ b/gdb/features/microblaze64.xml +@@ -0,0 +1,11 @@ ++<?xml version="1.0"?> ++<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. ++ ++ Copying and distribution of this file, with or without modification, ++ are permitted in any medium without royalty provided the copyright ++ notice and this notice are preserved. --> ++ ++<!DOCTYPE target SYSTEM "gdb-target.dtd"> ++<target> ++ <xi:include href="microblaze64-core.xml"/> ++</target> +diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c +index fc52adffb72..f2db32f0087 100644 +--- a/gdb/microblaze-linux-tdep.c ++++ b/gdb/microblaze-linux-tdep.c +@@ -40,6 +40,7 @@ + #include "features/microblaze-linux.c" + + static int microblaze_debug_flag = 0; ++int MICROBLAZE_REGISTER_SIZE=4; + + static void + microblaze_debug (const char *fmt, ...) +@@ -55,6 +56,7 @@ microblaze_debug (const char *fmt, ...) + } + } + ++#if 0 + static int + microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) +@@ -86,6 +88,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + return val; + } + ++#endif ++ + static void + microblaze_linux_sigtramp_cache (struct frame_info *next_frame, + struct trad_frame_cache *this_cache, +@@ -147,8 +151,8 @@ microblaze_linux_init_abi (struct gdbarch_info info, + + linux_init_abi (info, gdbarch, 0); + +- set_gdbarch_memory_remove_breakpoint (gdbarch, +- microblaze_linux_memory_remove_breakpoint); ++ // set_gdbarch_memory_remove_breakpoint (gdbarch, ++ // microblaze_linux_memory_remove_breakpoint); + + /* Shared library handling. */ + set_solib_svr4_fetch_link_map_offsets (gdbarch, +@@ -160,10 +164,30 @@ microblaze_linux_init_abi (struct gdbarch_info info, + + /* BFD target for core files. */ + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) +- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); ++ { ++ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) { ++ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze"); ++ MICROBLAZE_REGISTER_SIZE=8; ++ } ++ else ++ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); ++ } + else +- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); ++ { ++ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) { ++ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel"); ++ MICROBLAZE_REGISTER_SIZE=8; ++ } ++ else ++ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); ++ } + ++ switch (info.bfd_arch_info->mach) ++ { ++ case bfd_mach_microblaze64: ++ set_gdbarch_ptr_bit (gdbarch, 64); ++ break; ++ } + + /* Shared library handling. */ + set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); +@@ -178,7 +202,9 @@ void _initialize_microblaze_linux_tdep (); + void + _initialize_microblaze_linux_tdep () + { +- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX, ++ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX, ++ microblaze_linux_init_abi); ++ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX, + microblaze_linux_init_abi); + initialize_tdesc_microblaze_linux (); + } +diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c +index ccb6b730d64..c347bb9516b 100644 +--- a/gdb/microblaze-tdep.c ++++ b/gdb/microblaze-tdep.c +@@ -40,7 +40,9 @@ + #include "remote.h" + + #include "features/microblaze-with-stack-protect.c" ++#include "features/microblaze64-with-stack-protect.c" + #include "features/microblaze.c" ++#include "features/microblaze64.c" + + /* Instruction macros used for analyzing the prologue. */ + /* This set of instruction macros need to be changed whenever the +@@ -75,12 +77,13 @@ static const char * const microblaze_register_names[] = + "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6", + "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11", + "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi", +- "rslr", "rshr" ++ "slr", "shr" + }; + + #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names) + + static unsigned int microblaze_debug_flag = 0; ++int reg_size = 4; + + #define microblaze_debug(fmt, ...) \ + debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \ +@@ -128,6 +131,15 @@ microblaze_fetch_instruction (CORE_ADDR pc) + constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; + + typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint; ++static CORE_ADDR ++microblaze_store_arguments (struct regcache *regcache, int nargs, ++ struct value **args, CORE_ADDR sp, ++ int struct_return, CORE_ADDR struct_addr) ++{ ++ error (_("store_arguments not implemented")); ++ return sp; ++} ++#if 0 + static int + microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) +@@ -146,7 +158,6 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + /* Make sure we see the memory breakpoints. */ + scoped_restore restore_memory + = make_scoped_restore_show_memory_breakpoints (1); +- + val = target_read_memory (addr, old_contents, bplen); + + /* If our breakpoint is no longer at the address, this means that the +@@ -161,6 +172,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + return val; + } + ++#endif + /* Allocate and initialize a frame cache. */ + + static struct microblaze_frame_cache * +@@ -577,17 +589,16 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache, + gdb_byte *valbuf) + { + gdb_byte buf[8]; +- + /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */ + switch (TYPE_LENGTH (type)) + { + case 1: /* return last byte in the register. */ + regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf); +- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1); ++ memcpy(valbuf, buf + reg_size - 1, 1); + return; + case 2: /* return last 2 bytes in register. */ + regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf); +- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2); ++ memcpy(valbuf, buf + reg_size - 2, 2); + return; + case 4: /* for sizes 4 or 8, copy the required length. */ + case 8: +@@ -754,6 +765,12 @@ microblaze_software_single_step (struct regcache *regcache) + } + #endif + ++static void ++microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc) ++{ ++ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc); ++} ++ + static int dwarf2_to_reg_map[78] = + { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ + 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */ +@@ -788,13 +805,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg) + static void + microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) + { ++ + register_remote_g_packet_guess (gdbarch, + 4 * MICROBLAZE_NUM_CORE_REGS, +- tdesc_microblaze); ++ tdesc_microblaze64); + + register_remote_g_packet_guess (gdbarch, + 4 * MICROBLAZE_NUM_REGS, +- tdesc_microblaze_with_stack_protect); ++ tdesc_microblaze64_with_stack_protect); + } + + void +@@ -802,7 +820,7 @@ microblaze_supply_gregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *gregs) + { +- const unsigned int *regs = (const unsigned int *)gregs; ++ const gdb_byte *regs = (const gdb_byte *) gregs; + if (regnum >= 0) + regcache->raw_supply (regnum, regs + regnum); + +@@ -810,7 +828,7 @@ microblaze_supply_gregset (const struct regset *regset, + int i; + + for (i = 0; i < 50; i++) { +- regcache->raw_supply (i, regs + i); ++ regcache->raw_supply (regnum, regs + i); + } + } + } +@@ -833,6 +851,17 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch, + } + + ++static void ++make_regs (struct gdbarch *arch) ++{ ++ struct gdbarch_tdep *tdep = gdbarch_tdep (arch); ++ int mach = gdbarch_bfd_arch_info (arch)->mach; ++ ++ if (mach == bfd_mach_microblaze64) ++ { ++ set_gdbarch_ptr_bit (arch, 64); ++ } ++} + + static struct gdbarch * + microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +@@ -846,8 +875,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + if (arches != NULL) + return arches->gdbarch; + if (tdesc == NULL) +- tdesc = tdesc_microblaze; +- ++ { ++ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) ++ { ++ tdesc = tdesc_microblaze64; ++ reg_size = 8; ++ } ++ else ++ tdesc = tdesc_microblaze; ++ } + /* Check any target description for validity. */ + if (tdesc_has_registers (tdesc)) + { +@@ -855,31 +891,42 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + int valid_p; + int i; + +- feature = tdesc_find_feature (tdesc, +- "org.gnu.gdb.microblaze.core"); ++ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) ++ feature = tdesc_find_feature (tdesc, ++ "org.gnu.gdb.microblaze64.core"); ++ else ++ feature = tdesc_find_feature (tdesc, ++ "org.gnu.gdb.microblaze.core"); + if (feature == NULL) + return NULL; + tdesc_data = tdesc_data_alloc (); + + valid_p = 1; +- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++) +- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i, +- microblaze_register_names[i]); +- feature = tdesc_find_feature (tdesc, +- "org.gnu.gdb.microblaze.stack-protect"); ++ for (i = 0; i < MICROBLAZE_NUM_REGS; i++) ++ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i, ++ microblaze_register_names[i]); ++ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) ++ feature = tdesc_find_feature (tdesc, ++ "org.gnu.gdb.microblaze64.stack-protect"); ++ else ++ feature = tdesc_find_feature (tdesc, ++ "org.gnu.gdb.microblaze.stack-protect"); + if (feature != NULL) +- { +- valid_p = 1; +- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), +- MICROBLAZE_SLR_REGNUM, +- "rslr"); +- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), +- MICROBLAZE_SHR_REGNUM, +- "rshr"); +- } ++ { ++ valid_p = 1; ++ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), ++ MICROBLAZE_SLR_REGNUM, ++ "slr"); ++ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), ++ MICROBLAZE_SHR_REGNUM, ++ "shr"); ++ } + + if (!valid_p) +- return NULL; ++ { ++ // tdesc_data_cleanup (tdesc_data.get ()); ++ return NULL; ++ } + } + + /* Allocate space for the new architecture. */ +@@ -899,7 +946,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + /* Register numbers of various important registers. */ + set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM); + set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM); ++ ++ /* Register set. ++ make_regs (gdbarch); */ ++ switch (info.bfd_arch_info->mach) ++ { ++ case bfd_mach_microblaze64: ++ set_gdbarch_ptr_bit (gdbarch, 64); ++ break; ++ } + ++ + /* Map Dwarf2 registers to GDB registers. */ + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum); + +@@ -919,7 +976,9 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + microblaze_breakpoint::kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, + microblaze_breakpoint::bp_from_kind); +- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); ++// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); ++ ++// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); + + set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); + +@@ -927,7 +986,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + + set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); + +- microblaze_register_g_packet_guesses (gdbarch); ++ //microblaze_register_g_packet_guesses (gdbarch); + + frame_base_set_default (gdbarch, µblaze_frame_base); + +@@ -942,12 +1001,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data)); + //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer); + +- /* If we have register sets, enable the generic core file support. */ ++ /* If we have register sets, enable the generic core file support. + if (tdep->gregset) { + set_gdbarch_iterate_over_regset_sections (gdbarch, + microblaze_iterate_over_regset_sections); +- } +- ++ }*/ + return gdbarch; + } + +@@ -959,6 +1017,8 @@ _initialize_microblaze_tdep () + + initialize_tdesc_microblaze_with_stack_protect (); + initialize_tdesc_microblaze (); ++ initialize_tdesc_microblaze64_with_stack_protect (); ++ initialize_tdesc_microblaze64 (); + /* Debug this files internals. */ + add_setshow_zuinteger_cmd ("microblaze", class_maintenance, + µblaze_debug_flag, _("\ +diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h +index 2415acfe7b6..f4d810303ca 100644 +--- a/gdb/microblaze-tdep.h ++++ b/gdb/microblaze-tdep.h +@@ -28,7 +28,7 @@ struct microblaze_gregset + microblaze_gregset() {} + unsigned int gregs[32]; + unsigned int fpregs[32]; +- unsigned int pregs[16]; ++ unsigned int pregs[18]; + }; + + struct microblaze_gdbarch_tdep : gdbarch_tdep +@@ -134,7 +134,7 @@ struct microblaze_frame_cache + struct trad_frame_saved_reg *saved_regs; + }; + /* All registers are 32 bits. */ +-#define MICROBLAZE_REGISTER_SIZE 4 ++//#define MICROBLAZE_REGISTER_SIZE 8 + + /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. + Only used for native debugging. */ +diff --git a/include/elf/common.h b/include/elf/common.h +index 70d63e3299c..8aa330d6631 100644 +--- a/include/elf/common.h ++++ b/include/elf/common.h +@@ -360,6 +360,7 @@ + #define EM_U16_U8CORE 260 /* LAPIS nX-U16/U8 */ + #define EM_TACHYUM 261 /* Tachyum */ + #define EM_56800EF 262 /* NXP 56800EF Digital Signal Controller (DSC) */ ++#define EM_MB_64 263 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ + + /* If it is necessary to assign new unofficial EM_* values, please pick large + random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision +diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h +index 43ad3ad3904..79799b86a49 100644 +--- a/include/elf/microblaze.h ++++ b/include/elf/microblaze.h +@@ -61,6 +61,10 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) + RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */ + RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */ + RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */ ++ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) ++ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34) ++ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */ ++ + END_RELOC_NUMBERS (R_MICROBLAZE_max) + + /* Global base address names. */ +diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c +index b057492ba93..283d87c04a2 100644 +--- a/opcodes/microblaze-dis.c ++++ b/opcodes/microblaze-dis.c +@@ -33,6 +33,7 @@ + #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW) + #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW) + #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW) ++#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW) + #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW) + + #define NUM_STRBUFS 3 +@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr) + } + + static char * +-get_field_imm5 (struct string_buf *buf, long instr) ++get_field_imml (struct string_buf *buf, long instr) + { + char *p = strbuf (buf); + +- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW)); ++ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW)); ++ return p; ++} ++ ++static char * ++get_field_imms (struct string_buf *buf, long instr) ++{ ++ char *p = strbuf (buf); ++ ++ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW)); + return p; + } + +@@ -90,6 +100,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr) + return p; + } + ++static char * ++get_field_immw (struct string_buf *buf, long instr) ++{ ++ char *p = strbuf (buf); ++ ++ if (instr & 0x00004000) ++ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ ++ else ++ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */ ++ return p; ++} ++ + static char * + get_field_rfsl (struct string_buf *buf, long instr) + { +@@ -296,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) + } + } + break; +- case INST_TYPE_RD_R1_IMM5: ++ case INST_TYPE_RD_R1_IMML: ++ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst), ++ get_field_r1(&buf, inst), get_field_imm (&buf, inst)); ++ /* TODO: Also print symbol */ ++ break; ++ case INST_TYPE_RD_R1_IMMS: + print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst), +- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst)); ++ get_field_r1(&buf, inst), get_field_imms (&buf, inst)); + break; + case INST_TYPE_RD_RFSL: + print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), +@@ -402,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) + } + } + break; +- case INST_TYPE_RD_R2: +- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), +- get_field_r2 (&buf, inst)); ++ case INST_TYPE_IMML: ++ print_func (stream, "\t%s", get_field_imml (&buf, inst)); ++ /* TODO: Also print symbol */ ++ break; ++ case INST_TYPE_RD_R2: ++ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst)); + break; + case INST_TYPE_R2: + print_func (stream, "\t%s", get_field_r2 (&buf, inst)); +@@ -427,7 +457,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) + /* For mbar 16 or sleep insn. */ + case INST_TYPE_NONE: + break; +- /* For tuqula instruction */ ++ /* For bit field insns. */ ++ case INST_TYPE_RD_R1_IMMW_IMMS: ++ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst), ++ get_field_immw (&buf, inst), get_field_imms (&buf, inst)); ++ break; ++ /* For tuqula instruction */ + case INST_TYPE_RD: + print_func (stream, "\t%s", get_field_rd (&buf, inst)); + break; +diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h +index ffb0f08c692..5e45df995de 100644 +--- a/opcodes/microblaze-opc.h ++++ b/opcodes/microblaze-opc.h +@@ -40,7 +40,7 @@ + #define INST_TYPE_RD_SPECIAL 11 + #define INST_TYPE_R1 12 + /* New instn type for barrel shift imms. */ +-#define INST_TYPE_RD_R1_IMM5 13 ++#define INST_TYPE_RD_R1_IMMS 13 + #define INST_TYPE_RD_RFSL 14 + #define INST_TYPE_R1_RFSL 15 + +@@ -59,6 +59,15 @@ + /* For mbar. */ + #define INST_TYPE_IMM5 20 + ++/* For bsefi and bsifi */ ++#define INST_TYPE_RD_R1_IMMW_IMMS 21 ++ ++/* For 64-bit instructions */ ++#define INST_TYPE_IMML 22 ++#define INST_TYPE_RD_R1_IMML 23 ++#define INST_TYPE_R1_IMML 24 ++#define INST_TYPE_RD_R1_IMMW_IMMS 21 ++ + #define INST_TYPE_NONE 25 + + +@@ -88,10 +97,14 @@ + #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */ + #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */ + #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */ +-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */ ++#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */ ++#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */ + #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */ ++#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */ + #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */ ++#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */ + #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */ ++#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */ + + /* New Mask for msrset, msrclr insns. */ + #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */ +@@ -101,7 +114,7 @@ + #define DELAY_SLOT 1 + #define NO_DELAY_SLOT 0 + +-#define MAX_OPCODES 289 ++#define MAX_OPCODES 412 + + const struct op_code_struct + { +@@ -119,6 +132,7 @@ const struct op_code_struct + /* More info about output format here. */ + } microblaze_opcodes[MAX_OPCODES] = + { ++ /* 32-bit instructions */ + {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst }, + {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst }, + {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst }, +@@ -155,9 +169,11 @@ const struct op_code_struct + {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst }, + {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst }, + {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst }, +- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst }, +- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst }, +- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst }, ++ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst }, ++ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst }, ++ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst }, ++ {"bsefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst }, ++ {"bsifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst }, + {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst }, + {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst }, + {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst }, +@@ -174,9 +190,14 @@ const struct op_code_struct + {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst }, + {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst }, + {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst }, ++ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst }, + {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst }, ++ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst }, ++ {"wdc.clear.ea", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E6, OPCODE_MASK_H34B, wdcclearea, special_inst }, + {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst }, ++ {"mtse", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9500C000, OPCODE_MASK_H13S, mtse,special_inst }, + {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst }, ++ {"mfse", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94088000, OPCODE_MASK_H23S, mfse, special_inst }, + {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst }, + {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst }, + {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst }, +@@ -226,18 +247,24 @@ const struct op_code_struct + {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst }, + {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst }, + {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst }, ++ {"lbuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000080, OPCODE_MASK_H4, lbuea, memory_load_inst }, + {"lhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000000, OPCODE_MASK_H4, lhu, memory_load_inst }, + {"lhur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000200, OPCODE_MASK_H4, lhur, memory_load_inst }, ++ {"lhuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000080, OPCODE_MASK_H4, lhuea, memory_load_inst }, + {"lw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000000, OPCODE_MASK_H4, lw, memory_load_inst }, + {"lwr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000200, OPCODE_MASK_H4, lwr, memory_load_inst }, + {"lwx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000400, OPCODE_MASK_H4, lwx, memory_load_inst }, ++ {"lwea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000080, OPCODE_MASK_H4, lwea, memory_load_inst }, + {"sb", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000000, OPCODE_MASK_H4, sb, memory_store_inst }, + {"sbr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000200, OPCODE_MASK_H4, sbr, memory_store_inst }, ++ {"sbea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000080, OPCODE_MASK_H4, sbea, memory_store_inst }, + {"sh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000000, OPCODE_MASK_H4, sh, memory_store_inst }, + {"shr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000200, OPCODE_MASK_H4, shr, memory_store_inst }, ++ {"shea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000080, OPCODE_MASK_H4, shea, memory_store_inst }, + {"sw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000000, OPCODE_MASK_H4, sw, memory_store_inst }, + {"swr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000200, OPCODE_MASK_H4, swr, memory_store_inst }, + {"swx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000400, OPCODE_MASK_H4, swx, memory_store_inst }, ++ {"swea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000080, OPCODE_MASK_H4, swea, memory_store_inst }, + {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst }, + {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst }, + {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst }, +@@ -248,9 +275,7 @@ const struct op_code_struct + {"la", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* la translates to addik. */ + {"tuqula",INST_TYPE_RD, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3000002A, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* tuqula rd translates to addik rd, r0, 42. */ + {"not", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA800FFFF, OPCODE_MASK_H34, invalid_inst, logical_inst }, /* not translates to xori rd,ra,-1. */ +- {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */ + {"rtb", INST_TYPE_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB6000004, OPCODE_MASK_H1, invalid_inst, return_inst }, /* rtb translates to rts rd, 4. */ +- {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */ + {"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, + {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, + {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst }, +@@ -402,8 +427,135 @@ const struct op_code_struct + {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst }, + {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst }, + {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */ ++ {"hibernate", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB9020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 8. */ ++ {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */ + {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst }, + {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst }, ++ ++ /* 64-bit instructions */ ++ {"addl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000100, OPCODE_MASK_H4, addl, arithmetic_inst }, ++ {"rsubl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000100, OPCODE_MASK_H4, rsubl, arithmetic_inst }, ++ {"addlc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000100, OPCODE_MASK_H4, addlc, arithmetic_inst }, ++ {"rsublc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x0C000100, OPCODE_MASK_H4, rsublc, arithmetic_inst }, ++ {"addlk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x10000100, OPCODE_MASK_H4, addlk, arithmetic_inst }, ++ {"rsublk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000100, OPCODE_MASK_H4, rsublk, arithmetic_inst }, ++ {"addlkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x18000100, OPCODE_MASK_H4, addlkc, arithmetic_inst }, ++ {"rsublkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x1C000100, OPCODE_MASK_H4, rsublkc, arithmetic_inst }, ++ {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst }, ++ {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst }, ++ {"addli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x20000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ ++ {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ ++ {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ ++ {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ ++ {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ ++ {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ ++ {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ ++ {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ ++ {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst }, ++ {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst }, ++ {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst }, ++ {"bslrl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000100, OPCODE_MASK_H3, bslrl, barrel_shift_inst }, ++ {"bsllli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002400, OPCODE_MASK_H3B, bsllli, barrel_shift_inst }, ++ {"bslrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002200, OPCODE_MASK_H3B, bslrai, barrel_shift_inst }, ++ {"bslrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002000, OPCODE_MASK_H3B, bslrli, barrel_shift_inst }, ++ {"bslefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64006000, OPCODE_MASK_H32B, bslefi, barrel_shift_inst }, ++ {"bslifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6400a000, OPCODE_MASK_H32B, bslifi, barrel_shift_inst }, ++ {"orl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000100, OPCODE_MASK_H4, orl, logical_inst }, ++ {"andl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000100, OPCODE_MASK_H4, andl, logical_inst }, ++ {"xorl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000100, OPCODE_MASK_H4, xorl, logical_inst }, ++ {"andnl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000100, OPCODE_MASK_H4, andnl, logical_inst }, ++ {"pcmplbf", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000500, OPCODE_MASK_H4, pcmplbf, logical_inst }, ++ {"pcmpleq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000500, OPCODE_MASK_H4, pcmpleq, logical_inst }, ++ {"pcmplne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000500, OPCODE_MASK_H4, pcmplne, logical_inst }, ++ {"srla", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000101, OPCODE_MASK_H34, srla, logical_inst }, ++ {"srlc", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000121, OPCODE_MASK_H34, srlc, logical_inst }, ++ {"srll", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000141, OPCODE_MASK_H34, srll, logical_inst }, ++ {"sextl8", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000160, OPCODE_MASK_H34, sextl8, logical_inst }, ++ {"sextl16", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000161, OPCODE_MASK_H34, sextl16, logical_inst }, ++ {"sextl32", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000162, OPCODE_MASK_H34, sextl32, logical_inst }, ++ {"brea", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98010000, OPCODE_MASK_H124, brea, branch_inst }, ++ {"bread", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98110000, OPCODE_MASK_H124, bread, branch_inst }, ++ {"breald", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98150000, OPCODE_MASK_H24, breald, branch_inst }, ++ {"beaeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000000, OPCODE_MASK_H14, beaeq, branch_inst }, ++ {"bealeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000100, OPCODE_MASK_H14, bealeq, branch_inst }, ++ {"beaeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000000, OPCODE_MASK_H14, beaeqd, branch_inst }, ++ {"bealeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000100, OPCODE_MASK_H14, bealeqd, branch_inst }, ++ {"beane", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200000, OPCODE_MASK_H14, beane, branch_inst }, ++ {"bealne", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200100, OPCODE_MASK_H14, bealne, branch_inst }, ++ {"beaned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200000, OPCODE_MASK_H14, beaned, branch_inst }, ++ {"bealned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200100, OPCODE_MASK_H14, bealned, branch_inst }, ++ {"bealt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400000, OPCODE_MASK_H14, bealt, branch_inst }, ++ {"beallt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400100, OPCODE_MASK_H14, beallt, branch_inst }, ++ {"bealtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400000, OPCODE_MASK_H14, bealtd, branch_inst }, ++ {"bealltd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400100, OPCODE_MASK_H14, bealltd, branch_inst }, ++ {"beale", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600000, OPCODE_MASK_H14, beale, branch_inst }, ++ {"bealle", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600100, OPCODE_MASK_H14, bealle, branch_inst }, ++ {"bealed", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600000, OPCODE_MASK_H14, bealed, branch_inst }, ++ {"bealled", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600100, OPCODE_MASK_H14, bealled, branch_inst }, ++ {"beagt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800000, OPCODE_MASK_H14, beagt, branch_inst }, ++ {"bealgt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800100, OPCODE_MASK_H14, bealgt, branch_inst }, ++ {"beagtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800000, OPCODE_MASK_H14, beagtd, branch_inst }, ++ {"bealgtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800100, OPCODE_MASK_H14, bealgtd, branch_inst }, ++ {"beage", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00000, OPCODE_MASK_H14, beage, branch_inst }, ++ {"bealge", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00100, OPCODE_MASK_H14, bealge, branch_inst }, ++ {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst }, ++ {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst }, ++ {"orli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA0000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */ ++ {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */ ++ {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */ ++ {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */ ++ {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst }, ++ {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst }, ++ {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst }, ++ {"brealid", INST_TYPE_RD_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8150000, OPCODE_MASK_H2, brealid, branch_inst }, ++ {"beaeqi", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, beaeqi, branch_inst }, ++ {"bealeqi", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqi */ ++ {"beaeqid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, beaeqid, branch_inst }, ++ {"bealeqid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqid */ ++ {"beanei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, beanei, branch_inst }, ++ {"bealnei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beanei */ ++ {"beaneid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, beaneid, branch_inst }, ++ {"bealneid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaneid */ ++ {"bealti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, bealti, branch_inst }, ++ {"beallti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealti */ ++ {"bealtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, bealtid, branch_inst }, ++ {"bealltid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealtid */ ++ {"bealei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, bealei, branch_inst }, ++ {"beallei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealei */ ++ {"bealeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, bealeid, branch_inst }, ++ {"bealleid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealeid */ ++ {"beagti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, beagti, branch_inst }, ++ {"bealgti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagti */ ++ {"beagtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, beagtid, branch_inst }, ++ {"bealgtid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagtid */ ++ {"beagei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, beagei, branch_inst }, ++ {"bealgei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagei */ ++ {"beageid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, beageid, branch_inst }, ++ {"bealgeid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beageid */ ++ {"ll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000100, OPCODE_MASK_H4, ll, memory_load_inst }, ++ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst }, ++ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst }, ++ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst }, ++ {"lli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xEC000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */ ++ {"sli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xFC000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */ ++ {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */ ++ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst }, ++ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst }, ++ {"dmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000500, OPCODE_MASK_H4, dmul, arithmetic_inst }, ++ {"ddiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000580, OPCODE_MASK_H4, ddiv, arithmetic_inst }, ++ {"dcmp.lt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000610, OPCODE_MASK_H4, dcmp_lt, arithmetic_inst }, ++ {"dcmp.eq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000620, OPCODE_MASK_H4, dcmp_eq, arithmetic_inst }, ++ {"dcmp.le", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000630, OPCODE_MASK_H4, dcmp_le, arithmetic_inst }, ++ {"dcmp.gt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000640, OPCODE_MASK_H4, dcmp_gt, arithmetic_inst }, ++ {"dcmp.ne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000650, OPCODE_MASK_H4, dcmp_ne, arithmetic_inst }, ++ {"dcmp.ge", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000660, OPCODE_MASK_H4, dcmp_ge, arithmetic_inst }, ++ {"dcmp.un", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000600, OPCODE_MASK_H4, dcmp_un, arithmetic_inst }, ++ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst }, ++ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst }, ++ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst }, ++ {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */ ++ {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */ ++ + {"", 0, 0, 0, 0, 0, 0, 0, 0}, + }; + +@@ -424,5 +576,17 @@ char pvr_register_prefix[] = "rpvr"; + #define MIN_IMM5 ((int) 0x00000000) + #define MAX_IMM5 ((int) 0x0000001f) + ++#define MIN_IMM6 ((int) 0x00000000) ++#define MAX_IMM6 ((int) 0x0000003f) ++ ++#define MIN_IMM_WIDTH ((int) 0x00000001) ++#define MAX_IMM_WIDTH ((int) 0x00000020) ++ ++#define MIN_IMM6_WIDTH ((int) 0x00000001) ++#define MAX_IMM6_WIDTH ((int) 0x00000040) ++ ++#define MIN_IMML ((long) 0xffffff8000000000L) ++#define MAX_IMML ((long) 0x0000007fffffffffL) ++ + #endif /* MICROBLAZE_OPC */ + +diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h +index 8e293465fec..254d9fe911e 100644 +--- a/opcodes/microblaze-opcm.h ++++ b/opcodes/microblaze-opcm.h +@@ -25,22 +25,23 @@ + + enum microblaze_instr + { ++ /* 32-bit instructions */ + add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu, + addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, + mulh, mulhu, mulhsu,swapb,swaph, + idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput, +- ncget, ncput, muli, bslli, bsrai, bsrli, mului, ++ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului, + /* 'or/and/xor' are C++ keywords. */ + microblaze_or, microblaze_and, microblaze_xor, + andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, +- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd, +- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt, +- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, ++ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, wdcclearea, mts, mtse, ++ mfs, mfse, mbar, br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, ++ bne, bned, blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, + imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid, + brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, +- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh, +- shr, sw, swr, swx, lbui, lhui, lwi, +- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv, ++ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx, ++ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli, ++ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv, + fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, + /* 'fsqrt' is a glibc:math.h symbol. */ + fint, microblaze_fsqrt, +@@ -59,6 +60,18 @@ enum microblaze_instr + aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd, + eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd, + eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd, ++ ++ /* 64-bit instructions */ ++ addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull, ++ bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl, ++ andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32, ++ brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned, ++ bealned, bealt, beallt, bealtd, bealltd, beale, bealle, bealed, bealled, beagt, ++ bealgt, beagtd, bealgtd, beage, bealge, beaged, bealged, breai, breaid, brealid, ++ beaeqi, beaeqid, beanei, beaneid, bealti, bealtid, bealei, bealeid, beagti, ++ beagtid, beagei, beageid, imml, ll, llr, sl, slr, ++ dadd, drsub, dmul, ddiv, dcmp_lt, dcmp_eq, dcmp_le, dcmp_gt, dcmp_ne, dcmp_ge, ++ dcmp_un, dbl, dlong, dsqrt, + invalid_inst + }; + +@@ -130,18 +143,25 @@ enum microblaze_instr_type + #define RB_LOW 11 /* Low bit for RB. */ + #define IMM_LOW 0 /* Low bit for immediate. */ + #define IMM_MBAR 21 /* low bit for mbar instruction. */ ++#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */ + + #define RD_MASK 0x03E00000 + #define RA_MASK 0x001F0000 + #define RB_MASK 0x0000F800 + #define IMM_MASK 0x0000FFFF ++#define IMML_MASK 0x00FFFFFF + +-/* Imm mask for barrel shifts. */ ++/* Imm masks for barrel shifts. */ + #define IMM5_MASK 0x0000001F ++#define IMM6_MASK 0x0000003F + + /* Imm mask for mbar. */ + #define IMM5_MBAR_MASK 0x03E00000 + ++/* Imm masks for extract/insert width. */ ++#define IMM5_WIDTH_MASK 0x000007C0 ++#define IMM6_WIDTH_MASK 0x00000FC0 ++ + /* FSL imm mask for get, put instructions. */ + #define RFSL_MASK 0x000000F + +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-use-asm-sgidefs.h.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-use-asm-sgidefs.h.patch new file mode 100644 index 00000000..242099b9 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-use-asm-sgidefs.h.patch @@ -0,0 +1,36 @@ +From 25a75aaf29791f4302f0e4452f7ebaf735d4f083 Mon Sep 17 00:00:00 2001 +From: Andre McCurdy <amccurdy@gmail.com> +Date: Sat, 30 Apr 2016 15:29:06 -0700 +Subject: [PATCH 5/9] use <asm/sgidefs.h> + +Build fix for MIPS with musl libc + +The MIPS specific header <sgidefs.h> is provided by glibc and uclibc +but not by musl. Regardless of the libc, the kernel headers provide +<asm/sgidefs.h> which provides the same definitions, so use that +instead. + +Upstream-Status: Pending + +Signed-off-by: Andre McCurdy <armccurdy@gmail.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gdb/mips-linux-nat.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c +index 6adc61235aa..afb40066744 100644 +--- a/gdb/mips-linux-nat.c ++++ b/gdb/mips-linux-nat.c +@@ -31,7 +31,7 @@ + #include "gdb_proc_service.h" + #include "gregset.h" + +-#include <sgidefs.h> ++#include <asm/sgidefs.h> + #include "nat/gdb_ptrace.h" + #include <asm/ptrace.h> + #include "inf-ptrace.h" +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch new file mode 100644 index 00000000..58c9b1d0 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch @@ -0,0 +1,30 @@ +From c0e7c34134aa1f9644075c596a2338a50d3d923e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 30 Apr 2016 15:35:39 -0700 +Subject: [PATCH 6/9] Change order of CFLAGS + +Lets us override Werror if need be + +Upstream-Status: Inappropriate + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gdbserver/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in +index 47648b8d962..5599779de57 100644 +--- a/gdbserver/Makefile.in ++++ b/gdbserver/Makefile.in +@@ -156,7 +156,7 @@ WIN32APILIBS = @WIN32APILIBS@ + INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \ + ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS) + INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS) +-INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER ++INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) ${COMPILER_CFLAGS} -DGDBSERVER + + # LDFLAGS is specifically reserved for setting from the command line + # when running make. +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch new file mode 100644 index 00000000..9d12cc53 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch @@ -0,0 +1,38 @@ +From ef411b49f3b2c9e4048eb273f43ab4ee96f96b7e Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 19 Apr 2021 14:33:27 +0530 +Subject: [PATCH 6/8] [Patch,MicroBlaze] : these changes will make 64 bit + vectors as default target types when we built gdb with microblaze 64 bit type + targets,for instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64 + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + bfd/config.bfd | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/bfd/config.bfd b/bfd/config.bfd +index 5e9ba3d9805..deb3d078439 100644 +--- a/bfd/config.bfd ++++ b/bfd/config.bfd +@@ -856,7 +856,15 @@ case "${targ}" in + targ_defvec=metag_elf32_vec + targ_underscore=yes + ;; ++ microblazeel*-*64) ++ targ_defvec=microblaze_elf64_le_vec ++ targ_selvecs=microblaze_elf64_vec ++ ;; + ++ microblaze*-*64) ++ targ_defvec=microblaze_elf64_vec ++ targ_selvecs=microblaze_elf64_le_vec ++ ;; + microblazeel*-*) + targ_defvec=microblaze_elf32_le_vec + targ_selvecs=microblaze_elf32_vec +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch new file mode 100644 index 00000000..ec11e7be --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch @@ -0,0 +1,300 @@ +From d2f145ec8e4e149e055adc74e92016447af91806 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 9 Nov 2021 16:19:17 +0530 +Subject: [PATCH 7/8] [Patch,MicroBlaze] : Added m64 abi for 64 bit target + descriptions. set m64 abi for 64 bit elf. + +Conflicts: + gdb/microblaze-tdep.c + gdb/microblaze-tdep.h +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gdb/features/microblaze64.xml | 1 + + gdb/microblaze-tdep.c | 159 ++++++++++++++++++++++++++++++++-- + gdb/microblaze-tdep.h | 13 ++- + 3 files changed, 165 insertions(+), 8 deletions(-) + +diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml +index 515d18e65cf..9c1b7d22003 100644 +--- a/gdb/features/microblaze64.xml ++++ b/gdb/features/microblaze64.xml +@@ -7,5 +7,6 @@ + + <!DOCTYPE target SYSTEM "gdb-target.dtd"> + <target> ++ <architecture>microblaze64</architecture> + <xi:include href="microblaze64-core.xml"/> + </target> +diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c +index c347bb9516b..d83072cdaef 100644 +--- a/gdb/microblaze-tdep.c ++++ b/gdb/microblaze-tdep.c +@@ -65,8 +65,95 @@ + #define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \ + ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0) + ++static const char *microblaze_abi_string; ++ ++static const char *const microblaze_abi_strings[] = { ++ "auto", ++ "m64", ++}; ++ ++enum microblaze_abi ++microblaze_abi (struct gdbarch *gdbarch) ++{ ++ microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch); ++ return tdep->microblaze_abi; ++} + /* The registers of the Xilinx microblaze processor. */ + ++ static struct cmd_list_element *setmicroblazecmdlist = NULL; ++ static struct cmd_list_element *showmicroblazecmdlist = NULL; ++ ++static void ++microblaze_abi_update (const char *ignore_args, ++ int from_tty, struct cmd_list_element *c) ++{ ++ struct gdbarch_info info; ++ ++ /* Force the architecture to update, and (if it's a microblaze architecture) ++ * microblaze_gdbarch_init will take care of the rest. */ ++// gdbarch_info_init (&info); ++ gdbarch_update_p (info); ++} ++ ++ ++static enum microblaze_abi ++global_microblaze_abi (void) ++{ ++ int i; ++ ++ for (i = 0; microblaze_abi_strings[i] != NULL; i++) ++ if (microblaze_abi_strings[i] == microblaze_abi_string) ++ return (enum microblaze_abi) i; ++ ++// internal_error (__FILE__, __LINE__, _("unknown ABI string")); ++} ++ ++static void ++show_microblaze_abi (struct ui_file *file, ++ int from_tty, ++ struct cmd_list_element *ignored_cmd, ++ const char *ignored_value) ++{ ++ enum microblaze_abi global_abi = global_microblaze_abi (); ++ enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ()); ++ const char *actual_abi_str = microblaze_abi_strings[actual_abi]; ++ ++#if 1 ++ if (global_abi == MICROBLAZE_ABI_AUTO) ++ fprintf_filtered ++ (file, ++ "The microblaze ABI is set automatically (currently \"%s\").\n", ++ actual_abi_str); ++ else if (global_abi == actual_abi) ++ fprintf_filtered ++ (file, ++ "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n", ++ actual_abi_str); ++ else ++ { ++#endif ++ /* Probably shouldn't happen... */ ++ fprintf_filtered (file, ++ "The (auto detected) microblaze ABI \"%s\" is in use " ++ "even though the user setting was \"%s\".\n", ++ actual_abi_str, microblaze_abi_strings[global_abi]); ++ } ++} ++ ++static void ++show_microblaze_command (const char *args, int from_tty) ++{ ++ help_list (showmicroblazecmdlist, "show microblaze ", all_commands, gdb_stdout); ++} ++ ++static void ++set_microblaze_command (const char *args, int from_tty) ++{ ++ printf_unfiltered ++ ("\"set microblaze\" must be followed by an appropriate subcommand.\n"); ++ help_list (setmicroblazecmdlist, "set microblaze ", all_commands, gdb_stdout); ++} ++ + static const char * const microblaze_register_names[] = + { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", +@@ -85,9 +172,21 @@ static const char * const microblaze_register_names[] = + static unsigned int microblaze_debug_flag = 0; + int reg_size = 4; + ++unsigned int ++microblaze_abi_regsize (struct gdbarch *gdbarch) ++{ ++ switch (microblaze_abi (gdbarch)) ++ { ++ case MICROBLAZE_ABI_M64: ++ return 8; ++ default: ++ return 4; ++ } ++} ++ + #define microblaze_debug(fmt, ...) \ + debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \ +- fmt, ## __VA_ARGS__) ++ fmt, ## __VA_ARGS__) + + + /* Return the name of register REGNUM. */ +@@ -868,15 +967,30 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + { + struct gdbarch *gdbarch; + tdesc_arch_data_up tdesc_data; ++ enum microblaze_abi microblaze_abi, found_abi, wanted_abi; + const struct target_desc *tdesc = info.target_desc; + ++ /* What has the user specified from the command line? */ ++ wanted_abi = global_microblaze_abi (); ++ if (gdbarch_debug) ++ fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n", ++ wanted_abi); ++ if (wanted_abi != MICROBLAZE_ABI_AUTO) ++ microblaze_abi = wanted_abi; ++ + /* If there is already a candidate, use it. */ + arches = gdbarch_list_lookup_by_info (arches, &info); +- if (arches != NULL) ++ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64)) + return arches->gdbarch; ++ ++ if (microblaze_abi == MICROBLAZE_ABI_M64) ++ { ++ tdesc = tdesc_microblaze64; ++ reg_size = 8; ++ } + if (tdesc == NULL) + { +- if (info.bfd_arch_info->mach == bfd_mach_microblaze64) ++ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64)) + { + tdesc = tdesc_microblaze64; + reg_size = 8; +@@ -891,7 +1005,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + int valid_p; + int i; + +- if (info.bfd_arch_info->mach == bfd_mach_microblaze64) ++ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64)) + feature = tdesc_find_feature (tdesc, + "org.gnu.gdb.microblaze64.core"); + else +@@ -905,7 +1019,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + for (i = 0; i < MICROBLAZE_NUM_REGS; i++) + valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i, + microblaze_register_names[i]); +- if (info.bfd_arch_info->mach == bfd_mach_microblaze64) ++ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64)) + feature = tdesc_find_feature (tdesc, + "org.gnu.gdb.microblaze64.stack-protect"); + else +@@ -955,7 +1069,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + set_gdbarch_ptr_bit (gdbarch, 64); + break; + } +- ++ if(microblaze_abi == MICROBLAZE_ABI_M64) ++ set_gdbarch_ptr_bit (gdbarch, 64); + + /* Map Dwarf2 registers to GDB registers. */ + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum); +@@ -1014,7 +1129,38 @@ void + _initialize_microblaze_tdep () + { + register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init); ++// static struct cmd_list_element *setmicroblazecmdlist = NULL; ++// static struct cmd_list_element *showmicroblazecmdlist = NULL; ++ ++ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */ + ++ add_setshow_prefix_cmd ("microblaze", no_class, ++ _("Various microblaze specific commands."), ++ _("Various microblaze specific commands."), ++ &setmicroblazecmdlist,&showmicroblazecmdlist, ++ &setlist,&showlist); ++#if 0 ++ add_prefix_cmd ("microblaze", no_class, set_microblaze_command, ++ _("Various microblaze specific commands."), ++ &setmicroblazecmdlist, "set microblaze ", 0, &setlist); ++ ++ add_prefix_cmd ("microblaze", no_class, show_microblaze_command, ++ _("Various microblaze specific commands."), ++ &showmicroblazecmdlist, "show microblaze ", 0, &showlist); ++#endif ++ ++ /* Allow the user to override the ABI. */ ++ add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings, ++ µblaze_abi_string, _("\ ++Set the microblaze ABI used by this program."), _("\ ++Show the microblaze ABI used by this program."), _("\ ++This option can be set to one of:\n\ ++ auto - the default ABI associated with the current binary\n\ ++ m64"), ++ microblaze_abi_update, ++ show_microblaze_abi, ++ &setmicroblazecmdlist, &showmicroblazecmdlist); ++ + initialize_tdesc_microblaze_with_stack_protect (); + initialize_tdesc_microblaze (); + initialize_tdesc_microblaze64_with_stack_protect (); +@@ -1029,5 +1175,4 @@ When non-zero, microblaze specific debugging is enabled."), + NULL, + &setdebuglist, &showdebuglist); + +- + } +diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h +index f4d810303ca..babd6c36926 100644 +--- a/gdb/microblaze-tdep.h ++++ b/gdb/microblaze-tdep.h +@@ -19,9 +19,17 @@ + + #ifndef MICROBLAZE_TDEP_H + #define MICROBLAZE_TDEP_H 1 +- ++#include "objfiles.h" + #include "gdbarch.h" + ++struct gdbarch; ++enum microblaze_abi ++ { ++ MICROBLAZE_ABI_AUTO = 0, ++ MICROBLAZE_ABI_M64, ++ }; ++ ++enum microblaze_abi microblaze_abi (struct gdbarch *gdbarch); + /* Microblaze architecture-specific information. */ + struct microblaze_gregset + { +@@ -35,11 +43,14 @@ struct microblaze_gdbarch_tdep : gdbarch_tdep + { + int dummy; // declare something. + ++ enum microblaze_abi microblaze_abi {}; ++ enum microblaze_abi found_abi {}; + /* Register sets. */ + struct regset *gregset; + size_t sizeof_gregset; + struct regset *fpregset; + size_t sizeof_fpregset; ++ int register_size; + }; + + /* Register numbers. */ +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch new file mode 100644 index 00000000..bbd1f0b2 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch @@ -0,0 +1,48 @@ +From 44fa1ecfbd8a5fe0cfea12a175fa041686842a0c Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 10 May 2016 08:47:05 -0700 +Subject: [PATCH 7/9] resolve restrict keyword conflict + +GCC detects that we call 'restrict' as param name in function +signatures and complains since both params are called 'restrict' +therefore we use __restrict to denote the C99 keywork + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gnulib/import/sys_time.in.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/gnulib/import/sys_time.in.h b/gnulib/import/sys_time.in.h +index 90a67d18426..664641a1fe8 100644 +--- a/gnulib/import/sys_time.in.h ++++ b/gnulib/import/sys_time.in.h +@@ -93,20 +93,20 @@ struct timeval + # define gettimeofday rpl_gettimeofday + # endif + _GL_FUNCDECL_RPL (gettimeofday, int, +- (struct timeval *restrict, void *restrict) ++ (struct timeval *__restrict, void *__restrict) + _GL_ARG_NONNULL ((1))); + _GL_CXXALIAS_RPL (gettimeofday, int, +- (struct timeval *restrict, void *restrict)); ++ (struct timeval *__restrict, void *__restrict)); + # else + # if !@HAVE_GETTIMEOFDAY@ + _GL_FUNCDECL_SYS (gettimeofday, int, +- (struct timeval *restrict, void *restrict) ++ (struct timeval *__restrict, void *__restrict) + _GL_ARG_NONNULL ((1))); + # endif + /* Need to cast, because on glibc systems, by default, the second argument is + struct timezone *. */ + _GL_CXXALIAS_SYS_CAST (gettimeofday, int, +- (struct timeval *restrict, void *restrict)); ++ (struct timeval *__restrict, void *__restrict)); + # endif + _GL_CXXALIASWARN (gettimeofday); + # if defined __cplusplus && defined GNULIB_NAMESPACE +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch new file mode 100644 index 00000000..3e293276 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch @@ -0,0 +1,55 @@ +From 48906e1038e469b429aa35d0f967730a929c3880 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 15 Jan 2023 00:16:25 -0800 +Subject: [PATCH 8/8] Define alignof using _Alignof when using C11 or newer + +WG14 N2350 made very clear that it is an UB having type definitions +within "offsetof" [1]. This patch enhances the implementation of macro +alignof_slot to use builtin "_Alignof" to avoid undefined behavior on +when using std=c11 or newer + +clang 16+ has started to flag this [2] + +Fixes build when using -std >= gnu11 and using clang16+ + +Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it +may support C11, exclude those compilers too + +gnulib needs this fix and then it will be applied to downstream packages +like gdb [3] + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 +[3] https://public-inbox.org/bug-gnulib/20230114232744.215167-1-raj.khem@gmail.com/T/#u + +Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=2d404c7dd974cc65f894526f4a1b76bc1dcd8d82] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + libiberty/sha1.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/libiberty/sha1.c b/libiberty/sha1.c +index 504f06d3b9b..790ada82443 100644 +--- a/libiberty/sha1.c ++++ b/libiberty/sha1.c +@@ -229,7 +229,17 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) + if (len >= 64) + { + #if !_STRING_ARCH_unaligned ++/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 ++ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. ++ clang versions < 8.0.0 have the same bug. */ ++#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ ++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ ++ && !defined __clang__) \ ++ || (defined __clang__ && __clang_major__ < 8)) + # define alignof(type) offsetof (struct { char c; type x; }, x) ++#else ++# define alignof(type) _Alignof(type) ++#endif + # define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0) + if (UNALIGNED_P (buffer)) + while (len > 64) +-- +2.39.0 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-invalid-sigprocmask-call.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-invalid-sigprocmask-call.patch new file mode 100644 index 00000000..ed1310ce --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-invalid-sigprocmask-call.patch @@ -0,0 +1,49 @@ +From 5bdd15553daef7370ca3c1f12d8f14247fdd4907 Mon Sep 17 00:00:00 2001 +From: Yousong Zhou <yszhou4tech@gmail.com> +Date: Fri, 24 Mar 2017 10:36:03 +0800 +Subject: [PATCH 8/9] Fix invalid sigprocmask call +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The POSIX document says + + The pthread_sigmask() and sigprocmask() functions shall fail if: + + [EINVAL] + The value of the how argument is not equal to one of the defined values. + +and this is how musl-libc is currently doing. Fix the call to be safe +and correct + + [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html + +gdb/ChangeLog: +2017-03-24 Yousong Zhou <yszhou4tech@gmail.com> + + * common/signals-state-save-restore.c (save_original_signals_state): + Fix invalid sigprocmask call. + +Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek] +Signed-off-by: André Draszik <adraszik@tycoint.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gdbsupport/signals-state-save-restore.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc +index 92e799d3551..a4a0234272a 100644 +--- a/gdbsupport/signals-state-save-restore.cc ++++ b/gdbsupport/signals-state-save-restore.cc +@@ -38,7 +38,7 @@ save_original_signals_state (bool quiet) + int i; + int res; + +- res = gdb_sigmask (0, NULL, &original_signal_mask); ++ res = gdb_sigmask (SIG_BLOCK, NULL, &original_signal_mask); + if (res == -1) + perror_with_name (("sigprocmask")); + +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch new file mode 100644 index 00000000..941a3b9c --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch @@ -0,0 +1,65 @@ +From 0532b1db08b9d8efc670f7288fe2d8168b8ed0d1 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Thu, 21 Jul 2022 11:45:01 +0530 +Subject: [PATCH 8/8] =?UTF-8?q?[Patch,MicroBlaze]:=20Depth:=20=20Total=20n?= + =?UTF-8?q?umber=20of=20inline=20functions=20[refer=20inline-frame.c]=20st?= + =?UTF-8?q?ate->skipped=5Fframes=20:=20Number=20of=20inline=20functions=20?= + =?UTF-8?q?skipped.=20the=20current=20unwind=5Fpc=20is=20causing=20an=20is?= + =?UTF-8?q?sue=20when=20we=20try=20to=20step=20into=20inline=20functions[D?= + =?UTF-8?q?epth=20is=20becoming=200].=20It=E2=80=99s=20incrementing=20pc?= + =?UTF-8?q?=20by=208=20even=20with=20si=20instruction.?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- + gdb/microblaze-tdep.c | 14 +++----------- + 1 file changed, 3 insertions(+), 11 deletions(-) + +diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c +index d83072cdaef..38ba38e8c7d 100644 +--- a/gdb/microblaze-tdep.c ++++ b/gdb/microblaze-tdep.c +@@ -513,16 +513,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, + static CORE_ADDR + microblaze_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) + { +- gdb_byte buf[4]; + CORE_ADDR pc; +- +- frame_unwind_register (next_frame, MICROBLAZE_PC_REGNUM, buf); +- pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr); +- /* For sentinel frame, return address is actual PC. For other frames, +- return address is pc+8. This is a workaround because gcc does not +- generate correct return address in CIE. */ +- if (frame_relative_level (next_frame) >= 0) +- pc += 8; ++ pc=frame_unwind_register_unsigned (next_frame, MICROBLAZE_PC_REGNUM); + return pc; + } + +@@ -553,7 +545,6 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) + ostart_pc = microblaze_analyze_prologue (gdbarch, func_start, 0xffffffffUL, + &cache); + +- + if (ostart_pc > start_pc) + return ostart_pc; + return start_pc; +@@ -660,7 +651,8 @@ static const struct frame_unwind microblaze_frame_unwind = + microblaze_frame_this_id, + microblaze_frame_prev_register, + NULL, +- default_frame_sniffer ++ default_frame_sniffer, ++ NULL, + }; + + static CORE_ADDR +-- +2.37.1 (Apple Git-137.1) + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch new file mode 100644 index 00000000..f53d3bd1 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch @@ -0,0 +1,40 @@ +From bc3b1f6aacf2d8fe66b022fbfcf28cd82c76e52f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 29 Nov 2018 18:00:23 -0800 +Subject: [PATCH 9/9] gdbserver ctrl-c handling + +This problem was created by the upstream commit 78708b7c8c +After applying the commit, it will send SIGINT to the process +group(-signal_pid). +But if we use gdbserver send SIGINT, and the attached process is not a +process +group leader, then the "kill (-signal_pid, SIGINT)" returns error and +fails to +interrupt the attached process. + +Upstream-Status: Submitted +[https://sourceware.org/bugzilla/show_bug.cgi?id=18945] + +Author: Josh Gao +Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + gdbserver/linux-low.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc +index 7726a4a0c36..f750e074a03 100644 +--- a/gdbserver/linux-low.cc ++++ b/gdbserver/linux-low.cc +@@ -5496,7 +5496,7 @@ linux_process_target::request_interrupt () + { + /* Send a SIGINT to the process group. This acts just like the user + typed a ^C on the controlling terminal. */ +- ::kill (-signal_pid, SIGINT); ++ ::kill (signal_pid, SIGINT); + } + + bool +-- +2.36.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch b/meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch new file mode 100644 index 00000000..c2db4c0d --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch @@ -0,0 +1,39 @@ +From 1add37b567a7dee39d99f37b37802034c3fce9c4 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab <schwab@linux-m68k.org> +Date: Sun, 20 Mar 2022 14:01:54 +0100 +Subject: [PATCH] Add support for readline 8.2 + +In readline 8.2 the type of rl_completer_word_break_characters changed to +include const. + +Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=1add37b567a7dee39d99f37b37802034c3fce9c4] +Signed-off-by: Alexander Kanavin <alex@linutronix.de> +--- + gdb/completer.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gdb/completer.c b/gdb/completer.c +index d3900ae2014..a51c16ac7f8 100644 +--- a/gdb/completer.c ++++ b/gdb/completer.c +@@ -36,7 +36,7 @@ + calling a hook instead so we eliminate the CLI dependency. */ + #include "gdbcmd.h" + +-/* Needed for rl_completer_word_break_characters() and for ++/* Needed for rl_completer_word_break_characters and for + rl_filename_completion_function. */ + #include "readline/readline.h" + +@@ -2011,7 +2011,7 @@ gdb_completion_word_break_characters_throw () + rl_basic_quote_characters = NULL; + } + +- return rl_completer_word_break_characters; ++ return (char *) rl_completer_word_break_characters; + } + + char * +-- +2.31.1 + diff --git a/meta-microblaze/recipes-devtools/gdb/gdb_%.bbappend b/meta-microblaze/recipes-devtools/gdb/gdb_%.bbappend new file mode 100644 index 00000000..33fbe158 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb_%.bbappend @@ -0,0 +1,4 @@ +MICROBLAZEPATCHES = "" +MICROBLAZEPATCHES:microblaze = "gdb-microblaze.inc" + +require ${MICROBLAZEPATCHES} diff --git a/meta-microblaze/recipes-devtools/gdb/gdb_12.1.bb b/meta-microblaze/recipes-devtools/gdb/gdb_12.1.bb new file mode 100644 index 00000000..9c6db4ca --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb_12.1.bb @@ -0,0 +1,39 @@ +require gdb-common.inc + +inherit gettext pkgconfig + +#LDFLAGS:append = " -s" +#export CFLAGS:append=" -L${STAGING_LIBDIR}" + +# cross-canadian must not see this +PACKAGES =+ "gdbserver" +FILES:gdbserver = "${bindir}/gdbserver" + +require gdb.inc + +inherit python3-dir + +EXTRA_OEMAKE:append:libc-musl = "\ + gt_cv_func_gnugettext1_libc=yes \ + gt_cv_func_gnugettext2_libc=yes \ + gl_cv_func_working_strerror=yes \ + gl_cv_func_strerror_0_works=yes \ + gl_cv_func_gettimeofday_clobber=no \ + " + +do_configure:prepend() { + if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then + cat > ${WORKDIR}/python << EOF +#!/bin/sh +case "\$2" in + --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;; + --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;; + --exec-prefix) echo "${exec_prefix}" ;; + *) exit 1 ;; +esac +exit 0 +EOF + chmod +x ${WORKDIR}/python + fi +} + diff --git a/meta-microblaze/recipes-devtools/m4/files/m4-stack-direction-microblaze.patch b/meta-microblaze/recipes-devtools/m4/files/m4-stack-direction-microblaze.patch new file mode 100644 index 00000000..2821e55f --- /dev/null +++ b/meta-microblaze/recipes-devtools/m4/files/m4-stack-direction-microblaze.patch @@ -0,0 +1,17 @@ +Need a broader match for microblazeel. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +--- m4-1.4.19/m4/stack-direction.m4.orig 2021-11-30 13:19:56.005640547 -0800 ++++ m4-1.4.19/m4/stack-direction.m4 2021-11-30 13:20:03.917640741 -0800 +@@ -35,7 +35,7 @@ + m68* | \ + m88k | \ + mcore | \ +- microblaze | \ ++ microblaze* | \ + mips* | \ + mmix | \ + mn10200 | \ diff --git a/meta-microblaze/recipes-devtools/m4/m4_%.bbappend b/meta-microblaze/recipes-devtools/m4/m4_%.bbappend new file mode 100644 index 00000000..c0afc82d --- /dev/null +++ b/meta-microblaze/recipes-devtools/m4/m4_%.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/files" +SRC_URI:append:microblaze = " \ + file://m4-stack-direction-microblaze.patch \ +" diff --git a/meta-microblaze/recipes-devtools/python/python3_%.bbappend b/meta-microblaze/recipes-devtools/python/python3_%.bbappend new file mode 100644 index 00000000..9ea0eac5 --- /dev/null +++ b/meta-microblaze/recipes-devtools/python/python3_%.bbappend @@ -0,0 +1,3 @@ +# Microblaze's libpython seems to be named slightly differently +# /usr/lib/python3.11/config-3.11/libpython3.11.a +FILES:libpython3-staticdev:append:microblaze = " ${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}/libpython${PYTHON_MAJMIN}.a" diff --git a/meta-xilinx-bsp/recipes-microblaze/qemu/qemu_%.bbappend b/meta-microblaze/recipes-devtools/qemu/qemu-microblaze.inc index 3d3a54fe..3d3a54fe 100644 --- a/meta-xilinx-bsp/recipes-microblaze/qemu/qemu_%.bbappend +++ b/meta-microblaze/recipes-devtools/qemu/qemu-microblaze.inc diff --git a/meta-microblaze/recipes-devtools/qemu/qemu-native_%.bbappend b/meta-microblaze/recipes-devtools/qemu/qemu-native_%.bbappend new file mode 100644 index 00000000..45a4dcaf --- /dev/null +++ b/meta-microblaze/recipes-devtools/qemu/qemu-native_%.bbappend @@ -0,0 +1 @@ +include qemu-microblaze.inc diff --git a/meta-microblaze/recipes-devtools/qemu/qemu-system-native_%.bbappend b/meta-microblaze/recipes-devtools/qemu/qemu-system-native_%.bbappend new file mode 100644 index 00000000..45a4dcaf --- /dev/null +++ b/meta-microblaze/recipes-devtools/qemu/qemu-system-native_%.bbappend @@ -0,0 +1 @@ +include qemu-microblaze.inc diff --git a/meta-microblaze/recipes-devtools/qemu/qemu_%.bbappend b/meta-microblaze/recipes-devtools/qemu/qemu_%.bbappend new file mode 100644 index 00000000..45a4dcaf --- /dev/null +++ b/meta-microblaze/recipes-devtools/qemu/qemu_%.bbappend @@ -0,0 +1 @@ +include qemu-microblaze.inc diff --git a/meta-microblaze/recipes-devtools/tcf-agent/tcf-agent_%.bbappend b/meta-microblaze/recipes-devtools/tcf-agent/tcf-agent_%.bbappend new file mode 100644 index 00000000..0938bd1a --- /dev/null +++ b/meta-microblaze/recipes-devtools/tcf-agent/tcf-agent_%.bbappend @@ -0,0 +1,2 @@ +MAKE_ARCH:microblaze = "microblaze" + diff --git a/meta-microblaze/recipes-extended/xz/xz_%.bbappend b/meta-microblaze/recipes-extended/xz/xz_%.bbappend new file mode 100644 index 00000000..be8fffd8 --- /dev/null +++ b/meta-microblaze/recipes-extended/xz/xz_%.bbappend @@ -0,0 +1,5 @@ +# Microblaze doesn't support versioned symbols +# +# ../../../xz-5.4.1/src/liblzma/common/stream_encoder_mt.c:1283:1: error: symver is only supported on ELF platforms +# +EXTRA_OECONF:append:microblaze = " --disable-symbol-versions" diff --git a/meta-microblaze/recipes-extended/zstd/zstd_1.5.%.bbappend b/meta-microblaze/recipes-extended/zstd/zstd_1.5.%.bbappend new file mode 100644 index 00000000..c5fec141 --- /dev/null +++ b/meta-microblaze/recipes-extended/zstd/zstd_1.5.%.bbappend @@ -0,0 +1,2 @@ +# Using atomic C++ templates requires libatomic on microblaze +CXXFLAGS:append:microblaze = " -latomic" diff --git a/meta-microblaze/recipes-graphics/mesa/mesa_%.bbappend b/meta-microblaze/recipes-graphics/mesa/mesa_%.bbappend new file mode 100644 index 00000000..7c80fb6c --- /dev/null +++ b/meta-microblaze/recipes-graphics/mesa/mesa_%.bbappend @@ -0,0 +1,14 @@ +# mesa doesn't compile with microblaze compiler + +# +# When building POKY, it's advised that the user set the following: +# +# POKY_DEFAULT_DISTRO_FEATURES:microblaze = "ptest" +# +# The original version is: POKY_DEFAULT_DISTRO_FEATURES = "opengl ptest multiarch wayland vulkan" +# +# opengl, wayland and vulkan are not supported, primarily due to mesa not compiling. +# +# multiarch is not something we have on microblaze, so can be left or removed +# +COMPATIBLE_MACHINE:microblaze = "none" diff --git a/meta-xilinx-bsp/README.booting.md b/meta-xilinx-bsp/README.booting.md deleted file mode 100644 index 04c32c51..00000000 --- a/meta-xilinx-bsp/README.booting.md +++ /dev/null @@ -1,244 +0,0 @@ -Booting meta-xilinx boards -========================== - -Contents --------- - -* [Loading via JTAG](#loading-via-jtag) - * [XSDB](#xsdb) - * [Load Bitstream](#load-bitstream) - * [Load U-Boot (MicroBlaze)](#load-u-boot-microblaze) - * [Load U-Boot (Zynq)](#load-u-boot-zynq) - * [U-Boot Console](#u-boot-console) - * [Kernel, Root Filesystem and Device Tree](#kernel-root-filesystem-and-device-tree) - * [Booting via U-Boot](#booting-via-u-boot) -* [Loading via SD](#loading-via-sd) - * [Preparing SD/MMC](#preparing-sdmmc) - * [Installing U-Boot](#installing-u-boot) - * [Installing Kernel and Device Tree](#installing-kernel-and-device-tree) - * [Installing Root Filesystem](#installing-root-filesystem) - * [U-Boot Configuration File](#u-boot-configuration-file) - * [Booting](#booting) -* [Loading via TFTP](#loading-via-tftp) - * [Kernel, Root Filesystem and Device Tree](#kernel-root-filesystem-and-device-tree-1) - * [Booting via U-Boot](#booting-via-u-boot-1) - - -Loading via JTAG ----------------- -This boot flow requires the use of the Xilinx tools, specifically XSDB and the -associated JTAG device drivers. This also requires access to the JTAG interface -on the board, a number of Xilinx and third-party boards come with on-board JTAG -modules. - -### XSDB -Start `xsdb` and connect. Ensure that the target chip is visible. - - $ xsdb - xsdb% connect - xsdb% targets - -### Load Bitstream -**(Note: This step is only required for platforms which have a bitstream e.g. -MicroBlaze.)** - -Download the bitstream for the system using XSDB with the `fpga -f` command. If -a bitstream is available from meta-xilinx is will be located in the -`deploy/images/<machine-name>/` directory. - - xsdb% fpga -f download.bit - -### Load U-Boot (MicroBlaze) -Download `u-boot.elf` to the target CPU via the use of XSDB. - - xsdb% targets -set -filter {name =~ "MicroBlaze*"} - xsdb% rst - xsdb% dow u-boot.elf - xsdb% con - -### Load U-Boot (Zynq) -Ensure the board is configured to boot from JTAG. The Zynq platform requires the -loading of SPL first, this can be done by loading the `u-boot-spl.bin` and -executing it at location `0x0`. `u-boot-spl.bin` is not output to the deploy -directory by default, it can be obtained from the work directory for U-Boot -(`git/spl/u-boot-spl.bin`) or can be extracted from `boot.bin` using -`dd if=boot.bin of=u-boot-spl.bin bs=1 skip=2240`. - - xsdb% targets -set -filter {name =~ "ARM*#0"} - xsdb% dow -data u-boot-spl.bin 0x0 - xsdb% rwr pc 0x0 - xsdb% con - -On the UART console the following should appear, indicating SPL was loaded. - - U-Boot SPL 2016.01 - Trying to boot from unknown boot device - SPL: Unsupported Boot Device! - SPL: failed to boot from all boot devices - ### ERROR ### Please RESET the board ### - -Once SPL has loaded U-Boot can now be loaded into memory and executed. Download -`u-boot.elf` to the target. - - xsdb% stop - xsdb% dow u-boot.elf - xsdb% con - -### U-Boot Console -U-Boot will load and the console will be available on the UART interface. - - ... - Hit any key to stop autoboot: 0 - U-Boot> - -### Kernel, Root Filesystem and Device Tree -Whilst it is possible to load the images via JTAG this connection is slow and -this process can take a long time to execute (more than 10 minutes). If your -system has ethernet it is recommended that you use TFTP to load these images -using U-Boot. - -Once U-Boot has been loaded, pause the execution using XSDB and use the `dow` -command to load the images into the targets memory. Once the images are loaded -continue the execution and return to the U-Boot console. - -MicroBlaze (kc705-microblazeel): - - xsdb% stop - xsdb% dow -data linux.bin.ub 0x85000000 - xsdb% dow -data core-image-minimal-kc705-microblazeel.cpio.gz.u-boot 0x86000000 - xsdb% dow -data kc705-microblazeel.dtb 0x84000000 - xsdb% con - -Zynq: - - xsdb% stop - xsdb% dow -data uImage 0x2000000 - xsdb% dow -data core-image-minimal-<machine name>.cpio.gz.u-boot 0x3000000 - xsdb% dow -data <machine name>.dtb 0x2A00000 - xsdb% con - -### Booting via U-Boot -At the U-Boot console use the `bootm` command to execute the kernel. - -MicroBlaze (kc705-microblazeel): - - U-Boot> bootm 0x85000000 0x86000000 0x84000000 - -Zynq: - - U-Boot> bootm 0x2000000 0x3000000 0x2A00000 - - -Loading via SD ---------------------- -**(Note: This section only applies to Zynq.)** - -### Preparing SD/MMC -Setup the card with the first partition formatted as FAT16. If you intend to -boot with the root filesystem located on the SD card, also create a second -partition formatted as EXT4. - -It is recommended that the first partition be at least 64MB in size, however -this value will depend on whether using a ramdisk for the root filesystem and -how large the ramdisk is. - -This section describes how to manually prepare and populate an SD card image. -There are automation tools in OpenEmbedded that can generate disk images already -formatted and prepared such that they can be written directly to a disk. Refer -to the Yocto Project Development Manual for more details: - http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#creating-partitioned-images - -### Installing U-Boot -Add the following files to the first partition: - -* `boot.bin` -* `u-boot.img` - -### Installing Kernel and Device Tree -Add the following files to the first partition: - -* `uImage` -* `<machine name>.dtb` - -### Installing Root Filesystem -If using a ramdisk also add the `.cpio.gz.u-boot` type of root filesystem image -to the first partition. - -* `core-image-minimal-<machine name>.cpio.gz.u-boot` - -If using the SD card as the root filesystem, populate the second partition with -the content of the root filesystem. To install the root filesystem extract the -corresponding tarball into the root of the second partition (the following -command assumes that the second partition is mounted at /media/root). - - tar x -C /media/root -f core-image-minimal-<machine name>.tar.gz - -### U-Boot Configuration File -Also create the file `uEnv.txt` on the first partition of the SD card partition, -with the following contents. Replacing the names of files where appropriate. - - kernel_image=uImage - devicetree_image=<machine name>.dtb - -If using a ramdisk root filesystem setup the `ramdisk_image` variable. - - ramdisk_image=core-image-minimal-<machine name>.cpio.gz.u-boot - -If using the SD card as the root filesystem setup the kernel boot args, and -`uenvcmd` variable. - - bootargs=root=/dev/mmcblk0p2 rw rootwait - uenvcmd=fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000 - -### Booting -Insert the SD card and connect UART to a terminal program and power on the -board. (For boards that have configurable boot jumper/switches ensure the board -is configured for SD). - -Initially U-Boot SPL will load, which will in turn load U-Boot. U-Boot will use -the `uEnv.txt` to automatically load and execute the kernel. - - -Loading via TFTP ----------------- -**(Note: This boot flow requires ethernet on the baord and a TFTP server)** - -Boot your system into U-Boot, using one of boot methods (e.g. JTAG, SD, QSPI). - -### Kernel, Root Filesystem and Device Tree -Place the following images into the root of the TFTP server directory: - -* `core-image-minimal-<machine name>.cpio.gz.u-boot` -* `uImage` (Zynq) or `linux.bin.ub` (MicroBlaze) -* `<machine name>.dtb` - -### Booting via U-Boot -The serial console of the target board will display the U-Boot console. -Configure the `ipaddr` and `serverip` of the U-Boot environment. - - U-Boot> set serverip <server ip> - U-Boot> set ipaddr <board ip> - -Using the U-Boot console; load the Kernel, root filesystem and the DTB into -memory. And then boot Linux using the `bootm` command. (Note the load addresses -will be dependant on machine used) - -MicroBlaze (kc705-microblazeel): - - U-Boot> tftpboot 0x85000000 linux.bin.ub - U-Boot> tftpboot 0x86000000 core-image-minimal-kc705-microblazeel.cpio.gz.u-boot - U-Boot> tftpboot 0x84000000 kc705-microblazeel.dtb - U-Boot> bootm 0x85000000 0x86000000 0x84000000 - -Zynq: - - U-Boot> tftpboot 0x2000000 uImage - U-Boot> tftpboot 0x3000000 core-image-minimal-<machine name>.cpio.gz.u-boot - U-Boot> tftpboot 0x2A00000 <machine name>.dtb - U-Boot> bootm 0x2000000 0x3000000 0x2A00000 - -U-Boot will prepare the Kernel for boot and then it will being to execute. - - ... - Starting kernel... - diff --git a/meta-xilinx-bsp/README.building.md b/meta-xilinx-bsp/README.building.md deleted file mode 100644 index c4aa33ad..00000000 --- a/meta-xilinx-bsp/README.building.md +++ /dev/null @@ -1,32 +0,0 @@ -Build Instructions -================== - -The following instructions require OE-Core meta and BitBake. Poky provides these -components, however they can be acquired separately. - -Initialize a build using the `oe-init-build-env` script. Once initialized -configure `bblayers.conf` by adding the `meta-xilinx` layer. e.g.: - - BBLAYERS ?= " \ - <path to layer>/oe-core/meta \ - <path to layer>/meta-xilinx \ - " - -To build a specific target BSP configure the associated machine in `local.conf`: - - MACHINE ?= "zc702-zynq7" - -Build the target file system image using `bitbake`: - - $ bitbake core-image-minimal - -Once complete the images for the target machine will be available in the output -directory `tmp/deploy/images/<machine name>/`. - -Additional Information ----------------------- - -For more complete details on setting up and using Yocto/OE refer to the Yocto -Project Quick Start guide available at: - http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html - diff --git a/meta-xilinx-bsp/README.md b/meta-xilinx-bsp/README.md index 7df98cea..2d869913 100644 --- a/meta-xilinx-bsp/README.md +++ b/meta-xilinx-bsp/README.md @@ -1,86 +1,66 @@ -meta-xilinx -=========== - -This layer provides support for MicroBlaze, Zynq and ZynqMP. - -Additional documentation: - -* [Building](README.building.md) -* [Booting](README.booting.md) - -Supported Boards/Machines -========================= - -Boards/Machines supported by this layer: - -* MicroBlaze: - * [Xilinx ML605 (QEMU)](conf/machine/ml605-qemu-microblazeel.conf) - `ml605-qemu-microblazeel` (QEMU support) - * [Xilinx S3A DSP 1800 (QEMU)](conf/machine/s3adsp1800-qemu-microblazeeb.conf) - `s3adsp1800-qemu-microblazeeb` (QEMU support) - * [Xilinx KC705](conf/machine/kc705-microblazeel.conf) - `kc705-microblazeel` -* Zynq: - * [Zynq (QEMU)](conf/machine/qemu-zynq7.conf) - `qemu-zynq7` (QEMU Support) - * [Xilinx ZC702](conf/machine/zc702-zynq7.conf) - `zc702-zynq7` (with QEMU support) - * [Xilinx ZC706](conf/machine/zc706-zynq7.conf) - `zc706-zynq7` (with QEMU support) - * [Avnet MicroZed](conf/machine/microzed-zynq7.conf) - `microzed-zynq7` - * [Avnet PicoZed](conf/machine/picozed-zynq7.conf) - `picozed-zynq7` - * [Avnet/Digilent ZedBoard](conf/machine/zedboard-zynq7.conf) - `zedboard-zynq7` - * [Digilent Zybo](conf/machine/zybo-zynq7.conf) - `zybo-zynq7` - * [Digilent Zybo Linux BD](conf/machine/zybo-linux-bd-zynq7.conf) - `zybo-linux-bd-zynq7` -* ZynqMP: - * [Xilinx ZCU102](conf/machine/zcu102-zynqmp.conf) - `zcu102-zynqmp` (QEMU support) - -Additional information on Xilinx architectures can be found at: - http://www.xilinx.com/support/index.htm - -For Zybo Linux BD reference design, please see meta-xilinx-contrib layer - -Maintainers, Mailing list, Patches -================================== - -Please send any patches, pull requests, comments or questions for this layer to -the [meta-xilinx mailing list](https://lists.yoctoproject.org/listinfo/meta-xilinx): - - meta-xilinx@lists.yoctoproject.org - -Maintainers: - - Nathan Rossi <nathan@nathanrossi.com> - Manjukumar Harthikote Matha <manjukumar.harthikote-matha@xilinx.com> - -Dependencies -============ +# meta-xilinx-bsp + +This layer enables AMD Xilinx MicroBlaze, Zynq, ZynqMP and Versal device +evaluation boards and provides related metadata. + +## Additional documentation + +* [Building Image Instructions](../README.building.md) +* [Booting Image Instructions](../README.booting.md) +--- + +## AMD Xilinx Evaluation Boards BSP Machines files + +The following boards are supported by the meta-xilinx-bsp layer: + +> **Variable usage examples:** +> +> Machine Configuration file: `MACHINE = "zcu102-zynqmp"` +> +> Reference XSA: `HDF_MACHINE = "zcu102-zynqmp"` +> +> HW Board Device tree: `YAML_DT_BOARD_FLAGS = "{BOARD zcu102-rev1.0}"` + +| Devices | Evaluation Board | Machine Configuration file | Reference XSA | HW Board Device tree | QEMU tested | HW tested | +|------------|-------------------------------------------------------------------------------|--------------------------------------------------------------|-----------------------|-------------------------------------|-------------|-----------| +| MicroBlaze | [KC705](https://www.xilinx.com/products/boards-and-kits/ek-k7-kc705-g.html) | [kc705-microblazeel](conf/machine/kc705-microblazeel.conf) | `kc705-microblazeel` | `kc705-full` | Yes | Yes | +| | [AC701](https://www.xilinx.com/products/boards-and-kits/ek-a7-ac701-g.html) | [ac701-microblazeel](conf/machine/ac701-microblazeel.conf) | `ac701-microblazeel` | `ac701-full` | Yes | Yes | +| | [KCU105](https://www.xilinx.com/products/boards-and-kits/kcu105.html) | [kcu105-microblazeel](conf/machine/kcu105-microblazeel.conf) | `kcu105-microblazeel` | `kcu105` | Yes | Yes | +| | [VCU118](https://www.xilinx.com/products/boards-and-kits/vcu118.html) | [vcu118-microblazeel](conf/machine/vcu118-microblazeel.conf) | `vcu118-microblazeel` | `vcu118-rev2.0` | Yes | Yes | +| Zynq-7000 | [ZC702](https://www.xilinx.com/products/boards-and-kits/ek-z7-zc702-g.html) | [zc702-zynq7](conf/machine/zc702-zynq7.conf) | `zc702-zynq7` | `zc702` | Yes | Yes | +| | [ZC706](https://www.xilinx.com/products/boards-and-kits/ek-z7-zc706-g.html) | [zc706-zynq7](conf/machine/zc706-zynq7.conf) | `zc706-zynq7` | `zc706` | Yes | Yes | +| ZynqMP | [ZCU102](https://www.xilinx.com/products/boards-and-kits/ek-u1-zcu102-g.html) | [zcu102-zynqmp](conf/machine/zcu102-zynqmp.conf) | `zcu102-zynqmp` | `zcu102-rev1.0` | Yes | Yes | +| | [ZCU104](https://www.xilinx.com/products/boards-and-kits/zcu104.html) | [zcu104-zynqmp](conf/machine/zcu104-zynqmp.conf) | `zcu104-zynqmp` | `zcu104-revc` | Yes | Yes | +| | [ZCU106](https://www.xilinx.com/products/boards-and-kits/zcu106.html) | [zcu106-zynqmp](conf/machine/zcu106-zynqmp.conf) | `zcu106-zynqmp` | `zcu106-reva` | Yes | Yes | +| | [ZCU111](https://www.xilinx.com/products/boards-and-kits/zcu111.html) | [zcu111-zynqmp](conf/machine/zcu111-zynqmp.conf) | `zcu111-zynqmp` | `zcu111-reva` | Yes | Yes | +| | [ZCU208](https://www.xilinx.com/products/boards-and-kits/zcu208.html) | [zcu208-zynqmp](conf/machine/zcu208-zynqmp.conf) | `zcu208-zynqmp` | `zcu208-reva` | Yes | Yes | +| | [ZCU216](https://www.xilinx.com/products/boards-and-kits/zcu216.html) | [zcu216-zynqmp](conf/machine/zcu216-zynqmp.conf) | `zcu216-zynqmp` | `zcu216-reva` | Yes | Yes | +| | [ZCU670](https://www.xilinx.com/products/boards-and-kits/zcu670.html) | [zcu670-zynqmp](conf/machine/zcu670-zynqmp.conf) | `zcu670-zynqmp` | `zcu670-revb` | Yes | Yes | +| Versal | [VCK190](https://www.xilinx.com/products/boards-and-kits/vck190.html) | [vck190-versal](conf/machine/vck190-versal.conf) | `vck190-versal` | `versal-vck190-reva-x-ebm-01-reva` | Yes | Yes | +| | [VMK180](https://www.xilinx.com/products/boards-and-kits/vmk180.html) | [vmk180-versal](conf/machine/vmk180-versal.conf) | `vmk180-versal` | `versal-vmk180-reva-x-ebm-01-reva` | Yes | Yes | +| | [VCK5000](https://www.xilinx.com/products/boards-and-kits/vck5000.html) | [vck5000-versal](conf/machine/vck5000-versal.conf) | `vck5000-versal` | `versal-vck5000-reva-x-ebm-01-reva` | No | No | +| | [VPK120](https://www.xilinx.com/products/boards-and-kits/vpk120.html) | [vpk120-versal](conf/machine/vpk120-versal.conf) | `vpk120-versal` | `versal-vpk120-reva` | Yes | Yes | +| | [VPK180](https://www.xilinx.com/products/boards-and-kits/vpk180.html) | [vpk180-versal](conf/machine/vpk180-versal.conf) | `vpk180-versal` | `versal-vpk180-reva` | Yes | Yes | +| | [VEK280](https://www.xilinx.com/products/boards-and-kits/vek280.html) | [vek280-versal](conf/machine/vek280-versal.conf) | `vek280-versal` | `versal-vek280-revb` | Yes | Yes | +| | [VHK158](https://www.xilinx.com/products/boards-and-kits/vhk158.html) | [vhk158-versal](conf/machine/vhk158-versal.conf) | `vhk158-versal` | `versal-vhk158-reva` | Yes | Yes | + +> **Note:** Additional information on Xilinx architectures can be found at: + https://www.xilinx.com/products/silicon-devices.html +--- +## Dependencies This layer depends on: - URI: git://git.openembedded.org/bitbake - - URI: git://git.openembedded.org/openembedded-core - layers: meta - -Recipe Licenses -=============== - -Due to licensing restrictions some recipes in this layer rely on closed source -or restricted content provided by Xilinx. In order to use these recipes you must -accept or agree to the licensing terms (e.g. EULA, Export Compliance, NDA, -Redistribution, etc). This layer **does not enforce** any legal requirement, it -is the **responsibility of the user** the ensure that they are in compliance -with any licenses or legal requirements for content used. - -In order to use recipes that rely on restricted content the `xilinx` license -flag must be white-listed in the build configuration (e.g. `local.conf`). This -can be done on a per package basis: - - LICENSE_FLAGS_WHITELIST += "xilinx_pmu-rom" - -or generally: - - LICENSE_FLAGS_WHITELIST += "xilinx" + URI: https://git.yoctoproject.org/poky + layers: meta, meta-poky + branch: langdale -Generally speaking Xilinx content that is provided as a restricted download -cannot be obtained without a Xilinx account, in order to use this content you -must first download it with your Xilinx account and place the downloaded content -in the `downloads/` directory of your build or on a `PREMIRROR`. Attempting to -fetch the content using bitbake will fail, indicating the URL from which to -acquire the content. + URI: https://git.openembedded.org/meta-openembedded + layers: meta-oe + branch: langdale + URI: + https://git.yoctoproject.org/meta-xilinx (official version) + https://github.com/Xilinx/meta-xilinx (development and amd xilinx release) + layers: meta-xilinx-microblaze, meta-xilinx-core + branch: langdale or amd xilinx release version (e.g. rel-v2023.1) diff --git a/meta-xilinx-bsp/README.qemu.md b/meta-xilinx-bsp/README.qemu.md deleted file mode 100644 index 992e0618..00000000 --- a/meta-xilinx-bsp/README.qemu.md +++ /dev/null @@ -1,25 +0,0 @@ - -ZynqMP - PMU ROM ----------------- - -Since Xilinx tool release v2017.1 multiple components (arm-trusted-firmware, -linux, u-boot, etc.) require the PMU firmware to be loaded. For QEMU this also -means that the PMU ROM must be loaded so that the PMU firmware can be used. - -The PMU ROM is not available for download separately from a location that can be -accessed without a Xilinx account. As such the PMU ROM must be obtained manually -by the user. The PMU ROM is available in the ZCU102 PetaLinux BSP, but can be -extracted without the need for the PetaLinux tools. - -Download the BSP (you will need a Xilinx account and agreement to terms): - -https://www.xilinx.com/member/forms/download/xef.html?filename=xilinx-zcu102-v2017.1-final.bsp&akdm=1 - -Once downloaded the PMU ROM can be extracted using the following command and -place `pmu-rom.elf` in the `deploy/images/zcu102-zynqmp/` directory. - -``` -# tar -O -xf xilinx-zcu102-v2017.1-final.bsp \ - xilinx-zcu102-2017.1/pre-built/linux/images/pmu_rom_qemu_sha3.elf > pmu-rom.elf -``` - diff --git a/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass b/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass deleted file mode 100644 index 59dfabfc..00000000 --- a/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass +++ /dev/null @@ -1,10 +0,0 @@ -# Define the 'qemu-sd' conversion type -# -# This conversion type pads any image to the 256K boundary to ensure that the -# image file can be used directly with QEMU's SD emulation which requires the -# block device to match that of valid SD card sizes (which are multiples of -# 256K). - -CONVERSIONTYPES_append = " qemu-sd" -CONVERSION_CMD_qemu-sd = "cp ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd; truncate -s %256K ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd" -CONVERSION_DEPENDS_qemu-sd = "coreutils-native" diff --git a/meta-xilinx-bsp/classes/qemuboot-xilinx.bbclass b/meta-xilinx-bsp/classes/qemuboot-xilinx.bbclass deleted file mode 100644 index 024626cb..00000000 --- a/meta-xilinx-bsp/classes/qemuboot-xilinx.bbclass +++ /dev/null @@ -1,27 +0,0 @@ - -# enable the overrides for the context of the conf only -OVERRIDES .= ":qemuboot-xilinx" - -# setup the target binary -QB_SYSTEM_NAME_prepend = "qemu-xilinx/" - -# Default machine targets for Xilinx QEMU (FDT Generic) -QB_MACHINE_aarch64 = "-machine arm-generic-fdt" -QB_MACHINE_arm = "-machine arm-generic-fdt-7series" -QB_MACHINE_microblaze = "-machine microblaze-generic-fdt-plnx" - -# defaults -QB_DEFAULT_KERNEL ?= "none" - -inherit qemuboot - -# rewrite the qemuboot with the custom sysroot bindir -python do_write_qemuboot_conf_append() { - val = os.path.join(d.getVar('BASE_WORKDIR'), d.getVar('BUILD_SYS'), 'qemu-xilinx-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/') - cf.set('config_bsp', 'STAGING_BINDIR_NATIVE', '%s' % val) - - # write out the updated version from this append - with open(qemuboot, 'w') as f: - cf.write(f) -} - diff --git a/meta-xilinx-bsp/classes/zynqmp-pmu.bbclass b/meta-xilinx-bsp/classes/zynqmp-pmu.bbclass deleted file mode 100644 index 714eb96a..00000000 --- a/meta-xilinx-bsp/classes/zynqmp-pmu.bbclass +++ /dev/null @@ -1,122 +0,0 @@ -# -# This class handles configuring a recipe to build for the ZynqMP PMU -# architecture. The reason for this class is due to limitations of multilib -# with regards to multiple architectures (which do not work correctly). -# -# This class is specifically intended to extend the binutils-cross, gcc-cross, -# newlib, libgloss and pmu-firmware recipes so that binaries can be emitted -# which target the PMU architecture alongside building for the APU architecture -# (ARM64). But the class can be applied globally via BBCLASSEXTEND in for -# example a <machine>.conf. -# -# This class is almost the same as a multilib variant with custom TUNE_* setup -# to allow for a switched TUNE_ARCH. -# - -ORIG_TARGET_ARCH := "${TARGET_ARCH}" - -# zynqmp-pmu target arch (hardcoded based on pre-gen data from arch-microblaze.inc) -DEFAULTTUNE = "microblaze" -ABIEXTENSION = "" -TUNE_ARCH = "microblazeel" -#TUNE_FEATURES_tune-microblaze += "v9.2 barrel-shift pattern-compare" -TUNE_CCARGS = "-mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mno-xl-reorder -mcpu=v9.2 -mxl-soft-mul -mxl-soft-div" -TUNE_LDARGS = "" -TUNE_ASARGS = "" -TUNE_PKGARCH = "microblazeel-v9.2-bs-cmp" -TARGET_OS = "elf" -TARGET_FPU = "fpu-soft" - -# rebuild the MACHINE overrides -MACHINEOVERRIDES = "${MACHINE}${@':${SOC_FAMILY}' if d.getVar('SOC_FAMILY') else ''}:microblaze" - -# override tune provided archs -PACKAGE_EXTRA_ARCHS = "${TUNE_PKGARCH}" - -# baremetal equivalent config (note the tclibc is not included, this is purely -# for recipes/etc that check for the value) -TCLIBC = "baremetal" -LIBCEXTENSION = "" -LIBCOVERRIDE = ":libc-baremetal" -USE_NLS = "no" -IMAGE_LINGUAS = "" -LIBC_DEPENDENCIES = "" - -# gcc-cross specific baremetal setup (due to the override order this is important) -EXTRA_OECONF_pn-${MLPREFIX}gcc-cross-${TARGET_ARCH}_append = " --without-headers" - -EXTRA_OECONF_GCC_FLOAT = "" - -# Setup a multiarch like prefix. -prefix = "/usr/${TARGET_SYS}" -# Make sure GCC can search in the prefix dir (for libgcc) -TOOLCHAIN_OPTIONS += "-B${RECIPE_SYSROOT}${includedir}/ -B${RECIPE_SYSROOT}${libdir}/" -TOOLCHAIN_OPTIONS += "-I =${includedir} -L =${libdir}" - -python multitarget_zynqmp_pmu_virtclass_handler () { - variant = "zynqmp-pmu" - pn = d.getVar("PN") - if not (pn.startswith(variant + "-") or pn.endswith("-" + variant)): - return - - if bb.data.inherits_class('native', e.data) or bb.data.inherits_class('nativesdk', e.data) or bb.data.inherits_class('crosssdk', e.data): - raise bb.parse.SkipPackage("Can't extend native/nativesdk/crosssdk recipes") - - initialpn = e.data.getVar("PN").replace("-" + variant, "").replace(variant + "-", "") - e.data.setVar("MLPREFIX", variant + "-") - e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-" + variant) - - # hide multilib variants, this class is not one but this works around recipes thinking it is (due to MLPREFIX). - e.data.setVar("MULTILIB_VARIANTS", "") - - # work around for -cross recipes that embed the TARGET_ARCH value - if bb.data.inherits_class('cross', e.data): - if initialpn.endswith("-" + d.getVar("ORIG_TARGET_ARCH")): - initialpn = initialpn.replace("-" + d.getVar("ORIG_TARGET_ARCH"), "-" + d.getVar("TARGET_ARCH")) - - e.data.setVar("PN", variant + "-" + initialpn) -} - -addhandler multitarget_zynqmp_pmu_virtclass_handler -multitarget_zynqmp_pmu_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" - -python () { - variant = "zynqmp-pmu" - pn = d.getVar("PN") - if not pn.startswith(variant + "-"): - return - - if pn.endswith("gcc-cross-" + d.getVar("TARGET_ARCH")): - # work around, DEPENDS _remove being immediate in gcc-cross - d.setVar("DEPENDS_remove", "virtual/%slibc-for-gcc" % d.getVar("TARGET_PREFIX")) - - if pn.endswith("libgcc"): - # work around, strip depends on libc via do_package* tasks (this class cannot set ASSUME_PROVIDED += libc) - for i in ["do_package", "do_package_write_ipk", "do_package_write_deb", "do_package_write_rpm"]: - sanitized = " ".join([dep for dep in d.getVarFlag(i, "depends").split() if not dep.startswith("virtual/%s-libc" % variant)]) - d.setVarFlag(i, "depends", sanitized) - - import oe.classextend - - clsextend = oe.classextend.ClassExtender(variant, d) - - clsextend.map_depends_variable("DEPENDS") - clsextend.map_variable("PROVIDES") - - clsextend.rename_packages() - clsextend.rename_package_variables((d.getVar("PACKAGEVARS") or "").split()) - - clsextend.map_packagevars() - clsextend.map_regexp_variable("PACKAGES_DYNAMIC") - clsextend.map_variable("PACKAGE_INSTALL") -} - -# microblaze elf insane definitions not currently in insane.bbclass -PACKAGEQA_EXTRA_MACHDEFFUNCS += "package_qa_get_machine_dict_microblazeelf" -def package_qa_get_machine_dict_microblazeelf(machdata, d): - machdata["elf"] = { - "microblaze": (189, 0, 0, False, 32), - "microblazeeb":(189, 0, 0, False, 32), - "microblazeel":(189, 0, 0, True, 32), - } - return machdata diff --git a/meta-xilinx-bsp/conf/layer.conf b/meta-xilinx-bsp/conf/layer.conf index dac3e246..42990b73 100644 --- a/meta-xilinx-bsp/conf/layer.conf +++ b/meta-xilinx-bsp/conf/layer.conf @@ -5,8 +5,15 @@ BBPATH .= ":${LAYERDIR}" BBFILES += "${LAYERDIR}/recipes-*/*/*.bb" BBFILES += "${LAYERDIR}/recipes-*/*/*.bbappend" -BBFILE_COLLECTIONS += "xilinx" -BBFILE_PATTERN_xilinx = "^${LAYERDIR}/" -BBFILE_PRIORITY_xilinx = "5" +BBFILES_DYNAMIC += " \ +xilinx-tools:${LAYERDIR}/dynamic-layers/meta-xilinx-tools/recipes-*/*/*.bb \ +xilinx-tools:${LAYERDIR}/dynamic-layers/meta-xilinx-tools/recipes-*/*/*.bbappend \ +" -LAYERDEPENDS_xilinx = "core" +BBFILE_COLLECTIONS += "xilinx-bsp" +BBFILE_PATTERN_xilinx-bsp = "^${LAYERDIR}/" +BBFILE_PRIORITY_xilinx-bsp = "5" + +LAYERDEPENDS_xilinx-bsp = "xilinx" + +LAYERSERIES_COMPAT_xilinx-bsp = "scarthgap" diff --git a/meta-xilinx-bsp/conf/machine/ac701-microblazeel.conf b/meta-xilinx-bsp/conf/machine/ac701-microblazeel.conf new file mode 100644 index 00000000..27cb3939 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/ac701-microblazeel.conf @@ -0,0 +1,50 @@ +#@TYPE: Machine +#@NAME: ac701-microblazeel +#@DESCRIPTION: Machine configuration for the AC701 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'ac701-microblazeel:']['ac701-microblazeel' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in microblazeel-generic.conf will be set. + +# Yocto AC701 device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "MIG_7SERIES_0" +DT_PADDING_SIZE:pn-device-tree ?= "0x1000" +DTC_FLAGS:pn-device-tree ?= "" +XSCTH_PROC:pn-device-tree ?= "microblaze_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD ac701-full}" + +# Yocto FS-Boot variables +YAML_SERIAL_CONSOLE_STDIN:pn-fs-boot ?= "axi_uartlite_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fs-boot ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-fs-boot ?= "MIG_7SERIES_0" +YAML_FLASH_MEMORY_CONFIG:pn-fs-boot ?= "axi_quad_spi_0" +XSCTH_PROC:pn-fs-boot ?= "microblaze_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x80000000" +UBOOT_LOADADDRESS ?= "0x80000000" + +# ac701-microblazeel Serial Console +SERIAL_CONSOLES ?= "115200;ttyUL0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Set DDR Base address for u-boot-xlnx-scr variables +DDR_BASEADDR ?= "0x80000000" +SKIP_APPEND_BASEADDR ?= "0" + +# Required generic machine inclusion +require conf/machine/microblaze-generic.conf + +# This machine conf file uses ac701-microblazeel xsa as reference input. +# User can override with ac701 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "ac701-microblazeel" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' ac701_microblazeel']['ac701-microblazeel' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/include/machine-xilinx-board.inc b/meta-xilinx-bsp/conf/machine/include/machine-xilinx-board.inc deleted file mode 100644 index ba9a36be..00000000 --- a/meta-xilinx-bsp/conf/machine/include/machine-xilinx-board.inc +++ /dev/null @@ -1,6 +0,0 @@ -# Default Xilinx Board settings - -EXTRA_IMAGEDEPENDS += "virtual/bootloader" - -IMAGE_BOOT_FILES ?= "${KERNEL_IMAGETYPE} ${UBOOT_BINARY}" - diff --git a/meta-xilinx-bsp/conf/machine/include/machine-xilinx-default.inc b/meta-xilinx-bsp/conf/machine/include/machine-xilinx-default.inc deleted file mode 100644 index 77fbec88..00000000 --- a/meta-xilinx-bsp/conf/machine/include/machine-xilinx-default.inc +++ /dev/null @@ -1,42 +0,0 @@ -# Default Xilinx BSP Machine settings - -MACHINE_FEATURES_BACKFILL_CONSIDERED += "rtc" - -# File System Configuration -IMAGE_FSTYPES ?= "tar.gz cpio cpio.gz.u-boot" - -# Kernel Configuration -XILINX_DEFAULT_KERNEL := "linux-xlnx" -XILINX_DEFAULT_KERNEL_microblaze := "linux-yocto" -XILINX_DEFAULT_KERNEL_zynqmp := "linux-yocto" -PREFERRED_PROVIDER_virtual/kernel ??= "${XILINX_DEFAULT_KERNEL}" - -# U-Boot Configuration -XILINX_DEFAULT_UBOOT := "u-boot-xlnx" -XILINX_DEFAULT_UBOOT_zynqmp := "u-boot" -PREFERRED_PROVIDER_virtual/bootloader ??= "${XILINX_DEFAULT_UBOOT}" -PREFERRED_PROVIDER_virtual/boot-bin ??= "${PREFERRED_PROVIDER_virtual/bootloader}" - -UBOOT_SUFFIX ?= "img" -UBOOT_SUFFIX_zynqmp ?= "bin" -UBOOT_SUFFIX_microblaze ?= "bin" - -UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" -UBOOT_ELF ?= "u-boot" -UBOOT_ELF_aarch64 ?= "u-boot.elf" - -XSERVER ?= " \ - xserver-xorg \ - xf86-input-evdev \ - xf86-input-mouse \ - xf86-input-keyboard \ - xf86-video-fbdev \ - ${XSERVER_EXT} \ - " - -XSERVER_EXT ?= "" -XSERVER_EXT_zynqmp ?= "xf86-video-armsoc" - -# For MicroBlaze default all microblaze machines to use GDB 7.7.1 (for gdbserver/gdb) -PREFERRED_VERSION_gdb_microblaze = "7.7.1" - diff --git a/meta-xilinx-bsp/conf/machine/include/machine-xilinx-qemu.inc b/meta-xilinx-bsp/conf/machine/include/machine-xilinx-qemu.inc deleted file mode 100644 index dd275f3b..00000000 --- a/meta-xilinx-bsp/conf/machine/include/machine-xilinx-qemu.inc +++ /dev/null @@ -1,49 +0,0 @@ -# This include is used to setup default QEMU and qemuboot config for meta-xilinx -# machines. - -# depend on qemu-helper-native, which will depend on QEMU -EXTRA_IMAGEDEPENDS += "qemu-helper-native" - -def qemu_default_dtb(d): - if d.getVar("IMAGE_BOOT_FILES", True): - dtbs = d.getVar("IMAGE_BOOT_FILES", True).split(" ") - # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>' - dtbs = [f.split(";")[0] for f in dtbs] - dtbs = [f for f in dtbs if f.endswith(".dtb")] - if len(dtbs) != 0: - return dtbs[0] - if d.getVar("KERNEL_DEVICETREE", True): - dtbs = d.getVar("KERNEL_DEVICETREE", True).split(" ") - dtbs = [os.path.basename(d) for d in dtbs] - if len(dtbs) != 0: - return d.getVar("KERNEL_IMAGETYPE", True) + "-" + dtbs[0] - return "" - -def qemu_default_serial(d): - if d.getVar("SERIAL_CONSOLE", True): - speed, console = d.getVar("SERIAL_CONSOLE", True).split(" ", 1) - # zynqmp uses earlycon and stdout (in dtb) - if "zynqmp" in d.getVar("MACHINEOVERRIDES", True).split(":"): - return "" - return "console=%s,%s earlyprintk" % (console, speed) - return "" - -def qemu_target_binary(d): - ta = d.getVar("TARGET_ARCH", True) - if ta == "microblazeeb": - ta = "microblaze" - elif ta == "arm": - ta = "aarch64" - return "qemu-system-%s" % ta - -def qemu_zynqmp_unhalt(d, multiarch): - if multiarch: - return "-global xlnx,zynqmp-boot.cpu-num=0 -global xlnx,zynqmp-boot.use-pmufw=true" - return "-device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4" - -# For qemuboot, default setup across all machines in meta-xilinx -QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}" -QB_DEFAULT_FSTYPE ?= "cpio" -QB_DTB ?= "${@qemu_default_dtb(d)}" -QB_KERNEL_CMDLINE_APPEND ?= "${@qemu_default_serial(d)}" - diff --git a/meta-xilinx-bsp/conf/machine/include/tune-zynq.inc b/meta-xilinx-bsp/conf/machine/include/tune-zynq.inc deleted file mode 100644 index 19e73412..00000000 --- a/meta-xilinx-bsp/conf/machine/include/tune-zynq.inc +++ /dev/null @@ -1,12 +0,0 @@ -DEFAULTTUNE ?= "cortexa9thf-neon" -SOC_FAMILY ?= "zynq" - -require conf/machine/include/tune-cortexa9.inc -require conf/machine/include/soc-family.inc - -# Linux Configuration -KERNEL_IMAGETYPE ?= "uImage" - -# Set default load address. -# Override with KERNEL_EXTRA_ARGS_<board> += "..." in machine file if required -KERNEL_EXTRA_ARGS_zynq += "UIMAGE_LOADADDR=0x8000" diff --git a/meta-xilinx-bsp/conf/machine/include/tune-zynqmp.inc b/meta-xilinx-bsp/conf/machine/include/tune-zynqmp.inc deleted file mode 100644 index 8d1f9537..00000000 --- a/meta-xilinx-bsp/conf/machine/include/tune-zynqmp.inc +++ /dev/null @@ -1,11 +0,0 @@ -DEFAULTTUNE ?= "aarch64" -SOC_FAMILY ?= "zynqmp" - -require conf/machine/include/arm/arch-armv8.inc -require conf/machine/include/soc-family.inc - -# Linux Configuration -KERNEL_IMAGETYPE ?= "Image" - -# Support multilib on zynqmp -DEFAULTTUNE_virtclass-multilib-lib32 ?= "armv7vethf-neon-vfpv4" diff --git a/meta-xilinx-bsp/conf/machine/include/zynqmp-pmu-config.inc b/meta-xilinx-bsp/conf/machine/include/zynqmp-pmu-config.inc deleted file mode 100644 index fd9e9809..00000000 --- a/meta-xilinx-bsp/conf/machine/include/zynqmp-pmu-config.inc +++ /dev/null @@ -1,20 +0,0 @@ - -# Enable the use of zynqmp-pmu for specific recipes only -def zynqmp_pmu_enable_for_bpns(d): - bpn = d.getVar("BPN") - crossbpns = ["binutils", "gcc"] - targetbpns = ["libgcc", "newlib", "libgloss"] - if bpn in targetbpns: - return True - if bpn in crossbpns and bb.data.inherits_class('cross', d): - return True - return False - -BBCLASSEXTEND_append = "${@' zynqmp-pmu' if zynqmp_pmu_enable_for_bpns(d) else ''}" - -# Add the pkgarch to the extra list, this is done to avoid warnings about -# missing manifests due to implicit dependency chains on populate_sysroot when -# a recipe/task depends on a IMAGE_EXTRADEPENDS/do_deploy task which is -# provided by a zynqmp-pmu-* target. -PACKAGE_EXTRA_ARCHS_append = " microblazeel-v9.2-bs-cmp" - diff --git a/meta-xilinx-bsp/conf/machine/kc705-microblazeel.conf b/meta-xilinx-bsp/conf/machine/kc705-microblazeel.conf index a73ce9ca..f3236f07 100644 --- a/meta-xilinx-bsp/conf/machine/kc705-microblazeel.conf +++ b/meta-xilinx-bsp/conf/machine/kc705-microblazeel.conf @@ -1,22 +1,50 @@ #@TYPE: Machine #@NAME: kc705-microblazeel -#@DESCRIPTION: Machine support for Xilinx KC705 Embedded Kit. -# - -require conf/machine/include/tune-microblaze.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc - -TUNE_FEATURES_tune-microblaze += "v10.0 barrel-shift reorder pattern-compare multiply-high divide-hard" - -MACHINE_FEATURES = "" - -USE_VT = "" -SERIAL_CONSOLE = "115200 ttyS0" - -KERNEL_IMAGETYPE ?= "linux.bin.ub" - -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" - -EXTRA_IMAGEDEPENDS += "virtual/bitstream" - +#@DESCRIPTION: Machine configuration for the KC705 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'kc705-microblazeel:']['kc705-microblazeel' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in microblazeel-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "MIG_7SERIES_0" +DT_PADDING_SIZE:pn-device-tree ?= "0x1000" +DTC_FLAGS:pn-device-tree ?= "" +XSCTH_PROC:pn-device-tree ?= "microblaze_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD kc705-full}" + +# Yocto FS-Boot variables +YAML_SERIAL_CONSOLE_STDIN:pn-fs-boot ?= "axi_uartlite_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fs-boot ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-fs-boot ?= "MIG_7SERIES_0" +YAML_FLASH_MEMORY_CONFIG:pn-fs-boot ?= "axi_emc_0" +XSCTH_PROC:pn-fs-boot ?= "microblaze_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x80000000" +UBOOT_LOADADDRESS ?= "0x80000000" + +# kc705-microblazeel Serial Console +SERIAL_CONSOLES ?= "115200;ttyUL0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Set DDR Base address for u-boot-xlnx-scr variables +DDR_BASEADDR ?= "0x80000000" +SKIP_APPEND_BASEADDR ?= "0" + +# Required generic machine inclusion +require conf/machine/microblaze-generic.conf + +# This machine conf file uses kc705-microblazeel xsa as reference input. +# User can override with kc705 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "kc705-microblazeel" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' kc705_microblazeel']['kc705-microblazeel' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/kcu105-microblazeel.conf b/meta-xilinx-bsp/conf/machine/kcu105-microblazeel.conf new file mode 100644 index 00000000..a866f87c --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/kcu105-microblazeel.conf @@ -0,0 +1,50 @@ +#@TYPE: Machine +#@NAME: kcu105-microblazeel +#@DESCRIPTION: Machine configuration for the KCU105 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'kcu105-microblazeel:']['kcu105-microblazeel' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in microblazeel-generic.conf will be set. + +# Yocto KCU105 device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "DDR4_0" +DT_PADDING_SIZE:pn-device-tree ?= "0x1000" +DTC_FLAGS:pn-device-tree ?= "" +XSCTH_PROC:pn-device-tree ?= "microblaze_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD kcu105}" + +# Yocto FS-Boot variables +YAML_SERIAL_CONSOLE_STDIN:pn-fs-boot ?= "axi_uartlite_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fs-boot ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-fs-boot ?= "DDR4_0" +YAML_FLASH_MEMORY_CONFIG:pn-fs-boot ?= "axi_quad_spi_0" +XSCTH_PROC:pn-fs-boot ?= "microblaze_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x80000000" +UBOOT_LOADADDRESS ?= "0x80000000" + +# kcu105-microblazeel Serial Console +SERIAL_CONSOLES ?= "115200;ttyUL0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Set DDR Base address for u-boot-xlnx-scr variables +DDR_BASEADDR ?= "0x80000000" +SKIP_APPEND_BASEADDR ?= "0" + +# Required generic machine inclusion +require conf/machine/microblaze-generic.conf + +# This machine conf file uses kcu105-microblazeel xsa as reference input. +# User can override with kcu105 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "kcu105-microblazeel" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' kcu105_microblazeel']['kcu105-microblazeel' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/microblazeel-v11.0-bs-cmp-mh-div-generic.conf b/meta-xilinx-bsp/conf/machine/microblazeel-v11.0-bs-cmp-mh-div-generic.conf new file mode 100644 index 00000000..96b4e6d1 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/microblazeel-v11.0-bs-cmp-mh-div-generic.conf @@ -0,0 +1,7 @@ +#@TYPE: Machine +#@NAME: microblazeel-v11.0-bs-cmp-mh-div-generic +#@DESCRIPTION: microblazeel-v11.0-bs-cmp-mh-div + +TUNE_FEATURES:tune-microblaze ?= "microblaze v11.0 barrel-shift pattern-compare reorder divide-hard multiply-high" + +require conf/machine/microblaze-generic.conf diff --git a/meta-xilinx-bsp/conf/machine/microblazeel-v11.0-bs-cmp-ml-generic.conf b/meta-xilinx-bsp/conf/machine/microblazeel-v11.0-bs-cmp-ml-generic.conf new file mode 100644 index 00000000..cf83acf8 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/microblazeel-v11.0-bs-cmp-ml-generic.conf @@ -0,0 +1,7 @@ +#@TYPE: Machine +#@NAME: microblazeel-v11.0-bs-cmp-ml-generic +#@DESCRIPTION: microblazeel-v11.0-bs-cmp-ml + +TUNE_FEATURES:tune-microblaze ?= "microblaze v11.0 barrel-shift reorder pattern-compare multiply-low" + +require conf/machine/microblaze-generic.conf diff --git a/meta-xilinx-bsp/conf/machine/microzed-zynq7.conf b/meta-xilinx-bsp/conf/machine/microzed-zynq7.conf deleted file mode 100644 index 815bf474..00000000 --- a/meta-xilinx-bsp/conf/machine/microzed-zynq7.conf +++ /dev/null @@ -1,30 +0,0 @@ -#@TYPE: Machine -#@NAME: microzed-zynq7 -#@DESCRIPTION: Machine support for microZed. (http://www.microzed.org/) - -require conf/machine/include/tune-zynq.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc - -MACHINE_FEATURES = "ext2 vfat usbhost" - -# u-boot configuration -PREFERRED_PROVIDER_virtual/bootloader = "u-boot" -UBOOT_MACHINE = "zynq_microzed_config" -SPL_BINARY = "spl/boot.bin" - -EXTRA_IMAGEDEPENDS += " \ - u-boot-zynq-uenv \ - virtual/boot-bin \ - " - -SERIAL_CONSOLE = "115200 ttyPS0" - -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" - -IMAGE_BOOT_FILES += " \ - boot.bin \ - ${MACHINE}.dtb \ - uEnv.txt \ - " - diff --git a/meta-xilinx-bsp/conf/machine/ml605-qemu-microblazeel.conf b/meta-xilinx-bsp/conf/machine/ml605-qemu-microblazeel.conf deleted file mode 100644 index f4ddb6df..00000000 --- a/meta-xilinx-bsp/conf/machine/ml605-qemu-microblazeel.conf +++ /dev/null @@ -1,27 +0,0 @@ -#@TYPE: Machine -#@NAME: ml605-qemu-microblazeel -#@DESCRIPTION: MicroBlaze QEMU machine support ('petalogix-ml605' model) - -require conf/machine/include/tune-microblaze.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-qemu.inc - -TUNE_FEATURES_tune-microblaze += "v8.50 barrel-shift reorder pattern-compare divide-hard multiply-high fpu-hard" - -MACHINE_FEATURES = "" - -USE_VT = "" -SERIAL_CONSOLE = "115200 ttyS0" - -KERNEL_IMAGETYPE ?= "linux.bin.ub" - -# Use the networking setup from qemuarm -FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm" - -# This machine is a targeting a QEMU model, runqemu setup: -IMAGE_CLASSES += "qemuboot" -QB_MEM = "-m 256" -QB_MACHINE = "-machine petalogix-ml605" -QB_OPT_APPEND = "-nographic -serial mon:stdio" -QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@" - diff --git a/meta-xilinx-bsp/conf/machine/picozed-zynq7.conf b/meta-xilinx-bsp/conf/machine/picozed-zynq7.conf deleted file mode 100644 index 59b4a6cb..00000000 --- a/meta-xilinx-bsp/conf/machine/picozed-zynq7.conf +++ /dev/null @@ -1,34 +0,0 @@ -#@TYPE: Machine -#@NAME: picozed-zynq7 -#@DESCRIPTION: Machine support for picoZed. (http://www.picozed.org/) -# -# Note: This machine configuration is intended as a generic config for -# the picozed SOM. It also covers the multiple SKUs for the picoZed -# including 7010, 7020, 7015 and 7030. - -require conf/machine/include/tune-zynq.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc - -MACHINE_FEATURES = "ext2 vfat usbhost usbgadget" - -# u-boot configuration -PREFERRED_PROVIDER_virtual/bootloader = "u-boot" -UBOOT_MACHINE = "zynq_picozed_config" -SPL_BINARY = "spl/boot.bin" - -EXTRA_IMAGEDEPENDS += " \ - u-boot-zynq-uenv \ - virtual/boot-bin \ - " - -SERIAL_CONSOLE = "115200 ttyPS0" - -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" - -IMAGE_BOOT_FILES += " \ - boot.bin \ - ${MACHINE}.dtb \ - uEnv.txt \ - " - diff --git a/meta-xilinx-bsp/conf/machine/qemu-zynq7.conf b/meta-xilinx-bsp/conf/machine/qemu-zynq7.conf deleted file mode 100644 index 0fe99e27..00000000 --- a/meta-xilinx-bsp/conf/machine/qemu-zynq7.conf +++ /dev/null @@ -1,25 +0,0 @@ -#@TYPE: Machine -#@NAME: qemu-zynq7 -#@DESCRIPTION: Zynq QEMU machine support ('xilinx-zynq-a9' model) - -require conf/machine/include/tune-zynq.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-qemu.inc - -MACHINE_FEATURES = "ext2 vfat" - -SERIAL_CONSOLE = "115200 ttyPS0" - -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" -IMAGE_BOOT_FILES += "${MACHINE}.dtb" - -# Use the networking setup from qemuarm -FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm" - -# This machine is a targeting a QEMU model, runqemu setup: -IMAGE_CLASSES += "qemuboot" -QB_MEM = "-m 1024" -QB_MACHINE = "-machine xilinx-zynq-a9" -QB_OPT_APPEND = "-nographic -serial null -serial mon:stdio" -QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@" - diff --git a/meta-xilinx-bsp/conf/machine/qemu-zynqmp-cg.conf b/meta-xilinx-bsp/conf/machine/qemu-zynqmp-cg.conf new file mode 100644 index 00000000..cb92bc71 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/qemu-zynqmp-cg.conf @@ -0,0 +1,42 @@ +#@TYPE: Machine +#@NAME: QEMU ZynqMP CG machine +#@DESCRIPTION: Machine configuration for running a ZynqMP CG system on QEMU w/ testimage + +# This machine is NOT designed to be inherited by other machines or used as an +# example of how to create a machine. It is only useful for running testimage +# with runqemu. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'qemu-zynqmp-cg:']['qemu-zynqmp-cg' !='${MACHINE}']}" +#### Regular settings follow + +# The following is from conf/machine/include/qemu.inc, but we can not use it +# as it changes other values that need to come from the distro and the +# AMD machine settings +XSERVER ?= "xserver-xorg \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'mesa-driver-swrast xserver-xorg-extension-glx', '', d)} \ + xf86-video-fbdev \ + xf86-video-modesetting \ + " + +MACHINE_FEATURES = "alsa bluetooth usbgadget screen vfat" + +MACHINEOVERRIDES =. "qemuall:" + +IMAGE_FSTYPES += "tar.bz2 ext4" + +# Don't include kernels in standard images +RDEPENDS:${KERNEL_PACKAGE_NAME}-base = "" + +# Provide the nfs server kernel module for all qemu images +KERNEL_FEATURES:append:pn-linux-yocto = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-yocto-rt = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-xlnx = " features/nfsd/nfsd-enable.scc" + + +# Now include the generic machine which already supports QEMU booting +require conf/machine/zynqmp-cg-generic.conf + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' qemu_zynqmp_cg']['qemu-zynqmp-cg' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/qemu-zynqmp-dr.conf b/meta-xilinx-bsp/conf/machine/qemu-zynqmp-dr.conf new file mode 100644 index 00000000..5fcb3541 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/qemu-zynqmp-dr.conf @@ -0,0 +1,42 @@ +#@TYPE: Machine +#@NAME: QEMU ZynqMP DR machine +#@DESCRIPTION: Machine configuration for running a ZynqMP DR system on QEMU w/ testimage + +# This machine is NOT designed to be inherited by other machines or used as an +# example of how to create a machine. It is only useful for running testimage +# with runqemu. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'qemu-zynqmp-dr:']['qemu-zynqmp-dr' !='${MACHINE}']}" +#### Regular settings follow + +# The following is from conf/machine/include/qemu.inc, but we can not use it +# as it changes other values that need to come from the distro and the +# AMD machine settings +XSERVER ?= "xserver-xorg \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'mesa-driver-swrast xserver-xorg-extension-glx', '', d)} \ + xf86-video-fbdev \ + xf86-video-modesetting \ + " + +MACHINE_FEATURES = "alsa bluetooth usbgadget screen vfat" + +MACHINEOVERRIDES =. "qemuall:" + +IMAGE_FSTYPES += "tar.bz2 ext4" + +# Don't include kernels in standard images +RDEPENDS:${KERNEL_PACKAGE_NAME}-base = "" + +# Provide the nfs server kernel module for all qemu images +KERNEL_FEATURES:append:pn-linux-yocto = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-yocto-rt = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-xlnx = " features/nfsd/nfsd-enable.scc" + + +# Now include the generic machine which already supports QEMU booting +require conf/machine/zynqmp-dr-generic.conf + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' qemu_zynqmp_dr']['qemu-zynqmp-dr' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/qemu-zynqmp-eg.conf b/meta-xilinx-bsp/conf/machine/qemu-zynqmp-eg.conf new file mode 100644 index 00000000..5f4b972c --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/qemu-zynqmp-eg.conf @@ -0,0 +1,42 @@ +#@TYPE: Machine +#@NAME: QEMU ZynqMP EG machine +#@DESCRIPTION: Machine configuration for running a ZynqMP EG system on QEMU w/ testimage + +# This machine is NOT designed to be inherited by other machines or used as an +# example of how to create a machine. It is only useful for running testimage +# with runqemu. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'qemu-zynqmp-eg:']['qemu-zynqmp-eg' !='${MACHINE}']}" +#### Regular settings follow + +# The following is from conf/machine/include/qemu.inc, but we can not use it +# as it changes other values that need to come from the distro and the +# AMD machine settings +XSERVER ?= "xserver-xorg \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'mesa-driver-swrast xserver-xorg-extension-glx', '', d)} \ + xf86-video-fbdev \ + xf86-video-modesetting \ + " + +MACHINE_FEATURES = "alsa bluetooth usbgadget screen vfat" + +MACHINEOVERRIDES =. "qemuall:" + +IMAGE_FSTYPES += "tar.bz2 ext4" + +# Don't include kernels in standard images +RDEPENDS:${KERNEL_PACKAGE_NAME}-base = "" + +# Provide the nfs server kernel module for all qemu images +KERNEL_FEATURES:append:pn-linux-yocto = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-yocto-rt = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-xlnx = " features/nfsd/nfsd-enable.scc" + + +# Now include the generic machine which already supports QEMU booting +require conf/machine/zynqmp-eg-generic.conf + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' qemu_zynqmp_eg']['qemu-zynqmp-eg' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/qemu-zynqmp-ev.conf b/meta-xilinx-bsp/conf/machine/qemu-zynqmp-ev.conf new file mode 100644 index 00000000..6058bfa4 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/qemu-zynqmp-ev.conf @@ -0,0 +1,42 @@ +#@TYPE: Machine +#@NAME: QEMU ZynqMP EV machine +#@DESCRIPTION: Machine configuration for running a ZynqMP EV system on QEMU w/ testimage + +# This machine is NOT designed to be inherited by other machines or used as an +# example of how to create a machine. It is only useful for running testimage +# with runqemu. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'qemu-zynqmp-ev:']['qemu-zynqmp-ev' !='${MACHINE}']}" +#### Regular settings follow + +# The following is from conf/machine/include/qemu.inc, but we can not use it +# as it changes other values that need to come from the distro and the +# AMD machine settings +XSERVER ?= "xserver-xorg \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'mesa-driver-swrast xserver-xorg-extension-glx', '', d)} \ + xf86-video-fbdev \ + xf86-video-modesetting \ + " + +MACHINE_FEATURES = "alsa bluetooth usbgadget screen vfat" + +MACHINEOVERRIDES =. "qemuall:" + +IMAGE_FSTYPES += "tar.bz2 ext4" + +# Don't include kernels in standard images +RDEPENDS:${KERNEL_PACKAGE_NAME}-base = "" + +# Provide the nfs server kernel module for all qemu images +KERNEL_FEATURES:append:pn-linux-yocto = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-yocto-rt = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-xlnx = " features/nfsd/nfsd-enable.scc" + + +# Now include the generic machine which already supports QEMU booting +require conf/machine/zynqmp-ev-generic.conf + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' qemu_zynqmp_ev']['qemu-zynqmp-ev' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/qemu-zynqmp.conf b/meta-xilinx-bsp/conf/machine/qemu-zynqmp.conf new file mode 100644 index 00000000..91a96ede --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/qemu-zynqmp.conf @@ -0,0 +1,45 @@ +#@TYPE: Machine +#@NAME: QEMU ZynqMP machine +#@DESCRIPTION: Machine configuration for running a ZynqMP system on QEMU w/ testimage + +# This machine is NOT designed to be inherited by other machines or used as an +# example of how to create a machine. It is only useful for running testimage +# with runqemu. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'qemu-zynqmp:']['qemu-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# The following is from conf/machine/include/qemu.inc, but we can not use it +# as it changes other values that need to come from the distro and the +# AMD machine settings +XSERVER ?= "xserver-xorg \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'mesa-driver-swrast xserver-xorg-extension-glx', '', d)} \ + xf86-video-fbdev \ + xf86-video-modesetting \ + " + +MACHINE_FEATURES = "alsa bluetooth usbgadget screen vfat" + +MACHINEOVERRIDES =. "qemuall:" + +IMAGE_FSTYPES += "tar.bz2 ext4" + +# Don't include kernels in standard images +RDEPENDS:${KERNEL_PACKAGE_NAME}-base = "" + +# Provide the nfs server kernel module for all qemu images +KERNEL_FEATURES:append:pn-linux-yocto = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-yocto-rt = " features/nfsd/nfsd-enable.scc" +KERNEL_FEATURES:append:pn-linux-xlnx = " features/nfsd/nfsd-enable.scc" + + +# Now include the generic machine which already supports QEMU booting +require conf/machine/zynqmp-generic.conf + +# This may break standalone runqemu, but allows testimage to work +QB_XILINX_SERIAL = "" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' qemu_zynqmp']['qemu-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/s3adsp1800-qemu-microblazeeb.conf b/meta-xilinx-bsp/conf/machine/s3adsp1800-qemu-microblazeeb.conf deleted file mode 100644 index 3a21eb78..00000000 --- a/meta-xilinx-bsp/conf/machine/s3adsp1800-qemu-microblazeeb.conf +++ /dev/null @@ -1,24 +0,0 @@ -#@TYPE: Machine -#@NAME: s3adsp1800-qemu-microblazeeb -#@DESCRIPTION: MicroBlaze QEMU machine support ('petalogix-s3adsp1800' model) - -require conf/machine/include/tune-microblaze.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-qemu.inc - -TUNE_FEATURES_tune-microblaze += "v8.00 bigendian barrel-shift pattern-compare multiply-low" - -MACHINE_FEATURES = "" - -USE_VT = "" -SERIAL_CONSOLE = "115200 ttyUL0" - -KERNEL_IMAGETYPE ?= "linux.bin.ub" - -# This machine is a targeting a QEMU model, runqemu setup: -IMAGE_CLASSES += "qemuboot" -QB_MEM = "-m 256" -QB_MACHINE = "-machine petalogix-s3adsp1800" -QB_OPT_APPEND = "-nographic -serial mon:stdio" -QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@" - diff --git a/meta-xilinx-bsp/conf/machine/vck190-versal.conf b/meta-xilinx-bsp/conf/machine/vck190-versal.conf new file mode 100644 index 00000000..ed049268 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/vck190-versal.conf @@ -0,0 +1,45 @@ +#@TYPE: Machine +#@NAME: vck190-versal +#@DESCRIPTION: Machine configuration for the VCK190 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'vck190-versal:']['vck190-versal' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in versal-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "CIPS_0_pspmc_0_psv_sbsauart_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD versal-vck190-reva-x-ebm-01-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "pl011" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PLM variables +YAML_SERIAL_CONSOLE_STDIN:pn-plm-firmware ?= "CIPS_0_pspmc_0_psv_sbsauart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-plm-firmware ?= "CIPS_0_pspmc_0_psv_sbsauart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# vck190-versal Serial Console +SERIAL_CONSOLES ?= "115200;ttyAMA0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# VCK190 board uses Versal AI Core device hence use soc variant based generic +# machine inclusion +require conf/machine/versal-ai-core-generic.conf + +# This machine conf file uses vck190-versal xsa as reference input. +# User can override with vck190 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "vck190-versal" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' vck190_versal']['vck190-versal' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/vcu118-microblazeel.conf b/meta-xilinx-bsp/conf/machine/vcu118-microblazeel.conf new file mode 100644 index 00000000..bfd60336 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/vcu118-microblazeel.conf @@ -0,0 +1,50 @@ +#@TYPE: Machine +#@NAME: vcu118-microblazeel +#@DESCRIPTION: Machine configuration for the VCU118 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'vcu118-microblazeel:']['vcu118-microblazeel' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in microblazeel-generic.conf will be set. + +# Yocto VCU118 device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "DDR4_0" +DT_PADDING_SIZE:pn-device-tree ?= "0x1000" +DTC_FLAGS:pn-device-tree ?= "" +XSCTH_PROC:pn-device-tree ?= "microblaze_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD vcu118-rev2.0}" + +# Yocto FS-Boot variables +YAML_SERIAL_CONSOLE_STDIN:pn-fs-boot ?= "axi_uartlite_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fs-boot ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-fs-boot ?= "DDR4_0" +YAML_FLASH_MEMORY_CONFIG:pn-fs-boot ?= "axi_quad_spi_0" +XSCTH_PROC:pn-fs-boot ?= "microblaze_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x80000000" +UBOOT_LOADADDRESS ?= "0x80000000" + +# vcu118-microblazeel Serial Console +SERIAL_CONSOLES ?= "115200;ttyUL0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Set DDR Base address for u-boot-xlnx-scr variables +DDR_BASEADDR ?= "0x80000000" +SKIP_APPEND_BASEADDR ?= "0" + +# Required generic machine inclusion +require conf/machine/microblaze-generic.conf + +# This machine conf file uses vcu118-microblazeel xsa as reference input. +# User can override with vcu118 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "vcu118-microblazeel" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' vcu118_microblazeel']['vcu118-microblazeel' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/vek280-versal.conf b/meta-xilinx-bsp/conf/machine/vek280-versal.conf new file mode 100644 index 00000000..ffe2fcb7 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/vek280-versal.conf @@ -0,0 +1,55 @@ +XILINX_DEPRECATED[vek280-versal] = "${@'vek280-versal is not supported in 2023.2' if d.getVar("XILINX_RELEASE_VERSION") == 'v2023.2' else ''}" + +#@TYPE: Machine +#@NAME: vek280-versal +#@DESCRIPTION: Machine configuration for the VEK280 evaluation boards. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'vek280-versal:']['vek280-versal' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in versal-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "CIPS_0_pspmc_0_psv_sbsauart_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD versal-vek280-revb}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "pl011" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PLM variables +YAML_SERIAL_CONSOLE_STDIN:pn-plm-firmware ?= "CIPS_0_pspmc_0_psv_sbsauart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-plm-firmware ?= "CIPS_0_pspmc_0_psv_sbsauart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# vek280-versal Serial Console +SERIAL_CONSOLES ?= "115200;ttyAMA0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +require conf/machine/versal-ai-edge-generic.conf + +# This machine conf file uses vek280-versal xsa as reference input. +# User can override with vek280 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "vek280-versal" + +# VEK280 board has 12GB memory only but default versal-generic has QB_MEM set to +# 8G, Hence we need set 12G in QB_MEM. +QB_MEM = "-m 12G" + +QEMU_HW_DTB_PS = "${QEMU_HW_DTB_PATH}/board-versal-ps-vek280.dtb" +QEMU_HW_DTB_PMC = "${QEMU_HW_DTB_PATH}/board-versal-pmc-virt.dtb" + +# Yocto MACHINE_FEATURES Variable +MACHINE_FEATURES += "vdu" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' vek280_versal']['vek280-versal' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/vmk180-versal.conf b/meta-xilinx-bsp/conf/machine/vmk180-versal.conf new file mode 100644 index 00000000..0f474f78 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/vmk180-versal.conf @@ -0,0 +1,45 @@ +#@TYPE: Machine +#@NAME: vmk180-versal +#@DESCRIPTION: Machine configuration for the VMK180 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'vmk180-versal:']['vmk180-versal' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in versal-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD versal-vmk180-reva-x-ebm-01-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "pl011" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PLM variables +YAML_SERIAL_CONSOLE_STDIN:pn-plm-firmware ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-plm-firmware ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# vmk180-versal Serial Console +SERIAL_CONSOLES ?= "115200;ttyAMA0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# VMK180 board uses Versal Prime device hence use soc variant based generic +# machine inclusion +require conf/machine/versal-prime-generic.conf + +# This machine conf file uses vmk180-versal xsa as reference input. +# User can override with vmk180 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "vmk180-versal" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' vmk180_versal']['vmk180-versal' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/vpk120-versal.conf b/meta-xilinx-bsp/conf/machine/vpk120-versal.conf new file mode 100644 index 00000000..e200d42d --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/vpk120-versal.conf @@ -0,0 +1,48 @@ +#@TYPE: Machine +#@NAME: vpk120-versal +#@DESCRIPTION: Machine configuration for the VPK120 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'vpk120-versal:']['vpk120-versal' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in versal-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD versal-vpk120-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "pl011" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PLM variables +YAML_SERIAL_CONSOLE_STDIN:pn-plm-firmware ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-plm-firmware ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# vpk120-versal Serial Console +SERIAL_CONSOLES ?= "115200;ttyAMA0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# VPK120 board uses Versal Premium device hence use soc variant based generic +# machine inclusion +require conf/machine/versal-premium-generic.conf + +# This machine conf file uses vpk120-versal xsa as reference input. +# User can override with vpk120 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "vpk120-versal" + +QEMU_HW_DTB_PS = "${QEMU_HW_DTB_PATH}/board-versal-ps-vpk120.dtb" +QEMU_HW_DTB_PMC = "${QEMU_HW_DTB_PATH}/board-versal-pmc-virt.dtb" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' vpk120_versal']['vpk120-versal' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/vpk180-versal.conf b/meta-xilinx-bsp/conf/machine/vpk180-versal.conf new file mode 100644 index 00000000..92630e97 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/vpk180-versal.conf @@ -0,0 +1,48 @@ +#@TYPE: Machine +#@NAME: vpk180-versal +#@DESCRIPTION: Machine configuration for the VPK180 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'vpk180-versal:']['vpk180-versal' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in versal-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD versal-vpk180-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "pl011" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PLM variables +YAML_SERIAL_CONSOLE_STDIN:pn-plm-firmware ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-plm-firmware ?= "versal_cips_0_pspmc_0_psv_sbsauart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# vpk180-versal Serial Console +SERIAL_CONSOLES ?= "115200;ttyAMA0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# VPK180 board uses Versal Premium device hence use soc variant based generic +# machine inclusion +require conf/machine/versal-premium-generic.conf + +# This machine conf file uses vpk180-versal xsa as reference input. +# User can override with vpk180 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "vpk180-versal" + +QEMU_HW_DTB_PS = "${QEMU_HW_DTB_PATH}/board-versal-ps-vpk180.dtb" +QEMU_HW_DTB_PMC = "${QEMU_HW_DTB_PATH}/board-versal-pmc-virt.dtb" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' vpk180_versal']['vpk180-versal' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zc1254-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zc1254-zynqmp.conf new file mode 100644 index 00000000..c3518577 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/zc1254-zynqmp.conf @@ -0,0 +1,13 @@ +#@TYPE: Machine +#@NAME: zc1254-zynqmp +#@DESCRIPTION: Machine support for ZC1254 Evaluation Board. +# + +SOC_VARIANT = "dr" + +require conf/machine/zynqmp-generic.conf + +# Add board compatibility override +MACHINEOVERRIDES .= ":zc1254" + +KERNEL_DEVICETREE = "xilinx/zynqmp-zc1254-revA.dtb" diff --git a/meta-xilinx-bsp/conf/machine/zc702-zynq7.conf b/meta-xilinx-bsp/conf/machine/zc702-zynq7.conf index 57877bfa..1db0616f 100644 --- a/meta-xilinx-bsp/conf/machine/zc702-zynq7.conf +++ b/meta-xilinx-bsp/conf/machine/zc702-zynq7.conf @@ -1,45 +1,44 @@ #@TYPE: Machine #@NAME: zc702-zynq7 -#@DESCRIPTION: Machine support for ZC702 Evaluation Board. -# -# For details on the Evaluation board: -# http://www.xilinx.com/products/boards-and-kits/EK-Z7-ZC702-G.htm -# For documentation and design files for the ZC702: -# http://www.xilinx.com/support/index.html/content/xilinx/en/supportNav/boards_and_kits/zynq-7000_soc_boards_and_kits/zynq-7000_soc_zc702_evaluation_kit.html -# For the FSBL 'zynq_fsbl_0.elf' refer to UG873 and the associated design files. -# +#@DESCRIPTION: Machine configuration for the ZC702 evaluation boards. -require conf/machine/include/tune-zynq.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc -require conf/machine/include/machine-xilinx-qemu.inc +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zc702-zynq7:']['zc702-zynq7' !='${MACHINE}']}" +#### Regular settings follow -MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost" +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynq-generic.conf will be set. -# u-boot configuration -UBOOT_MACHINE = "zynq_zc702_config" -SPL_BINARY = "spl/boot.bin" +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "ps7_uart_1" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PS7_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zc702}" -EXTRA_IMAGEDEPENDS += " \ - u-boot-zynq-uenv \ - virtual/boot-bin \ - " +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "ps7_uart_1" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "ps7_uart_1" -SERIAL_CONSOLE = "115200 ttyPS0" +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" -KERNEL_DEVICETREE = "zynq-zc702.dtb" +# zc702-zynq7 Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" -IMAGE_BOOT_FILES += "boot.bin uEnv.txt ${KERNEL_IMAGETYPE}-zynq-zc702.dtb" +# Required generic machine inclusion +require conf/machine/zynq-generic.conf -# Although not fully supported you can run this machine on the mainline QEMU 'xilinx-zynq-a9' machine -IMAGE_CLASSES += "qemuboot" -QB_MEM = "-m 1024" -QB_MACHINE = "-machine xilinx-zynq-a9" -QB_OPT_APPEND = "-nographic -serial null -serial mon:stdio" -QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@" +# This eval board machine conf file uses zc702-zynq7 xsa as reference input. +# User can override with zc702 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zc702-zynq7" -# Xilinx's fork of QEMU has much better results, so let's default to that -# Use qemu-xilinx instead of mainline -PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native" +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "zynq-zc702.dtb" -IMAGE_CLASSES += "qemuboot-xilinx" +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zc702_zynq7']['zc702-zynq7' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zc706-zynq7.conf b/meta-xilinx-bsp/conf/machine/zc706-zynq7.conf index d2fbf1b1..7e0525d1 100644 --- a/meta-xilinx-bsp/conf/machine/zc706-zynq7.conf +++ b/meta-xilinx-bsp/conf/machine/zc706-zynq7.conf @@ -1,49 +1,44 @@ #@TYPE: Machine #@NAME: zc706-zynq7 -#@DESCRIPTION: Machine support for ZC706 Evaluation Board. -# -# For details on the Evaluation board: -# http://www.xilinx.com/products/boards-and-kits/EK-Z7-ZC706-G.htm -# For documentation and design files for the ZC702: -# http://www.xilinx.com/support/index.html/content/xilinx/en/supportNav/boards_and_kits/zynq-7000_soc_boards_and_kits/zynq-7000_soc_zc706_evaluation_kit.html -# For the FSBL 'zynq_fsbl_0.elf' refer to UG873 and the associated design files. -# - -require conf/machine/include/tune-zynq.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc -require conf/machine/include/machine-xilinx-qemu.inc - -MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost usbgadget" - -# u-boot configuration -UBOOT_MACHINE = "zynq_zc706_config" -SPL_BINARY = "spl/boot.bin" - -EXTRA_IMAGEDEPENDS += " \ - u-boot-zynq-uenv \ - virtual/boot-bin \ - " - -SERIAL_CONSOLE = "115200 ttyPS0" - -KERNEL_DEVICETREE = "zynq-zc706.dtb" - -IMAGE_BOOT_FILES += " \ - boot.bin \ - ${KERNEL_IMAGETYPE}-zynq-zc706.dtb \ - uEnv.txt \ - " - -# Although not fully supported you can run this machine on the mainline QEMU 'xilinx-zynq-a9' machine -IMAGE_CLASSES += "qemuboot" -QB_MEM = "-m 1024" -QB_MACHINE = "-machine xilinx-zynq-a9" -QB_OPT_APPEND = "-nographic -serial null -serial mon:stdio" -QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@" - -# Xilinx's fork of QEMU has much better results, so let's default to that -# Use qemu-xilinx instead of mainline -PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native" - -IMAGE_CLASSES += "qemuboot-xilinx" +#@DESCRIPTION: Machine configuration for the ZC706 evaluation boards. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zc706-zynq7:']['zc706-zynq7' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynq-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "ps7_uart_1" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PS7_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zc706}" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "ps7_uart_1" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "ps7_uart_1" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zc706-zynq7 Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +require conf/machine/zynq-generic.conf + +# This eval board machine conf file uses zc702-zynq7 xsa as reference input. +# User can override with zc702 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zc706-zynq7" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "zynq-zc706.dtb" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zc706_zynq7']['zc706-zynq7' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zcu102-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zcu102-zynqmp.conf index fe411483..acd2544a 100644 --- a/meta-xilinx-bsp/conf/machine/zcu102-zynqmp.conf +++ b/meta-xilinx-bsp/conf/machine/zcu102-zynqmp.conf @@ -1,77 +1,54 @@ #@TYPE: Machine #@NAME: zcu102-zynqmp -#@DESCRIPTION: Machine support for ZCU102 Evaluation Board. - -require conf/machine/include/tune-zynqmp.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc -require conf/machine/include/machine-xilinx-qemu.inc -include conf/machine/include/zynqmp-pmu-config.inc - -MACHINE_FEATURES = "rtc ext2 ext3 vfat usbhost" - -UBOOT_MACHINE = "xilinx_zynqmp_zcu102_rev1_0_defconfig" -SPL_BINARY = "spl/boot.bin" - -# Default SD image build onfiguration, use qemu-sd to pad -IMAGE_CLASSES += "image-types-xilinx-qemu" -IMAGE_FSTYPES += "wic.qemu-sd" -WKS_FILES ?= "sdimage-bootpart.wks" - -SERIAL_CONSOLE = "115200 ttyPS0" -SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}" - -KERNEL_DEVICETREE = "xilinx/zynqmp-zcu102-rev1.0.dtb" - -PREFERRED_PROVIDER_virtual/kernel ?= "linux-xlnx" -PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-xlnx" -PREFERRED_PROVIDER_virtual/pmu-firmware ?= "zynqmp-pmu-pmu-firmware" - -EXTRA_IMAGEDEPENDS += " \ - u-boot-zynq-uenv \ - arm-trusted-firmware \ - qemu-devicetrees \ - virtual/pmu-firmware \ - virtual/boot-bin \ - " - -IMAGE_BOOT_FILES += "uEnv.txt atf-uboot.ub ${KERNEL_IMAGETYPE}-zynqmp-zcu102-rev1.0.dtb" - -# This machine has a QEMU model, runqemu setup: -IMAGE_CLASSES += "qemuboot-xilinx" -QB_MACHINE = "-machine xlnx-zcu102" -QB_MEM = "-m 4096" -QB_OPT_APPEND = "-nographic -serial mon:stdio -serial null" -QB_NETWORK_DEVICE = "-net nic -net nic -net nic -net nic,netdev=net0,macaddr=@MAC@" - -# Use qemu-xilinx instead of mainline -PREFERRED_PROVIDER_qemu-helper-native = "qemu-xilinx-helper-native" - -# Use the multiarch script instead of launching QEMU directly -QB_SYSTEM_NAME_append = "-multiarch" - -# Replicate BootROM like behaviour, having loaded SPL and PMU(ROM+FW) -QB_OPT_APPEND_append_qemuboot-xilinx = " \ - -hw-dtb ${DEPLOY_DIR_IMAGE}/qemu-hw-devicetrees/multiarch/zcu102-arm.dtb \ - ${@qemu_zynqmp_unhalt(d, True)} \ - -device loader,addr=0xfffc0000,file=${DEPLOY_DIR_IMAGE}/u-boot-spl.bin,cpu-num=0 \ - " - -# Attach the rootfs disk image to the second SD interface of QEMU (which is SD0) -QB_DEFAULT_FSTYPE_qemuboot-xilinx = "wic.qemu-sd" -QB_OPT_APPEND_append_qemuboot-xilinx = " -boot mode=3" -QB_ROOTFS_OPT_qemuboot-xilinx = " -drive if=sd,index=1,file=@ROOTFS@,format=raw" - -# PMU instance args -PMU_ROM ?= "${DEPLOY_DIR_IMAGE}/pmu-rom.elf" -QB_PMU_OPT = " \ - -M microblaze-fdt \ - -display none \ - -hw-dtb ${DEPLOY_DIR_IMAGE}/qemu-hw-devicetrees/multiarch/zynqmp-pmu.dtb \ - -kernel ${PMU_ROM} \ - -device loader,file=${DEPLOY_DIR_IMAGE}/pmu-${MACHINE}.elf \ - -device loader,addr=0xfd1a0074,data=0x1011003,data-len=4 \ - -device loader,addr=0xfd1a007C,data=0x1010f03,data-len=4 \ - " -QB_OPT_APPEND_append_qemuboot-xilinx = " -pmu-args '${QB_PMU_OPT}'" - +#@DESCRIPTION: Machine configuration for the ZCU102 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zcu102-zynqmp:']['zcu102-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynqmp-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu102-rev1.0}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zcu102-zynqmp Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# ZCU102 board uses ZynqMP EG device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-eg-generic.conf + +# This eval board machine conf file uses zcu102-zynqmp xsa as reference input. +# User can override with zcu102 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zcu102-zynqmp" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu102-rev1.0.dtb" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zcu102_zynqmp']['zcu102-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zcu104-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zcu104-zynqmp.conf new file mode 100644 index 00000000..b4c11f3a --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/zcu104-zynqmp.conf @@ -0,0 +1,58 @@ +#@TYPE: Machine +#@NAME: zcu104-zynqmp +#@DESCRIPTION: Machine configuration for the ZCU104 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zcu104-zynqmp:']['zcu104-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynqmp-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu104-revc}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zcu104-zynqmp Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# ZCU104 board uses ZynqMP EV device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-ev-generic.conf + +# This eval board machine conf file uses zcu104-zynqmp xsa as reference input. +# User can override with zcu104 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zcu104-zynqmp" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu104-revC.dtb" + +# Yocto IMAGE_FEATURES Variable +MACHINE_HWCODECS = "libomxil-xlnx" +IMAGE_FEATURES += "hwcodecs" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zcu104_zynqmp']['zcu104-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zcu106-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zcu106-zynqmp.conf new file mode 100644 index 00000000..ff273134 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/zcu106-zynqmp.conf @@ -0,0 +1,58 @@ +#@TYPE: Machine +#@NAME: zcu106-zynqmp +#@DESCRIPTION: Machine configuration for the ZCU106 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zcu106-zynqmp:']['zcu106-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynqmp-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu106-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zcu106-zynqmp Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# ZCU106 board uses ZynqMP EV device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-ev-generic.conf + +# This eval board machine conf file uses zcu106-zynqmp xsa as reference input. +# User can override with zcu106 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zcu106-zynqmp" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu106-revA.dtb" + +# Yocto IMAGE_FEATURES Variable +MACHINE_HWCODECS = "libomxil-xlnx" +IMAGE_FEATURES += "hwcodecs" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zcu106_zynqmp']['zcu106-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zcu111-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zcu111-zynqmp.conf new file mode 100644 index 00000000..77da93ca --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/zcu111-zynqmp.conf @@ -0,0 +1,54 @@ +#@TYPE: Machine +#@NAME: zcu111-zynqmp +#@DESCRIPTION: Machine configuration for the ZCU111 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zcu111-zynqmp:']['zcu111-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynqmp-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu111-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zcu111-zynqmp Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# ZCU111 board uses ZynqMP DR device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-dr-generic.conf + +# This eval board machine conf file uses zcu111-zynqmp xsa as reference input. +# User can override with zcu111 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zcu111-zynqmp" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu111-revA.dtb" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zcu111_zynqmp']['zcu111-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zcu1275-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zcu1275-zynqmp.conf new file mode 100644 index 00000000..18aa3eee --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/zcu1275-zynqmp.conf @@ -0,0 +1,52 @@ +XILINX_DEPRECATED[zcu1275-zynqmp] = "${@'zcu1275-zynqmp is not supported in 2023.2' if d.getVar("XILINX_RELEASE_VERSION") == 'v2023.2' else ''}" + +#@TYPE: Machine +#@NAME: zcu1275-zynqmp +#@DESCRIPTION: Machine configuration for the ZCU1275 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zcu1275-zynqmp:']['zcu1275-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu1275-revb}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zcu1275-zynqmp Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# ZCU1275 board uses ZynqMP DR device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-dr-generic.conf + +# This eval board machine conf file uses zcu1275-zynqmp xsa as reference input. +# User can override with zcu1275 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zcu1275-zynqmp" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu1275-revB.dtb" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', 'zcu1275_zynqmp']['zcu1275-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zcu1285-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zcu1285-zynqmp.conf new file mode 100644 index 00000000..6fba3619 --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/zcu1285-zynqmp.conf @@ -0,0 +1,56 @@ +XILINX_DEPRECATED[zcu1285-zynqmp] = "${@'zcu1285-zynqmp is not supported in 2023.2' if d.getVar("XILINX_RELEASE_VERSION") == 'v2023.2' else ''}" + +#@TYPE: Machine +#@NAME: zcu1285-zynqmp +#@DESCRIPTION: Machine configuration for the ZCU1285 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zcu1285-zynqmp:']['zcu1285-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynqmp-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu1285-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zcu1285-zynqmp Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# ZCU1285 board uses ZynqMP DR device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-dr-generic.conf + +# This eval board machine conf file uses zcu1285-zynqmp xsa as reference input. +# User can override with zcu1285 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zcu1285-zynqmp" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu1285-revA.dtb" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', 'zcu1285_zynqmp']['zcu1285-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zcu208-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zcu208-zynqmp.conf new file mode 100644 index 00000000..7bb2c9db --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/zcu208-zynqmp.conf @@ -0,0 +1,50 @@ +#@TYPE: Machine +#@NAME: zcu208-zynqmp +#@DESCRIPTION: Machine configuration for the ZCU208 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zcu208-zynqmp:']['zcu208-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynqmp-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu208-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zcu208-zynqmp Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# ZCU208 board uses ZynqMP DR device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-dr-generic.conf + +# This eval board machine conf file uses zcu208-zynqmp xsa as reference input. +# User can override with zcu208 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zcu208-zynqmp" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zcu208_zynqmp']['zcu208-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zcu216-zynqmp.conf b/meta-xilinx-bsp/conf/machine/zcu216-zynqmp.conf new file mode 100644 index 00000000..f4e1619d --- /dev/null +++ b/meta-xilinx-bsp/conf/machine/zcu216-zynqmp.conf @@ -0,0 +1,50 @@ +#@TYPE: Machine +#@NAME: zcu216-zynqmp +#@DESCRIPTION: Machine configuration for the ZCU216 evaluation board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zcu216-zynqmp:']['zcu216-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynqmp-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu216-reva}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# zcu216-zynqmp Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# ZCU216 board uses ZynqMP DR device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-dr-generic.conf + +# This eval board machine conf file uses zcu216-zynqmp xsa as reference input. +# User can override with zcu216 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "zcu216-zynqmp" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zcu216_zynqmp']['zcu216-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-bsp/conf/machine/zedboard-zynq7.conf b/meta-xilinx-bsp/conf/machine/zedboard-zynq7.conf deleted file mode 100644 index 114927de..00000000 --- a/meta-xilinx-bsp/conf/machine/zedboard-zynq7.conf +++ /dev/null @@ -1,29 +0,0 @@ -#@TYPE: Machine -#@NAME: zedboard-zynq7 -#@DESCRIPTION: Machine support for ZedBoard. (http://www.zedboard.org/) -# -# For details on the Evaluation board: -# http://www.zedboard.org/content/overview -# For design files (including 'zynq_fsbl_0.elf') for the ZedBoard: -# http://www.zedboard.org/reference-designs-categories/zynq-concepts-tools-and-techniques-zedboard -# - -require conf/machine/include/tune-zynq.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc - -# u-boot configuration -UBOOT_MACHINE = "zynq_zed_config" -SPL_BINARY = "spl/boot.bin" - -EXTRA_IMAGEDEPENDS += " \ - u-boot-zynq-uenv \ - virtual/boot-bin \ - " - -SERIAL_CONSOLE = "115200 ttyPS0" - -KERNEL_DEVICETREE = "zynq-zed.dtb" - -IMAGE_BOOT_FILES += "boot.bin uEnv.txt ${KERNEL_IMAGETYPE}-zynq-zed.dtb" - diff --git a/meta-xilinx-bsp/conf/machine/zybo-linux-bd-zynq7.conf b/meta-xilinx-bsp/conf/machine/zybo-linux-bd-zynq7.conf deleted file mode 100644 index b916a209..00000000 --- a/meta-xilinx-bsp/conf/machine/zybo-linux-bd-zynq7.conf +++ /dev/null @@ -1,40 +0,0 @@ -#@TYPE: Machine -#@NAME: zybo-linux-bd-zynq7 -#@DESCRIPTION: Machine support for zybo-linux-bd project. -# -# generated base on ZYBO linux-bd project -# - -require conf/machine/include/tune-zynq.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc - -PREFERRED_PROVIDER_virtual/kernel ?= "linux-xlnx" -PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" - -MACHINE_FEATURES = "ext2 vfat usbhost usbgadget keyboard screen alsa sdio" -SERIAL_CONSOLE = "115200 ttyPS0" - -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" - -UBOOT_MACHINE = "zynq_zybo_config" -SPL_BINARY = "spl/boot.bin" -FORCE_PLATFORM_INIT = "1" - -EXTRA_IMAGEDEPENDS += " \ - u-boot-zynq-uenv \ - virtual/boot-bin \ - virtual/bitstream \ - " - -IMAGE_BOOT_FILES += " \ - boot.bin \ - ${MACHINE}.dtb \ - bitstream \ - uEnv.txt \ - " - -KERNEL_FEATURES += " \ - bsp/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.scc \ - features/v4l2/v4l2-xilinx.scc \ - " diff --git a/meta-xilinx-bsp/conf/machine/zybo-zynq7.conf b/meta-xilinx-bsp/conf/machine/zybo-zynq7.conf deleted file mode 100644 index e94ad6b9..00000000 --- a/meta-xilinx-bsp/conf/machine/zybo-zynq7.conf +++ /dev/null @@ -1,34 +0,0 @@ -#@TYPE: Machine -#@NAME: zybo-zynq7 -#@DESCRIPTION: Machine support for ZYBO. -# -# For details on the ZYBO board: -# https://www.digilentinc.com/Products/Detail.cfm?Prod=ZYBO -# - -require conf/machine/include/tune-zynq.inc -require conf/machine/include/machine-xilinx-default.inc -require conf/machine/include/machine-xilinx-board.inc - -MACHINE_FEATURES = "ext2 vfat usbhost usbgadget" - -# u-boot configuration -PREFERRED_PROVIDER_virtual/bootloader = "u-boot" -UBOOT_MACHINE = "zynq_zybo_config" -SPL_BINARY = "spl/boot.bin" - -EXTRA_IMAGEDEPENDS += " \ - u-boot-zynq-uenv \ - virtual/boot-bin \ - " - -SERIAL_CONSOLE = "115200 ttyPS0" - -KERNEL_DEVICETREE = "zynq-zybo.dtb" - -IMAGE_BOOT_FILES += " \ - boot.bin \ - ${KERNEL_IMAGETYPE}-zynq-zybo.dtb \ - uEnv.txt \ - " - diff --git a/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc b/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc deleted file mode 100644 index 80d14f96..00000000 --- a/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc +++ /dev/null @@ -1,64 +0,0 @@ -DESCRIPTION = "ARM Trusted Firmware" - -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://license.md;md5=829bdeb34c1d9044f393d5a16c068371" - -PROVIDES = "virtual/arm-trusted-firmware" - -inherit deploy - -DEPENDS += "u-boot-mkimage-native" - -S = "${WORKDIR}/git" -B = "${WORKDIR}/build" - -BRANCH ?= "master" -REPO ?= "git://github.com/Xilinx/arm-trusted-firmware.git;protocol=https" -BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" -SRC_URI = "${REPO};${BRANCHARG}" - -ATF_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}-${DATETIME}" -ATF_BASE_NAME[vardepsexclude] = "DATETIME" - -COMPATIBLE_MACHINE = "zynqmp" -PLATFORM_zynqmp = "zynqmp" - -# requires CROSS_COMPILE set by hand as there is no configure script -export CROSS_COMPILE="${TARGET_PREFIX}" - -# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application -CFLAGS[unexport] = "1" -LDFLAGS[unexport] = "1" -AS[unexport] = "1" -LD[unexport] = "1" - -do_configure() { - : -} - -do_compile() { - oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31 -} - -do_install() { - : -} - -OUTPUT_DIR = "${B}/${PLATFORM}/release" - -do_deploy() { - install -d ${DEPLOYDIR} - install -m 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${DEPLOYDIR}/${ATF_BASE_NAME}.elf - ln -sf ${ATF_BASE_NAME}.elf ${DEPLOYDIR}/${PN}.elf - install -m 0644 ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.bin - ln -sf ${ATF_BASE_NAME}.bin ${DEPLOYDIR}/${PN}.bin - - # Get the entry point address from the elf. - BL31_BASE_ADDR=$(${READELF} -h ${OUTPUT_DIR}/bl31/bl31.elf | egrep -m 1 -i "entry point.*?0x" | sed -r 's/.*?(0x.*?)/\1/g') - mkimage -A arm64 -O linux -T kernel -C none \ - -a $BL31_BASE_ADDR -e $BL31_BASE_ADDR \ - -d ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.ub - ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/${PN}.ub - ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/atf-uboot.ub -} -addtask deploy before do_build after do_compile diff --git a/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend b/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend new file mode 100644 index 00000000..c6c92fe7 --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend @@ -0,0 +1,2 @@ +EXTRA_OEMAKE:append:vc-p-a2197-00-versal =" VERSAL_PLATFORM=silicon" + diff --git a/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2017.3.bb b/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2017.3.bb deleted file mode 100644 index 9bf5cacf..00000000 --- a/meta-xilinx-bsp/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2017.3.bb +++ /dev/null @@ -1,6 +0,0 @@ -include arm-trusted-firmware.inc - -XILINX_RELEASE_VERSION = "v2017.3" -SRCREV ?= "f9b244beaa7ac6a670b192192b6e92e5fd6044dc" - -PV = "1.3-xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}" diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bb b/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bb deleted file mode 100644 index a7370674..00000000 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bb +++ /dev/null @@ -1,83 +0,0 @@ -SUMMARY = "Device Trees for BSPs" -DESCRIPTION = "Device Tree generation and packaging for BSP Device Trees." -SECTION = "bsp" - -LICENSE = "MIT & GPLv2" -LIC_FILES_CHKSUM = " \ - file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ - file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \ - " - -inherit deploy kernel-arch - -INHIBIT_DEFAULT_DEPS = "1" -DEPENDS += "dtc-native" - -COMPATIBLE_MACHINE ?= "^$" - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -FILES_${PN} = "/boot/devicetree/*.dtb /boot/devicetree/*.dtbo" - -S = "${WORKDIR}" -B = "${WORKDIR}/build" - -SYSROOT_DIRS += "/boot/devicetree" - -# By default provide the current kernel arch's boot/dts and boot/dts/include. -KERNEL_DTS_INCLUDE ??= " \ - ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts \ - ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/include \ - " -# For arm64/zynqmp the xilinx specific includes are subdired under a vendor directory. -KERNEL_DTS_INCLUDE_append_zynqmp = " \ - ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/xilinx \ - " - -DTS_FILES_PATH ?= "${S}" -DTS_INCLUDE ?= "${DTS_FILES_PATH} ${KERNEL_DTS_INCLUDE}" - -DT_PADDING_SIZE ?= "0x3000" -DEVICETREE_FLAGS ?= " \ - -R 8 -p ${DT_PADDING_SIZE} -b 0 \ - ${@' '.join(['-i %s' % i for i in d.getVar('DTS_INCLUDE', True).split()])} \ - " -DEVICETREE_OFLAGS ?= "-@ -H epapr" -DEVICETREE_PP_FLAGS ?= " \ - -nostdinc -Ulinux -x assembler-with-cpp \ - ${@' '.join(['-I%s' % i for i in d.getVar('DTS_INCLUDE', True).split()])} \ - " - -python () { - # auto add dependency on kernel tree - if d.getVar("KERNEL_DTS_INCLUDE") != "": - d.appendVarFlag("do_compile", "depends", " virtual/kernel:do_configure") -} - -do_compile() { - for DTS_FILE in ${DTS_FILES_PATH}/*.dts; do - DTS_NAME=`basename -s .dts ${DTS_FILE}` - ${BUILD_CPP} ${DEVICETREE_PP_FLAGS} -o `basename ${DTS_FILE}`.pp ${DTS_FILE} - - # for now use the existance of the '/plugin/' tag to detect overlays - if grep -qse "/plugin/;" `basename ${DTS_FILE}`.pp; then - dtc ${DEVICETREE_OFLAGS} -I dts -O dtb ${DEVICETREE_FLAGS} -o ${DTS_NAME}.dtbo `basename ${DTS_FILE}`.pp - else - dtc -I dts -O dtb ${DEVICETREE_FLAGS} -o ${DTS_NAME}.dtb `basename ${DTS_FILE}`.pp - fi - done -} - -do_install() { - for DTB_FILE in `ls *.dtb *.dtbo`; do - install -Dm 0644 ${B}/${DTB_FILE} ${D}/boot/devicetree/${DTB_FILE} - done -} - -do_deploy() { - for DTB_FILE in `ls *.dtb *.dtbo`; do - install -Dm 0644 ${B}/${DTB_FILE} ${DEPLOYDIR}/${DTB_FILE} - done -} -addtask deploy before do_build after do_install - diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bbappend b/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bbappend index e128e0e8..fa4816af 100644 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bbappend +++ b/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bbappend @@ -1,30 +1,7 @@ - -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -# common zynq include -SRC_URI_append_zynq = " file://zynq-7000-qspi-dummy.dtsi" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" # device tree sources for the various machines -COMPATIBLE_MACHINE_picozed-zynq7 = ".*" -SRC_URI_append_picozed-zynq7 = " file://picozed-zynq7.dts" - -COMPATIBLE_MACHINE_microzed-zynq7 = ".*" -SRC_URI_append_microzed-zynq7 = " file://microzed-zynq7.dts" - -COMPATIBLE_MACHINE_qemu-zynq7 = ".*" -SRC_URI_append_qemu-zynq7 = " file://qemu-zynq7.dts" - -COMPATIBLE_MACHINE_zybo-linux-bd-zynq7 = ".*" -SRC_URI_append_zybo-linux-bd-zynq7 = " \ - file://zybo-linux-bd-zynq7.dts \ - file://pcw.dtsi \ - file://pl.dtsi \ - " - -COMPATIBLE_MACHINE_kc705-microblazeel = ".*" -SRC_URI_append_kc705-microblazeel = " \ - file://kc705-microblazeel.dts \ - file://pl.dtsi \ - file://system-conf.dtsi \ - " +COMPATIBLE_MACHINE:qemu-zynq7 = ".*" +SRC_URI:append:qemu-zynq7 = " file://qemu-zynq7.dts" +EXTRA_OVERLAYS:append = "${@bb.utils.contains('MACHINE_FEATURES', 'provencore', ' pnc.dtsi', '', d)}" diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/kc705-microblazeel.dts b/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/kc705-microblazeel.dts deleted file mode 100644 index 45e488c1..00000000 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/kc705-microblazeel.dts +++ /dev/null @@ -1,56 +0,0 @@ -/dts-v1/; -/include/ "pl.dtsi" -/include/ "system-conf.dtsi" -/ { - hard-reset-gpios = <&reset_gpio 0 1>; - aliases { - ethernet0 = &axi_ethernet; - i2c0 = &iic_main; - serial0 = &rs232_uart; - }; - memory { - device_type = "memory"; - reg = <0x80000000 0x40000000>; - }; -}; - -&iic_main { - i2cswitch@74 { - compatible = "nxp,pca9548"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x74>; - i2c@0 { - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - si570: clock-generator@5d { - #clock-cells = <0>; - compatible = "silabs,si570"; - temperature-stability = <50>; - reg = <0x5d>; - factory-fout = <156250000>; - clock-frequency = <148500000>; - }; - }; - i2c@3 { - #address-cells = <1>; - #size-cells = <0>; - reg = <3>; - eeprom@54 { - compatible = "at,24c08"; - reg = <0x54>; - }; - }; - }; -}; - -&axi_ethernet { - phy-handle = <&phy0>; - axi_ethernet_mdio: mdio { - phy0: phy@7 { - device_type = "ethernet-phy"; - reg = <7>; - }; - }; -}; diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/pl.dtsi b/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/pl.dtsi deleted file mode 100644 index 43bc2ab7..00000000 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/pl.dtsi +++ /dev/null @@ -1,445 +0,0 @@ -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "xlnx,microblaze"; - model = "Xilinx MicroBlaze"; - cpus { - #address-cells = <1>; - #cpus = <1>; - #size-cells = <0>; - microblaze_0: cpu@0 { - bus-handle = <&amba_pl>; - clock-frequency = <200000000>; - clocks = <&clk_cpu>; - compatible = "xlnx,microblaze-10.0"; - d-cache-baseaddr = <0x0000000080000000>; - d-cache-highaddr = <0x00000000bfffffff>; - d-cache-line-size = <0x20>; - d-cache-size = <0x4000>; - device_type = "cpu"; - i-cache-baseaddr = <0x0000000080000000>; - i-cache-highaddr = <0x00000000bfffffff>; - i-cache-line-size = <0x10>; - i-cache-size = <0x4000>; - interrupt-handle = <µblaze_0_axi_intc>; - model = "microblaze,10.0"; - timebase-frequency = <200000000>; - xlnx,addr-size = <0x20>; - xlnx,addr-tag-bits = <0x10>; - xlnx,allow-dcache-wr = <0x1>; - xlnx,allow-icache-wr = <0x1>; - xlnx,area-optimized = <0x0>; - xlnx,async-interrupt = <0x1>; - xlnx,async-wakeup = <0x3>; - xlnx,avoid-primitives = <0x0>; - xlnx,base-vectors = <0x0000000000000000>; - xlnx,branch-target-cache-size = <0x0>; - xlnx,cache-byte-size = <0x4000>; - xlnx,d-axi = <0x1>; - xlnx,d-lmb = <0x1>; - xlnx,d-lmb-mon = <0x0>; - xlnx,daddr-size = <0x20>; - xlnx,data-size = <0x20>; - xlnx,dc-axi-mon = <0x0>; - xlnx,dcache-addr-tag = <0x10>; - xlnx,dcache-always-used = <0x1>; - xlnx,dcache-byte-size = <0x4000>; - xlnx,dcache-data-width = <0x0>; - xlnx,dcache-force-tag-lutram = <0x0>; - xlnx,dcache-line-len = <0x8>; - xlnx,dcache-use-writeback = <0x0>; - xlnx,dcache-victims = <0x0>; - xlnx,debug-counter-width = <0x20>; - xlnx,debug-enabled = <0x1>; - xlnx,debug-event-counters = <0x5>; - xlnx,debug-external-trace = <0x0>; - xlnx,debug-interface = <0x0>; - xlnx,debug-latency-counters = <0x1>; - xlnx,debug-profile-size = <0x0>; - xlnx,debug-trace-async-reset = <0x0>; - xlnx,debug-trace-size = <0x2000>; - xlnx,div-zero-exception = <0x1>; - xlnx,dp-axi-mon = <0x0>; - xlnx,dynamic-bus-sizing = <0x0>; - xlnx,ecc-use-ce-exception = <0x0>; - xlnx,edge-is-positive = <0x1>; - xlnx,enable-discrete-ports = <0x0>; - xlnx,endianness = <0x1>; - xlnx,fault-tolerant = <0x0>; - xlnx,fpu-exception = <0x0>; - xlnx,freq = <0xbebc200>; - xlnx,fsl-exception = <0x0>; - xlnx,fsl-links = <0x0>; - xlnx,i-axi = <0x0>; - xlnx,i-lmb = <0x1>; - xlnx,i-lmb-mon = <0x0>; - xlnx,iaddr-size = <0x20>; - xlnx,ic-axi-mon = <0x0>; - xlnx,icache-always-used = <0x1>; - xlnx,icache-data-width = <0x0>; - xlnx,icache-force-tag-lutram = <0x0>; - xlnx,icache-line-len = <0x4>; - xlnx,icache-streams = <0x1>; - xlnx,icache-victims = <0x8>; - xlnx,ill-opcode-exception = <0x1>; - xlnx,imprecise-exceptions = <0x0>; - xlnx,instr-size = <0x20>; - xlnx,interconnect = <0x2>; - xlnx,interrupt-is-edge = <0x0>; - xlnx,interrupt-mon = <0x0>; - xlnx,ip-axi-mon = <0x0>; - xlnx,lockstep-master = <0x0>; - xlnx,lockstep-select = <0x0>; - xlnx,lockstep-slave = <0x0>; - xlnx,mmu-dtlb-size = <0x4>; - xlnx,mmu-itlb-size = <0x2>; - xlnx,mmu-privileged-instr = <0x0>; - xlnx,mmu-tlb-access = <0x3>; - xlnx,mmu-zones = <0x2>; - xlnx,num-sync-ff-clk = <0x2>; - xlnx,num-sync-ff-clk-debug = <0x2>; - xlnx,num-sync-ff-clk-irq = <0x1>; - xlnx,num-sync-ff-dbg-clk = <0x1>; - xlnx,num-sync-ff-dbg-trace-clk = <0x2>; - xlnx,number-of-pc-brk = <0x1>; - xlnx,number-of-rd-addr-brk = <0x0>; - xlnx,number-of-wr-addr-brk = <0x0>; - xlnx,opcode-0x0-illegal = <0x1>; - xlnx,optimization = <0x0>; - xlnx,pc-width = <0x20>; - xlnx,piaddr-size = <0x20>; - xlnx,pvr = <0x2>; - xlnx,pvr-user1 = <0x00>; - xlnx,pvr-user2 = <0x00000000>; - xlnx,reset-msr = <0x00000000>; - xlnx,reset-msr-bip = <0x0>; - xlnx,reset-msr-dce = <0x0>; - xlnx,reset-msr-ee = <0x0>; - xlnx,reset-msr-eip = <0x0>; - xlnx,reset-msr-ice = <0x0>; - xlnx,reset-msr-ie = <0x0>; - xlnx,sco = <0x0>; - xlnx,trace = <0x0>; - xlnx,unaligned-exceptions = <0x1>; - xlnx,use-barrel = <0x1>; - xlnx,use-branch-target-cache = <0x0>; - xlnx,use-config-reset = <0x0>; - xlnx,use-dcache = <0x1>; - xlnx,use-div = <0x1>; - xlnx,use-ext-brk = <0x0>; - xlnx,use-ext-nm-brk = <0x0>; - xlnx,use-extended-fsl-instr = <0x0>; - xlnx,use-fpu = <0x0>; - xlnx,use-hw-mul = <0x2>; - xlnx,use-icache = <0x1>; - xlnx,use-interrupt = <0x2>; - xlnx,use-mmu = <0x3>; - xlnx,use-msr-instr = <0x1>; - xlnx,use-non-secure = <0x0>; - xlnx,use-pcmp-instr = <0x1>; - xlnx,use-reorder-instr = <0x1>; - xlnx,use-stack-protection = <0x0>; - }; - }; - clocks { - #address-cells = <1>; - #size-cells = <0>; - clk_cpu: clk_cpu@0 { - #clock-cells = <0>; - clock-frequency = <200000000>; - clock-output-names = "clk_cpu"; - compatible = "fixed-clock"; - reg = <0>; - }; - clk_bus_0: clk_bus_0@1 { - #clock-cells = <0>; - clock-frequency = <200000000>; - clock-output-names = "clk_bus_0"; - compatible = "fixed-clock"; - reg = <1>; - }; - }; - amba_pl: amba_pl { - #address-cells = <1>; - #size-cells = <1>; - compatible = "simple-bus"; - ranges ; - axi_ethernet: ethernet@40c00000 { - axistream-connected = <&axi_ethernet_dma>; - axistream-control-connected = <&axi_ethernet_dma>; - clock-frequency = <100000000>; - compatible = "xlnx,axi-ethernet-1.00.a"; - device_type = "network"; - interrupt-parent = <µblaze_0_axi_intc>; - interrupts = <4 2>; - phy-mode = "gmii"; - reg = <0x40c00000 0x40000>; - xlnx = <0x0>; - xlnx,axiliteclkrate = <0x0>; - xlnx,axisclkrate = <0x0>; - xlnx,clockselection = <0x0>; - xlnx,enableasyncsgmii = <0x0>; - xlnx,gt-type = <0x0>; - xlnx,gtinex = <0x0>; - xlnx,gtlocation = <0x0>; - xlnx,gtrefclksrc = <0x0>; - xlnx,include-dre ; - xlnx,instantiatebitslice0 = <0x0>; - xlnx,phy-type = <0x1>; - xlnx,phyaddr = <0x1>; - xlnx,rable = <0x0>; - xlnx,rxcsum = <0x0>; - xlnx,rxlane0-placement = <0x0>; - xlnx,rxlane1-placement = <0x0>; - xlnx,rxmem = <0x1000>; - xlnx,rxnibblebitslice0used = <0x0>; - xlnx,tx-in-upper-nibble = <0x1>; - xlnx,txcsum = <0x0>; - xlnx,txlane0-placement = <0x0>; - xlnx,txlane1-placement = <0x0>; - axi_ethernet_mdio: mdio { - #address-cells = <1>; - #size-cells = <0>; - }; - }; - axi_ethernet_dma: dma@41e00000 { - #dma-cells = <1>; - axistream-connected = <&axi_ethernet>; - axistream-control-connected = <&axi_ethernet>; - clock-frequency = <200000000>; - clock-names = "s_axi_lite_aclk"; - clocks = <&clk_bus_0>; - compatible = "xlnx,eth-dma"; - interrupt-parent = <µblaze_0_axi_intc>; - interrupts = <3 2 2 2>; - reg = <0x41e00000 0x10000>; - xlnx,include-dre ; - }; - axi_timer_0: timer@41c00000 { - clock-frequency = <200000000>; - clocks = <&clk_bus_0>; - compatible = "xlnx,xps-timer-1.00.a"; - interrupt-parent = <µblaze_0_axi_intc>; - interrupts = <5 2>; - reg = <0x41c00000 0x10000>; - xlnx,count-width = <0x20>; - xlnx,gen0-assert = <0x1>; - xlnx,gen1-assert = <0x1>; - xlnx,one-timer-only = <0x0>; - xlnx,trig0-assert = <0x1>; - xlnx,trig1-assert = <0x1>; - }; - calib_complete_gpio: gpio@40010000 { - #gpio-cells = <2>; - compatible = "xlnx,xps-gpio-1.00.a"; - gpio-controller ; - reg = <0x40010000 0x10000>; - xlnx,all-inputs = <0x1>; - xlnx,all-inputs-2 = <0x0>; - xlnx,all-outputs = <0x0>; - xlnx,all-outputs-2 = <0x0>; - xlnx,dout-default = <0x00000000>; - xlnx,dout-default-2 = <0x00000000>; - xlnx,gpio-width = <0x1>; - xlnx,gpio2-width = <0x20>; - xlnx,interrupt-present = <0x0>; - xlnx,is-dual = <0x0>; - xlnx,tri-default = <0xFFFFFFFF>; - xlnx,tri-default-2 = <0xFFFFFFFF>; - }; - dip_switches_4bits: gpio@40020000 { - #gpio-cells = <2>; - compatible = "xlnx,xps-gpio-1.00.a"; - gpio-controller ; - reg = <0x40020000 0x10000>; - xlnx,all-inputs = <0x1>; - xlnx,all-inputs-2 = <0x0>; - xlnx,all-outputs = <0x0>; - xlnx,all-outputs-2 = <0x0>; - xlnx,dout-default = <0x00000000>; - xlnx,dout-default-2 = <0x00000000>; - xlnx,gpio-width = <0x4>; - xlnx,gpio2-width = <0x20>; - xlnx,interrupt-present = <0x0>; - xlnx,is-dual = <0x0>; - xlnx,tri-default = <0xFFFFFFFF>; - xlnx,tri-default-2 = <0xFFFFFFFF>; - }; - iic_main: i2c@40800000 { - #address-cells = <1>; - #size-cells = <0>; - clock-frequency = <200000000>; - clocks = <&clk_bus_0>; - compatible = "xlnx,xps-iic-2.00.a"; - interrupt-parent = <µblaze_0_axi_intc>; - interrupts = <1 2>; - reg = <0x40800000 0x10000>; - }; - led_8bits: gpio@40030000 { - #gpio-cells = <2>; - compatible = "xlnx,xps-gpio-1.00.a"; - gpio-controller ; - reg = <0x40030000 0x10000>; - xlnx,all-inputs = <0x0>; - xlnx,all-inputs-2 = <0x0>; - xlnx,all-outputs = <0x1>; - xlnx,all-outputs-2 = <0x0>; - xlnx,dout-default = <0x00000000>; - xlnx,dout-default-2 = <0x00000000>; - xlnx,gpio-width = <0x8>; - xlnx,gpio2-width = <0x20>; - xlnx,interrupt-present = <0x0>; - xlnx,is-dual = <0x0>; - xlnx,tri-default = <0xFFFFFFFF>; - xlnx,tri-default-2 = <0xFFFFFFFF>; - }; - linear_flash: flash@60000000 { - bank-width = <2>; - compatible = "cfi-flash"; - reg = <0x60000000 0x8000000>; - xlnx,axi-clk-period-ps = <0x1388>; - xlnx,include-datawidth-matching-0 = <0x1>; - xlnx,include-datawidth-matching-1 = <0x1>; - xlnx,include-datawidth-matching-2 = <0x1>; - xlnx,include-datawidth-matching-3 = <0x1>; - xlnx,include-negedge-ioregs = <0x0>; - xlnx,lflash-period-ps = <0x1388>; - xlnx,linear-flash-sync-burst = <0x0>; - xlnx,max-mem-width = <0x10>; - xlnx,mem-a-lsb = <0x0>; - xlnx,mem-a-msb = <0x1f>; - xlnx,mem0-type = <0x2>; - xlnx,mem0-width = <0x10>; - xlnx,mem1-type = <0x0>; - xlnx,mem1-width = <0x10>; - xlnx,mem2-type = <0x0>; - xlnx,mem2-width = <0x10>; - xlnx,mem3-type = <0x0>; - xlnx,mem3-width = <0x10>; - xlnx,num-banks-mem = <0x1>; - xlnx,page-size = <0x10>; - xlnx,parity-type-mem-0 = <0x0>; - xlnx,parity-type-mem-1 = <0x0>; - xlnx,parity-type-mem-2 = <0x0>; - xlnx,parity-type-mem-3 = <0x0>; - xlnx,port-diff = <0x0>; - xlnx,s-axi-en-reg = <0x0>; - xlnx,s-axi-mem-addr-width = <0x20>; - xlnx,s-axi-mem-data-width = <0x20>; - xlnx,s-axi-mem-id-width = <0x1>; - xlnx,s-axi-reg-addr-width = <0x5>; - xlnx,s-axi-reg-data-width = <0x20>; - xlnx,synch-pipedelay-0 = <0x1>; - xlnx,synch-pipedelay-1 = <0x1>; - xlnx,synch-pipedelay-2 = <0x1>; - xlnx,synch-pipedelay-3 = <0x1>; - xlnx,tavdv-ps-mem-0 = <0x1fbd0>; - xlnx,tavdv-ps-mem-1 = <0x3a98>; - xlnx,tavdv-ps-mem-2 = <0x3a98>; - xlnx,tavdv-ps-mem-3 = <0x3a98>; - xlnx,tcedv-ps-mem-0 = <0x1fbd0>; - xlnx,tcedv-ps-mem-1 = <0x3a98>; - xlnx,tcedv-ps-mem-2 = <0x3a98>; - xlnx,tcedv-ps-mem-3 = <0x3a98>; - xlnx,thzce-ps-mem-0 = <0x88b8>; - xlnx,thzce-ps-mem-1 = <0x1b58>; - xlnx,thzce-ps-mem-2 = <0x1b58>; - xlnx,thzce-ps-mem-3 = <0x1b58>; - xlnx,thzoe-ps-mem-0 = <0x1b58>; - xlnx,thzoe-ps-mem-1 = <0x1b58>; - xlnx,thzoe-ps-mem-2 = <0x1b58>; - xlnx,thzoe-ps-mem-3 = <0x1b58>; - xlnx,tlzwe-ps-mem-0 = <0xc350>; - xlnx,tlzwe-ps-mem-1 = <0x0>; - xlnx,tlzwe-ps-mem-2 = <0x0>; - xlnx,tlzwe-ps-mem-3 = <0x0>; - xlnx,tpacc-ps-flash-0 = <0x61a8>; - xlnx,tpacc-ps-flash-1 = <0x61a8>; - xlnx,tpacc-ps-flash-2 = <0x61a8>; - xlnx,tpacc-ps-flash-3 = <0x61a8>; - xlnx,twc-ps-mem-0 = <0x11170>; - xlnx,twc-ps-mem-1 = <0x3a98>; - xlnx,twc-ps-mem-2 = <0x3a98>; - xlnx,twc-ps-mem-3 = <0x3a98>; - xlnx,twp-ps-mem-0 = <0x13880>; - xlnx,twp-ps-mem-1 = <0x2ee0>; - xlnx,twp-ps-mem-2 = <0x2ee0>; - xlnx,twp-ps-mem-3 = <0x2ee0>; - xlnx,twph-ps-mem-0 = <0x13880>; - xlnx,twph-ps-mem-1 = <0x2ee0>; - xlnx,twph-ps-mem-2 = <0x2ee0>; - xlnx,twph-ps-mem-3 = <0x2ee0>; - xlnx,use-startup = <0x0>; - xlnx,use-startup-int = <0x0>; - xlnx,wr-rec-time-mem-0 = <0x186a0>; - xlnx,wr-rec-time-mem-1 = <0x6978>; - xlnx,wr-rec-time-mem-2 = <0x6978>; - xlnx,wr-rec-time-mem-3 = <0x6978>; - }; - microblaze_0_axi_intc: interrupt-controller@41200000 { - #interrupt-cells = <2>; - compatible = "xlnx,xps-intc-1.00.a"; - interrupt-controller ; - reg = <0x41200000 0x10000>; - xlnx,kind-of-intr = <0x0>; - xlnx,num-intr-inputs = <0x6>; - }; - push_buttons_5bits: gpio@40040000 { - #gpio-cells = <2>; - compatible = "xlnx,xps-gpio-1.00.a"; - gpio-controller ; - reg = <0x40040000 0x10000>; - xlnx,all-inputs = <0x1>; - xlnx,all-inputs-2 = <0x0>; - xlnx,all-outputs = <0x0>; - xlnx,all-outputs-2 = <0x0>; - xlnx,dout-default = <0x00000000>; - xlnx,dout-default-2 = <0x00000000>; - xlnx,gpio-width = <0x5>; - xlnx,gpio2-width = <0x20>; - xlnx,interrupt-present = <0x0>; - xlnx,is-dual = <0x0>; - xlnx,tri-default = <0xFFFFFFFF>; - xlnx,tri-default-2 = <0xFFFFFFFF>; - }; - reset_gpio: gpio@40000000 { - #gpio-cells = <2>; - compatible = "xlnx,xps-gpio-1.00.a"; - gpio-controller ; - reg = <0x40000000 0x10000>; - xlnx,all-inputs = <0x0>; - xlnx,all-inputs-2 = <0x0>; - xlnx,all-outputs = <0x1>; - xlnx,all-outputs-2 = <0x0>; - xlnx,dout-default = <0x00000000>; - xlnx,dout-default-2 = <0x00000000>; - xlnx,gpio-width = <0x1>; - xlnx,gpio2-width = <0x20>; - xlnx,interrupt-present = <0x0>; - xlnx,is-dual = <0x0>; - xlnx,tri-default = <0xFFFFFFFF>; - xlnx,tri-default-2 = <0xFFFFFFFF>; - }; - rs232_uart: serial@44a00000 { - clock-frequency = <200000000>; - clocks = <&clk_bus_0>; - compatible = "xlnx,xps-uart16550-2.00.a", "ns16550a"; - current-speed = <115200>; - device_type = "serial"; - interrupt-parent = <µblaze_0_axi_intc>; - interrupts = <0 2>; - port-number = <0>; - reg = <0x44a00000 0x10000>; - reg-offset = <0x1000>; - reg-shift = <2>; - xlnx,external-xin-clk-hz = <0x17d7840>; - xlnx,external-xin-clk-hz-d = <0x19>; - xlnx,has-external-rclk = <0x0>; - xlnx,has-external-xin = <0x0>; - xlnx,is-a-16550 = <0x1>; - xlnx,s-axi-aclk-freq-hz-d = "200.0"; - xlnx,use-modem-ports = <0x1>; - xlnx,use-user-ports = <0x1>; - }; - }; -}; diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/system-conf.dtsi b/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/system-conf.dtsi deleted file mode 100644 index 09b26c6a..00000000 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/kc705-microblazeel/system-conf.dtsi +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CAUTION: This file is automatically generated by PetaLinux SDK. - * DO NOT modify this file - */ - - -/ { - chosen { - bootargs = "console=ttyS0,115200 earlyprintk"; - stdout-path = "serial0:115200n8"; - }; -}; - -&axi_ethernet { - local-mac-address = [00 0a 35 00 22 01]; -}; - -&linear_flash { - reg = <0x60000000 0x08000000>; - #address-cells = <1>; - #size-cells = <1>; - partition@0x00000000 { - label = "fpga"; - reg = <0x00000000 0x00b00000>; - }; - partition@0x00b00000 { - label = "boot"; - reg = <0x00b00000 0x00080000>; - }; - partition@0x00b80000 { - label = "bootenv"; - reg = <0x00b80000 0x00020000>; - }; - partition@0x00ba0000 { - label = "kernel"; - reg = <0x00ba0000 0x00c00000>; - }; - partition@0x017a0000 { - label = "spare"; - reg = <0x017a0000 0x00000000>; - }; -}; - diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/microzed-zynq7.dts b/meta-xilinx-bsp/recipes-bsp/device-tree/files/microzed-zynq7.dts deleted file mode 100644 index b9376a49..00000000 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/microzed-zynq7.dts +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2011 - 2014 Xilinx - * Copyright (C) 2016 Jagan Teki <jteki@openedev.com> - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ -/dts-v1/; -/include/ "zynq-7000.dtsi" - -/ { - model = "Zynq MicroZED Development Board"; - compatible = "xlnx,zynq-microzed", "xlnx,zynq-7000"; - - aliases { - ethernet0 = &gem0; - serial0 = &uart1; - }; - - memory { - device_type = "memory"; - reg = <0x0 0x40000000>; - }; - - chosen { - bootargs = "earlycon"; - stdout-path = "serial0:115200n8"; - }; - - usb_phy0: phy0 { - compatible = "usb-nop-xceiv"; - #phy-cells = <0>; - }; -}; - -&clkc { - ps-clk-frequency = <33333333>; -}; - -&gem0 { - status = "okay"; - phy-mode = "rgmii-id"; - phy-handle = <ðernet_phy>; - - ethernet_phy: ethernet-phy@0 { - reg = <0>; - }; -}; - -&sdhci0 { - status = "okay"; -}; - -&uart1 { - status = "okay"; -}; - -&usb0 { - status = "okay"; - dr_mode = "host"; - usb-phy = <&usb_phy0>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usb0_default>; -}; - -&pinctrl0 { - pinctrl_usb0_default: usb0-default { - mux { - groups = "usb0_0_grp"; - function = "usb0"; - }; - - conf { - groups = "usb0_0_grp"; - slew-rate = <0>; - io-standard = <1>; - }; - - conf-rx { - pins = "MIO29", "MIO31", "MIO36"; - bias-high-impedance; - }; - - conf-tx { - pins = "MIO28", "MIO30", "MIO32", "MIO33", "MIO34", - "MIO35", "MIO37", "MIO38", "MIO39"; - bias-disable; - }; - }; -}; diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/pnc.dtsi b/meta-xilinx-bsp/recipes-bsp/device-tree/files/pnc.dtsi new file mode 100644 index 00000000..760b76be --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/device-tree/files/pnc.dtsi @@ -0,0 +1,13 @@ +/ { + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + pnc-reserved-memory@70000000{ + compatible = "pnc,secure-memory"; + reg = <0x0 0x70000000 0x0 0x0FF00000>; + no-map; + }; + }; +}; diff --git a/meta-xilinx-bsp/recipes-bsp/dfx-mgr/dfx-mgr_%.bbappend b/meta-xilinx-bsp/recipes-bsp/dfx-mgr/dfx-mgr_%.bbappend new file mode 100644 index 00000000..8fdf14bb --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/dfx-mgr/dfx-mgr_%.bbappend @@ -0,0 +1,10 @@ +FILESEXTRAPATHS:append := ":${THISDIR}/files" + +SRC_URI += "file://zcu106-xlnx-firmware-detect" + +PACKAGE_ARCH:zcu106-zynqmp = "${MACHINE_ARCH}" + +# ZCU106 eval board firmware detection script. +do_install:append:zcu106-zynqmp () { + install -m 0755 ${WORKDIR}/zcu106-xlnx-firmware-detect ${D}${bindir}/xlnx-firmware-detect +} diff --git a/meta-xilinx-bsp/recipes-bsp/dfx-mgr/files/zcu106-xlnx-firmware-detect b/meta-xilinx-bsp/recipes-bsp/dfx-mgr/files/zcu106-xlnx-firmware-detect new file mode 100644 index 00000000..ef5654cc --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/dfx-mgr/files/zcu106-xlnx-firmware-detect @@ -0,0 +1,71 @@ +#! /bin/sh + +# Copyright (C) 2022 Xilinx, Inc. All rights reserved. +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. +# +# SPDX-License-Identifier: MIT + +# read values from dfx-mgr conf file +conffile="/etc/dfx-mgrd/daemon.conf" +if [ ! -f "${conffile}" ]; then + echo "dfx-mgrd configuration file not found: ${conffile}" + exit 1 +fi + +fwbasedir=$(grep "firmware_location" ${conffile} | sed 's/.*:.*\[\"\(.*\)\"\],\?/\1/') +if [ -z "${fwbasedir}" ]; then + echo "Property 'firmware_location' not found in ${conffile}" + exit 1 +fi + +fwfile=$(grep "default_accel" ${conffile} | sed 's/.*:.*\"\(.*\)\",\?/\1/') +if [ -z "${fwfile}" ]; then + echo "Property 'default_accel' not found in ${conffile}" + exit 1 +fi + +# check if default firmware is already set and present +if [ -f "${fwfile}" ]; then + fwname=$(cat ${fwfile}) + fwdir="${fwbasedir}/${fwname}" + if [ -n "${fwname}" ] && [ -d "${fwdir}" ]; then + echo "Default firmware detected: ${fwname}" + exit 0 + fi +fi + +# search for firmware based on EEPROM board id +echo "Trying to detect default firmware based on EEPROM..." + +#check if board is a zcu106 eval board product +eeprom=$(ls /sys/bus/i2c/devices/*54/eeprom 2> /dev/null) +if [ -n "${eeprom}" ]; then + boardid=`dd if=$eeprom bs=1 count=6 skip=208 2>/dev/null | tr '[:upper:]' '[:lower:]'` + revision=`dd if=$eeprom bs=1 count=3 skip=224 2>/dev/null | tr '[:upper:]' '[:lower:]'` + + fwname="${boardid}-${revision}" + fwdir="${fwbasedir}/${fwname}" + + fixed_rev=2.0 + var=$(awk 'BEGIN{ print "'$fixed_rev'"<"'$revision'" }') + + if [ "${boardid}" == "zcu106" ] && [ "${var}" -eq 1 ] ;then + revision=2.0 + echo "later than 2.0 board revisions are supported in 2.0 bit and dtbo files" + fwname="${boardid}-${revision}" + fwdir="${fwbasedir}/${fwname}" + echo "${fwname}" > "${fwfile}" + exit 1 + elif [ ! -d "${fwdir}" ] ; then + echo "No default firmware named ${fwname} found in ${fwbasedir} , Loading rev1.0 bitstream and dtbo as default " + revision=1.0 + fwname=$(ls ${fwbasedir} | grep ${revision}) + fwdir="${fwbasedir}/${fwname}" + echo "${fwname}" > "${fwfile}" + exit 1 + fi + + echo "Default firmware detected: ${fwname}" + echo "${fwname}" > "${fwfile}" + exit 0 +fi diff --git a/meta-xilinx-bsp/recipes-bsp/embeddedsw/fsbl-firmware_%.bbappend b/meta-xilinx-bsp/recipes-bsp/embeddedsw/fsbl-firmware_%.bbappend new file mode 100644 index 00000000..6a23dc47 --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/embeddedsw/fsbl-firmware_%.bbappend @@ -0,0 +1,20 @@ +# QEMU for the Kria SOM requires a section from the FSBL to be extracted + +PMU_CONF_NAME ?= "pmu-conf" +PMU_CONF_BASE_NAME ?= "${PMU_CONF_NAME}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +# Required so we can run objcopy in do_compile +DEPENDS:append:zynqmp = " virtual/${TARGET_PREFIX}binutils" + +do_compile:append:zynqmp () { + if [ -z "${SYSTEM_DTFILE}" ]; then + ${OBJCOPY} --dump-section .sys_cfg_data=${B}/${PMU_CONF_NAME}.bin ${B}/${ESW_COMPONENT} + fi +} + +do_deploy:append:zynqmp () { + if [ -z "${SYSTEM_DTFILE}" ]; then + install -Dm 0644 ${B}/${PMU_CONF_NAME}.bin ${DEPLOYDIR}/${PMU_CONF_BASE_NAME}.bin + ln -s ${PMU_CONF_BASE_NAME}.bin ${DEPLOYDIR}/${PMU_CONF_NAME}.bin + fi +} diff --git a/meta-xilinx-bsp/recipes-bsp/pmu-firmware/pmu-firmware_2017.3.bb b/meta-xilinx-bsp/recipes-bsp/pmu-firmware/pmu-firmware_2017.3.bb deleted file mode 100644 index e5c5a034..00000000 --- a/meta-xilinx-bsp/recipes-bsp/pmu-firmware/pmu-firmware_2017.3.bb +++ /dev/null @@ -1,99 +0,0 @@ -SUMMARY = "Firmware for the PMU on the ZynqMP Programmable Silicon" -HOMEPAGE = "https://github.com/Xilinx/embeddedsw" -SECTION = "bsp" - -INHIBIT_DEFAULT_DEPS = "1" -DEPENDS = "virtual/${TARGET_PREFIX}gcc newlib libgloss libgcc" - -# force this recipe to provide a target virtual/pmu-firmware. this is applied -# after any class extender mapping and results in this recipe always providing -# 'virtual/pmu-firmware'. -python append_target_provides () { - d.appendVar("PROVIDES", " virtual/pmu-firmware") -} -addhandler append_target_provides -append_target_provides[eventmask] = "bb.event.RecipeParsed" - -# This source links in a number of components with differing licenses, and some -# licenses are not Open Source compatible. Additionally the pmu-firmware source -# itself is licensed under a modified MIT license which restricts use to Xilinx -# devices only. -LICENSE = "Proprietary" -LIC_FILES_CHKSUM = "file://../../../../license.txt;md5=530190e8d7ebcdfeddbe396f3f20417f" - -inherit deploy - -XILINX_RELEASE_VERSION = "v2017.3" -SRCREV = "3c9f0cfde9307c2dc1a298f9f22d492601232821" -PV = "${XILINX_RELEASE_VERSION}+git${SRCPV}" - -SRC_URI = "git://github.com/Xilinx/embeddedsw.git;protocol=https;nobranch=1" - -COMPATIBLE_HOST = "microblaze.*-elf" -COMPATIBLE_MACHINE = "^$" -COMPATIBLE_MACHINE_zynqmp = "zynqmp" - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -S = "${WORKDIR}/git/lib/sw_apps/zynqmp_pmufw/src" - -# The makefile does not handle parallelization -PARALLEL_MAKE = "" - -do_configure() { - # manually do the copy_bsp step first, so as to be able to fix up use of - # mb-* commands - ${S}/../misc/copy_bsp.sh -} - -COMPILER = "${CC}" -COMPILER_FLAGS = "-O2 -c" -EXTRA_COMPILER_FLAGS = "-g -Wall -Wextra -Os -flto -ffat-lto-objects" -ARCHIVER = "${AR}" - -# HACK: fix the dirty bug where xilsecure wants to call this PSVersion -# function, which is not implemented for microblaze. The symbols never make it -# into the final elf as the xilsecure function that uses it is not called in -# pmufw. -EXTRA_COMPILER_FLAGS_append = " -DXGetPSVersion_Info=atexit" - -BSP_DIR ?= "${S}/../misc/zynqmp_pmufw_bsp" -BSP_TARGETS_DIR ?= "${BSP_DIR}/psu_pmu_0/libsrc" - -def bsp_make_vars(d): - s = ["COMPILER", "CC", "COMPILER_FLAGS", "EXTRA_COMPILER_FLAGS", "ARCHIVER", "AR", "AS"] - return " ".join(["\"%s=%s\"" % (v, d.getVar(v)) for v in s]) - -do_compile() { - # the Makefile in ${S}/../misc/Makefile, does not handle CC, AR, AS, etc - # properly. So do its job manually. Preparing the includes first, then libs. - for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do - oe_runmake -C $(dirname $i) -s include ${@bsp_make_vars(d)} - done - for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do - oe_runmake -C $(dirname $i) -s libs ${@bsp_make_vars(d)} - done - - # --build-id=none is required due to linker script not defining a location for it. - oe_runmake CC="${CC}" CC_FLAGS="-MMD -MP -Wl,--build-id=none" -} - -do_install() { - : -} - -PMU_FIRMWARE_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" -PMU_FIRMWARE_BASE_NAME[vardepsexclude] = "DATETIME" - -do_deploy() { - install -Dm 0644 ${B}/executable.elf ${DEPLOYDIR}/${PMU_FIRMWARE_BASE_NAME}.elf - ln -sf ${PMU_FIRMWARE_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf - ln -sf ${BPN}-${MACHINE}.elf ${DEPLOYDIR}/pmu-${MACHINE}.elf - ${OBJCOPY} -O binary ${B}/executable.elf ${B}/executable.bin - install -m 0644 ${B}/executable.bin ${DEPLOYDIR}/${PMU_FIRMWARE_BASE_NAME}.bin - ln -sf ${PMU_FIRMWARE_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin - ln -sf ${BPN}-${MACHINE}.bin ${DEPLOYDIR}/pmu-${MACHINE}.bin -} -addtask deploy before do_build after do_install - -BBCLASSEXTEND = "zynqmp-pmu" diff --git a/meta-xilinx-bsp/recipes-bsp/pmu-firmware/pmu-rom_2017.3.bb b/meta-xilinx-bsp/recipes-bsp/pmu-firmware/pmu-rom_2017.3.bb deleted file mode 100644 index 89a23a5f..00000000 --- a/meta-xilinx-bsp/recipes-bsp/pmu-firmware/pmu-rom_2017.3.bb +++ /dev/null @@ -1,41 +0,0 @@ -SUMMARY = "PMU ROM for QEMU" -DESCRIPTION = "The ZynqMP PMU ROM for QEMU emulation" -HOMEPAGE = "http://www.xilinx.com" -SECTION = "bsp" - -# The BSP package does not include any license information. -LICENSE = "Proprietary" -LICENSE_FLAGS = "xilinx" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Proprietary;md5=0557f9d92cf58f2ccdd50f62f8ac0b28" - -COMPATIBLE_MACHINE = "zcu102-zynqmp" - -inherit deploy -inherit xilinx-fetch-restricted - -BSP_NAME = "xilinx-zcu102" -BSP_FILE = "${BSP_NAME}-v${PV}-final.bsp" -SRC_URI = "https://www.xilinx.com/member/forms/download/xef.html?filename=${BSP_FILE};downloadfilename=${BSP_FILE}" -SRC_URI[md5sum] = "d91b624bf5b7d2430a317ffb5067509b" -SRC_URI[sha256sum] = "ff6f2e4faf877abba3c5f7f711c2aeb6b490df5da4f38852e7337d0251800f38" - -INHIBIT_DEFAULT_DEPS = "1" -PACKAGE_ARCH = "${MACHINE_ARCH}" - -do_compile() { - # Extract the rom into workdir - tar -xf ${WORKDIR}/${BSP_FILE} ${BSP_NAME}-${PV}/pre-built/linux/images/pmu_rom_qemu_sha3.elf -C ${S} - # tar preserves the tree, so use find to get the full path and move to to the root - for i in $(find ${S} -type f -name *.elf); do mv $i ${S}/pmu-rom.elf; done -} - -do_install() { - : -} - -do_deploy () { - install -D ${S}/pmu-rom.elf ${DEPLOYDIR}/pmu-rom.elf -} - -addtask deploy before do_build after do_install - diff --git a/meta-xilinx-bsp/recipes-bsp/reference-design/kc705-bitstream_2017.3.bb b/meta-xilinx-bsp/recipes-bsp/reference-design/kc705-bitstream_2017.3.bb deleted file mode 100644 index 164df79b..00000000 --- a/meta-xilinx-bsp/recipes-bsp/reference-design/kc705-bitstream_2017.3.bb +++ /dev/null @@ -1,48 +0,0 @@ -SUMMARY = "KC705 Pre-built Bitstream" -DESCRIPTION = "A Pre-built bitstream for the KC705, which is capable of booting a Linux system." -HOMEPAGE = "http://www.xilinx.com" -SECTION = "bsp" - -# The BSP package does not include any license information. -LICENSE = "Proprietary" -LICENSE_FLAGS = "xilinx" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Proprietary;md5=0557f9d92cf58f2ccdd50f62f8ac0b28" - -COMPATIBLE_MACHINE = "kc705-microblazeel" - -inherit deploy -inherit xilinx-fetch-restricted - -BSP_NAME = "xilinx-kc705" -BSP_FILE = "${BSP_NAME}-v${PV}-final.bsp" -SRC_URI = "https://www.xilinx.com/member/forms/download/xef.html?filename=${BSP_FILE};downloadfilename=${BSP_FILE}" -SRC_URI[md5sum] = "e4c4de43dcbcb955a3c63e4c68542792" -SRC_URI[sha256sum] = "3e2b0e426958dad01a0ee810822001700065e9ed988f5c1c12b984ad2b48bc5c" - -PROVIDES = "virtual/bitstream" - -FILES_${PN} += "/boot/download.bit" - -INHIBIT_DEFAULT_DEPS = "1" -PACKAGE_ARCH = "${MACHINE_ARCH}" - -# deps needed to extract content from the .bsp file -DEPENDS += "tar-native gzip-native" - -do_compile() { - # Extract the bitstream into workdir - tar -xf ${WORKDIR}/${BSP_FILE} ${BSP_NAME}-axi-full-${PV}/pre-built/linux/images/download.bit -C ${S} - # move the bit file to ${S}/ as it is in a subdir in the tar file - for i in $(find -type f -name download.bit); do mv $i ${S}; done -} - -do_install() { - install -D ${S}/download.bit ${D}/boot/download.bit -} - -do_deploy () { - install -D ${S}/download.bit ${DEPLOYDIR}/download.bit -} - -addtask deploy before do_build after do_install - diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/files/kc705-microblazeel.cfg b/meta-xilinx-bsp/recipes-bsp/u-boot/files/kc705-microblazeel.cfg new file mode 100644 index 00000000..8fb38950 --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/files/kc705-microblazeel.cfg @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: MIT + +#........................................................................ +# WARNING +# +# This file is a u-boot configuration fragment, and not a full u-boot +# configuration file. The final u-boot configuration is made up of +# an assembly of processed fragments, each of which is designed to +# capture a specific part of the final configuration (e.g. platform +# configuration, feature configuration, and board specific hardware +# configuration). For more information on u-boot configuration, please +# refer the product documentation. +# +#....................................................................... + +# +# Definitions for KC705 evaluation board +# +CONFIG_SYS_FLASH_PROTECTION=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_CFI=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_CMD_FLASH=y +CONFIG_CMD_IMLS=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_MTD_DEVICE=y +# CONFIG_CMD_SPI is not set +# CONFIG_CMD_SF is not set +# CONFIG_SPI_FLASH is not set +# CONFIG_SPI_FLASH_BAR is not set +# CONFIG_DM_SPI_FLASH is not set +# CONFIG_DM_SPI is not set +# CONFIG_SPI_FLASH_SPANSION is not set +# CONFIG_SPI_FLASH_STMICRO is not set +# CONFIG_SPI_FLASH_WINBOND is not set +# CONFIG_SPI_FLASH_MACRONIX is not set +# CONFIG_SPI is not set +# CONFIG_SPI_FLASH_ISSI is not set +# CONFIG_XILINX_SPI is not set
\ No newline at end of file diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx.inc b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx.inc deleted file mode 100644 index c97a4a4a..00000000 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx.inc +++ /dev/null @@ -1,19 +0,0 @@ -require recipes-bsp/u-boot/u-boot.inc - -DEPENDS += "bc-native dtc-native" - -UBOOTURI ?= "git://github.com/Xilinx/u-boot-xlnx.git;protocol=https" -UBRANCH ?= "master" -UBRANCHARG = "${@['nobranch=1', 'branch=${UBRANCH}'][d.getVar('UBRANCH', True) != '']}" -SRC_URI = "${UBOOTURI};${UBRANCHARG}" - -S = "${WORKDIR}/git" - -FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot:" -FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot-xlnx:" -FILESEXTRAPATHS_prepend := "${@'${THISDIR}/u-boot-xlnx/${XILINX_RELEASE_VERSION}:' if d.getVar('XILINX_RELEASE_VERSION') else ''}" - -do_deploy_append_zcu102-zynqmp () { - # deploy u-boot-spl.bin for use by runqemu/QEMU - install -Dm 0644 ${B}/spl/u-boot-spl.bin ${DEPLOYDIR}/u-boot-spl.bin -} diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx/v2017.3/arm64-zynqmp-Setup-partid-for-QEMU-to-match-silicon.patch b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx/v2017.3/arm64-zynqmp-Setup-partid-for-QEMU-to-match-silicon.patch deleted file mode 100644 index d8261e62..00000000 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx/v2017.3/arm64-zynqmp-Setup-partid-for-QEMU-to-match-silicon.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 777ac896daaffeaa2fac2bdb424a96def7409a4b Mon Sep 17 00:00:00 2001 -From: Nathan Rossi <nathan@nathanrossi.com> -Date: Wed, 18 Oct 2017 21:29:47 +1000 -Subject: [PATCH] arm64: zynqmp: Setup partid for QEMU to match silicon - -During board late init the environment is 'setup' to set the partid to 0 -for QEMU. Change this so that QEMU targets behave just like silicon and -emulation targets such that partid is set to auto. - -Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> -Upstream-Status: Submitted [sent to git@xilinx.com] ---- - board/xilinx/zynqmp/zynqmp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c -index fd80844df6..2df66a4b75 100644 ---- a/board/xilinx/zynqmp/zynqmp.c -+++ b/board/xilinx/zynqmp/zynqmp.c -@@ -294,9 +294,9 @@ int board_late_init(void) - setenv("setup", "setenv baudrate 4800 && setenv bootcmd run veloce"); - case ZYNQMP_CSU_VERSION_EP108: - case ZYNQMP_CSU_VERSION_SILICON: -+ case ZYNQMP_CSU_VERSION_QEMU: - setenv("setup", "setenv partid auto"); - break; -- case ZYNQMP_CSU_VERSION_QEMU: - default: - setenv("setup", "setenv partid 0"); - } --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend new file mode 100644 index 00000000..23b1eb50 --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend @@ -0,0 +1,5 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append:kc705-microblazeel = " \ + file://kc705-microblazeel.cfg \ + "
\ No newline at end of file diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx_2017.3.bb b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx_2017.3.bb deleted file mode 100644 index c10564f4..00000000 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx_2017.3.bb +++ /dev/null @@ -1,24 +0,0 @@ -include u-boot-xlnx.inc -include u-boot-spl-zynq-init.inc - -XILINX_RELEASE_VERSION = "v2017.3" -SRCREV ?= "da811c4511ef9caeb95f9a22fe49d38bd8e56ded" -PV = "v2017.01-xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}" - -SRC_URI_append = " \ - file://arm64-zynqmp-Setup-partid-for-QEMU-to-match-silicon.patch \ - " - -LICENSE = "GPLv2+" -LIC_FILES_CHKSUM = "file://README;beginline=1;endline=6;md5=157ab8408beab40cd8ce1dc69f702a6c" - -# u-boot-xlnx has support for these -HAS_PLATFORM_INIT ?= " \ - zynq_microzed_config \ - zynq_zed_config \ - zynq_zc702_config \ - zynq_zc706_config \ - zynq_zybo_config \ - xilinx_zynqmp_zcu102_rev1_0_config \ - " - diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-uenv.bb b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-uenv.bb deleted file mode 100644 index f6c2a00d..00000000 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-uenv.bb +++ /dev/null @@ -1,116 +0,0 @@ -SUMMARY = "U-Boot uEnv.txt SD boot environment generation for Zynq targets" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" - -INHIBIT_DEFAULT_DEPS = "1" -PACKAGE_ARCH = "${MACHINE_ARCH}" - -COMPATIBLE_MACHINE = "^$" -COMPATIBLE_MACHINE_zynq = ".*" -COMPATIBLE_MACHINE_zynqmp = ".*" - -inherit deploy - -def bootfiles_bitstream(d): - expectedfiles = [("bitstream", True)] - expectedexts = [(".bit", True), (".bin", False)] - # search for bitstream paths, use the renamed file. First matching is used - for f in (d.getVar("IMAGE_BOOT_FILES") or "").split(): - sf, rf = f, f - if ';' in f: - sf, rf = f.split(';') - - # skip boot.bin and u-boot.bin, it is not a bitstream - skip = ["boot.bin", "u-boot.bin"] - if sf in skip or rf in skip: - continue - - for e, t in expectedfiles: - if sf == e or rf == e: - return rf, t - for e, t in expectedexts: - if sf.endswith(e) or rf.endswith(e): - return rf, t - return "", False - -def bootfiles_dtb_filepath(d): - if d.getVar("IMAGE_BOOT_FILES"): - dtbs = d.getVar("IMAGE_BOOT_FILES").split(" ") - # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>' - dtbs = [f.split(";")[0] for f in dtbs] - dtbs = [f for f in dtbs if f.endswith(".dtb")] - if len(dtbs) != 0: - return dtbs[0] - return "" - -def uboot_boot_cmd(d): - if d.getVar("KERNEL_IMAGETYPE") in ["uImage", "fitImage"]: - return "bootm" - if d.getVar("KERNEL_IMAGETYPE") in ["zImage"]: - return "bootz" - if d.getVar("KERNEL_IMAGETYPE") in ["Image"]: - return "booti" - raise bb.parse.SkipRecipe("Unsupport kernel image type") - -def uenv_populate(d): - # populate the environment values - env = {} - - env["machine_name"] = d.getVar("MACHINE") - - env["kernel_image"] = d.getVar("KERNEL_IMAGETYPE") - env["kernel_load_address"] = d.getVar("KERNEL_LOAD_ADDRESS") - - env["devicetree_image"] = bootfiles_dtb_filepath(d) - env["devicetree_load_address"] = d.getVar("DEVICETREE_LOAD_ADDRESS") - - env["bootargs"] = d.getVar("KERNEL_BOOTARGS") - - env["loadkernel"] = "fatload mmc 0 ${kernel_load_address} ${kernel_image}" - env["loaddtb"] = "fatload mmc 0 ${devicetree_load_address} ${devicetree_image}" - env["bootkernel"] = "run loadkernel && run loaddtb && " + uboot_boot_cmd(d) + " ${kernel_load_address} - ${devicetree_load_address}" - - # default uenvcmd does not load bitstream - env["uenvcmd"] = "run bootkernel" - - bitstream, bitstreamtype = bootfiles_bitstream(d) - if bitstream: - env["bitstream_image"] = bitstream - env["bitstream_load_address"] = "0x100000" - - # if bitstream is "bit" format use loadb, otherwise use load - env["bitstream_type"] = "loadb" if bitstreamtype else "load" - - # load bitstream first with loadfpa - env["loadfpga"] = "fatload mmc 0 ${bitstream_load_address} ${bitstream_image} && fpga ${bitstream_type} 0 ${bitstream_load_address} ${filesize}" - env["uenvcmd"] = "run loadfpga && run bootkernel" - - return env - -# bootargs, default to booting with the rootfs device being partition 2 of the first mmc device -KERNEL_BOOTARGS_zynq = "earlyprintk console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait" -KERNEL_BOOTARGS_zynqmp = "earlycon clk_ignore_unused root=/dev/mmcblk0p2 rw rootwait" - -KERNEL_LOAD_ADDRESS_zynq = "0x2080000" -KERNEL_LOAD_ADDRESS_zynqmp = "0x80000" -DEVICETREE_LOAD_ADDRESS_zynq = "0x2000000" -DEVICETREE_LOAD_ADDRESS_zynqmp = "0x4000000" - -python do_compile() { - env = uenv_populate(d) - with open(d.expand("${WORKDIR}/uEnv.txt"), "w") as f: - for k, v in env.items(): - f.write("{0}={1}\n".format(k, v)) -} - -FILES_${PN} += "/boot/uEnv.txt" - -do_install() { - install -Dm 0644 ${WORKDIR}/uEnv.txt ${D}/boot/uEnv.txt -} - -do_deploy() { - install -Dm 0644 ${WORKDIR}/uEnv.txt ${DEPLOYDIR}/uEnv.txt -} -addtask do_deploy after do_compile before do_build - diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot_%.bbappend b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot_%.bbappend deleted file mode 100644 index b8522369..00000000 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot_%.bbappend +++ /dev/null @@ -1,11 +0,0 @@ -include u-boot-spl-zynq-init.inc - -# u-boot 2016.11 has support for these -HAS_PLATFORM_INIT ??= " \ - zynq_microzed_config \ - zynq_zed_config \ - zynq_zc702_config \ - zynq_zc706_config \ - zynq_zybo_config \ - " - diff --git a/meta-xilinx-bsp/recipes-core/newlib/libgloss_2.5.0.bb b/meta-xilinx-bsp/recipes-core/newlib/libgloss_2.5.0.bb deleted file mode 100644 index 6fbafc1d..00000000 --- a/meta-xilinx-bsp/recipes-core/newlib/libgloss_2.5.0.bb +++ /dev/null @@ -1,18 +0,0 @@ - -require newlib.inc - -DEPENDS += "newlib" - -do_configure() { - ${S}/libgloss/configure ${CONFIGUREOPTS} -} - -do_install_prepend() { - # install doesn't create this itself - install -d ${D}${prefix}/${TARGET_SYS}/lib -} - -FILES_${PN} += "${libdir}/*.ld ${libdir}/*.specs" - -INHIBIT_PACKAGE_STRIP = "1" -INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/meta-xilinx-bsp/recipes-core/newlib/newlib.inc b/meta-xilinx-bsp/recipes-core/newlib/newlib.inc deleted file mode 100644 index 2fb2301d..00000000 --- a/meta-xilinx-bsp/recipes-core/newlib/newlib.inc +++ /dev/null @@ -1,59 +0,0 @@ -SUMMARY = "Newlib is a C library intended for use on embedded systems" -HOMEPAGE = "https://sourceware.org/newlib/" -DESCRIPTION = "It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products." -SECTION = "libs" - -LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2" -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ - file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \ - file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LIBGLOSS;md5=73f5c98779aea7dba4a6c94a74ab0ae2 \ - file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \ - file://COPYING.NEWLIB;md5=bfdd6396bf3b02bd23ffbb9f7ddfbec6 \ - file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \ - file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0 \ - " - -SRC_URI = "ftp://sourceware.org/pub/newlib/newlib-${PV}.tar.gz" -SRC_URI[md5sum] = "767dc60aaf814d091997d91d588968b2" -SRC_URI[sha256sum] = "5b76a9b97c9464209772ed25ce55181a7bb144a66e5669aaec945aa64da3189b" - -INHIBIT_DEFAULT_DEPS = "1" -DEPENDS = "virtual/${TARGET_PREFIX}gcc" - -S = "${WORKDIR}/newlib-${PV}" -B = "${WORKDIR}/build" - -# disable use of a link hash style -TARGET_LINK_HASH_STYLE_microblaze = "" - -# disable stdlib -TARGET_CC_ARCH_append = " -nostdlib" - -CONFIGUREOPTS = " \ - --build=${BUILD_SYS} \ - --host=${HOST_SYS} \ - --target=${TARGET_SYS} \ - --prefix=${prefix} \ - --exec-prefix=${exec_prefix} \ - --bindir=${bindir} \ - --libdir=${libdir} \ - --includedir=${includedir} \ - --enable-languages=c \ - --with-newlib \ - --with-gnu-as \ - --with-gnu-ld \ - --disable-multilib \ - " - -do_configure[cleandirs] = "${B}" - -do_install() { - oe_runmake install DESTDIR='${D}' - - # output of headers/libs in 'tooldir' subdirectories, move it up to the prefix dir. - mv ${D}${prefix}/${TARGET_SYS}/* ${D}${prefix}/ - rmdir ${D}${prefix}/${TARGET_SYS} -} - diff --git a/meta-xilinx-bsp/recipes-core/newlib/newlib_2.5.0.bb b/meta-xilinx-bsp/recipes-core/newlib/newlib_2.5.0.bb deleted file mode 100644 index dc30c6b2..00000000 --- a/meta-xilinx-bsp/recipes-core/newlib/newlib_2.5.0.bb +++ /dev/null @@ -1,11 +0,0 @@ - -require newlib.inc - -do_configure_prepend_microblaze() { - # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) - export CC="${CC} -L${S}/libgloss/microblaze" -} - -do_configure() { - ${S}/configure ${CONFIGUREOPTS} -} diff --git a/meta-xilinx-bsp/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch b/meta-xilinx-bsp/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch deleted file mode 100644 index 15124c1b..00000000 --- a/meta-xilinx-bsp/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -BINPATH=$(dirname $0) -MACHINE_PATH=$(mktemp -d) - -APU_ARGS= -PMU_ARGS= - -while [ ! -z "$1" ]; do - if [ "$1" = "-pmu-args" ]; then - PMU_ARGS+=" $2" - shift - else - APU_ARGS+=" $1" - fi - shift -done - -PMU_ROM=$(last=; for i in $PMU_ARGS; do if [ "$last" = "-kernel" ]; then echo "$i"; break; fi; last=$i; done) -if [ ! -e $PMU_ROM ]; then - echo "------" - echo "Error: Missing PMU ROM - $PMU_ROM" - echo " See 'meta-xilinx/README.qemu.md' for more information on accquiring the PMU ROM." - echo "------" - exit 255 -fi - -# start the PMU instance -$BINPATH/qemu-system-microblazeel $PMU_ARGS -machine-path $MACHINE_PATH & -# start the APU instance -$BINPATH/qemu-system-aarch64 $APU_ARGS -machine-path $MACHINE_PATH - diff --git a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-devicetrees_2017.3.bb b/meta-xilinx-bsp/recipes-devtools/qemu/qemu-devicetrees_2017.3.bb deleted file mode 100644 index ec6093b7..00000000 --- a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-devicetrees_2017.3.bb +++ /dev/null @@ -1,4 +0,0 @@ -require qemu-devicetrees.inc - -XILINX_RELEASE_VERSION = "v2017.3" -SRCREV ?= "4b951c594078562e9dd828430075968dd91ac425" diff --git a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb b/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb deleted file mode 100644 index 55b35b53..00000000 --- a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx-helper-native_1.0.bb +++ /dev/null @@ -1,28 +0,0 @@ - -python () { - if d.getVar("PREFERRED_PROVIDER_qemu-helper-native") != d.getVar("PN"): - raise bb.parse.SkipRecipe("Set qemu-helper-native provider to use this recipe") -} - -def get_filespath_extra(d, subpath): - metaroot = next((p for p in d.getVar('BBPATH').split(':') if os.path.basename(p) == 'meta'), None) - if metaroot: - return os.path.join(metaroot, subpath) + ":" - return "" - -# TODO: improve this, since it is very hacky that this recipe need to build tunctl. -# include the existing qemu-helper-native -require recipes-devtools/qemu/qemu-helper-native_1.0.bb -# get the path to tunctl.c -FILESEXTRAPATHS_prepend := "${@get_filespath_extra(d, 'recipes-devtools/qemu/qemu-helper')}" - -# provide it, to replace the existing -PROVIDES += "qemu-helper-native" - -# replace qemu with qemu-xilinx -DEPENDS_remove = "qemu-native" -DEPENDS_append = " \ - qemu-xilinx-native \ - qemu-xilinx-multiarch-helper-native \ - " - diff --git a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx.inc b/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx.inc deleted file mode 100644 index 9b59ecce..00000000 --- a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx.inc +++ /dev/null @@ -1,47 +0,0 @@ -QEMU_TARGETS = "aarch64 arm microblaze microblazeel" - -require recipes-devtools/qemu/qemu.inc - -SUMMARY = "Xilinx's fork of a fast open source processor emulator" -HOMEPAGE = "https://github.com/xilinx/qemu/" - -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ - file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913 \ - " - -PV = "${XILINX_QEMU_VERSION}-xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}" -BRANCH ?= "" -REPO ?= "git://github.com/Xilinx/qemu.git;protocol=https" - -BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" -SRC_URI = "${REPO};${BRANCHARG}" - -S = "${WORKDIR}/git" - -# Disable KVM completely -PACKAGECONFIG_remove = "kvm" - -# Enable libgcrypt -PACKAGECONFIG_append = " gcrypt" - -DISABLE_STATIC_pn-${PN} = "" - -PTEST_ENABLED = "" - -# append a suffix dir, to allow multiple versions of QEMU to be installed -EXTRA_OECONF_append = " \ - --bindir=${bindir}/qemu-xilinx \ - --libexecdir=${libexecdir}/qemu-xilinx \ - " - -do_configure_prepend() { - # rewrite usage of 'libgcrypt-config' with 'pkg-config libgcrypt' - sed -r -i 's/libgcrypt-config(\s*--)/pkg-config libgcrypt\1/g' ${S}/configure -} - -do_install_append() { - # Prevent QA warnings about installed ${localstatedir}/run - if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi -} - diff --git a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx_2017.3.bb b/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx_2017.3.bb deleted file mode 100644 index f8a91d75..00000000 --- a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx_2017.3.bb +++ /dev/null @@ -1,5 +0,0 @@ -require qemu-xilinx.inc - -XILINX_RELEASE_VERSION = "v2017.3" -XILINX_QEMU_VERSION = "v2.8.1" -SRCREV ?= "8f8c89b18f6e4523099e41d81769fc534064b8de" diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb deleted file mode 100644 index edd8cbe9..00000000 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali.bb +++ /dev/null @@ -1,45 +0,0 @@ -SUMMARY = "A Mali 400 Linux Kernel module" -SECTION = "kernel/modules" - -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = " \ - file://linux/license/gpl/mali_kernel_license.h;md5=1436c0d104589824163a3eb50fbb5050 \ - " - -PV = "r7p0-00rel0" - -SRC_URI = " \ - https://developer.arm.com/-/media/Files/downloads/mali-drivers/kernel/mali-utgard-gpu/DX910-SW-99002-${PV}.tgz \ - file://0001-Change-Makefile-to-be-compatible-with-Yocto.patch \ - file://0002-staging-mali-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch \ - file://0003-staging-mali-r7p0-00rel0-Remove-unused-trace-macros.patch \ - file://0004-staging-mali-r7p0-00rel0-Don-t-include-mali_read_phy.patch \ - file://0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch \ - file://0006-staging-mali-r7p0-page_cache_release-to-put_page.patch \ - file://0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch \ - file://0008-arm.c-dma_ops-will-be-modified-by-the-driver-only-ti.patch \ - file://0009-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch \ - file://0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch \ - " -SRC_URI[md5sum] = "db3ef3258eb55700484ecadfdce1fee1" -SRC_URI[sha256sum] = "496ba80684aa4236806891a8445978849f7dd07299f5e58b14d52cd5e7ba0536" - -inherit module - -do_make_scripts[depends] += "virtual/kernel:do_unpack" - -S = "${WORKDIR}/DX910-SW-99002-${PV}/driver/src/devicedrv/mali" - -COMPATIBLE_MACHINE = "^$" -COMPATIBLE_MACHINE_zynqmp = "zynqmp" - -EXTRA_OEMAKE = 'KDIR="${STAGING_KERNEL_DIR}" \ - ARCH="${ARCH}" \ - BUILD=release \ - MALI_PLATFORM="arm" \ - USING_DT=1 \ - MALI_SHARED_INTERRUPTS=1 \ - CROSS_COMPILE="${TARGET_PREFIX}" \ - O=${STAGING_KERNEL_BUILDDIR} \ - MALI_QUIET=1 \ - ' diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch deleted file mode 100644 index 32dd9d45..00000000 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0005-mali-r7p0-PAGE_CACHE_SHIFT-to-PAGE_CACHE.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ac3baaacbaa564e768529dcb2353a84eb47ae847 Mon Sep 17 00:00:00 2001 -From: Hyun Kwon <hyun.kwon@xilinx.com> -Date: Mon, 12 Sep 2016 13:12:46 -0700 -Subject: [PATCH 5/6] mali: r7p0: PAGE_CACHE_SHIFT to PAGE_CACHE - -09cbfea removed PAGE_CACHE_*. - -Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> -Upstream Status: Pending ---- - driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c -index 4793328..1aea47b 100755 ---- linux/mali_memory_swap_alloc.c -+++ b/linux/mali_memory_swap_alloc.c -@@ -52,7 +52,7 @@ extern struct mali_mem_os_allocator mali_mem_os_allocator; - #define MALI_SWAP_LOW_MEM_DEFAULT_VALUE (60*1024*1024) - #define MALI_SWAP_INVALIDATE_MALI_ADDRESS (0) /* Used to mark the given memory cookie is invalidate. */ - #define MALI_SWAP_GLOBAL_SWAP_FILE_SIZE (0xFFFFFFFF) --#define MALI_SWAP_GLOBAL_SWAP_FILE_INDEX ((MALI_SWAP_GLOBAL_SWAP_FILE_SIZE) >> PAGE_CACHE_SHIFT) -+#define MALI_SWAP_GLOBAL_SWAP_FILE_INDEX ((MALI_SWAP_GLOBAL_SWAP_FILE_SIZE) >> PAGE_SHIFT) - #define MALI_SWAP_GLOBAL_SWAP_FILE_INDEX_RESERVE (1 << 15) /* Reserved for CoW nonlinear swap backend memory, the space size is 128MB. */ - - unsigned int mali_mem_swap_out_threshold_value = MALI_SWAP_LOW_MEM_DEFAULT_VALUE; --- -2.7.4 - diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0006-staging-mali-r7p0-page_cache_release-to-put_page.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0006-staging-mali-r7p0-page_cache_release-to-put_page.patch deleted file mode 100644 index 5582bfa4..00000000 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0006-staging-mali-r7p0-page_cache_release-to-put_page.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 9dd708ba609b826c07fa91d8a5ee56b368ae8183 Mon Sep 17 00:00:00 2001 -From: "madhurki@xilinx.com" <madhurki@xilinx.com> -Date: Mon, 12 Sep 2016 17:14:34 -0700 -Subject: [PATCH 6/6] staging: mali: r7p0: page_cache_release() to put_page() - -09cbfea replaced page_cache_release() to put_page(). - -Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> -Signed-off-by: madhurki@xilinx.com <madhurki@xilinx.com> -Upstream Status: Pending ---- - driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_swap_alloc.c -index 1aea47b..068e4d0 100755 ---- linux/mali_memory_swap_alloc.c -+++ b/linux/mali_memory_swap_alloc.c -@@ -183,7 +183,7 @@ static void mali_mem_swap_out_page_node(mali_page_node *page_node) - dma_unmap_page(&mali_platform_device->dev, page_node->swap_it->dma_addr, - _MALI_OSK_MALI_PAGE_SIZE, DMA_TO_DEVICE); - set_page_dirty(page_node->swap_it->page); -- page_cache_release(page_node->swap_it->page); -+ put_page(page_node->swap_it->page); - } - - void mali_mem_swap_unlock_single_mem_backend(mali_mem_backend *mem_bkend) --- -2.7.4 - diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch b/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch deleted file mode 100644 index 79c507d2..00000000 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0007-mali_memory_os_alloc.c-Align-with-dma_attrs-changes-.patch +++ /dev/null @@ -1,92 +0,0 @@ -From f0a49bccbdd910c48aab59e07aed98093f4a0fea Mon Sep 17 00:00:00 2001 -From: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Date: Wed, 25 Jan 2017 02:59:40 -0800 -Subject: [PATCH 1/2] mali_memory_os_alloc.c: Align with dma_attrs changes from - 4.8 Kernel - -From 4.8 Kernel the DMA attributes is no longer a pointer but an unsigned long. - -Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Upstream Status: Pending ---- - .../devicedrv/mali/linux/mali_memory_os_alloc.c | 25 +++++++++++++++++----- - 1 file changed, 20 insertions(+), 5 deletions(-) - -diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c -index 7f229eb..08fa2fb 100755 ---- linux/mali_memory_os_alloc.c -+++ b/linux/mali_memory_os_alloc.c -@@ -26,9 +26,11 @@ - #define MALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_PAGES (MALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB * 256) - #define MALI_OS_MEMORY_POOL_TRIM_JIFFIES (10 * CONFIG_HZ) /* Default to 10s */ - --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) - /* Write combine dma_attrs */ - static DEFINE_DMA_ATTRS(dma_attrs_wc); -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) -+static unsigned long dma_attrs_wc; - #endif - - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) -@@ -511,10 +513,14 @@ _mali_osk_errcode_t mali_mem_os_get_table_page(mali_dma_addr *phys, mali_io_addr - spin_unlock(&mali_mem_page_table_page_pool.lock); - - if (_MALI_OSK_ERR_OK != ret) { --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) - *mapping = dma_alloc_attrs(&mali_platform_device->dev, - _MALI_OSK_MALI_PAGE_SIZE, &tmp_phys, - GFP_KERNEL, &dma_attrs_wc); -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) -+ *mapping = dma_alloc_attrs(&mali_platform_device->dev, -+ _MALI_OSK_MALI_PAGE_SIZE, &tmp_phys, -+ GFP_KERNEL, dma_attrs_wc); - #else - *mapping = dma_alloc_writecombine(&mali_platform_device->dev, - _MALI_OSK_MALI_PAGE_SIZE, &tmp_phys, GFP_KERNEL); -@@ -550,10 +556,14 @@ void mali_mem_os_release_table_page(mali_dma_addr phys, void *virt) - } else { - spin_unlock(&mali_mem_page_table_page_pool.lock); - --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) - dma_free_attrs(&mali_platform_device->dev, - _MALI_OSK_MALI_PAGE_SIZE, virt, phys, - &dma_attrs_wc); -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) -+ dma_free_attrs(&mali_platform_device->dev, -+ _MALI_OSK_MALI_PAGE_SIZE, virt, phys, -+ dma_attrs_wc); - #else - dma_free_writecombine(&mali_platform_device->dev, - _MALI_OSK_MALI_PAGE_SIZE, virt, phys); -@@ -606,9 +616,12 @@ static void mali_mem_os_page_table_pool_free(size_t nr_to_free) - - /* After releasing the spinlock: free the pages we removed from the pool. */ - for (i = 0; i < nr_to_free; i++) { --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) - dma_free_attrs(&mali_platform_device->dev, _MALI_OSK_MALI_PAGE_SIZE, - virt_arr[i], (dma_addr_t)phys_arr[i], &dma_attrs_wc); -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) -+ dma_free_attrs(&mali_platform_device->dev, _MALI_OSK_MALI_PAGE_SIZE, -+ virt_arr[i], (dma_addr_t)phys_arr[i], dma_attrs_wc); - #else - dma_free_writecombine(&mali_platform_device->dev, - _MALI_OSK_MALI_PAGE_SIZE, -@@ -757,8 +770,10 @@ _mali_osk_errcode_t mali_mem_os_init(void) - return _MALI_OSK_ERR_NOMEM; - } - --#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) - dma_set_attr(DMA_ATTR_WRITE_COMBINE, &dma_attrs_wc); -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) -+ dma_attrs_wc |= DMA_ATTR_WRITE_COMBINE; - #endif - - register_shrinker(&mali_mem_os_allocator.shrinker); --- -2.7.4 - diff --git a/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc_git.bb b/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc_git.bb deleted file mode 100644 index 7a671fe0..00000000 --- a/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc_git.bb +++ /dev/null @@ -1,23 +0,0 @@ -require recipes-graphics/xorg-driver/xorg-driver-video.inc - -SUMMARY = "X.Org X server -- Xilinx ARM SOC display driver" -DESCRIPTION = "Xilinx ARM SOC display driver " - -LICENSE = "MIT-X & GPLv2+" -LIC_FILES_CHKSUM = "file://COPYING;md5=10ce5de3b111315ea652a5f74ec0c602" - -DEPENDS += "virtual/libx11 libdrm xf86driproto" -RDEPENDS_${PN} += "xserver-xorg-module-exa" - -PV = "1.4.1+git${SRCPV}" - -SRCREV = "8bbdb2ae3bb8ef649999a8da33ddbe11a04763b8" -SRC_URI = " \ - git://anongit.freedesktop.org/xorg/driver/xf86-video-armsoc \ - file://0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch \ - " - -S = "${WORKDIR}/git" - -EXTRA_OECONF = " --enable-maintainer-mode" -CFLAGS += " -I${STAGING_INCDIR}/xorg " diff --git a/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend b/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend deleted file mode 100644 index 72d991c7..00000000 --- a/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-microblaze.inc b/meta-xilinx-bsp/recipes-kernel/linux/linux-microblaze.inc deleted file mode 100644 index e23a50e8..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-microblaze.inc +++ /dev/null @@ -1,5 +0,0 @@ -# MicroBlaze is a uImage target, but its not called 'uImage' instead it is called 'linux.bin.ub' -python () { - if d.getVar('KERNEL_IMAGETYPE', True).endswith('.ub'): - d.setVar('DEPENDS', "%s u-boot-mkimage-native" % d.getVar('DEPENDS', True)) -} diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx-dev.bbappend b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx-dev.bbappend new file mode 100644 index 00000000..5f4db309 --- /dev/null +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx-dev.bbappend @@ -0,0 +1,3 @@ +# MicroBlaze BSP fragments +KERNEL_FEATURES:append:kc705-microblazeel = " bsp/xilinx/kc705-microblazeel-features/kc705-microblazeel-features.scc" + diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx.inc b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx.inc deleted file mode 100644 index 39c146aa..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx.inc +++ /dev/null @@ -1,44 +0,0 @@ -# This version extension should match CONFIG_LOCALVERSION in defconfig -XILINX_RELEASE_VERSION ?= "" -LINUX_VERSION_EXTENSION ?= "-xilinx-${XILINX_RELEASE_VERSION}" -PV = "${LINUX_VERSION}${LINUX_VERSION_EXTENSION}+git${SRCPV}" - -# Sources, by default allow for the use of SRCREV pointing to orphaned tags/commits -KBRANCH ?= "" -SRCBRANCHARG = "${@['nobranch=1', 'branch=${KBRANCH}'][d.getVar('KBRANCH', True) != '']}" - -FILESOVERRIDES_append = ":${XILINX_RELEASE_VERSION}" -KERNELURI ?= "git://github.com/Xilinx/linux-xlnx.git;protocol=https" -SRC_URI = "${KERNELURI};${SRCBRANCHARG}" - -SRCREV_machine ?= "${SRCREV}" - -require recipes-kernel/linux/linux-yocto.inc -require linux-microblaze.inc - -DESCRIPTION = "Xilinx Kernel" - -# Force the use of the KBUILD_DEFCONFIG even if some other defconfig was generated in the ${WORKDIR} -do_kernel_metadata_prepend () { - [ -n "${KBUILD_DEFCONFIG}" ] && [ -e ${WORKDIR}/defconfig ] && rm ${WORKDIR}/defconfig -} - -# Default to be only compatible with specific machines or soc families -COMPATIBLE_MACHINE ?= "^$" -COMPATIBLE_MACHINE_zynq = ".*" -COMPATIBLE_MACHINE_zynqmp = ".*" -COMPATIBLE_MACHINE_kc705-microblazeel = ".*" - -# Use DEFCONFIGs for configuring linux-xlnx kernels -KCONFIG_MODE ?= "alldefconfig" -KBUILD_DEFCONFIG_zynqmp = "xilinx_zynqmp_defconfig" -KBUILD_DEFCONFIG_zynq = "xilinx_zynq_defconfig" -KBUILD_DEFCONFIG_microblaze = "mmu_defconfig" - -# Add meta-xilinx kmeta, used for MicroBlaze BSP fragments -FILESEXTRAPATHS_prepend := "${THISDIR}:" -SRC_URI_append = " file://xilinx-kmeta;type=kmeta;name=xilinx-kmeta;destsuffix=xilinx-kmeta" - -# MicroBlaze BSP fragments -KERNEL_FEATURES_append_kc705-microblazeel = " bsp/kc705-microblazeel/kc705-microblazeel.scc" - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/ac701-microblazeel/ac701-microblazeel.cfg b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/ac701-microblazeel/ac701-microblazeel.cfg new file mode 100644 index 00000000..05452ce9 --- /dev/null +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/ac701-microblazeel/ac701-microblazeel.cfg @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: MIT + +#........................................................................ +# WARNING +# +# This file is a kernel configuration fragment, and not a full kernel +# configuration file. The final kernel configuration is made up of +# an assembly of processed fragments, each of which is designed to +# capture a specific part of the final configuration (e.g. platform +# configuration, feature configuration, and board specific hardware +# configuration). For more information on kernel configuration, please +# refer the product documentation. +# +#........................................................................ + +# +# Definitions for MICROBLAZE +# +CONFIG_XILINX_MICROBLAZE0_FAMILY="artix7" diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/ac701-microblazeel/ac701-microblazeel.scc b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/ac701-microblazeel/ac701-microblazeel.scc new file mode 100644 index 00000000..6d551461 --- /dev/null +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/ac701-microblazeel/ac701-microblazeel.scc @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT + +define KFEATURE_DESCRIPTION "Kernel Config for AC701 machine BSP" +define KFEATURE_COMPATIBILITY AC701 board + +kconf hardware ac701-microblazeel.cfg diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/vcu118-microblazeel/vcu118-microblazeel.cfg b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/vcu118-microblazeel/vcu118-microblazeel.cfg new file mode 100644 index 00000000..c25a48e1 --- /dev/null +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/vcu118-microblazeel/vcu118-microblazeel.cfg @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: MIT + +#........................................................................ +# WARNING +# +# This file is a kernel configuration fragment, and not a full kernel +# configuration file. The final kernel configuration is made up of +# an assembly of processed fragments, each of which is designed to +# capture a specific part of the final configuration (e.g. platform +# configuration, feature configuration, and board specific hardware +# configuration). For more information on kernel configuration, please +# refer the product documentation. +# +#........................................................................ + +# +# Definitions for MICROBLAZE +# +CONFIG_XILINX_MICROBLAZE0_FAMILY="virtexuplus" diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/vcu118-microblazeel/vcu118-microblazeel.scc b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/vcu118-microblazeel/vcu118-microblazeel.scc new file mode 100644 index 00000000..29261805 --- /dev/null +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx/linux-xlnx-bsp-kmeta/bsp/vcu118-microblazeel/vcu118-microblazeel.scc @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT + +define KFEATURE_DESCRIPTION "Kernel Config for VCU118 machine BSP" +define KFEATURE_COMPATIBILITY VCU118 board + +kconf hardware vcu118-microblazeel.cfg diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_%.bbappend b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_%.bbappend new file mode 100644 index 00000000..627f6661 --- /dev/null +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_%.bbappend @@ -0,0 +1,10 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI:append = " \ + file://linux-xlnx-bsp-kmeta;type=kmeta;name=linux-xlnx-bsp-kmeta;destsuffix=linux-xlnx-bsp-kmeta \ + " + +# MicroBlaze BSP fragments +KERNEL_FEATURES:append:kc705-microblazeel = " bsp/xilinx/kc705-microblazeel-features/kc705-microblazeel-features.scc" +KERNEL_FEATURES:append:ac701-microblazeel = " bsp/ac701-microblazeel/ac701-microblazeel.scc" +KERNEL_FEATURES:append:vcu118-microblazeel = " bsp/vcu118-microblazeel/vcu118-microblazeel.scc" diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2017.3.bb b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2017.3.bb deleted file mode 100644 index 7115947b..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2017.3.bb +++ /dev/null @@ -1,6 +0,0 @@ -LINUX_VERSION = "4.9" -XILINX_RELEASE_VERSION = "v2017.3" -SRCREV ?= "f1b1e077d641fc83b54c1b8f168cbb58044fbd4e" - -include linux-xlnx.inc - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-dev.bbappend b/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-dev.bbappend index 05c39951..0233531d 100644 --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -1 +1,7 @@ -require linux-yocto-xilinx.inc +# MicroBlaze KMACHINEs +KMACHINE:ml605-qemu-microblazeel = "qemumicroblazeel" +KMACHINE:s3adsp1800-qemu-microblazeeb = "qemumicroblazeeb" + +# Default kernel config fragements for specific machines +KERNEL_FEATURES:append:kc705-microblazeel = " bsp/xilinx/kc705-microblazeel-features/kc705-microblazeel-features.scc" + diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-tiny_%.bbappend b/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-tiny_%.bbappend index 05c39951..0233531d 100644 --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-tiny_%.bbappend +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-tiny_%.bbappend @@ -1 +1,7 @@ -require linux-yocto-xilinx.inc +# MicroBlaze KMACHINEs +KMACHINE:ml605-qemu-microblazeel = "qemumicroblazeel" +KMACHINE:s3adsp1800-qemu-microblazeeb = "qemumicroblazeeb" + +# Default kernel config fragements for specific machines +KERNEL_FEATURES:append:kc705-microblazeel = " bsp/xilinx/kc705-microblazeel-features/kc705-microblazeel-features.scc" + diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-xilinx.inc b/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-xilinx.inc deleted file mode 100644 index 92093008..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto-xilinx.inc +++ /dev/null @@ -1,25 +0,0 @@ -require linux-microblaze.inc - -# Add meta-xilinx kmeta -FILESEXTRAPATHS_prepend := "${THISDIR}:" -SRC_URI_append = " file://xilinx-kmeta;type=kmeta;name=xilinx-kmeta;destsuffix=xilinx-kmeta" - -# Zynq default generic KMACHINE -COMPATIBLE_MACHINE_zynq = "zynq" -KMACHINE_zynq = "zynq" - -# ZynqMP default generic KMACHINE -COMPATIBLE_MACHINE_zynqmp = "zynqmp" -KMACHINE_zynqmp = "zynqmp" - -# MicroBlaze KMACHINEs -KMACHINE_ml605-qemu-microblazeel = "qemumicroblazeel" -KMACHINE_s3adsp1800-qemu-microblazeeb = "qemumicroblazeeb" - -# MicroBlaze default generic KMACHINE -KMACHINE_microblaze = "microblaze" -COMPATIBLE_MACHINE_microblaze = "microblaze" - -# Default kernel config fragements for specific machines -KERNEL_FEATURES_append_kc705-microblazeel = " bsp/kc705-microblazeel/kc705-microblazeel.scc" - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto_%.bbappend index 05c39951..0233531d 100644 --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto_%.bbappend +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-yocto_%.bbappend @@ -1 +1,7 @@ -require linux-yocto-xilinx.inc +# MicroBlaze KMACHINEs +KMACHINE:ml605-qemu-microblazeel = "qemumicroblazeel" +KMACHINE:s3adsp1800-qemu-microblazeeb = "qemumicroblazeeb" + +# Default kernel config fragements for specific machines +KERNEL_FEATURES:append:kc705-microblazeel = " bsp/xilinx/kc705-microblazeel-features/kc705-microblazeel-features.scc" + diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/kc705-microblazeel/kc705-microblazeel.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/kc705-microblazeel/kc705-microblazeel.cfg deleted file mode 100644 index bf7f316a..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/kc705-microblazeel/kc705-microblazeel.cfg +++ /dev/null @@ -1,17 +0,0 @@ -CONFIG_XILINX_MICROBLAZE0_FAMILY="kintex7" - -# CPU ISA Config -CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1 -CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1 -CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1 -CONFIG_XILINX_MICROBLAZE0_USE_DIV=1 -CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=2 -CONFIG_XILINX_MICROBLAZE0_USE_FPU=0 -CONFIG_XILINX_MICROBLAZE0_HW_VER="10.0" - -# Memory Base Address -CONFIG_KERNEL_BASE_ADDR=0x80000000 - -CONFIG_XILINX_AXI_EMAC=y -CONFIG_XILINX_PHY=y -CONFIG_BLK_DEV_INITRD=y diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/kc705-microblazeel/kc705-microblazeel.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/kc705-microblazeel/kc705-microblazeel.scc deleted file mode 100644 index aaf7c2af..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/kc705-microblazeel/kc705-microblazeel.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Kernel Config for kc705-microblazeel specific setup" -define KFEATURE_COMPATIBILITY board - -kconf hardware kc705-microblazeel.cfg diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/microblaze-standard.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/microblaze-standard.scc deleted file mode 100644 index 170489d4..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/microblaze-standard.scc +++ /dev/null @@ -1,14 +0,0 @@ -define KMACHINE microblaze -define KTYPE standard -define KARCH microblaze - -include ktypes/standard/standard.scc - -include bsp/xilinx/soc/microblaze.scc - -# Common board drivers -include bsp/xilinx/board-common.scc - -# default policy for standard kernels -include features/latencytop/latencytop.scc -include features/profiling/profiling.scc diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/microblaze-tiny.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/microblaze-tiny.scc deleted file mode 100644 index 979fb86b..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/microblaze-tiny.scc +++ /dev/null @@ -1,11 +0,0 @@ -define KMACHINE microblaze -define KTYPE tiny -define KARCH microblaze - -include ktypes/tiny/tiny.scc - -include bsp/xilinx/soc/microblaze.scc - -# Common board drivers -include bsp/xilinx/board-common.scc - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-drm.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-drm.cfg deleted file mode 100644 index 0f66c8bc..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-drm.cfg +++ /dev/null @@ -1,14 +0,0 @@ -# CMA -CONFIG_CMA=y -CONFIG_DMA_CMA=y -CONFIG_CMA_SIZE_MBYTES=128 -CONFIG_CMA_SIZE_SEL_MBYTES=y -CONFIG_CMA_ALIGNMENT=8 - -# DRM -CONFIG_DRM=y -CONFIG_DRM_XILINX=y - -# frame buffer console -CONFIG_FRAMEBUFFER_CONSOLE=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-drm.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-drm.scc deleted file mode 100644 index 56c80c3a..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-drm.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Enable Xilinx DRM support" -define KFEATURE_COMPATIBILITY board - -kconfig hardware drivers-drm.cfg diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-softip-pcie.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-softip-pcie.cfg deleted file mode 100644 index df88fce7..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-softip-pcie.cfg +++ /dev/null @@ -1,7 +0,0 @@ - -# PCIe -CONFIG_PCI=y -CONFIG_PCI_MSI=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCIE_XILINX=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-softip-pcie.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-softip-pcie.scc deleted file mode 100644 index e60047ae..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-softip-pcie.scc +++ /dev/null @@ -1,5 +0,0 @@ -define KFEATURE_DESCRIPTION "Xilinx AXI PCIe Host Bridge" -define KFEATURE_COMPATIBILITY board - -kconfig hardware drivers-softip-pcie.cfg - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-softip.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-softip.cfg deleted file mode 100644 index 5c2529a2..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-softip.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Xilinx DMA engines -CONFIG_XILINX_DMA_ENGINES=y - -# Xilinx Traffic Generator -CONFIG_XILINX_TRAFGEN=y - -# Xilinx Perfmon UIO driver -CONFIG_UIO_XILINX_APM=y - -# Interrupt controller -CONFIG_XILINX_INTC=y - -# Xilinx PHY -CONFIG_XILINX_PHY=y - -# JESD204B PHY -CONFIG_XILINX_JESD204B=y -CONFIG_XILINX_JESD204B_PHY=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-zynq.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-zynq.cfg deleted file mode 100644 index 9b70ac4e..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-zynq.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Devcfg -CONFIG_XILINX_DEVCFG=y - -# Ethernet -CONFIG_XILINX_PS_EMAC=y - -# SPI -CONFIG_SPI_ZYNQ_QSPI=y - -# NAND -CONFIG_MTD_NAND_PL353=y -CONFIG_MTD_NAND_PL35X=y - -# FPGA -CONFIG_XILINX_PR_DECOUPLER=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-zynqmp.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-zynqmp.cfg deleted file mode 100644 index 4cbb2050..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-xlnx-zynqmp.cfg +++ /dev/null @@ -1,67 +0,0 @@ -CONFIG_SOC_XILINX_ZYNQMP=y - -# PMU Firmware API -CONFIG_ZYNQMP_PM_API_DEBUGFS=y - -# DMA -CONFIG_DMADEVICES=y -CONFIG_XILINX_DMA_ENGINES=y -CONFIG_XILINX_DPDMA=y - -# NAND -CONFIG_MTD=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ARASAN=y - -# PCIe -CONFIG_PCI=y -CONFIG_PCI_MSI=y -CONFIG_PCIE_XILINX_NWL=y - -# CONFIG_ARM_MALI is not set - -CONFIG_PHY_XILINX_ZYNQMP=y - -# EDAC -CONFIG_EDAC=y -CONFIG_EDAC_MM_EDAC=y -CONFIG_EDAC_CORTEX_ARM64=y -CONFIG_EDAC_SYNOPSYS=y -CONFIG_EDAC_ZYNQMP_OCM=y - -# Sound -CONFIG_SOUND=y -CONFIG_SND=y -CONFIG_SND_DRIVERS=y -CONFIG_SND_SOC=y -CONFIG_SND_SOC_XILINX_DP=y - -# Ethernet -CONFIG_MACB_EXT_BD=y - -# FPGA -CONFIG_FPGA=y -CONFIG_FPGA_MGR_ZYNQMP_FPGA=y -CONFIG_FPGA_REGION=y -CONFIG_FPGA_BRIDGE=y -CONFIG_XILINX_PR_DECOUPLER=y - -# AMS -CONFIG_XILINX_AMS=y - -# NVMEM -CONFIG_NVMEM=y -CONFIG_NVMEM_ZYNQMP=y - -# Fabric Clock -CONFIG_STAGING=y -CONFIG_XILINX_FCLK=y - -# Clock controllers -CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_ZYNQMP=y - -# Reset controller -CONFIG_RESET_CONTROLLER=y -CONFIG_ZYNQMP_RESET_CONTROLLER=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-zynqmp.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-zynqmp.cfg deleted file mode 100644 index dc69a659..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/drivers-zynqmp.cfg +++ /dev/null @@ -1,68 +0,0 @@ - -# Bus -CONFIG_ARM_CCI400_PMU=y - -# IOMMU -CONFIG_IOMMU_SUPPORT=y -CONFIG_ARM_SMMU=y - -# Serial -CONFIG_TTY=y -CONFIG_SERIAL_EARLYCON=y -CONFIG_SERIAL_XILINX_PS_UART=y -CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y - -# Watchdog -CONFIG_WATCHDOG=y -CONFIG_CADENCE_WATCHDOG=y - -# RTC -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_ZYNQMP=y - -# Ethernet -CONFIG_NET_CADENCE=y -CONFIG_MACB=y - -# GPIO -CONFIG_GPIOLIB=y -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_ZYNQ=y - -# I2C -CONFIG_I2C=y -CONFIG_I2C_CADENCE=y - -# SPI -CONFIG_SPI=y -CONFIG_SPI_CADENCE=y -CONFIG_SPI_ZYNQMP_GQSPI=y - -# CAN -CONFIG_CAN=y -CONFIG_CAN_DEV=y -CONFIG_CAN_XILINXCAN=y - -# SATA -CONFIG_ATA=y -CONFIG_ATA_SFF=y -CONFIG_SATA_AHCI_PLATFORM=y -CONFIG_AHCI_CEVA=y - -# MMC/SD -CONFIG_MMC=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MMC_SDHCI_OF_ARASAN=y - -# USB -CONFIG_USB=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_DWC3=y -CONFIG_USB_GADGET=y - -# DMA -CONFIG_DMA_ENGINE=y -CONFIG_XILINX_ZYNQMP_DMA=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/zynqmp.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/zynqmp.cfg deleted file mode 100644 index 072a3feb..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/zynqmp.cfg +++ /dev/null @@ -1,26 +0,0 @@ - -# Arch Feature Selections -CONFIG_ARM64=y -CONFIG_64BIT=y -CONFIG_ARCH_ZYNQMP=y - -# SMP -CONFIG_SMP=y - -# ARM 32-Bit compatiblity -CONFIG_COMPAT=y -# CONFIG_COMPAT_BRK is not set - -# CPU Frequency -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_STAT=y -CONFIG_CPU_FREQ_STAT_DETAILS=y -CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_CPUFREQ_DT=y -CONFIG_CPU_IDLE=y -CONFIG_ARM_CPUIDLE=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/zynqmp.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/zynqmp.scc deleted file mode 100644 index 8fcb8e62..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/soc/zynqmp.scc +++ /dev/null @@ -1,10 +0,0 @@ -define KFEATURE_DESCRIPTION "Xilinx Zynq UltraScale+ MPSoC" -define KFEATURE_COMPATIBILITY board - -include features/net/net.scc -include cfg/timer/no_hz.scc - -kconf hardware zynqmp.cfg -kconf hardware drivers-zynqmp.cfg -include bsp/xilinx/soc/drivers-softip.scc - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/zynqmp-standard.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/zynqmp-standard.scc deleted file mode 100644 index 1c9a4f3d..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/zynqmp-standard.scc +++ /dev/null @@ -1,15 +0,0 @@ -define KMACHINE zynqmp -define KTYPE standard -define KARCH arm64 - -include ktypes/standard/standard.scc - -include bsp/xilinx/soc/zynqmp.scc -include bsp/xilinx/board-common.scc - -include features/input/input.scc -include cfg/usb-mass-storage.scc - -# default policy for standard kernels -#include features/latencytop/latencytop.scc -#include features/profiling/profiling.scc diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/zynqmp-tiny.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/zynqmp-tiny.scc deleted file mode 100644 index 6cdfc723..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/xilinx/zynqmp-tiny.scc +++ /dev/null @@ -1,9 +0,0 @@ -define KMACHINE zynqmp -define KTYPE tiny -define KARCH arm64 - -include ktypes/tiny/tiny.scc - -include bsp/xilinx/soc/zynqmp.scc -include bsp/xilinx/board-common.scc - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.cfg deleted file mode 100644 index 37eaa4cf..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Keyboard GPIO support -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_GPIO_POLLED=y - -# Sound support for Zybo linux_bd project -CONFIG_SOUND=y -CONFIG_SND=y -CONFIG_SND_SOC=y -CONFIG_SND_SOC_ADI=y -CONFIG_SND_SOC_ADI_AXI_I2S=y -CONFIG_SND_SIMPLE_CARD=y -CONFIG_SND_SOC_SSM2602_I2C=y - -# Drivers for Digilent DRM encoder -# DRM encoder -CONFIG_DRM_DIGILENT_ENCODER=y -# Common Clock Framework -CONFIG_COMMON_CLK_DGLNT_DYNCLK=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.scc deleted file mode 100644 index f3e6e8b8..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/bsp/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.scc +++ /dev/null @@ -1,7 +0,0 @@ -define KFEATURE_DESCRIPTION "Kernel Config for ZYBO Linux-BD Design" -define KFEATURE_COMPATIBILITY board - -kconf hardware zybo-linux-bd-zynq7.cfg - -include bsp/xilinx/soc/drivers-drm.scc - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/uio/uio.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/uio/uio.cfg deleted file mode 100644 index 048ffe49..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/uio/uio.cfg +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_UIO=y -CONFIG_UIO_PDRV_GENIRQ=y -CONFIG_UIO_DMEM_GENIRQ=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/uio/uio.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/uio/uio.scc deleted file mode 100644 index 9697949a..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/uio/uio.scc +++ /dev/null @@ -1,5 +0,0 @@ -define KFEATURE_DESCRIPTION "Enable UIO Support" -define KFEATURE_COMPATIBILITY board - -kconfig hardware uio.cfg - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/v4l2/v4l2-xilinx.cfg b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/v4l2/v4l2-xilinx.cfg deleted file mode 100644 index 49a5d6fe..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/v4l2/v4l2-xilinx.cfg +++ /dev/null @@ -1,23 +0,0 @@ -# Media support -CONFIG_MEDIA_SUPPORT=y -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_CONTROLLER=y - -# V4L -CONFIG_V4L_PLATFORM_DRIVERS=y -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_V4L2=y -CONFIG_VIDEO_V4L2_SUBDEV_API=y - -# Xilinx Video drivers -CONFIG_VIDEO_XILINX=y -CONFIG_VIDEO_XILINX_CFA=y -CONFIG_VIDEO_XILINX_CRESAMPLE=y -CONFIG_VIDEO_XILINX_HLS=y -CONFIG_VIDEO_XILINX_REMAPPER=y -CONFIG_VIDEO_XILINX_RGB2YUV=y -CONFIG_VIDEO_XILINX_SCALER=y -CONFIG_VIDEO_XILINX_SWITCH=y -CONFIG_VIDEO_XILINX_TPG=y -CONFIG_VIDEO_XILINX_VTC=y - diff --git a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/v4l2/v4l2-xilinx.scc b/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/v4l2/v4l2-xilinx.scc deleted file mode 100644 index 6d6ba6ac..00000000 --- a/meta-xilinx-bsp/recipes-kernel/linux/xilinx-kmeta/features/v4l2/v4l2-xilinx.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Enable Xilinx V4L2 support" -define KFEATURE_COMPATIBILITY board - -kconfig hardware v4l2-xilinx.cfg
\ No newline at end of file diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils%.bbappend b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils%.bbappend deleted file mode 100644 index 17843185..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils%.bbappend +++ /dev/null @@ -1,15 +0,0 @@ -FILESEXTRAPATHS_append_microblaze := "${THISDIR}/binutils-2.29:" -SRC_URI_append_microblaze = " \ - file://0001-MicroBlaze-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \ - file://0002-MicroBlaze-add-mlittle-endian-and-mbig-endian-flags.patch \ - file://0003-Disable-the-warning-message-for-eh_frame_hdr.patch \ - file://0004-Fix-relaxation-of-assembler-resolved-references.patch \ - file://0005-Fixup-MicroBlaze-debug_loc-sections-after-linker-rel.patch \ - file://0006-Fix-bug-in-MicroBlaze-TLSTPREL-Relocation.patch \ - file://0007-Add-MicroBlaze-address-extension-instructions.patch \ - file://0008-Add-new-MicroBlaze-bit-field-instructions.patch \ - file://0009-Fixing-MicroBlaze-IMM-bug.patch \ - file://0010-Fixed-bug-in-GCC-so-that-it-will-support-.long-0U-an.patch \ - file://0011-Fixing-MicroBlaze-constant-range-check-issue.patch \ - file://0012-MicroBlaze-fix-mask-for-barrel-shift-instructions.patch \ - " diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0001-MicroBlaze-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0001-MicroBlaze-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch deleted file mode 100644 index 193061a3..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0001-MicroBlaze-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch +++ /dev/null @@ -1,67 +0,0 @@ -From d2979c539c309347493cebae91dc455fa3368f4f Mon Sep 17 00:00:00 2001 -From: David Holsgrove <david.holsgrove@xilinx.com> -Date: Mon, 28 Aug 2017 19:53:52 -0700 -Subject: [PATCH] MicroBlaze Add wdc.ext.clear and wdc.ext.flush insns - -Added two new instructions, wdc.ext.clear and wdc.ext.flush, -to enable MicroBlaze to flush an external cache, which is -used with the new coherency support for multiprocessing. - -Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> -Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - opcodes/microblaze-opc.h | 5 ++++- - opcodes/microblaze-opcm.h | 4 ++-- - 2 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h -index 3954f927d1..b33178145f 100644 ---- a/opcodes/microblaze-opc.h -+++ b/opcodes/microblaze-opc.h -@@ -91,6 +91,7 @@ - #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */ - #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */ - #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */ -+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */ - #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */ - - /* New Mask for msrset, msrclr insns. */ -@@ -101,7 +102,7 @@ - #define DELAY_SLOT 1 - #define NO_DELAY_SLOT 0 - --#define MAX_OPCODES 289 -+#define MAX_OPCODES 291 - - struct op_code_struct - { -@@ -174,7 +175,9 @@ struct op_code_struct - {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst }, - {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst }, - {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst }, -+ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst }, - {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst }, -+ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst }, - {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst }, - {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst }, - {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst }, -diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h -index 6b25173442..00dc131302 100644 ---- a/opcodes/microblaze-opcm.h -+++ b/opcodes/microblaze-opcm.h -@@ -33,8 +33,8 @@ enum microblaze_instr - /* 'or/and/xor' are C++ keywords. */ - microblaze_or, microblaze_and, microblaze_xor, - andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, -- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd, -- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt, -+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar, br, -+ brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt, - bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, - imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid, - brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0002-MicroBlaze-add-mlittle-endian-and-mbig-endian-flags.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0002-MicroBlaze-add-mlittle-endian-and-mbig-endian-flags.patch deleted file mode 100644 index c8142ca4..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0002-MicroBlaze-add-mlittle-endian-and-mbig-endian-flags.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 90fa3cca5ce8ca19c9aca521bbc3d47485f02bf1 Mon Sep 17 00:00:00 2001 -From: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Date: Mon, 28 Aug 2017 19:53:53 -0700 -Subject: [PATCH] MicroBlaze add mlittle-endian and mbig-endian flags - -Added support in gas for mlittle-endian and mbig-endian flags -as options. - -Updated show usage for MicroBlaze specific assembler options -to include new entries. - -Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - gas/config/tc-microblaze.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c -index 0124422168..d47793646b 100644 ---- a/gas/config/tc-microblaze.c -+++ b/gas/config/tc-microblaze.c -@@ -37,6 +37,8 @@ - - #define OPTION_EB (OPTION_MD_BASE + 0) - #define OPTION_EL (OPTION_MD_BASE + 1) -+#define OPTION_LITTLE (OPTION_MD_BASE + 2) -+#define OPTION_BIG (OPTION_MD_BASE + 3) - - void microblaze_generate_symbol (char *sym); - static bfd_boolean check_spl_reg (unsigned *); -@@ -1837,6 +1839,8 @@ struct option md_longopts[] = - { - {"EB", no_argument, NULL, OPTION_EB}, - {"EL", no_argument, NULL, OPTION_EL}, -+ {"mlittle-endian", no_argument, NULL, OPTION_LITTLE}, -+ {"mbig-endian", no_argument, NULL, OPTION_BIG}, - { NULL, no_argument, NULL, 0} - }; - -@@ -2471,9 +2475,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) - switch (c) - { - case OPTION_EB: -+ case OPTION_BIG: - target_big_endian = 1; - break; - case OPTION_EL: -+ case OPTION_LITTLE: - target_big_endian = 0; - break; - default: -@@ -2488,6 +2494,9 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED) - /* fprintf(stream, _("\ - MicroBlaze options:\n\ - -noSmall Data in the comm and data sections do not go into the small data section\n")); */ -+ fprintf (stream, _(" MicroBlaze specific assembler options:\n")); -+ fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu")); -+ fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu")); - } - - --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0003-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0003-Disable-the-warning-message-for-eh_frame_hdr.patch deleted file mode 100644 index 55f4ce33..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0003-Disable-the-warning-message-for-eh_frame_hdr.patch +++ /dev/null @@ -1,36 +0,0 @@ -From f81026057270346cfcfa16e460dcb04a9fa48511 Mon Sep 17 00:00:00 2001 -From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> -Date: Mon, 28 Aug 2017 19:53:54 -0700 -Subject: [PATCH] Disable the warning message for eh_frame_hdr - -Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Inappropriate [workaround] ---- - bfd/elf-eh-frame.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c -index 52ba9c6213..7ac511dfcb 100644 ---- a/bfd/elf-eh-frame.c -+++ b/bfd/elf-eh-frame.c -@@ -1046,10 +1046,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, - goto success; - - free_no_table: -- (*info->callbacks->einfo) -+ /* FIXME: Remove the microblaze specifics when relaxing gets fixed. */ -+ if (bfd_get_arch(abfd) != bfd_arch_microblaze) { - /* xgettext:c-format */ -- (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"), -- abfd, sec); -+ (*info->callbacks->einfo) -+ (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"), -+ abfd, sec); -+ } - hdr_info->u.dwarf.table = FALSE; - if (sec_info) - free (sec_info); --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0004-Fix-relaxation-of-assembler-resolved-references.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0004-Fix-relaxation-of-assembler-resolved-references.patch deleted file mode 100644 index c145a746..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0004-Fix-relaxation-of-assembler-resolved-references.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0d5966951c379882b7557befaa229dc5def8dafe Mon Sep 17 00:00:00 2001 -From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> -Date: Mon, 28 Aug 2017 19:53:55 -0700 -Subject: [PATCH] Fix relaxation of assembler resolved references - -Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++++++++++ - gas/config/tc-microblaze.c | 1 + - 2 files changed, 40 insertions(+) - -diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c -index 265773675c..c3dbead48d 100644 ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -1901,6 +1901,45 @@ microblaze_elf_relax_section (bfd *abfd, - irelscanend = irelocs + o->reloc_count; - for (irelscan = irelocs; irelscan < irelscanend; irelscan++) - { -+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE) -+ { -+ unsigned int val; -+ -+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info); -+ -+ /* This was a PC-relative instruction that was completely resolved. */ -+ if (ocontents == NULL) -+ { -+ if (elf_section_data (o)->this_hdr.contents != NULL) -+ ocontents = elf_section_data (o)->this_hdr.contents; -+ else -+ { -+ /* We always cache the section contents. -+ Perhaps, if info->keep_memory is FALSE, we -+ should free them, if we are permitted to. */ -+ -+ if (o->rawsize == 0) -+ o->rawsize = o->size; -+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); -+ if (ocontents == NULL) -+ goto error_return; -+ if (!bfd_get_section_contents (abfd, o, ocontents, -+ (file_ptr) 0, -+ o->rawsize)) -+ goto error_return; -+ elf_section_data (o)->this_hdr.contents = ocontents; -+ } -+ } -+ -+ irelscan->r_addend -= calc_fixup (irelscan->r_addend -+ + isym->st_value, sec); -+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); -+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, -+ irelscan->r_addend); -+ } -+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) { -+ fprintf(stderr, "Unhandled NONE 64\n"); -+ } - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) - { - isym = isymbuf + ELF32_R_SYM (irelscan->r_info); -diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c -index d47793646b..1cfd441c19 100644 ---- a/gas/config/tc-microblaze.c -+++ b/gas/config/tc-microblaze.c -@@ -2183,6 +2183,7 @@ md_apply_fix (fixS * fixP, - else - fixP->fx_r_type = BFD_RELOC_NONE; - fixP->fx_addsy = section_symbol (absolute_section); -+ fixP->fx_done = 0; - } - return; - } --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0005-Fixup-MicroBlaze-debug_loc-sections-after-linker-rel.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0005-Fixup-MicroBlaze-debug_loc-sections-after-linker-rel.patch deleted file mode 100644 index 9eeb0b28..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0005-Fixup-MicroBlaze-debug_loc-sections-after-linker-rel.patch +++ /dev/null @@ -1,236 +0,0 @@ -From ef876d5062148e8555353e5e72da87c3a47dea8f Mon Sep 17 00:00:00 2001 -From: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Date: Mon, 28 Aug 2017 19:53:56 -0700 -Subject: [PATCH] Fixup MicroBlaze debug_loc sections after linker relaxation - -Fixup debug_loc sections after linker relaxation Adds a new reloctype -R_MICROBLAZE_32_NONE, used for passing reloc info from the assembler to -the linker when the linker manages to fully resolve a local symbol -reference. - -This is a workaround for design flaws in the assembler to -linker interface with regards to linker relaxation. - -Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> -Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - bfd/bfd-in2.h | 9 +++++++-- - bfd/elf32-microblaze.c | 42 +++++++++++++++++++++++++++++++++++------- - bfd/libbfd.h | 1 + - bfd/reloc.c | 6 ++++++ - binutils/readelf.c | 4 ++++ - gas/config/tc-microblaze.c | 5 ++++- - include/elf/microblaze.h | 1 + - 7 files changed, 58 insertions(+), 10 deletions(-) - -diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h -index 1343780c8c..3456826f83 100644 ---- a/bfd/bfd-in2.h -+++ b/bfd/bfd-in2.h -@@ -5809,10 +5809,15 @@ value relative to the read-write small data area anchor */ - expressions of the form "Symbol Op Symbol" */ - BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, - --/* This is a 64 bit reloc that stores the 32 bit pc relative -+/* This is a 32 bit reloc that stores the 32 bit pc relative - value in two words (with an imm instruction). No relocation is - done here - only used for relaxing */ -- BFD_RELOC_MICROBLAZE_64_NONE, -+ BFD_RELOC_MICROBLAZE_32_NONE, -+ -+/* This is a 64 bit reloc that stores the 32 bit pc relative -+ * +value in two words (with an imm instruction). No relocation is -+ * +done here - only used for relaxing */ -+ BFD_RELOC_MICROBLAZE_64_NONE, - - /* This is a 64 bit reloc that stores the 32 bit pc relative - value in two words (with an imm instruction). The relocation is -diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c -index c3dbead48d..1d1f7e210a 100644 ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -176,6 +176,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = - 0x0000ffff, /* Dest Mask. */ - FALSE), /* PC relative offset? */ - -+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ -+ 0, /* Rightshift. */ -+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ -+ 32, /* Bitsize. */ -+ TRUE, /* PC_relative. */ -+ 0, /* Bitpos. */ -+ complain_overflow_bitfield, /* Complain on overflow. */ -+ NULL, /* Special Function. */ -+ "R_MICROBLAZE_32_NONE",/* Name. */ -+ FALSE, /* Partial Inplace. */ -+ 0, /* Source Mask. */ -+ 0, /* Dest Mask. */ -+ FALSE), /* PC relative offset? */ -+ - /* This reloc does nothing. Used for relaxation. */ - HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ - 0, /* Rightshift. */ -@@ -532,6 +546,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, - case BFD_RELOC_NONE: - microblaze_reloc = R_MICROBLAZE_NONE; - break; -+ case BFD_RELOC_MICROBLAZE_32_NONE: -+ microblaze_reloc = R_MICROBLAZE_32_NONE; -+ break; - case BFD_RELOC_MICROBLAZE_64_NONE: - microblaze_reloc = R_MICROBLAZE_64_NONE; - break; -@@ -1846,14 +1863,22 @@ microblaze_elf_relax_section (bfd *abfd, - } - break; - case R_MICROBLAZE_NONE: -+ case R_MICROBLAZE_32_NONE: - { - /* This was a PC-relative instruction that was - completely resolved. */ - int sfix, efix; -+ unsigned int val; - bfd_vma target_address; - target_address = irel->r_addend + irel->r_offset; - sfix = calc_fixup (irel->r_offset, 0, sec); - efix = calc_fixup (target_address, 0, sec); -+ -+ /* Validate the in-band val. */ -+ val = bfd_get_32 (abfd, contents + irel->r_offset); -+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { -+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); -+ } - irel->r_addend -= (efix - sfix); - /* Should use HOWTO. */ - microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, -@@ -1901,12 +1926,16 @@ microblaze_elf_relax_section (bfd *abfd, - irelscanend = irelocs + o->reloc_count; - for (irelscan = irelocs; irelscan < irelscanend; irelscan++) - { -- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE) -+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) - { - unsigned int val; - - isym = isymbuf + ELF32_R_SYM (irelscan->r_info); - -+ /* hax: We only do the following fixup for debug location lists. */ -+ if (strcmp(".debug_loc", o->name)) -+ continue; -+ - /* This was a PC-relative instruction that was completely resolved. */ - if (ocontents == NULL) - { -@@ -1931,15 +1960,14 @@ microblaze_elf_relax_section (bfd *abfd, - } - } - -- irelscan->r_addend -= calc_fixup (irelscan->r_addend -- + isym->st_value, sec); - val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); -+ if (val != irelscan->r_addend) { -+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend); -+ } -+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); - microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, - irelscan->r_addend); - } -- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) { -- fprintf(stderr, "Unhandled NONE 64\n"); -- } - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) - { - isym = isymbuf + ELF32_R_SYM (irelscan->r_info); -@@ -1999,7 +2027,7 @@ microblaze_elf_relax_section (bfd *abfd, - elf_section_data (o)->this_hdr.contents = ocontents; - } - } -- irelscan->r_addend -= calc_fixup (irel->r_addend -+ irelscan->r_addend -= calc_fixup (irelscan->r_addend - + isym->st_value, - 0, - sec); -diff --git a/bfd/libbfd.h b/bfd/libbfd.h -index ae9bf76814..2091286c7c 100644 ---- a/bfd/libbfd.h -+++ b/bfd/libbfd.h -@@ -2847,6 +2847,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", - "BFD_RELOC_MICROBLAZE_32_ROSDA", - "BFD_RELOC_MICROBLAZE_32_RWSDA", - "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", -+ "BFD_RELOC_MICROBLAZE_32_NONE", - "BFD_RELOC_MICROBLAZE_64_NONE", - "BFD_RELOC_MICROBLAZE_64_GOTPC", - "BFD_RELOC_MICROBLAZE_64_GOT", -diff --git a/bfd/reloc.c b/bfd/reloc.c -index aa70fa5874..54d7f538ec 100644 ---- a/bfd/reloc.c -+++ b/bfd/reloc.c -@@ -6860,6 +6860,12 @@ ENUM - ENUMDOC - This is a 32 bit reloc for the microblaze to handle - expressions of the form "Symbol Op Symbol" -+ENUM -+ BFD_RELOC_MICROBLAZE_32_NONE -+ENUMDOC -+ This is a 32 bit reloc that stores the 32 bit pc relative -+ value in two words (with an imm instruction). No relocation is -+ done here - only used for relaxing - ENUM - BFD_RELOC_MICROBLAZE_64_NONE - ENUMDOC -diff --git a/binutils/readelf.c b/binutils/readelf.c -index b2f75c0048..8a3226eba9 100644 ---- a/binutils/readelf.c -+++ b/binutils/readelf.c -@@ -12488,6 +12488,10 @@ is_none_reloc (unsigned int reloc_type) - || reloc_type == 32 /* R_AVR_DIFF32. */); - case EM_METAG: - return reloc_type == 3; /* R_METAG_NONE. */ -+ case EM_MICROBLAZE: -+ return reloc_type == 30 /* R_MICROBLAZE_32_NONE. */ -+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */ -+ || reloc_type == 9; /* R_MICROBLAZE_64_NONE. */ - case EM_NDS32: - return (reloc_type == 0 /* R_XTENSA_NONE. */ - || reloc_type == 204 /* R_NDS32_DIFF8. */ -diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c -index 1cfd441c19..e135547e62 100644 ---- a/gas/config/tc-microblaze.c -+++ b/gas/config/tc-microblaze.c -@@ -2179,7 +2179,9 @@ md_apply_fix (fixS * fixP, - /* This fixup has been resolved. Create a reloc in case the linker - moves code around due to relaxing. */ - if (fixP->fx_r_type == BFD_RELOC_64_PCREL) -- fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; -+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; -+ else if (fixP->fx_r_type == BFD_RELOC_32) -+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; - else - fixP->fx_r_type = BFD_RELOC_NONE; - fixP->fx_addsy = section_symbol (absolute_section); -@@ -2401,6 +2403,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) - switch (fixp->fx_r_type) - { - case BFD_RELOC_NONE: -+ case BFD_RELOC_MICROBLAZE_32_NONE: - case BFD_RELOC_MICROBLAZE_64_NONE: - case BFD_RELOC_32: - case BFD_RELOC_MICROBLAZE_32_LO: -diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h -index ccb47404c5..abcaea561b 100644 ---- a/include/elf/microblaze.h -+++ b/include/elf/microblaze.h -@@ -58,6 +58,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) - RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL64, 27) /* TLS Offset Within TLS Block */ - RELOC_NUMBER (R_MICROBLAZE_TLSGOTTPREL32, 28) /* TLS Offset From Thread Pointer */ - RELOC_NUMBER (R_MICROBLAZE_TLSTPREL32, 29) /* TLS Offset From Thread Pointer */ -+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 30) - - END_RELOC_NUMBERS (R_MICROBLAZE_max) - --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0006-Fix-bug-in-MicroBlaze-TLSTPREL-Relocation.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0006-Fix-bug-in-MicroBlaze-TLSTPREL-Relocation.patch deleted file mode 100644 index de458adb..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0006-Fix-bug-in-MicroBlaze-TLSTPREL-Relocation.patch +++ /dev/null @@ -1,37 +0,0 @@ -From b55dddad1303aafe249e2ba0ddf20460f8f035f6 Mon Sep 17 00:00:00 2001 -From: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Date: Mon, 28 Aug 2017 19:53:58 -0700 -Subject: [PATCH] Fix bug in MicroBlaze TLSTPREL Relocation - -Fixed the problem related to the fixup/relocations TLSTPREL. -When the fixup is applied the addend is not added at the correct offset -of the instruction. The offset is hard coded considering its big endian -and it fails for Little endian. This patch allows support for both -big & little-endian compilers - -Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - bfd/elf32-microblaze.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c -index 1d1f7e210a..cc6e4b1fd9 100644 ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -1417,9 +1417,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, - relocation += addend; - relocation -= dtprel_base(info); - bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, -- contents + offset + 2); -+ contents + offset + endian); - bfd_put_16 (input_bfd, relocation & 0xffff, -- contents + offset + 2 + INST_WORD_SIZE); -+ contents + offset + endian + INST_WORD_SIZE); - break; - case (int) R_MICROBLAZE_64_PCREL : - case (int) R_MICROBLAZE_64: --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0007-Add-MicroBlaze-address-extension-instructions.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0007-Add-MicroBlaze-address-extension-instructions.patch deleted file mode 100644 index ad62345c..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0007-Add-MicroBlaze-address-extension-instructions.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 82c8eacbceb51422d3da75ac30912f9dedc0e832 Mon Sep 17 00:00:00 2001 -From: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Date: Mon, 28 Aug 2017 19:53:59 -0700 -Subject: [PATCH] Add MicroBlaze address extension instructions - -This patch adds the support of new instructions which are required -for supporting Address extension feature. - -2016-01-18 Nagaraju Mekala <nagaraju.mekala@xilinx.com> - - * microblaze-opc.h (op_code_struct): Added new instructions - * microblaze-opcm.h (microblaze_instr): Added new instructions - -Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - opcodes/microblaze-opc.h | 13 ++++++++++++- - opcodes/microblaze-opcm.h | 10 +++++----- - 2 files changed, 17 insertions(+), 6 deletions(-) - -diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h -index b33178145f..a64f8362da 100644 ---- a/opcodes/microblaze-opc.h -+++ b/opcodes/microblaze-opc.h -@@ -102,7 +102,7 @@ - #define DELAY_SLOT 1 - #define NO_DELAY_SLOT 0 - --#define MAX_OPCODES 291 -+#define MAX_OPCODES 299 - - struct op_code_struct - { -@@ -178,8 +178,11 @@ struct op_code_struct - {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst }, - {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst }, - {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst }, -+ {"wdc.clear.ea", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E6, OPCODE_MASK_H34B, wdcclearea, special_inst }, - {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst }, -+ {"mtse", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9500C000, OPCODE_MASK_H13S, mtse,special_inst }, - {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst }, -+ {"mfse", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94088000, OPCODE_MASK_H23S, mfse, special_inst }, - {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst }, - {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst }, - {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst }, -@@ -229,18 +232,24 @@ struct op_code_struct - {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst }, - {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst }, - {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst }, -+ {"lbuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000080, OPCODE_MASK_H4, lbuea, memory_load_inst }, - {"lhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000000, OPCODE_MASK_H4, lhu, memory_load_inst }, - {"lhur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000200, OPCODE_MASK_H4, lhur, memory_load_inst }, -+ {"lhuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000080, OPCODE_MASK_H4, lhuea, memory_load_inst }, - {"lw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000000, OPCODE_MASK_H4, lw, memory_load_inst }, - {"lwr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000200, OPCODE_MASK_H4, lwr, memory_load_inst }, - {"lwx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000400, OPCODE_MASK_H4, lwx, memory_load_inst }, -+ {"lwea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000080, OPCODE_MASK_H4, lwea, memory_load_inst }, - {"sb", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000000, OPCODE_MASK_H4, sb, memory_store_inst }, - {"sbr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000200, OPCODE_MASK_H4, sbr, memory_store_inst }, -+ {"sbea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000080, OPCODE_MASK_H4, sbea, memory_store_inst }, - {"sh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000000, OPCODE_MASK_H4, sh, memory_store_inst }, - {"shr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000200, OPCODE_MASK_H4, shr, memory_store_inst }, -+ {"shea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000080, OPCODE_MASK_H4, shea, memory_store_inst }, - {"sw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000000, OPCODE_MASK_H4, sw, memory_store_inst }, - {"swr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000200, OPCODE_MASK_H4, swr, memory_store_inst }, - {"swx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000400, OPCODE_MASK_H4, swx, memory_store_inst }, -+ {"swea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000080, OPCODE_MASK_H4, swea, memory_store_inst }, - {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst }, - {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst }, - {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst }, -@@ -405,6 +414,8 @@ struct op_code_struct - {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst }, - {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst }, - {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */ -+ {"hibernate", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB9020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 8. */ -+ {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */ - {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst }, - {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst }, - {"", 0, 0, 0, 0, 0, 0, 0, 0}, -diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h -index 00dc131302..21a3dc8d76 100644 ---- a/opcodes/microblaze-opcm.h -+++ b/opcodes/microblaze-opcm.h -@@ -33,13 +33,13 @@ enum microblaze_instr - /* 'or/and/xor' are C++ keywords. */ - microblaze_or, microblaze_and, microblaze_xor, - andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, -- wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar, br, -- brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt, -- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, -+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, wdcclearea, mts, mtse, -+ mfs, mfse, mbar, br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, -+ bne, bned, blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, - imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid, - brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, -- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh, -- shr, sw, swr, swx, lbui, lhui, lwi, -+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx, -+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, - sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv, - fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, - fint, fsqrt, --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0008-Add-new-MicroBlaze-bit-field-instructions.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0008-Add-new-MicroBlaze-bit-field-instructions.patch deleted file mode 100644 index 0bc01177..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0008-Add-new-MicroBlaze-bit-field-instructions.patch +++ /dev/null @@ -1,232 +0,0 @@ -From 5c4dacaae2ba93569c1d37cda9859c57d6649dc0 Mon Sep 17 00:00:00 2001 -From: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Date: Mon, 28 Aug 2017 19:54:01 -0700 -Subject: [PATCH] Add new MicroBlaze bit-field instructions - -This patches adds new bsefi and bsifi instructions. BSEFI- The -instruction shall extract a bit field from a register and place it -right-adjusted in the destination register. The other bits in the -destination register shall be set to zero BSIFI- The instruction shall -insert a right-adjusted bit field from a register at another position in -the destination register. The rest of the bits in the destination -register shall be unchanged - -Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++++++++++- - opcodes/microblaze-dis.c | 16 +++++++++++ - opcodes/microblaze-opc.h | 12 +++++++- - opcodes/microblaze-opcm.h | 6 +++- - 4 files changed, 102 insertions(+), 3 deletions(-) - -diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c -index e135547e62..34cb80fac2 100644 ---- a/gas/config/tc-microblaze.c -+++ b/gas/config/tc-microblaze.c -@@ -909,7 +909,7 @@ md_assemble (char * str) - unsigned reg2; - unsigned reg3; - unsigned isize; -- unsigned int immed, temp; -+ unsigned int immed, immed2, temp; - expressionS exp; - char name[20]; - -@@ -1164,7 +1164,76 @@ md_assemble (char * str) - inst |= (reg2 << RA_LOW) & RA_MASK; - inst |= (immed << IMM_LOW) & IMM5_MASK; - break; -+ case INST_TYPE_RD_R1_IMM5_IMM5: -+ if (strcmp (op_end, "")) -+ op_end = parse_reg (op_end + 1, ®1); /* Get rd. */ -+ else -+ { -+ as_fatal (_("Error in statement syntax")); -+ reg1 = 0; -+ } -+ if (strcmp (op_end, "")) -+ op_end = parse_reg (op_end + 1, ®2); /* Get r1. */ -+ else -+ { -+ as_fatal (_("Error in statement syntax")); -+ reg2 = 0; -+ } -+ -+ /* Check for spl registers. */ -+ if (check_spl_reg (®1)) -+ as_fatal (_("Cannot use special register with this instruction")); -+ if (check_spl_reg (®2)) -+ as_fatal (_("Cannot use special register with this instruction")); - -+ /* Width immediate value. */ -+ if (strcmp (op_end, "")) -+ op_end = parse_imm (op_end + 1, &exp, MIN_IMM_WIDTH, MAX_IMM_WIDTH); -+ else -+ as_fatal (_("Error in statement syntax")); -+ if (exp.X_op != O_constant) -+ { -+ as_warn (_("Symbol used as immediate width value for bit field instruction")); -+ immed = 1; -+ } -+ else -+ immed = exp.X_add_number; -+ if (opcode->instr == bsefi && immed > 31) -+ as_fatal (_("Width value must be less than 32")); -+ -+ /* Shift immediate value. */ -+ if (strcmp (op_end, "")) -+ op_end = parse_imm (op_end + 1, &exp, MIN_IMM, MAX_IMM); -+ else -+ as_fatal (_("Error in statement syntax")); -+ if (exp.X_op != O_constant) -+ { -+ as_warn (_("Symbol used as immediate shift value for bit field instruction")); -+ immed2 = 0; -+ } -+ else -+ { -+ output = frag_more (isize); -+ immed2 = exp.X_add_number; -+ } -+ if (immed2 != (immed2 % 32)) -+ { -+ as_warn (_("Shift value greater than 32. using <value %% 32>")); -+ immed2 = immed2 % 32; -+ } -+ -+ /* Check combined value. */ -+ if (immed + immed2 > 32) -+ as_fatal (_("Width value + shift value must not be greater than 32")); -+ -+ inst |= (reg1 << RD_LOW) & RD_MASK; -+ inst |= (reg2 << RA_LOW) & RA_MASK; -+ if (opcode->instr == bsefi) -+ inst |= (immed & IMM5_MASK) << IMM_WIDTH_LOW; /* bsefi */ -+ else -+ inst |= ((immed + immed2 - 1) & IMM5_MASK) << IMM_WIDTH_LOW; /* bsifi */ -+ inst |= (immed2 << IMM_LOW) & IMM5_MASK; -+ break; - case INST_TYPE_R1_R2: - if (strcmp (op_end, "")) - op_end = parse_reg (op_end + 1, ®1); /* Get r1. */ -diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c -index 6a174b0eb9..80a47ad2fc 100644 ---- a/opcodes/microblaze-dis.c -+++ b/opcodes/microblaze-dis.c -@@ -73,6 +73,18 @@ get_field_imm5_mbar (long instr) - return(strdup(tmpstr)); - } - -+static char * -+get_field_imm5width (long instr) -+{ -+ char tmpstr[25]; -+ -+ if (instr & 0x00004000) -+ sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ -+ else -+ sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */ -+ return (strdup (tmpstr)); -+} -+ - static char * - get_field_rfsl (long instr) - { -@@ -396,6 +408,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) - /* For mbar 16 or sleep insn. */ - case INST_TYPE_NONE: - break; -+ /* For bit field insns. */ -+ case INST_TYPE_RD_R1_IMM5_IMM5: -+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (inst),get_field_r1(inst),get_field_imm5width (inst), get_field_imm5 (inst)); -+ break; - /* For tuqula instruction */ - case INST_TYPE_RD: - print_func (stream, "\t%s", get_field_rd (inst)); -diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h -index a64f8362da..afb34989d9 100644 ---- a/opcodes/microblaze-opc.h -+++ b/opcodes/microblaze-opc.h -@@ -59,6 +59,9 @@ - /* For mbar. */ - #define INST_TYPE_IMM5 20 - -+/* For bsefi and bsifi */ -+#define INST_TYPE_RD_R1_IMM5_IMM5 21 -+ - #define INST_TYPE_NONE 25 - - -@@ -89,7 +92,9 @@ - #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */ - #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */ - #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */ -+#define OPCODE_MASK_H3B 0xFC00C600 /* High 6 bits and bits 16, 17, 21, 22. */ - #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */ -+#define OPCODE_MASK_H32B 0xFC00C000 /* High 6 bits and bit 16, 17. */ - #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */ - #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */ - #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */ -@@ -102,7 +107,7 @@ - #define DELAY_SLOT 1 - #define NO_DELAY_SLOT 0 - --#define MAX_OPCODES 299 -+#define MAX_OPCODES 301 - - struct op_code_struct - { -@@ -159,6 +164,8 @@ struct op_code_struct - {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst }, - {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst }, - {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst }, -+ {"bsefi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst }, -+ {"bsifi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst }, - {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst }, - {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst }, - {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst }, -@@ -438,5 +445,8 @@ char pvr_register_prefix[] = "rpvr"; - #define MIN_IMM5 ((int) 0x00000000) - #define MAX_IMM5 ((int) 0x0000001f) - -+#define MIN_IMM_WIDTH ((int) 0x00000001) -+#define MAX_IMM_WIDTH ((int) 0x00000020) -+ - #endif /* MICROBLAZE_OPC */ - -diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h -index 21a3dc8d76..dd6be7f65c 100644 ---- a/opcodes/microblaze-opcm.h -+++ b/opcodes/microblaze-opcm.h -@@ -29,7 +29,7 @@ enum microblaze_instr - addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, - mulh, mulhu, mulhsu,swapb,swaph, - idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput, -- ncget, ncput, muli, bslli, bsrai, bsrli, mului, -+ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului, - /* 'or/and/xor' are C++ keywords. */ - microblaze_or, microblaze_and, microblaze_xor, - andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, -@@ -129,6 +129,7 @@ enum microblaze_instr_type - #define RB_LOW 11 /* Low bit for RB. */ - #define IMM_LOW 0 /* Low bit for immediate. */ - #define IMM_MBAR 21 /* low bit for mbar instruction. */ -+#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */ - - #define RD_MASK 0x03E00000 - #define RA_MASK 0x001F0000 -@@ -141,6 +142,9 @@ enum microblaze_instr_type - /* Imm mask for mbar. */ - #define IMM5_MBAR_MASK 0x03E00000 - -+/* Imm mask for extract/insert width. */ -+#define IMM5_WIDTH_MASK 0x000007C0 -+ - /* FSL imm mask for get, put instructions. */ - #define RFSL_MASK 0x000000F - --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0009-Fixing-MicroBlaze-IMM-bug.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0009-Fixing-MicroBlaze-IMM-bug.patch deleted file mode 100644 index 0eef0f0d..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0009-Fixing-MicroBlaze-IMM-bug.patch +++ /dev/null @@ -1,31 +0,0 @@ -From cff770a6f73b82db3259e9577e13b08a1bcd14e8 Mon Sep 17 00:00:00 2001 -From: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Date: Mon, 28 Aug 2017 19:54:02 -0700 -Subject: [PATCH] Fixing MicroBlaze IMM bug - -Fixing the imm bug. with relax option imm -1 is also getting removed this is corrected now. - -Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - bfd/elf32-microblaze.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c -index cc6e4b1fd9..6fc475cbcd 100644 ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -1803,8 +1803,7 @@ microblaze_elf_relax_section (bfd *abfd, - else - symval += irel->r_addend; - -- if ((symval & 0xffff8000) == 0 -- || (symval & 0xffff8000) == 0xffff8000) -+ if ((symval & 0xffff8000) == 0) - { - /* We can delete this instruction. */ - sec->relax[sec->relax_count].addr = irel->r_offset; --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0010-Fixed-bug-in-GCC-so-that-it-will-support-.long-0U-an.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0010-Fixed-bug-in-GCC-so-that-it-will-support-.long-0U-an.patch deleted file mode 100644 index e08bedc7..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0010-Fixed-bug-in-GCC-so-that-it-will-support-.long-0U-an.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 4449e15997a576761433cc76daf3635742acec62 Mon Sep 17 00:00:00 2001 -From: Mahesh Bodapati <mbodapat@xilinx.com> -Date: Wed, 15 Nov 2017 17:45:35 -0800 -Subject: [PATCH] Fixed bug in GCC so that it will support .long 0U and .long - 0u - -Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - gas/expr.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/gas/expr.c b/gas/expr.c -index 6fc707b8a5..a54b1f4b76 100644 ---- a/gas/expr.c -+++ b/gas/expr.c -@@ -810,6 +810,15 @@ operand (expressionS *expressionP, enum expr_mode mode) - break; - } - } -+ if ((*input_line_pointer == 'U') || (*input_line_pointer == 'u')) -+ { -+ input_line_pointer--; -+ -+ integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) -+ ? 0 : 10, -+ expressionP); -+ break; -+ } - c = *input_line_pointer; - switch (c) - { --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0011-Fixing-MicroBlaze-constant-range-check-issue.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0011-Fixing-MicroBlaze-constant-range-check-issue.patch deleted file mode 100644 index fe940905..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0011-Fixing-MicroBlaze-constant-range-check-issue.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 4286d83d6dc58131982247f7017b738595329771 Mon Sep 17 00:00:00 2001 -From: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Date: Wed, 15 Nov 2017 17:45:34 -0800 -Subject: [PATCH] Fixing MicroBlaze constant range check issue - -Sample error: not in range ffffffff80000000..7fffffff, not ffffffff70000000 - -Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com> -Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> -Upstream-Status: Pending ---- - gas/config/tc-microblaze.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c -index 34cb80fac2..7e1233945a 100644 ---- a/gas/config/tc-microblaze.c -+++ b/gas/config/tc-microblaze.c -@@ -749,7 +749,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max) - if ((e->X_add_number >> 31) == 1) - e->X_add_number |= -((addressT) (1U << 31)); - -- if (e->X_add_number < min || e->X_add_number > max) -+ if ((int)e->X_add_number < min || (int)e->X_add_number > max) - { - as_fatal (_("operand must be absolute in range %lx..%lx, not %lx"), - (long) min, (long) max, (long) e->X_add_number); --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0012-MicroBlaze-fix-mask-for-barrel-shift-instructions.patch b/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0012-MicroBlaze-fix-mask-for-barrel-shift-instructions.patch deleted file mode 100644 index 1028c50a..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/binutils/binutils-2.29/0012-MicroBlaze-fix-mask-for-barrel-shift-instructions.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a3ce2a329f583a66732b6a435c1bd76a83732dd8 Mon Sep 17 00:00:00 2001 -From: Nathan Rossi <nathan@nathanrossi.com> -Date: Sun, 5 Nov 2017 22:17:39 +1000 -Subject: [PATCH] MicroBlaze fix mask for barrel shift instructions - -As of v10.0 the bsi (bslli/bsrai/bsrli/bsefi/bsifi) instructions have -bits 16 and 17 defined as 'Insert' and 'Extract' respectively to support -bit field insert/extract operations. For the bslli/bsrai/bsrli -instructions these bits must be 0, as such update the opcode mask so -that the bslli/bsrai/bsrli instructions do not also match the bsefi and -bsifi instructions. - -Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> -Upstream-Status: Pending ---- - opcodes/microblaze-opc.h | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h -index afb34989d9..68db818d69 100644 ---- a/opcodes/microblaze-opc.h -+++ b/opcodes/microblaze-opc.h -@@ -161,9 +161,9 @@ struct op_code_struct - {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst }, - {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst }, - {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst }, -- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst }, -- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst }, -- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst }, -+ {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst }, -+ {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst }, -+ {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst }, - {"bsefi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst }, - {"bsifi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst }, - {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst }, --- -2.15.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0001-Revert.patch b/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0001-Revert.patch deleted file mode 100644 index 8501bd87..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0001-Revert.patch +++ /dev/null @@ -1,42 +0,0 @@ -From cd395cbdaa551924459d6ecf143cb8e4a5771f2f Mon Sep 17 00:00:00 2001 -From: eager <eager@138bc75d-0d04-0410-961f-82ee72b054a4> -Date: Sat, 27 May 2017 18:29:40 +0000 -Subject: [PATCH 1/4] Revert: 2016-01-21 Ajit Agarwal - <ajitkum@xilinx.com> - - See https://gcc.gnu.org/ml/gcc/2017-05/msg00221.html. - - * config/microblaze/microblaze.h - (FIXED_REGISTERS): Update in macro. - (CALL_USED_REGISTERS): Update in macro. - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248540 138bc75d-0d04-0410-961f-82ee72b054a4 -Upstream-Status: Backport [from post gcc-7] ---- - gcc/config/microblaze/microblaze.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h -index 66e4ef5c3d..2c9ece1d6c 100644 ---- a/gcc/config/microblaze/microblaze.h -+++ b/gcc/config/microblaze/microblaze.h -@@ -269,14 +269,14 @@ extern enum pipeline_type microblaze_pipe; - #define FIXED_REGISTERS \ - { \ - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, \ -- 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ -+ 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 1, 1, 1, 1 \ - } - - #define CALL_USED_REGISTERS \ - { \ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ -- 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ -+ 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 1, 1, 1, 1 \ - } - #define GP_REG_FIRST 0 --- -2.11.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0003-microblaze-sync.md-Correct-behaviour-and-define-side.patch b/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0003-microblaze-sync.md-Correct-behaviour-and-define-side.patch deleted file mode 100644 index 9336291b..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0003-microblaze-sync.md-Correct-behaviour-and-define-side.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 6c7a10a9e077d0221cc9a6c5f5a6365815c1dca4 Mon Sep 17 00:00:00 2001 -From: Nathan Rossi <nathan@nathanrossi.com> -Date: Mon, 12 Jun 2017 00:28:42 +1000 -Subject: [PATCH 3/4] microblaze/sync.md: Correct behaviour and define - side-effects - -This change corrects the behaviour with regards to the bool output. -Previously the definition would set the bool operand to true (non-zero) -on failure, specifically at the 'cmp' against the expected operand which -would be set non-zero when the memory != expected value. Instead of -using the bool operand as the compare result use the clobbered %8 -operand for temporary comparison result and set the bool operand at the -end of the definition to true (in this case the immediate value of 1). -Also to ensure that the bool operand is 0 in all other cases the first -instruction which is intended as a clear of the carry bit is reused to -set the bool operand to 0 at the same time as clearing the carry bit. -And finally the jump offsets were updated - -Additional to the behaviour change this change defines the side-effects -of the atomic_compare_and_swap. Specifically the side effects where the -bool and val operands are modified/set based on the value of the memory -content. This prevents certain optimization behaviour from incorrectly -optimizing away code. An example of this is the snippet below, where in -certain cases the comparison is optimized away entirely. - - mem = 2; - if (atomic_compare_and_swap(&mem, ...) == 2) - ... - -Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> -Upstream-Status: Unsubmitted ---- - gcc/config/microblaze/sync.md | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md -index 8125bd8d63..605a9a969e 100644 ---- a/gcc/config/microblaze/sync.md -+++ b/gcc/config/microblaze/sync.md -@@ -18,9 +18,10 @@ - ;; <http://www.gnu.org/licenses/>. - - (define_insn "atomic_compare_and_swapsi" -- [(match_operand:SI 0 "register_operand" "=&d") ;; bool output -- (match_operand:SI 1 "register_operand" "=&d") ;; val output -- (match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory -+ [(set (match_operand:SI 0 "register_operand" "=&d") ;; bool output -+ (match_operand:SI 2 "nonimmediate_operand" "+Q")) ;; memory -+ (set (match_operand:SI 1 "register_operand" "=&d") ;; val output -+ (match_dup 2)) - (match_operand:SI 3 "register_operand" "d") ;; expected value - (match_operand:SI 4 "register_operand" "d") ;; desired value - (match_operand:SI 5 "const_int_operand" "") ;; is_weak -@@ -29,15 +30,16 @@ - (clobber (match_scratch:SI 8 "=&d"))] - "" - { -- output_asm_insn ("addc \tr0,r0,r0", operands); -+ output_asm_insn ("add \t%0,r0,r0", operands); - output_asm_insn ("lwx \t%1,%y2,r0", operands); - output_asm_insn ("addic\t%8,r0,0", operands); - output_asm_insn ("bnei \t%8,.-8", operands); -- output_asm_insn ("cmp \t%0,%1,%3", operands); -- output_asm_insn ("bnei \t%0,.+16", operands); -+ output_asm_insn ("cmp \t%8,%1,%3", operands); -+ output_asm_insn ("bnei \t%8,.+20", operands); - output_asm_insn ("swx \t%4,%y2,r0", operands); - output_asm_insn ("addic\t%8,r0,0", operands); - output_asm_insn ("bnei \t%8,.-28", operands); -+ output_asm_insn ("addi \t%0,r0,1", operands); - return ""; - } - ) --- -2.11.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0004-gcc-config-microblaze-Use-default-ident-output-gener.patch b/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0004-gcc-config-microblaze-Use-default-ident-output-gener.patch deleted file mode 100644 index 3b8a2f5d..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0004-gcc-config-microblaze-Use-default-ident-output-gener.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 308ac81945b2674953797a9db4aee98397f88362 Mon Sep 17 00:00:00 2001 -From: Nathan Rossi <nathan@nathanrossi.com> -Date: Sat, 27 May 2017 00:00:17 +1000 -Subject: [PATCH 4/4] gcc/config/microblaze: Use default ident output - generation - -Remove the MicroBlaze specific TARGET_ASM_OUTPUT_IDENT definition, and -use the default. - -Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> -Upstream-Status: Unsubmitted ---- - gcc/config/microblaze/microblaze-protos.h | 1 - - gcc/config/microblaze/microblaze.c | 24 ------------------------ - gcc/config/microblaze/microblaze.h | 2 +- - 3 files changed, 1 insertion(+), 26 deletions(-) - -diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h -index 9ba8f2d46f..b56e052ae4 100644 ---- a/gcc/config/microblaze/microblaze-protos.h -+++ b/gcc/config/microblaze/microblaze-protos.h -@@ -51,7 +51,6 @@ extern int microblaze_regno_ok_for_base_p (int, int); - extern HOST_WIDE_INT microblaze_initial_elimination_offset (int, int); - extern void microblaze_declare_object (FILE *, const char *, const char *, - const char *, int); --extern void microblaze_asm_output_ident (const char *); - extern int microblaze_legitimate_pic_operand (rtx); - extern bool microblaze_tls_referenced_p (rtx); - extern int symbol_mentioned_p (rtx); -diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c -index d0f86fd460..bba6983b65 100644 ---- a/gcc/config/microblaze/microblaze.c -+++ b/gcc/config/microblaze/microblaze.c -@@ -3351,30 +3351,6 @@ microblaze_eh_return (rtx op0) - emit_insn (gen_movsi (gen_rtx_MEM (Pmode, stack_pointer_rtx), op0)); - } - --/* Queue an .ident string in the queue of top-level asm statements. -- If the string size is below the threshold, put it into .sdata2. -- If the front-end is done, we must be being called from toplev.c. -- In that case, do nothing. */ --void --microblaze_asm_output_ident (const char *string) --{ -- const char *section_asm_op; -- int size; -- char *buf; -- -- if (symtab->state != PARSING) -- return; -- -- size = strlen (string) + 1; -- if (size <= microblaze_section_threshold) -- section_asm_op = SDATA2_SECTION_ASM_OP; -- else -- section_asm_op = READONLY_DATA_SECTION_ASM_OP; -- -- buf = ACONCAT ((section_asm_op, "\n\t.ascii \"", string, "\\0\"\n", NULL)); -- symtab->finalize_toplevel_asm (build_string (strlen (buf), buf)); --} -- - static void - microblaze_elf_asm_init_sections (void) - { -diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h -index 2c9ece1d6c..ccd77e8b4d 100644 ---- a/gcc/config/microblaze/microblaze.h -+++ b/gcc/config/microblaze/microblaze.h -@@ -743,7 +743,7 @@ do { \ - #define STRING_ASM_OP "\t.asciz\t" - - #undef TARGET_ASM_OUTPUT_IDENT --#define TARGET_ASM_OUTPUT_IDENT microblaze_asm_output_ident -+#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive - - /* Default to -G 8 */ - #ifndef MICROBLAZE_DEFAULT_GVALUE --- -2.11.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-source_7.%.bbappend b/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-source_7.%.bbappend deleted file mode 100644 index 5b695638..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-source_7.%.bbappend +++ /dev/null @@ -1,9 +0,0 @@ -# Add MicroBlaze Patches (only when using MicroBlaze) -FILESEXTRAPATHS_append_microblaze := "${THISDIR}/gcc-7:" -SRC_URI_append_microblaze = " \ - file://0001-Revert.patch \ - file://0002-microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch \ - file://0003-microblaze-sync.md-Correct-behaviour-and-define-side.patch \ - file://0004-gcc-config-microblaze-Use-default-ident-output-gener.patch \ - " - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch deleted file mode 100644 index 3575cd7e..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 8ab9a20c73acedbb636a41842a681872af8ae1d6 Mon Sep 17 00:00:00 2001 -From: David Holsgrove <david.holsgrove@xilinx.com> -Date: Wed, 8 May 2013 11:03:36 +1000 -Subject: [PATCH 01/16] [Patch, microblaze]: Add wdc.ext.clear and - wdc.ext.flush insns - -Added two new instructions, wdc.ext.clear and wdc.ext.flush, -to enable MicroBlaze to flush an external cache, which is -used with the new coherency support for multiprocessing. - -Signed-off-by:nagaraju <nmekala@xilix.com> -Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> -Upstream-Status: Pending ---- - opcodes/microblaze-opc.h | 5 ++++- - opcodes/microblaze-opcm.h | 6 +++--- - 2 files changed, 7 insertions(+), 4 deletions(-) - -diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h -index e3cc1d9..f453097 100644 ---- a/opcodes/microblaze-opc.h -+++ b/opcodes/microblaze-opc.h -@@ -91,6 +91,7 @@ - #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */ - #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */ - #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */ -+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */ - #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */ - - /* New Mask for msrset, msrclr insns. */ -@@ -101,7 +102,7 @@ - #define DELAY_SLOT 1 - #define NO_DELAY_SLOT 0 - --#define MAX_OPCODES 289 -+#define MAX_OPCODES 291 - - struct op_code_struct - { -@@ -174,7 +175,9 @@ struct op_code_struct - {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst }, - {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst }, - {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst }, -+ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst }, - {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst }, -+ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst }, - {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst }, - {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst }, - {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst }, -diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h -index 6868389..8f5c1cb 100644 ---- a/opcodes/microblaze-opcm.h -+++ b/opcodes/microblaze-opcm.h -@@ -31,9 +31,9 @@ enum microblaze_instr - idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput, - ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor, - andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, -- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd, -- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt, -- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, -+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar, -+ br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, -+ blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, - imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid, - brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, - bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh, --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch deleted file mode 100644 index 5d856408..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch +++ /dev/null @@ -1,384 +0,0 @@ -From da27c7161c676550f5fe8a4e0f7f395e5e0d4770 Mon Sep 17 00:00:00 2001 -From: David Holsgrove <david.holsgrove@petalogix.com> -Date: Fri, 18 May 2012 11:49:50 +1000 -Subject: [PATCH 03/16] [Patch, microblaze]: Initial port of microblaze core - reading support - -Added support for reading notes in linux core dumps -Support for reading of PRSTATUS and PSINFO information for rebuilding -".reg" sections of core dumps at run time. - -Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> -Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com> -Upstream-Status: Pending ---- - bfd/elf32-microblaze.c | 64 ++++++++++++++++++++++++++++++++ - gdb/configure.tgt | 2 +- - gdb/microblaze-linux-tdep.c | 61 +++++++++++++++++++++++++++++++ - gdb/microblaze-tdep.c | 89 +++++++++++++++++++++++++++++++++++++++++++++ - gdb/microblaze-tdep.h | 28 ++++++++++++++ - 5 files changed, 243 insertions(+), 1 deletion(-) - -diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c -index 9837b18..cbd18f0 100644 ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -668,6 +668,67 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name) - return _bfd_elf_is_local_label_name (abfd, name); - } - -+/* Support for core dump NOTE sections. */ -+static bfd_boolean -+microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) -+{ -+ int offset; -+ unsigned int size; -+ -+ switch (note->descsz) -+ { -+ default: -+ return FALSE; -+ -+ case 228: /* Linux/MicroBlaze */ -+ /* pr_cursig */ -+ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); -+ -+ /* pr_pid */ -+ elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24); -+ -+ /* pr_reg */ -+ offset = 72; -+ size = 50 * 4; -+ -+ break; -+ } -+ -+ /* Make a ".reg/999" section. */ -+ return _bfd_elfcore_make_pseudosection (abfd, ".reg", -+ size, note->descpos + offset); -+} -+ -+static bfd_boolean -+microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) -+{ -+ switch (note->descsz) -+ { -+ default: -+ return FALSE; -+ -+ case 128: /* Linux/MicroBlaze elf_prpsinfo */ -+ elf_tdata (abfd)->core->program -+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); -+ elf_tdata (abfd)->core->command -+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); -+ } -+ -+ /* Note that for some reason, a spurious space is tacked -+ onto the end of the args in some (at least one anyway) -+ implementations, so strip it off if it exists. */ -+ -+ { -+ char *command = elf_tdata (abfd)->core->command; -+ int n = strlen (command); -+ -+ if (0 < n && command[n - 1] == ' ') -+ command[n - 1] = '\0'; -+ } -+ -+ return TRUE; -+} -+ - /* The microblaze linker (like many others) needs to keep track of - the number of relocs that it decides to copy as dynamic relocs in - check_relocs for each symbol. This is so that it can later discard -@@ -3506,4 +3567,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, - #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections - #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook - -+#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus -+#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo -+ - #include "elf32-target.h" -diff --git a/gdb/configure.tgt b/gdb/configure.tgt -index 01311b2..9297c56 100644 ---- a/gdb/configure.tgt -+++ b/gdb/configure.tgt -@@ -340,7 +340,7 @@ mep-*-*) - - microblaze*-linux-*|microblaze*-*-linux*) - # Target: Xilinx MicroBlaze running Linux -- gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o \ -+ gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o glibc-tdep.o \ - monitor.o dsrec.o solib-svr4.o symfile-mem.o linux-tdep.o" - gdb_sim=../sim/microblaze/libsim.a - ;; -diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c -index 8d360eb..7e6b61b 100644 ---- a/gdb/microblaze-linux-tdep.c -+++ b/gdb/microblaze-linux-tdep.c -@@ -32,6 +32,7 @@ - #include "regset.h" - #include "solib-svr4.h" - #include "microblaze-tdep.h" -+#include "glibc-tdep.h" - #include "trad-frame.h" - #include "frame-unwind.h" - #include "tramp-frame.h" -@@ -116,6 +117,43 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame = - microblaze_linux_sighandler_cache_init - }; - -+const struct microblaze_gregset microblaze_linux_core_gregset; -+ -+static void -+microblaze_linux_supply_core_gregset (const struct regset *regset, -+ struct regcache *regcache, -+ int regnum, const void *gregs, size_t len) -+{ -+ microblaze_supply_gregset (µblaze_linux_core_gregset, regcache, -+ regnum, gregs); -+} -+ -+static void -+microblaze_linux_collect_core_gregset (const struct regset *regset, -+ const struct regcache *regcache, -+ int regnum, void *gregs, size_t len) -+{ -+ microblaze_collect_gregset (µblaze_linux_core_gregset, regcache, -+ regnum, gregs); -+} -+ -+static void -+microblaze_linux_supply_core_fpregset (const struct regset *regset, -+ struct regcache *regcache, -+ int regnum, const void *fpregs, size_t len) -+{ -+ /* FIXME. */ -+ microblaze_supply_fpregset (regcache, regnum, fpregs); -+} -+ -+static void -+microblaze_linux_collect_core_fpregset (const struct regset *regset, -+ const struct regcache *regcache, -+ int regnum, void *fpregs, size_t len) -+{ -+ /* FIXME. */ -+ microblaze_collect_fpregset (regcache, regnum, fpregs); -+} - - static void - microblaze_linux_init_abi (struct gdbarch_info info, -@@ -123,6 +161,10 @@ microblaze_linux_init_abi (struct gdbarch_info info, - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - -+ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset, -+ microblaze_linux_collect_core_gregset); -+ tdep->sizeof_gregset = 200; -+ - linux_init_abi (info, gdbarch); - - set_gdbarch_memory_remove_breakpoint (gdbarch, -@@ -135,6 +177,25 @@ microblaze_linux_init_abi (struct gdbarch_info info, - /* Trampolines. */ - tramp_frame_prepend_unwinder (gdbarch, - µblaze_linux_sighandler_tramp_frame); -+ -+ /* BFD target for core files. */ -+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) -+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); -+ else -+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); -+ -+ -+ /* Shared library handling. */ -+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); -+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); -+ -+ set_gdbarch_regset_from_core_section (gdbarch, -+ microblaze_regset_from_core_section); -+ -+ /* Enable TLS support. */ -+ set_gdbarch_fetch_tls_load_module_address (gdbarch, -+ svr4_fetch_objfile_link_map); -+ - } - - /* -Wmissing-prototypes */ -diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c -index 14c1b52..36cf1ca 100644 ---- a/gdb/microblaze-tdep.c -+++ b/gdb/microblaze-tdep.c -@@ -145,6 +145,14 @@ microblaze_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, - return sp; - } - -+static CORE_ADDR -+microblaze_store_arguments (struct regcache *regcache, int nargs, -+ struct value **args, CORE_ADDR sp, -+ int struct_return, CORE_ADDR struct_addr) -+{ -+ error (_("store_arguments not implemented")); -+ return sp; -+} - - static CORE_ADDR - microblaze_push_dummy_call (struct gdbarch *gdbarch, struct value *function, -@@ -536,6 +544,12 @@ microblaze_frame_base_address (struct frame_info *next_frame, - return cache->base; - } - -+static const struct frame_unwind * -+microblaze_frame_sniffer (struct frame_info *next_frame) -+{ -+ return µblaze_frame_unwind; -+} -+ - static const struct frame_base microblaze_frame_base = - { - µblaze_frame_unwind, -@@ -664,6 +678,70 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg) - return dwarf2_to_reg_map[reg]; - } - -+ -+void -+microblaze_supply_gregset (const struct microblaze_gregset *gregset, -+ struct regcache *regcache, -+ int regnum, const void *gregs) -+{ -+ unsigned int *regs = gregs; -+ if (regnum >= 0) -+ regcache_raw_supply (regcache, regnum, regs + regnum); -+ -+ if (regnum == -1) { -+ int i; -+ -+ for (i = 0; i < 50; i++) { -+ regcache_raw_supply (regcache, i, regs + i); -+ } -+ } -+} -+ -+ -+void -+microblaze_collect_gregset (const struct microblaze_gregset *gregset, -+ const struct regcache *regcache, -+ int regnum, void *gregs) -+{ -+ /* FIXME. */ -+} -+ -+void -+microblaze_supply_fpregset (struct regcache *regcache, -+ int regnum, const void *fpregs) -+{ -+ /* FIXME. */ -+} -+ -+void -+microblaze_collect_fpregset (const struct regcache *regcache, -+ int regnum, void *fpregs) -+{ -+ /* FIXME. */ -+} -+ -+ -+/* Return the appropriate register set for the core section identified -+ by SECT_NAME and SECT_SIZE. */ -+ -+const struct regset * -+microblaze_regset_from_core_section (struct gdbarch *gdbarch, -+ const char *sect_name, size_t sect_size) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name); -+ -+ if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset) -+ return tdep->gregset; -+ -+ if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset) -+ return tdep->fpregset; -+ -+ microblaze_debug ("microblaze_regset_from_core_section returning null :-( \n"); -+ return NULL; -+} -+ - static struct gdbarch * - microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - { -@@ -679,6 +757,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - tdep = XNEW (struct gdbarch_tdep); - gdbarch = gdbarch_alloc (&info, tdep); - -+ tdep->gregset = NULL; -+ tdep->sizeof_gregset = 0; -+ tdep->fpregset = NULL; -+ tdep->sizeof_fpregset = 0; -+ - set_gdbarch_long_double_bit (gdbarch, 128); - - set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); -@@ -726,6 +809,12 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - frame_unwind_append_unwinder (gdbarch, µblaze_frame_unwind); - frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); - -+ /* If we have register sets, enable the generic core file support. */ -+ if (tdep->gregset) { -+ set_gdbarch_regset_from_core_section (gdbarch, -+ microblaze_regset_from_core_section); -+ } -+ - return gdbarch; - } - -diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h -index a532092..fec24b9 100644 ---- a/gdb/microblaze-tdep.h -+++ b/gdb/microblaze-tdep.h -@@ -22,8 +22,22 @@ - - - /* Microblaze architecture-specific information. */ -+struct microblaze_gregset -+{ -+ unsigned int gregs[32]; -+ unsigned int fpregs[32]; -+ unsigned int pregs[16]; -+}; -+ - struct gdbarch_tdep - { -+ int dummy; // declare something. -+ -+ /* Register sets. */ -+ struct regset *gregset; -+ size_t sizeof_gregset; -+ struct regset *fpregset; -+ size_t sizeof_fpregset; - }; - - struct microblaze_frame_cache -@@ -117,4 +131,18 @@ enum microblaze_regnum - Only used for native debugging. */ - #define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60} - -+extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset, -+ struct regcache *regcache, -+ int regnum, const void *gregs); -+extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset, -+ const struct regcache *regcache, -+ int regnum, void *gregs); -+extern void microblaze_supply_fpregset (struct regcache *regcache, -+ int regnum, const void *fpregs); -+extern void microblaze_collect_fpregset (const struct regcache *regcache, -+ int regnum, void *fpregs); -+ -+extern const struct regset * microblaze_regset_from_core_section (struct gdbarch *gdbarch, -+ const char *sect_name, size_t sect_size); -+ - #endif /* microblaze-tdep.h */ --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch deleted file mode 100644 index b14e4092..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 26e124f0d78233b1d976bd4b787f6a7866bcb7e7 Mon Sep 17 00:00:00 2001 -From: nagaraju <nmekala@xilix.com> -Date: Wed, 4 Jan 2012 16:59:33 +0530 -Subject: [PATCH 04/16] [Patch, microblaze]: Communicate in larger blocks with - the target - -Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> -Upstream-Status: Pending ---- - gdb/microblaze-tdep.c | 25 ++++++++++++++++++++++--- - 1 file changed, 22 insertions(+), 3 deletions(-) - -diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c -index 36cf1ca..76e87b3 100644 ---- a/gdb/microblaze-tdep.c -+++ b/gdb/microblaze-tdep.c -@@ -242,6 +242,10 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, - int flags = 0; - int save_hidden_pointer_found = 0; - int non_stack_instruction_found = 0; -+ int n_insns; -+ unsigned long *insn_block; -+ gdb_byte *buf_block; -+ int ti, tj; - - /* Find the start of this function. */ - find_pc_partial_function (pc, &name, &func_addr, &func_end); -@@ -281,9 +285,23 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, - name, paddress (gdbarch, func_addr), - paddress (gdbarch, stop)); - -+/* Do a block read to minimize the transaction with the Debug Agent */ -+ n_insns = (stop == func_addr) ? 1 : ((stop - func_addr) / INST_WORD_SIZE); -+ insn_block = (unsigned long *)calloc(n_insns, sizeof(unsigned long)); -+ buf_block = (gdb_byte *)calloc(n_insns * INST_WORD_SIZE, sizeof(gdb_byte)); -+ -+ target_read_memory (func_addr, buf_block, n_insns * INST_WORD_SIZE ); -+ -+ for(ti = 0; ti < n_insns; ti++){ -+ insn_block[ti] = 0; -+ for( tj = ti * INST_WORD_SIZE; tj < (ti + 1) * INST_WORD_SIZE; tj++ ) -+ insn_block[ti] = (insn_block[ti] << 8) | buf_block[tj]; -+ } -+ - for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE) - { -- insn = microblaze_fetch_instruction (addr); -+ //insn = microblaze_fetch_instruction (addr); -+ insn = insn_block[(addr - func_addr) / INST_WORD_SIZE]; - op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm); - microblaze_debug ("%s %08lx\n", paddress (gdbarch, pc), insn); - -@@ -409,8 +427,9 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, - part of the prologue. */ - if (save_hidden_pointer_found) - prologue_end_addr -= INST_WORD_SIZE; -- -- return prologue_end_addr; -+ free(insn_block); -+ free(buf_block); -+ return prologue_end_addr; - } - - static CORE_ADDR --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch deleted file mode 100644 index e490f02a..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 5c3a08f407e1cbee5b0a4ca6092165b97acddda5 Mon Sep 17 00:00:00 2001 -From: "Edgar E. Iglesias" <edgar@axis.com> -Date: Fri, 24 Feb 2012 11:52:30 +0100 -Subject: [PATCH 05/16] [Patch, microblaze]: Add mb singlestepping. - -Fix prologue analysis for little-endian. -Always provide a frame base. - -Signed-off-by: Edgar E. Iglesias <edgar@axis.com> -Upstream-Status: Pending ---- - gdb/microblaze-tdep.c | 123 ++++++++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 108 insertions(+), 15 deletions(-) - -diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c -index 76e87b3..50b68d2 100644 ---- a/gdb/microblaze-tdep.c -+++ b/gdb/microblaze-tdep.c -@@ -243,9 +243,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, - int save_hidden_pointer_found = 0; - int non_stack_instruction_found = 0; - int n_insns; -- unsigned long *insn_block; -- gdb_byte *buf_block; -- int ti, tj; -+ unsigned int *insn_block; - - /* Find the start of this function. */ - find_pc_partial_function (pc, &name, &func_addr, &func_end); -@@ -287,23 +285,16 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, - - /* Do a block read to minimize the transaction with the Debug Agent */ - n_insns = (stop == func_addr) ? 1 : ((stop - func_addr) / INST_WORD_SIZE); -- insn_block = (unsigned long *)calloc(n_insns, sizeof(unsigned long)); -- buf_block = (gdb_byte *)calloc(n_insns * INST_WORD_SIZE, sizeof(gdb_byte)); -+ insn_block = calloc(n_insns, sizeof(unsigned long)); - -- target_read_memory (func_addr, buf_block, n_insns * INST_WORD_SIZE ); -- -- for(ti = 0; ti < n_insns; ti++){ -- insn_block[ti] = 0; -- for( tj = ti * INST_WORD_SIZE; tj < (ti + 1) * INST_WORD_SIZE; tj++ ) -- insn_block[ti] = (insn_block[ti] << 8) | buf_block[tj]; -- } -+ target_read_memory (func_addr, (void*) insn_block, n_insns * INST_WORD_SIZE ); - - for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE) - { - //insn = microblaze_fetch_instruction (addr); - insn = insn_block[(addr - func_addr) / INST_WORD_SIZE]; - op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm); -- microblaze_debug ("%s %08lx\n", paddress (gdbarch, pc), insn); -+ microblaze_debug ("%s %08lx op=%x r%d r%d imm=%d\n", paddress (gdbarch, addr), insn, op, rd, ra, imm); - - /* This code is very sensitive to what functions are present in the - prologue. It assumes that the (addi, addik, swi, sw) can be the -@@ -428,7 +419,6 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, - if (save_hidden_pointer_found) - prologue_end_addr -= INST_WORD_SIZE; - free(insn_block); -- free(buf_block); - return prologue_end_addr; - } - -@@ -502,6 +492,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) - - func = get_frame_func (next_frame); - -+ cache->base = get_frame_register_unsigned (next_frame, gdbarch_sp_regnum (gdbarch)); - cache->pc = get_frame_address_in_block (next_frame); - - return cache; -@@ -518,7 +509,7 @@ microblaze_frame_this_id (struct frame_info *next_frame, void **this_cache, - if (cache->base == 0) - return; - -- (*this_id) = frame_id_build (cache->base, cache->pc); -+ (*this_id) = frame_id_build (cache->base, get_frame_pc (next_frame)); - } - - static struct value * -@@ -661,6 +652,107 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) - return (TYPE_LENGTH (type) == 16); - } - -+int -+microblaze_software_single_step (struct frame_info *frame) -+{ -+ struct gdbarch *arch = get_frame_arch (frame); -+ struct address_space *aspace = get_frame_address_space (frame); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch); -+ static char le_breakp[] = MICROBLAZE_BREAKPOINT_LE; -+ static char be_breakp[] = MICROBLAZE_BREAKPOINT; -+ enum bfd_endian byte_order = gdbarch_byte_order (arch); -+ char *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp; -+ int ret = 0; -+ -+ /* Save the address and the values of the next_pc and the target */ -+ static struct sstep_breaks -+ { -+ CORE_ADDR address; -+ bfd_boolean valid; -+ /* Shadow contents. */ -+ char data[INST_WORD_SIZE]; -+ } stepbreaks[2]; -+ int ii; -+ -+ if (1) -+ { -+ CORE_ADDR pc; -+ long insn; -+ enum microblaze_instr minstr; -+ bfd_boolean isunsignednum; -+ enum microblaze_instr_type insn_type; -+ short delay_slots; -+ int imm; -+ bfd_boolean immfound = FALSE; -+ -+ /* Set a breakpoint at the next instruction */ -+ /* If the current instruction is an imm, set it at the inst after */ -+ /* If the instruction has a delay slot, skip the delay slot */ -+ pc = get_frame_pc (frame); -+ insn = microblaze_fetch_instruction (pc); -+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots); -+ if (insn_type == immediate_inst) -+ { -+ int rd, ra, rb; -+ immfound = TRUE; -+ minstr = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm); -+ pc = pc + INST_WORD_SIZE; -+ insn = microblaze_fetch_instruction (pc); -+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots); -+ } -+ stepbreaks[0].address = pc + (delay_slots * INST_WORD_SIZE) + INST_WORD_SIZE; -+ if (insn_type != return_inst) { -+ stepbreaks[0].valid = TRUE; -+ } else { -+ stepbreaks[0].valid = FALSE; -+ } -+ -+ microblaze_debug ("single-step insn_type=%x insn=%x\n", insn_type, insn); -+ /* Now check for branch or return instructions */ -+ if (insn_type == branch_inst || insn_type == return_inst) { -+ int limm; -+ int lrd, lra, lrb; -+ int ra, rb; -+ bfd_boolean targetvalid; -+ bfd_boolean unconditionalbranch; -+ microblaze_decode_insn(insn, &lrd, &lra, &lrb, &limm); -+ if (lra >= 0 && lra < MICROBLAZE_NUM_REGS) -+ ra = get_frame_register_unsigned (frame, lra); -+ else -+ ra = 0; -+ if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS) -+ rb = get_frame_register_unsigned (frame, lrb); -+ else -+ rb = 0; -+ stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch); -+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address); -+ if (unconditionalbranch) -+ stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */ -+ if (targetvalid && (stepbreaks[0].valid == FALSE || -+ (stepbreaks[0].address != stepbreaks[1].address)) -+ && (stepbreaks[1].address != pc)) { -+ stepbreaks[1].valid = TRUE; -+ } else { -+ stepbreaks[1].valid = FALSE; -+ } -+ } else { -+ stepbreaks[1].valid = FALSE; -+ } -+ -+ /* Insert the breakpoints */ -+ for (ii = 0; ii < 2; ++ii) -+ { -+ -+ /* ignore invalid breakpoint. */ -+ if (stepbreaks[ii].valid) { -+ insert_single_step_breakpoint (arch, aspace, stepbreaks[ii].address); -+ ret = 1; -+ } -+ } -+ } -+ return ret; -+} -+ - static void - microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc) - { -@@ -809,6 +901,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - - set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc); -+ set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); - - set_gdbarch_frame_args_skip (gdbarch, 8); - --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch deleted file mode 100644 index 7cd11905..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch +++ /dev/null @@ -1,82 +0,0 @@ -From fb2af2fffb673dbb14d743c8da94c4a83b71c792 Mon Sep 17 00:00:00 2001 -From: David Holsgrove <david.holsgrove@xilinx.com> -Date: Mon, 26 Nov 2012 17:39:17 +1000 -Subject: [PATCH 07/16] [Patch, microblaze]: Add slr and shr regs and - little-endian breakpoint - -Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> -Upstream-Status: Pending ---- - gdb/microblaze-tdep.c | 10 ++++++++-- - gdb/microblaze-tdep.h | 6 ++++-- - gdb/regformats/reg-microblaze.dat | 2 ++ - 3 files changed, 14 insertions(+), 4 deletions(-) - -diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c -index 1c6dbfe..0ce4947 100644 ---- a/gdb/microblaze-tdep.c -+++ b/gdb/microblaze-tdep.c -@@ -73,7 +73,8 @@ static const char *microblaze_register_names[] = - "rpc", "rmsr", "rear", "resr", "rfsr", "rbtr", - "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6", - "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11", -- "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi" -+ "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi", -+ "rslr", "rshr" - }; - - #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names) -@@ -201,10 +202,15 @@ static const gdb_byte * - microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, - int *len) - { -+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - static gdb_byte break_insn[] = MICROBLAZE_BREAKPOINT; -+ static gdb_byte break_insn_le[] = MICROBLAZE_BREAKPOINT_LE; - - *len = sizeof (break_insn); -- return break_insn; -+ if (byte_order == BFD_ENDIAN_BIG) -+ return break_insn; -+ else -+ return break_insn_le; - } - - /* Allocate and initialize a frame cache. */ -diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h -index 98aa0f5..cd32e9f 100644 ---- a/gdb/microblaze-tdep.h -+++ b/gdb/microblaze-tdep.h -@@ -56,7 +56,7 @@ struct microblaze_frame_cache - int fp_regnum; - - /* Offsets to saved registers. */ -- int register_offsets[57]; /* Must match MICROBLAZE_NUM_REGS. */ -+ int register_offsets[59]; /* Must match MICROBLAZE_NUM_REGS. */ - - /* Table of saved registers. */ - struct trad_frame_saved_reg *saved_regs; -@@ -121,7 +121,9 @@ enum microblaze_regnum - MICROBLAZE_RTLBX_REGNUM, - MICROBLAZE_RTLBSX_REGNUM, - MICROBLAZE_RTLBLO_REGNUM, -- MICROBLAZE_RTLBHI_REGNUM -+ MICROBLAZE_RTLBHI_REGNUM, -+ MICROBLAZE_SLR_REGNUM, -+ MICROBLAZE_SHR_REGNUM - }; - - /* All registers are 32 bits. */ -diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat -index a5dd0a0..bd8a438 100644 ---- a/gdb/regformats/reg-microblaze.dat -+++ b/gdb/regformats/reg-microblaze.dat -@@ -37,3 +37,5 @@ expedite:r1,pc - 32:ear - 32:esr - 32:fsr -+32:slr -+32:shr --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch deleted file mode 100644 index 7f075d55..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 7944750e435100e72913f01aa0a43b7d7cffd421 Mon Sep 17 00:00:00 2001 -From: nagaraju <nmekala@xilix.com> -Date: Tue, 3 Sep 2013 12:09:47 +0530 -Subject: [PATCH 08/16] [Patch, microblaze]: Added Backtrace support to GDB - -Added backtrace support without debugging information. - -Earlier backtrace used to work only when debug information is available. -Previous pc & sp values are calculated incorrectly due to which backtrace -was failing. - -In this patch, previous frame sp & pc values are calculated correctly -in microblaze_frame_cache function and supplied them to -microblaze_frame_prev_register function - -Signed-off-by:nagaraju <nmekala@xilix.com> -Upstream-Status: Pending ---- - gdb/microblaze-tdep.c | 42 ++++++++++++++++++++++++++++++++++-------- - gdb/microblaze-tdep.h | 5 +++-- - 2 files changed, 37 insertions(+), 10 deletions(-) - -diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c -index 0ce4947..247740e 100644 ---- a/gdb/microblaze-tdep.c -+++ b/gdb/microblaze-tdep.c -@@ -225,6 +225,7 @@ microblaze_alloc_frame_cache (void) - /* Base address. */ - cache->base = 0; - cache->pc = 0; -+ cache->saved_sp = 0; - - /* Frameless until proven otherwise. */ - cache->frameless_p = 1; -@@ -347,6 +348,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, - cache->frameless_p = 0; /* Frame found. */ - save_hidden_pointer_found = 0; - non_stack_instruction_found = 0; -+ cache->register_offsets[rd] = -imm; - continue; - } - else if (IS_SPILL_SP(op, rd, ra)) -@@ -508,6 +510,7 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) - return start_pc; - } - -+enum { REG_UNAVAIL = (CORE_ADDR) -1 }; - /* Normal frames. */ - - static struct microblaze_frame_cache * -@@ -515,7 +518,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) - { - struct microblaze_frame_cache *cache; - struct gdbarch *gdbarch = get_frame_arch (next_frame); -- CORE_ADDR func; -+ CORE_ADDR current_pc; - int rn; - - if (*this_cache) -@@ -529,10 +532,18 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) - for (rn = 0; rn < gdbarch_num_regs (gdbarch); rn++) - cache->register_offsets[rn] = -1; - -- func = get_frame_func (next_frame); -+ cache->pc = get_frame_func (next_frame); -+ current_pc = get_frame_pc (next_frame); -+ -+ if (cache->pc) -+ microblaze_analyze_prologue (gdbarch, cache->pc, current_pc, -+ cache); - - cache->base = get_frame_register_unsigned (next_frame, gdbarch_sp_regnum (gdbarch)); -- cache->pc = get_frame_address_in_block (next_frame); -+ cache->saved_sp = cache->base + cache->framesize; -+ -+ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM] = cache->base; -+ cache->register_offsets[MICROBLAZE_SP_REGNUM] = cache->saved_sp; - - return cache; - } -@@ -548,7 +559,7 @@ microblaze_frame_this_id (struct frame_info *next_frame, void **this_cache, - if (cache->base == 0) - return; - -- (*this_id) = frame_id_build (cache->base, get_frame_pc (next_frame)); -+ (*this_id) = frame_id_build (cache->base, cache->pc); - } - - static struct value * -@@ -558,6 +569,14 @@ microblaze_frame_prev_register (struct frame_info *this_frame, - struct microblaze_frame_cache *cache = - microblaze_frame_cache (this_frame, this_cache); - -+ if ((regnum == MICROBLAZE_SP_REGNUM && -+ cache->register_offsets[MICROBLAZE_SP_REGNUM]) -+ || (regnum == MICROBLAZE_FP_REGNUM && -+ cache->register_offsets[MICROBLAZE_SP_REGNUM])) -+ -+ return frame_unwind_got_constant (this_frame, regnum, -+ cache->register_offsets[MICROBLAZE_SP_REGNUM]); -+ - if (cache->frameless_p) - { - if (regnum == MICROBLAZE_PC_REGNUM) -@@ -565,11 +584,18 @@ microblaze_frame_prev_register (struct frame_info *this_frame, - if (regnum == MICROBLAZE_SP_REGNUM) - regnum = 1; - return trad_frame_get_prev_register (this_frame, -- cache->saved_regs, regnum); -+ cache->saved_regs, regnum); - } -- else -- return trad_frame_get_prev_register (this_frame, cache->saved_regs, -- regnum); -+ -+ if (regnum == MICROBLAZE_PC_REGNUM) -+ { -+ regnum = 15; -+ return frame_unwind_got_memory (this_frame, regnum, -+ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]); -+ } -+ -+ return trad_frame_get_prev_register (this_frame, cache->saved_regs, -+ regnum); - - } - -diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h -index cd32e9f..14eb3ab 100644 ---- a/gdb/microblaze-tdep.h -+++ b/gdb/microblaze-tdep.h -@@ -57,6 +57,7 @@ struct microblaze_frame_cache - - /* Offsets to saved registers. */ - int register_offsets[59]; /* Must match MICROBLAZE_NUM_REGS. */ -+ CORE_ADDR saved_sp; - - /* Table of saved registers. */ - struct trad_frame_saved_reg *saved_regs; -@@ -80,11 +81,11 @@ enum microblaze_regnum - MICROBLAZE_R12_REGNUM, - MICROBLAZE_R13_REGNUM, - MICROBLAZE_R14_REGNUM, -- MICROBLAZE_R15_REGNUM, -+ MICROBLAZE_R15_REGNUM, MICROBLAZE_PREV_PC_REGNUM = MICROBLAZE_R15_REGNUM, - MICROBLAZE_R16_REGNUM, - MICROBLAZE_R17_REGNUM, - MICROBLAZE_R18_REGNUM, -- MICROBLAZE_R19_REGNUM, -+ MICROBLAZE_R19_REGNUM, MICROBLAZE_FP_REGNUM = MICROBLAZE_R19_REGNUM, - MICROBLAZE_R20_REGNUM, - MICROBLAZE_R21_REGNUM, - MICROBLAZE_R22_REGNUM, --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch deleted file mode 100644 index 1ad6b89c..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch +++ /dev/null @@ -1,495 +0,0 @@ -From c7b918283f2e438deef78aae84f6b748a7a1bb54 Mon Sep 17 00:00:00 2001 -From: David Holsgrove <david.holsgrove@petalogix.com> -Date: Fri, 20 Jul 2012 15:18:35 +1000 -Subject: [PATCH 09/16] [Patch, microblaze]: Initial support for native gdb - -microblaze: Follow PPC method of getting setting registers -using PTRACE PEEK/POKE - -Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> -Upstream-Status: Pending ---- - gdb/Makefile.in | 4 +- - gdb/config/microblaze/linux.mh | 10 + - gdb/microblaze-linux-nat.c | 431 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 443 insertions(+), 2 deletions(-) - create mode 100644 gdb/config/microblaze/linux.mh - create mode 100644 gdb/microblaze-linux-nat.c - -diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index f2c16ec..12870a4 100644 ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -904,7 +904,7 @@ top.h bsd-kvm.h gdb-stabs.h reggroups.h \ - annotate.h sim-regno.h dictionary.h dfp.h main.h frame-unwind.h \ - remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \ - sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \ --gdb_usleep.h jit.h xml-syscall.h microblaze-tdep.h \ -+gdb_usleep.h jit.h xml-syscall.h microblaze-tdep.h microblaze-linux-tdep.h \ - psymtab.h psympriv.h progspace.h bfin-tdep.h ia64-hpux-tdep.h \ - amd64-darwin-tdep.h charset-list.h \ - config/djgpp/langinfo.h config/djgpp/nl_types.h darwin-nat.h \ -@@ -1631,7 +1631,7 @@ ALLDEPFILES = \ - m68kbsd-nat.c m68kbsd-tdep.c \ - m68klinux-nat.c m68klinux-tdep.c \ - m88k-tdep.c m88kbsd-nat.c \ -- microblaze-tdep.c microblaze-linux-tdep.c \ -+ microblaze-tdep.c microblaze-linux-nat.c microblaze-linux-tdep.c \ - mingw-hdep.c \ - mips-linux-nat.c mips-linux-tdep.c \ - mips-irix-tdep.c \ -diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh -new file mode 100644 -index 0000000..547d103 ---- /dev/null -+++ b/gdb/config/microblaze/linux.mh -@@ -0,0 +1,10 @@ -+# Host: Microblaze, running Linux -+ -+NAT_FILE= config/nm-linux.h -+NATDEPFILES= inf-ptrace.o fork-child.o \ -+ microblaze-linux-nat.o proc-service.o linux-thread-db.o \ -+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o \ -+ linux-waitpid.o -+NAT_CDEPS = $(srcdir)/proc-service.list -+ -+LOADLIBES = -ldl $(RDYNAMIC) -diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c -new file mode 100644 -index 0000000..81f8346 ---- /dev/null -+++ b/gdb/microblaze-linux-nat.c -@@ -0,0 +1,431 @@ -+/* Microblaze GNU/Linux native support. -+ -+ Copyright (C) 1988-1989, 1991-1992, 1994, 1996, 2000-2012 Free -+ Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -+ -+#include "defs.h" -+#include "arch-utils.h" -+#include "dis-asm.h" -+#include "frame.h" -+#include "trad-frame.h" -+#include "symtab.h" -+#include "value.h" -+#include "gdbcmd.h" -+#include "breakpoint.h" -+#include "inferior.h" -+#include "regcache.h" -+#include "target.h" -+#include "frame.h" -+#include "frame-base.h" -+#include "frame-unwind.h" -+#include "dwarf2-frame.h" -+#include "osabi.h" -+ -+#include "gdb_assert.h" -+#include <string.h> -+#include "target-descriptions.h" -+#include "opcodes/microblaze-opcm.h" -+#include "opcodes/microblaze-dis.h" -+ -+#include "linux-nat.h" -+#include "target-descriptions.h" -+ -+#include <sys/user.h> -+#include <sys/utsname.h> -+#include <sys/procfs.h> -+#include <sys/ptrace.h> -+ -+/* Prototypes for supply_gregset etc. */ -+#include "gregset.h" -+ -+#include "microblaze-tdep.h" -+ -+#include <elf/common.h> -+#include "auxv.h" -+ -+/* Defines ps_err_e, struct ps_prochandle. */ -+#include "gdb_proc_service.h" -+ -+/* On GNU/Linux, threads are implemented as pseudo-processes, in which -+ case we may be tracing more than one process at a time. In that -+ case, inferior_ptid will contain the main process ID and the -+ individual thread (process) ID. get_thread_id () is used to get -+ the thread id if it's available, and the process id otherwise. */ -+ -+int -+get_thread_id (ptid_t ptid) -+{ -+ int tid = ptid_get_lwp (ptid); -+ if (0 == tid) -+ tid = ptid_get_pid (ptid); -+ return tid; -+} -+ -+#define GET_THREAD_ID(PTID) get_thread_id (PTID) -+ -+/* Non-zero if our kernel may support the PTRACE_GETREGS and -+ PTRACE_SETREGS requests, for reading and writing the -+ general-purpose registers. Zero if we've tried one of -+ them and gotten an error. */ -+int have_ptrace_getsetregs = 1; -+ -+static int -+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno) -+{ -+ int u_addr = -1; -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace -+ interface, and not the wordsize of the program's ABI. */ -+ int wordsize = sizeof (long); -+ -+ /* General purpose registers occupy 1 slot each in the buffer. */ -+ if (regno >= MICROBLAZE_R0_REGNUM -+ && regno <= MICROBLAZE_FSR_REGNUM) -+ u_addr = (regno * wordsize); -+ -+ return u_addr; -+} -+ -+ -+static void -+fetch_register (struct regcache *regcache, int tid, int regno) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ /* This isn't really an address. But ptrace thinks of it as one. */ -+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); -+ int bytes_transferred; -+ unsigned int offset; /* Offset of registers within the u area. */ -+ char buf[MAX_REGISTER_SIZE]; -+ -+ if (regaddr == -1) -+ { -+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */ -+ regcache_raw_supply (regcache, regno, buf); -+ return; -+ } -+ -+ /* Read the raw register using sizeof(long) sized chunks. On a -+ 32-bit platform, 64-bit floating-point registers will require two -+ transfers. */ -+ for (bytes_transferred = 0; -+ bytes_transferred < register_size (gdbarch, regno); -+ bytes_transferred += sizeof (long)) -+ { -+ long l; -+ -+ errno = 0; -+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0); -+ regaddr += sizeof (long); -+ if (errno != 0) -+ { -+ char message[128]; -+ sprintf (message, "reading register %s (#%d)", -+ gdbarch_register_name (gdbarch, regno), regno); -+ perror_with_name (message); -+ } -+ memcpy (&buf[bytes_transferred], &l, sizeof (l)); -+ } -+ -+ /* Now supply the register. Keep in mind that the regcache's idea -+ of the register's size may not be a multiple of sizeof -+ (long). */ -+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) -+ { -+ /* Little-endian values are always found at the left end of the -+ bytes transferred. */ -+ regcache_raw_supply (regcache, regno, buf); -+ } -+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) -+ { -+ /* Big-endian values are found at the right end of the bytes -+ transferred. */ -+ size_t padding = (bytes_transferred - register_size (gdbarch, regno)); -+ regcache_raw_supply (regcache, regno, buf + padding); -+ } -+ else -+ internal_error (__FILE__, __LINE__, -+ _("fetch_register: unexpected byte order: %d"), -+ gdbarch_byte_order (gdbarch)); -+} -+ -+/* This function actually issues the request to ptrace, telling -+ it to get all general-purpose registers and put them into the -+ specified regset. -+ -+ If the ptrace request does not exist, this function returns 0 -+ and properly sets the have_ptrace_* flag. If the request fails, -+ this function calls perror_with_name. Otherwise, if the request -+ succeeds, then the regcache gets filled and 1 is returned. */ -+static int -+fetch_all_gp_regs (struct regcache *regcache, int tid) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ gdb_gregset_t gregset; -+ -+ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0) -+ { -+ if (errno == EIO) -+ { -+ have_ptrace_getsetregs = 0; -+ return 0; -+ } -+ perror_with_name (_("Couldn't get general-purpose registers.")); -+ } -+ -+ supply_gregset (regcache, (const gdb_gregset_t *) &gregset); -+ -+ return 1; -+} -+ -+ -+/* This is a wrapper for the fetch_all_gp_regs function. It is -+ responsible for verifying if this target has the ptrace request -+ that can be used to fetch all general-purpose registers at one -+ shot. If it doesn't, then we should fetch them using the -+ old-fashioned way, which is to iterate over the registers and -+ request them one by one. */ -+static void -+fetch_gp_regs (struct regcache *regcache, int tid) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int i; -+ -+ if (have_ptrace_getsetregs) -+ if (fetch_all_gp_regs (regcache, tid)) -+ return; -+ -+ /* If we've hit this point, it doesn't really matter which -+ architecture we are using. We just need to read the -+ registers in the "old-fashioned way". */ -+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++) -+ fetch_register (regcache, tid, i); -+} -+ -+ -+static void -+store_register (const struct regcache *regcache, int tid, int regno) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ /* This isn't really an address. But ptrace thinks of it as one. */ -+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); -+ int i; -+ size_t bytes_to_transfer; -+ char buf[MAX_REGISTER_SIZE]; -+ -+ if (regaddr == -1) -+ return; -+ -+ /* First collect the register. Keep in mind that the regcache's -+ idea of the register's size may not be a multiple of sizeof -+ (long). */ -+ memset (buf, 0, sizeof buf); -+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long)); -+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) -+ { -+ /* Little-endian values always sit at the left end of the buffer. */ -+ regcache_raw_collect (regcache, regno, buf); -+ } -+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) -+ { -+ /* Big-endian values sit at the right end of the buffer. */ -+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno)); -+ regcache_raw_collect (regcache, regno, buf + padding); -+ } -+ -+ for (i = 0; i < bytes_to_transfer; i += sizeof (long)) -+ { -+ long l; -+ -+ memcpy (&l, &buf[i], sizeof (l)); -+ errno = 0; -+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l); -+ regaddr += sizeof (long); -+ -+ if (errno != 0) -+ { -+ char message[128]; -+ sprintf (message, "writing register %s (#%d)", -+ gdbarch_register_name (gdbarch, regno), regno); -+ perror_with_name (message); -+ } -+ } -+} -+ -+/* This function actually issues the request to ptrace, telling -+ it to store all general-purpose registers present in the specified -+ regset. -+ -+ If the ptrace request does not exist, this function returns 0 -+ and properly sets the have_ptrace_* flag. If the request fails, -+ this function calls perror_with_name. Otherwise, if the request -+ succeeds, then the regcache is stored and 1 is returned. */ -+static int -+store_all_gp_regs (const struct regcache *regcache, int tid, int regno) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ gdb_gregset_t gregset; -+ -+ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0) -+ { -+ if (errno == EIO) -+ { -+ have_ptrace_getsetregs = 0; -+ return 0; -+ } -+ perror_with_name (_("Couldn't get general-purpose registers.")); -+ } -+ -+ fill_gregset (regcache, &gregset, regno); -+ -+ if (ptrace (PTRACE_SETREGS, tid, 0, (void *) &gregset) < 0) -+ { -+ if (errno == EIO) -+ { -+ have_ptrace_getsetregs = 0; -+ return 0; -+ } -+ perror_with_name (_("Couldn't set general-purpose registers.")); -+ } -+ -+ return 1; -+} -+ -+/* This is a wrapper for the store_all_gp_regs function. It is -+ responsible for verifying if this target has the ptrace request -+ that can be used to store all general-purpose registers at one -+ shot. If it doesn't, then we should store them using the -+ old-fashioned way, which is to iterate over the registers and -+ store them one by one. */ -+static void -+store_gp_regs (const struct regcache *regcache, int tid, int regno) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int i; -+ -+ if (have_ptrace_getsetregs) -+ if (store_all_gp_regs (regcache, tid, regno)) -+ return; -+ -+ /* If we hit this point, it doesn't really matter which -+ architecture we are using. We just need to store the -+ registers in the "old-fashioned way". */ -+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++) -+ store_register (regcache, tid, i); -+} -+ -+ -+/* Fetch registers from the child process. Fetch all registers if -+ regno == -1, otherwise fetch all general registers or all floating -+ point registers depending upon the value of regno. */ -+ -+static void -+microblaze_linux_fetch_inferior_registers (struct target_ops *ops, -+ struct regcache *regcache, int regno) -+{ -+ /* Get the thread id for the ptrace call. */ -+ int tid = GET_THREAD_ID (inferior_ptid); -+ -+ if (regno == -1) -+ fetch_gp_regs (regcache, tid); -+ else -+ fetch_register (regcache, tid, regno); -+} -+ -+/* Store registers back into the inferior. Store all registers if -+ regno == -1, otherwise store all general registers or all floating -+ point registers depending upon the value of regno. */ -+ -+static void -+microblaze_linux_store_inferior_registers (struct target_ops *ops, -+ struct regcache *regcache, int regno) -+{ -+ /* Get the thread id for the ptrace call. */ -+ int tid = GET_THREAD_ID (inferior_ptid); -+ -+ if (regno >= 0) -+ store_register (regcache, tid, regno); -+ else -+ store_gp_regs (regcache, tid, -1); -+} -+ -+/* Wrapper functions for the standard regset handling, used by -+ thread debugging. */ -+ -+void -+fill_gregset (const struct regcache *regcache, -+ gdb_gregset_t *gregsetp, int regno) -+{ -+ microblaze_collect_gregset (NULL, regcache, regno, gregsetp); -+} -+ -+void -+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp) -+{ -+ microblaze_supply_gregset (NULL, regcache, -1, gregsetp); -+} -+ -+void -+fill_fpregset (const struct regcache *regcache, -+ gdb_fpregset_t *fpregsetp, int regno) -+{ -+ /* FIXME. */ -+} -+ -+void -+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp) -+{ -+ /* FIXME. */ -+} -+ -+static const struct target_desc * -+microblaze_linux_read_description (struct target_ops *ops) -+{ -+ CORE_ADDR microblaze_hwcap = 0; -+ -+ if (target_auxv_search (ops, AT_HWCAP, µblaze_hwcap) != 1) -+ return NULL; -+ -+ return NULL; -+} -+ -+ -+void _initialize_microblaze_linux_nat (void); -+ -+void -+_initialize_microblaze_linux_nat (void) -+{ -+ struct target_ops *t; -+ -+ /* Fill in the generic GNU/Linux methods. */ -+ t = linux_target (); -+ -+ /* Add our register access methods. */ -+ t->to_fetch_registers = microblaze_linux_fetch_inferior_registers; -+ t->to_store_registers = microblaze_linux_store_inferior_registers; -+ -+ t->to_read_description = microblaze_linux_read_description; -+ -+ /* Register the target. */ -+ linux_nat_add_target (t); -+} --- -1.9.0 diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch deleted file mode 100644 index 3912ca57..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch +++ /dev/null @@ -1,43 +0,0 @@ -From a02963a97d7ce38b0af205f9e3e6dd7e0e06d9be Mon Sep 17 00:00:00 2001 -From: "Edgar E. Iglesias" <edgar@axis.com> -Date: Mon, 27 Feb 2012 06:28:00 +0100 -Subject: [PATCH 10/16] [Patch, gdb]: Robustify inline function support - -Signed-off-by: Edgar E. Iglesias <edgar@axis.com> -Upstream-Status: Pending ---- - gdb/blockframe.c | 3 ++- - gdb/inline-frame.c | 3 +++ - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/gdb/blockframe.c b/gdb/blockframe.c -index 0a9381e..ba41d85 100644 ---- a/gdb/blockframe.c -+++ b/gdb/blockframe.c -@@ -77,7 +77,8 @@ get_frame_block (struct frame_info *frame, CORE_ADDR *addr_in_block) - inline_count--; - - bl = BLOCK_SUPERBLOCK (bl); -- gdb_assert (bl != NULL); -+ if (!bl) -+ return NULL; - } - - return bl; -diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c -index eb82143..a793390 100644 ---- a/gdb/inline-frame.c -+++ b/gdb/inline-frame.c -@@ -231,6 +231,9 @@ inline_frame_sniffer (const struct frame_unwind *self, - cur_block = BLOCK_SUPERBLOCK (cur_block); - } - -+ if (depth == 0) -+ return 0; -+ - /* Check how many inlined functions already have frames. */ - for (next_frame = get_next_frame (this_frame); - next_frame && get_frame_type (next_frame) == INLINE_FRAME; --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch deleted file mode 100644 index bdec77c5..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch +++ /dev/null @@ -1,43 +0,0 @@ -From a05fb34192727fc1b63c827ed006ddde846ce6b8 Mon Sep 17 00:00:00 2001 -From: Nathan Rossi <nathan.rossi@petalogix.com> -Date: Tue, 8 May 2012 18:11:17 +1000 -Subject: [PATCH 11/16] [Patch, gdb]: Fix debug message when register is - unavailable - -Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com> -Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> -Upstream-Status: Pending ---- - gdb/frame.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff --git a/gdb/frame.c b/gdb/frame.c -index 013d602..4d0766f 100644 ---- a/gdb/frame.c -+++ b/gdb/frame.c -@@ -1134,12 +1134,19 @@ frame_unwind_register_value (struct frame_info *frame, int regnum) - else - { - int i; -- const gdb_byte *buf = value_contents (value); -+ const gdb_byte *buf = NULL; -+ if (value_entirely_available(value)) { -+ buf = value_contents (value); -+ } - - fprintf_unfiltered (gdb_stdlog, " bytes="); - fprintf_unfiltered (gdb_stdlog, "["); -- for (i = 0; i < register_size (gdbarch, regnum); i++) -- fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]); -+ if (buf != NULL) { -+ for (i = 0; i < register_size (gdbarch, regnum); i++) -+ fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]); -+ } else { -+ fprintf_unfiltered (gdb_stdlog, "unavailable"); -+ } - fprintf_unfiltered (gdb_stdlog, "]"); - } - } --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch deleted file mode 100644 index 819cd179..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch +++ /dev/null @@ -1,34 +0,0 @@ -From f54d5334afe799e15ca21c5d83097a4c81bbab7e Mon Sep 17 00:00:00 2001 -From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> -Date: Fri, 22 Jun 2012 01:20:20 +0200 -Subject: [PATCH 12/16] [LOCAL]: Disable the warning message for eh_frame_hdr - -Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> -Upstream-Status: Pending ---- - bfd/elf-eh-frame.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c -index 0f0a563..7d8e047 100644 ---- a/bfd/elf-eh-frame.c -+++ b/bfd/elf-eh-frame.c -@@ -919,9 +919,12 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, - goto success; - - free_no_table: -- (*info->callbacks->einfo) -- (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"), -- abfd, sec); -+ /* FIXME: Remove the microblaze specifics when relaxing gets fixed. */ -+ if (bfd_get_arch(abfd) != bfd_arch_microblaze) { -+ (*info->callbacks->einfo) -+ (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"), -+ abfd, sec); -+ } - hdr_info->table = FALSE; - if (sec_info) - free (sec_info); --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch deleted file mode 100644 index 3a0eae83..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch +++ /dev/null @@ -1,64 +0,0 @@ -From c9f1f07e5b0756069e3d4b04eb9505027f09677f Mon Sep 17 00:00:00 2001 -From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> -Date: Tue, 14 Feb 2012 01:00:22 +0100 -Subject: [PATCH 13/16] [LOCAL]: Fix relaxation of assembler resolved - references - -Upstream-Status: Pending ---- - bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 39 insertions(+) - -diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c -index cbd18f0..f90df47 100644 ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -1968,6 +1968,45 @@ microblaze_elf_relax_section (bfd *abfd, - irelscanend = irelocs + o->reloc_count; - for (irelscan = irelocs; irelscan < irelscanend; irelscan++) - { -+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE) -+ { -+ unsigned int val; -+ -+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info); -+ -+ /* This was a PC-relative instruction that was completely resolved. */ -+ if (ocontents == NULL) -+ { -+ if (elf_section_data (o)->this_hdr.contents != NULL) -+ ocontents = elf_section_data (o)->this_hdr.contents; -+ else -+ { -+ /* We always cache the section contents. -+ Perhaps, if info->keep_memory is FALSE, we -+ should free them, if we are permitted to. */ -+ -+ if (o->rawsize == 0) -+ o->rawsize = o->size; -+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); -+ if (ocontents == NULL) -+ goto error_return; -+ if (!bfd_get_section_contents (abfd, o, ocontents, -+ (file_ptr) 0, -+ o->rawsize)) -+ goto error_return; -+ elf_section_data (o)->this_hdr.contents = ocontents; -+ } -+ } -+ -+ irelscan->r_addend -= calc_fixup (irelscan->r_addend -+ + isym->st_value, sec); -+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); -+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, -+ irelscan->r_addend); -+ } -+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) { -+ fprintf(stderr, "Unhandled NONE 64\n"); -+ } - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) - { - isym = isymbuf + ELF32_R_SYM (irelscan->r_info); --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch deleted file mode 100644 index 85cee9d5..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch +++ /dev/null @@ -1,192 +0,0 @@ -From aca2758cff1f8fdc5ad7b6076ef985ba9ec5f857 Mon Sep 17 00:00:00 2001 -From: David Holsgrove <david.holsgrove@xilinx.com> -Date: Mon, 4 Feb 2013 12:15:22 +1000 -Subject: [PATCH 14/16] [LOCAL]: Fixup debug_loc sections after linker - relaxation - -Adds a new reloctype R_MICROBLAZE_32_NONE, used for passing -reloc info from the assembler to the linker when the linker -manages to fully resolve a local symbol reference. - -This is a workaround for design flaws in the assembler to -linker interface with regards to linker relaxation. - -Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> -Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> -Upstream-Status: Pending ---- - bfd/bfd-in2.h | 5 +++++ - bfd/elf32-microblaze.c | 45 +++++++++++++++++++++++++++++++++++++-------- - bfd/libbfd.h | 1 + - bfd/reloc.c | 6 ++++++ - include/elf/microblaze.h | 1 + - 5 files changed, 50 insertions(+), 8 deletions(-) - -diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h -index 8b7f2ee..de38907 100644 ---- a/bfd/bfd-in2.h -+++ b/bfd/bfd-in2.h -@@ -5449,6 +5449,11 @@ value relative to the read-write small data area anchor */ - expressions of the form "Symbol Op Symbol" */ - BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, - -+/* This is a 32 bit reloc that stores the 32 bit pc relative -+value in two words (with an imm instruction). No relocation is -+done here - only used for relaxing */ -+ BFD_RELOC_MICROBLAZE_32_NONE, -+ - /* This is a 64 bit reloc that stores the 32 bit pc relative - value in two words (with an imm instruction). No relocation is - done here - only used for relaxing */ -diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c -index f90df47..a3f89b9 100644 ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -177,6 +177,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = - FALSE), /* PC relative offset? */ - - /* This reloc does nothing. Used for relaxation. */ -+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ -+ 0, /* Rightshift. */ -+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ -+ 32, /* Bitsize. */ -+ TRUE, /* PC_relative. */ -+ 0, /* Bitpos. */ -+ complain_overflow_bitfield, /* Complain on overflow. */ -+ NULL, /* Special Function. */ -+ "R_MICROBLAZE_32_NONE",/* Name. */ -+ FALSE, /* Partial Inplace. */ -+ 0, /* Source Mask. */ -+ 0, /* Dest Mask. */ -+ FALSE), /* PC relative offset? */ -+ - HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ - 0, /* Rightshift. */ - 2, /* Size (0 = byte, 1 = short, 2 = long). */ -@@ -532,7 +546,10 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, - case BFD_RELOC_NONE: - microblaze_reloc = R_MICROBLAZE_NONE; - break; -- case BFD_RELOC_MICROBLAZE_64_NONE: -+ case BFD_RELOC_MICROBLAZE_32_NONE: -+ microblaze_reloc = R_MICROBLAZE_32_NONE; -+ break; -+ case BFD_RELOC_MICROBLAZE_64_NONE: - microblaze_reloc = R_MICROBLAZE_64_NONE; - break; - case BFD_RELOC_32: -@@ -1913,14 +1930,22 @@ microblaze_elf_relax_section (bfd *abfd, - } - break; - case R_MICROBLAZE_NONE: -+ case R_MICROBLAZE_32_NONE: - { - /* This was a PC-relative instruction that was - completely resolved. */ - int sfix, efix; -+ unsigned int val; - bfd_vma target_address; - target_address = irel->r_addend + irel->r_offset; - sfix = calc_fixup (irel->r_offset, 0, sec); - efix = calc_fixup (target_address, 0, sec); -+ -+ /* Validate the in-band val. */ -+ val = bfd_get_32 (abfd, contents + irel->r_offset); -+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { -+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); -+ } - irel->r_addend -= (efix - sfix); - /* Should use HOWTO. */ - microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, -@@ -1968,12 +1993,16 @@ microblaze_elf_relax_section (bfd *abfd, - irelscanend = irelocs + o->reloc_count; - for (irelscan = irelocs; irelscan < irelscanend; irelscan++) - { -- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE) -+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) - { - unsigned int val; - - isym = isymbuf + ELF32_R_SYM (irelscan->r_info); - -+ /* hax: We only do the following fixup for debug location lists. */ -+ if (strcmp(".debug_loc", o->name)) -+ continue; -+ - /* This was a PC-relative instruction that was completely resolved. */ - if (ocontents == NULL) - { -@@ -1998,15 +2027,15 @@ microblaze_elf_relax_section (bfd *abfd, - } - } - -- irelscan->r_addend -= calc_fixup (irelscan->r_addend -- + isym->st_value, sec); - val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); -+ if (val != irelscan->r_addend) { -+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend); -+ } -+ -+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); - microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, - irelscan->r_addend); - } -- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) { -- fprintf(stderr, "Unhandled NONE 64\n"); -- } - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) - { - isym = isymbuf + ELF32_R_SYM (irelscan->r_info); -@@ -2066,7 +2095,7 @@ microblaze_elf_relax_section (bfd *abfd, - elf_section_data (o)->this_hdr.contents = ocontents; - } - } -- irelscan->r_addend -= calc_fixup (irel->r_addend -+ irelscan->r_addend -= calc_fixup (irelscan->r_addend - + isym->st_value, - 0, - sec); -diff --git a/bfd/libbfd.h b/bfd/libbfd.h -index 09f307f..840c662 100644 ---- a/bfd/libbfd.h -+++ b/bfd/libbfd.h -@@ -2644,6 +2644,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", - "BFD_RELOC_MICROBLAZE_32_ROSDA", - "BFD_RELOC_MICROBLAZE_32_RWSDA", - "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", -+ "BFD_RELOC_MICROBLAZE_32_NONE", - "BFD_RELOC_MICROBLAZE_64_NONE", - "BFD_RELOC_MICROBLAZE_64_GOTPC", - "BFD_RELOC_MICROBLAZE_64_GOT", -diff --git a/bfd/reloc.c b/bfd/reloc.c -index 7f46c58..5bcd52d 100644 ---- a/bfd/reloc.c -+++ b/bfd/reloc.c -@@ -6396,6 +6396,12 @@ ENUMDOC - This is a 32 bit reloc for the microblaze to handle - expressions of the form "Symbol Op Symbol" - ENUM -+ BFD_RELOC_MICROBLAZE_32_NONE -+ENUMDOC -+ This is a 32 bit reloc that stores the 32 bit pc relative -+ value in two words (with an imm instruction). No relocation is -+ done here - only used for relaxing -+ENUM - BFD_RELOC_MICROBLAZE_64_NONE - ENUMDOC - This is a 64 bit reloc that stores the 32 bit pc relative -diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h -index effca20..f8420dc 100644 ---- a/include/elf/microblaze.h -+++ b/include/elf/microblaze.h -@@ -58,6 +58,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) - RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL64, 27) /* TLS Offset Within TLS Block */ - RELOC_NUMBER (R_MICROBLAZE_TLSGOTTPREL32, 28) /* TLS Offset From Thread Pointer */ - RELOC_NUMBER (R_MICROBLAZE_TLSTPREL32, 29) /* TLS Offset From Thread Pointer */ -+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 30) - - END_RELOC_NUMBERS (R_MICROBLAZE_max) - --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch b/meta-xilinx-bsp/recipes-microblaze/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch deleted file mode 100644 index 0bb66a94..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 22c63d4d79ac488403340470c14c73bad4984fa3 Mon Sep 17 00:00:00 2001 -From: David Holsgrove <david.holsgrove@xilinx.com> -Date: Wed, 27 Feb 2013 13:56:11 +1000 -Subject: [PATCH 15/16] [LOCAL]: upstream change to garbage collection sweep - causes mb regression - -Upstream change for PR13177 now clears the def_regular during gc_sweep of a -section. (All other archs in binutils/bfd/elf32-*.c received an update -to a warning about unresolvable relocations - this warning is not present -in binutils/bfd/elf32-microblaze.c, but this warning check would not -prevent the error being seen) - -The visible issue with this change is when running a c++ application -in Petalinux which links libstdc++.so for exception handling it segfaults -on execution. - -This does not occur if static linking libstdc++.a, so its during the -relocations for a shared lib with garbage collection this occurs - -Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> -Upstream-Status: Pending ---- - bfd/elflink.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/bfd/elflink.c b/bfd/elflink.c -index 6756fb1..f21dc06 100644 ---- a/bfd/elflink.c -+++ b/bfd/elflink.c -@@ -11932,7 +11932,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data) - - inf = (struct elf_gc_sweep_symbol_info *) data; - (*inf->hide_symbol) (inf->info, h, TRUE); -- h->def_regular = 0; - h->ref_regular = 0; - h->ref_regular_nonweak = 0; - } --- -1.9.0 - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-7.7.1.inc b/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-7.7.1.inc deleted file mode 100644 index 396f0fc1..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-7.7.1.inc +++ /dev/null @@ -1,12 +0,0 @@ -LICENSE = "GPLv2 & GPLv3 & LGPLv2 & LGPLv3" -LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ - file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \ - file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674" - -S = "${WORKDIR}/${BPN}-${PV}" - -SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.gz" -SRC_URI[md5sum] = "45b07b53d81832d32ccd4829465d4886" -SRC_URI[sha256sum] = "eefadb9831e3695d1eaef34e98b8f1fb441df6fe5071317ea49c6bd6ba213eff" - diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-cross-canadian_7.7.1.bb b/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-cross-canadian_7.7.1.bb deleted file mode 100644 index c349ebbb..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-cross-canadian_7.7.1.bb +++ /dev/null @@ -1,4 +0,0 @@ -require recipes-devtools/gdb/gdb-common.inc -require recipes-devtools/gdb/gdb-cross-canadian.inc -require gdb-${PV}.inc -require gdb-microblaze-7.7.inc diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-cross_7.7.1.bb b/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-cross_7.7.1.bb deleted file mode 100644 index 98b3359c..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-cross_7.7.1.bb +++ /dev/null @@ -1,3 +0,0 @@ -require recipes-devtools/gdb/gdb-cross.inc -require gdb-${PV}.inc -require gdb-microblaze-7.7.inc diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-microblaze-7.7.inc b/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-microblaze-7.7.inc deleted file mode 100644 index d1aba822..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb-microblaze-7.7.inc +++ /dev/null @@ -1,22 +0,0 @@ - -# MicroBlaze does not support LTTng UST -LTTNGUST_microblaze = "" - -# Add MicroBlaze Patches -FILESEXTRAPATHS_append := "${THISDIR}/files:" -SRC_URI_append = " \ - file://0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch \ - file://0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch \ - file://0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch \ - file://0005-Patch-microblaze-Add-mb-singlestepping.patch \ - file://0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch \ - file://0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch \ - file://0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch \ - file://0009-Patch-microblaze-Initial-support-for-native-gdb.patch \ - file://0010-Patch-gdb-Robustify-inline-function-support.patch \ - file://0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch \ - file://0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch \ - file://0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch \ - file://0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch \ - file://0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch \ - " diff --git a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb_7.7.1.bb b/meta-xilinx-bsp/recipes-microblaze/gdb/gdb_7.7.1.bb deleted file mode 100644 index 80b589a1..00000000 --- a/meta-xilinx-bsp/recipes-microblaze/gdb/gdb_7.7.1.bb +++ /dev/null @@ -1,29 +0,0 @@ -require recipes-devtools/gdb/gdb-common.inc -require gdb-${PV}.inc -require gdb-microblaze-7.7.inc - -inherit gettext -inherit python-dir - -PACKAGECONFIG ??= "" -PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python" -PACKAGECONFIG[babeltrace] = "--with-babeltrace,--without-babeltrace,babeltrace" - -do_configure_prepend() { - if [ -n "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}" ]; then - cat > ${WORKDIR}/python << EOF -#!/bin/sh -case "\$2" in - --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}/" ;; - --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}" ;; - --exec-prefix) echo "${exec_prefix}" ;; - *) exit 1 ;; -esac -exit 0 -EOF - chmod +x ${WORKDIR}/python - fi -} - -PACKAGES =+ "gdbserver" -FILES_gdbserver = "${bindir}/gdbserver" diff --git a/meta-xilinx-contrib/README.md b/meta-xilinx-contrib/README.md index 71557a6a..30dc3282 100644 --- a/meta-xilinx-contrib/README.md +++ b/meta-xilinx-contrib/README.md @@ -1,41 +1,34 @@ -meta-xilinx-contrib -=================== +# meta-xilinx-contrib -This layer is a contribution layer to support for MicroBlaze, Zynq and ZynqMP architectures. -This layer depends on meta-xilinx-bsp layer. +This layer is a contribution layer enables AMD Xilinx MicroBlaze, Zynq, ZynqMP +and Versal devices and provides related metadata. +Any patches from open source contributors for vendor board can be added here. -Supported Boards/Machines -========================= +## Vendor Evaluation Boards BSP Machines files -* Zynq: - * Digilent Zybo Linux BD Reference design +The following boards are supported by the meta-xilinx-contrib layer: -Maintainers, Mailing list, Patches -================================== - -Please send any patches, comments or questions for this layer to -the [meta-xilinx mailing list](https://lists.yoctoproject.org/listinfo/meta-xilinx): - - meta-xilinx@lists.yoctoproject.org with '[meta-xilinx-contrib]' in the subject. - - -Subscribe to mailing list at -https://lists.yoctoproject.org/listinfo/meta-xilinx - -Maintainers: - - Manjukumar Harthikote Matha <manjukumar.harthikote-matha@xilinx.com> - -Dependencies -============ +| Devices | Vendor Board Variant | Machine Configuration file | HW Board Device tree | QEMU tested | HW tested | +|------------|----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|----------------------|-------------|-----------| +| MicroBlaze | [Xilinx ML605 (QEMU)](https://www.digikey.com/en/products/detail/amd-xilinx/EK-V6-ML605-G/2175174) | [ml605-qemu-microblazeel](conf/machine/ml605-qemu-microblazeel.conf) | NA | No | NA | +| Zynq-7000 | NA | NA | NA | | | +| ZynqMP | NA | NA | NA | | | +| Versal | NA | NA | NA | | | +--- +## Dependencies This layer depends on: - URI: git://git.openembedded.org/bitbake - - URI: git://git.openembedded.org/openembedded-core - layers: meta - - URI: git://git.openembedded.org/meta-xilinx + URI: https:///git.yoctoproject.org/poky + layers: meta, meta-poky + branch: langdale + URI: https://git.openembedded.org/meta-openembedded + layers: meta-oe + branch: langdale + URI: + https://git.yoctoproject.org/meta-xilinx (official version) + https://github.com/Xilinx/meta-xilinx (development and amd xilinx release) + layers: meta-xilinx-microblaze, meta-xilinx-core, meta-xilinx-vendor + branch: langdale or amd xilinx release version (e.g. rel-v2023.1) diff --git a/meta-xilinx-contrib/conf/layer.conf b/meta-xilinx-contrib/conf/layer.conf index 41ea5aa0..b065a344 100644 --- a/meta-xilinx-contrib/conf/layer.conf +++ b/meta-xilinx-contrib/conf/layer.conf @@ -2,12 +2,23 @@ BBPATH .= ":${LAYERDIR}" # We have a packages directory, add to BBFILES -BBFILES += "${LAYERDIR}/recipes-*/*/*.bb" -BBFILES += "${LAYERDIR}/recipes-*/*/*.bbappend" +BBFILES += " \ + ${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend \ + " + +BBFILES_DYNAMIC += " \ + xilinx-tools:${LAYERDIR}/dynamic-layers/meta-xilinx-tools/recipes-*/*/*.bb \ + xilinx-tools:${LAYERDIR}/dynamic-layers/meta-xilinx-tools/recipes-*/*/*.bbappend \ + " BBFILE_COLLECTIONS += "xilinx-contrib" BBFILE_PATTERN_xilinx-contrib = "^${LAYERDIR}/" BBFILE_PRIORITY_xilinx-contrib = "5" -LAYERDEPENDS_xilinx-contrib = "core" -LAYERDEPENDS_xilinx-contrib = "xilinx" +LAYERDEPENDS_xilinx-contrib = " \ + core \ + xilinx \ + " + +LAYERSERIES_COMPAT_xilinx-contrib = "scarthgap" diff --git a/meta-xilinx-contrib/conf/machine/ml605-qemu-microblazeel.conf b/meta-xilinx-contrib/conf/machine/ml605-qemu-microblazeel.conf new file mode 100644 index 00000000..157a75c2 --- /dev/null +++ b/meta-xilinx-contrib/conf/machine/ml605-qemu-microblazeel.conf @@ -0,0 +1,20 @@ +#@TYPE: Machine +#@NAME: ml605-qemu-microblazeel +#@DESCRIPTION: MicroBlaze QEMU machine support ('petalogix-ml605' model) + +TUNE_FEATURES:tune-microblaze ?= "microblaze v8.50 barrel-shift reorder pattern-compare divide-hard multiply-high fpu-hard" + +require conf/machine/microblaze-generic.conf + +USE_VT = "" + +# Use the networking setup from qemuarm +MACHINEOVERRIDES:prepend:pn-init-ifupdown = "qemuall:" +FILESOVERRIDES:append:pn-init-ifupdown = ":qemuarm" + +# This machine is a targeting a QEMU model, runqemu setup: +QB_MEM = "-m 256" +QB_MACHINE = "-machine petalogix-ml605" +QB_OPT_APPEND = "-nographic -serial mon:stdio" +QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@" + diff --git a/meta-xilinx-contrib/dynamic-layers/meta-xilinx-tools/recipes-bsp/bitstream/bitstream-extraction_%.bbappend b/meta-xilinx-contrib/dynamic-layers/meta-xilinx-tools/recipes-bsp/bitstream/bitstream-extraction_%.bbappend new file mode 100644 index 00000000..4653c93a --- /dev/null +++ b/meta-xilinx-contrib/dynamic-layers/meta-xilinx-tools/recipes-bsp/bitstream/bitstream-extraction_%.bbappend @@ -0,0 +1,2 @@ +COMPATIBLE_MACHINE:zybo-linux-bd-zynq7 = "^$" + diff --git a/meta-xilinx-contrib/recipes-bsp/bitstream/bitstream-extraction_%.bbappend b/meta-xilinx-contrib/recipes-bsp/bitstream/bitstream-extraction_%.bbappend new file mode 100644 index 00000000..4653c93a --- /dev/null +++ b/meta-xilinx-contrib/recipes-bsp/bitstream/bitstream-extraction_%.bbappend @@ -0,0 +1,2 @@ +COMPATIBLE_MACHINE:zybo-linux-bd-zynq7 = "^$" + diff --git a/meta-xilinx-contrib/recipes-bsp/device-tree/device-tree.bbappend b/meta-xilinx-contrib/recipes-bsp/device-tree/device-tree.bbappend new file mode 100644 index 00000000..57c08620 --- /dev/null +++ b/meta-xilinx-contrib/recipes-bsp/device-tree/device-tree.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +# device tree sources for MiniZed +COMPATIBLE_MACHINE:minized-zynq7 = ".*" +SRC_URI:append:minized-zynq7 = " file://minized-zynq7.dts" + diff --git a/meta-xilinx-contrib/recipes-bsp/device-tree/files/minized-zynq7.dts b/meta-xilinx-contrib/recipes-bsp/device-tree/files/minized-zynq7.dts new file mode 100644 index 00000000..4570fa6e --- /dev/null +++ b/meta-xilinx-contrib/recipes-bsp/device-tree/files/minized-zynq7.dts @@ -0,0 +1,254 @@ +/* +* dts file for MiniZed +* +* Copyright (C) 2018 Clément Laigle <clement.laigle8@gmail.com> +*/ + +/dts-v1/; +/include/ "zynq-7000.dtsi" + + +/ { + model = "Zynq Minized Board"; + compatible = "xlnx,zynq-Minized", "xlnx,zynq-7000"; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + cpus { + cpu@0 { + operating-points = <666666 1000000 333333 1000000>; + }; + }; + + aliases { + serial0 = &uart1; + serial1 = &bluetooth_uart; + spi0 = &qspi; + mmc0 = &sdhci1; + }; + + memory { + device_type = "memory"; + reg = <0 0x20000000>; + }; + + usb_phy0: phy0 { + compatible = "usb-nop-xceiv"; + #phy-cells = <0x0>; + }; + + leds { + compatible = "gpio-leds"; + led-psg { + label = "led-psg"; + gpios = <&gpio0 53 0>; + default-state = "on"; + linux,default-trigger = "heartbeat"; + }; + led-psr { + label = "led-psr"; + gpios = <&gpio0 52 0>; + default-state = "on"; + linux,default-trigger = "heartbeat"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + sw3 { + label = "ps-bp"; + gpios = <&gpio0 0 0>; + linux,code = <108>; /* down */ + gpio-key,wakeup; + autorepeat; + }; + }; + + amba_pl: amba_pl { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges ; + + axi_gpio_0: gpio@41200000 { + #gpio-cells = <2>; + compatible = "xlnx,xps-gpio-1.00.a"; + gpio-controller ; + reg = <0x41200000 0x10000>; + xlnx,all-inputs = <0x0>; + xlnx,all-inputs-2 = <0x0>; + xlnx,all-outputs = <0x1>; + xlnx,all-outputs-2 = <0x1>; + xlnx,dout-default = <0x00000000>; + xlnx,dout-default-2 = <0x00000000>; + xlnx,gpio-width = <0x1>; + xlnx,gpio2-width = <0x1>; + xlnx,interrupt-present = <0x0>; + xlnx,is-dual = <0x1>; + xlnx,tri-default = <0xFFFFFFFF>; + xlnx,tri-default-2 = <0xFFFFFFFF>; + }; + axi_gpio_1: gpio@41210000 { + #gpio-cells = <2>; + compatible = "xlnx,xps-gpio-1.00.a"; + gpio-controller ; + reg = <0x41210000 0x10000>; + xlnx,all-inputs = <0x1>; + xlnx,all-inputs-2 = <0x0>; + xlnx,all-outputs = <0x0>; + xlnx,all-outputs-2 = <0x0>; + xlnx,dout-default = <0x00000000>; + xlnx,dout-default-2 = <0x00000000>; + xlnx,gpio-width = <0x1>; + xlnx,gpio2-width = <0x20>; + xlnx,interrupt-present = <0x0>; + xlnx,is-dual = <0x0>; + xlnx,tri-default = <0xFFFFFFFF>; + xlnx,tri-default-2 = <0xFFFFFFFF>; + }; + axi_iic_0: i2c@41600000 { + #address-cells = <1>; + #size-cells = <0>; + clock-names = "ref_clk"; + clocks = <&clkc 15>; + compatible = "xlnx,xps-iic-2.00.a"; + interrupt-parent = <&intc>; + interrupts = <0 30 4>; + reg = <0x41600000 0x10000>; + }; + bluetooth_uart: serial@43c00000 { + clock-frequency = <0x2dc6c00>; + clock-names = "ref_clk"; + clocks = <&clkc 0>; + compatible = "xlnx,xps-uart16550-2.00.a", "ns16550a"; + current-speed = <115200>; + device_type = "serial"; + interrupt-parent = <&intc>; + interrupts = <0 29 4>; + port-number = <1>; + reg = <0x43c00000 0x10000>; + reg-offset = <0x1000>; + reg-shift = <2>; + xlnx,external-xin-clk-hz = <0x2dc6c00>; + xlnx,external-xin-clk-hz-d = <0x30>; + xlnx,has-external-rclk = <0x0>; + xlnx,has-external-xin = <0x1>; + xlnx,is-a-16550 = <0x1>; + xlnx,s-axi-aclk-freq-hz-d = "100.0"; + xlnx,use-modem-ports = <0x1>; + xlnx,use-user-ports = <0x1>; + }; + }; + + wlreg_on: wlreg-on { + compatible = "regulator-fixed"; + regulator-name = "wlreg_on"; + enable-active-high; + gpio = <&gpio0 56 0>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + startup-delay-us = <100>; + }; +}; + +&gpio0 { + emio-gpio-width = <4>; + gpio-mask-high = <0x0>; + gpio-mask-low = <0x5600>; +}; + +&intc { + num_cpus = <1>; + num_interrupts = <96>; +}; + +&uart1 { + status = "okay"; +}; + +&sdhci0 { + status = "okay"; + bus-width= <4>; + xlnx,has-cd = <0x0>; + xlnx,has-power = <0x0>; + xlnx,has-wp = <0x0>; + non-removeable; + broken-cd; + vmmc-supply = <&wlreg_on>; + + brcmf: brcmf@1 { + status = "okay"; + reg = <1>; + compatible = "brcm,bcm43430-fmac"; + }; +}; + +&sdhci1 { + status = "okay"; + non-removable; + bus-width = <4>; + max-frequency = <12000000>; + + #address-cells = <1>; + #size-cells = <0>; + mmccard: mmccard@0 { + compatible = "mmc-card"; + reg = <0>; + broken-hpi; + }; +}; + +&usb0 { + status = "okay"; + dr_mode = "host"; + usb-reset = <&gpio0 7 0>; + usb-phy = <&usb_phy0>; +}; + +&uart1 { + u-boot,dm-pre-reloc; + status = "okay"; +}; + +&qspi { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <0x3>; + is-dual = <0x0>; + num-cs = <0x1>; + + + flash0: flash@0 { + compatible = "micron,m25p80"; + reg = <0x0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <50000000>; + + partition@0x00000000 { + label = "boot"; + reg = <0x0 0xff0000>; + }; + partition@0x00270000 { + label = "kernel"; + reg = <0x270000 0xd80000>; + }; + partition@0x00ff0000 { + label = "bootenv"; + reg = <0xff0000 0x10000>; + }; + + partition@0x01000000 { + label = "spare"; + reg = <0x1000000 0x0>; + }; + + }; +}; + diff --git a/meta-xilinx-contrib/recipes-bsp/reference-design/zybo-linux-bd.bb b/meta-xilinx-contrib/recipes-bsp/reference-design/zybo-linux-bd.bb index be68918c..b54274e4 100644 --- a/meta-xilinx-contrib/recipes-bsp/reference-design/zybo-linux-bd.bb +++ b/meta-xilinx-contrib/recipes-bsp/reference-design/zybo-linux-bd.bb @@ -26,41 +26,46 @@ S ?= "${WORKDIR}/${MACHINE}" PROVIDES = "virtual/bitstream virtual/xilinx-platform-init" -FILES_${PN}-platform-init += "${PLATFORM_INIT_DIR}/*" +FILES:${PN}-platform-init += "${PLATFORM_INIT_DIR}/*" -FILES_${PN}-bitstream += " \ - download.bit \ +FILES:${PN}-bitstream += " \ + /boot/bitstream \ " PACKAGES = "${PN}-platform-init ${PN}-bitstream" -BITSTREAM ?= "bitstream-${PV}-${PR}.bit" +inherit image-artifact-names + +BITSTREAM_NAME ?= "download" +BITSTREAM_BASE_NAME ?= "${BITSTREAM_NAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}" PACKAGE_ARCH = "${MACHINE_ARCH}" inherit xilinx-platform-init inherit deploy -SYSROOT_DIRS += "${PLATFORM_INIT_DIR}" +SYSROOT_DIRS += "${PLATFORM_INIT_DIR} /boot/bitstream" do_install() { fn=$(unzip -l ${S}/${HDF} | awk '{print $NF}' | grep ".bit$") unzip -o ${S}/${HDF} ${fn} -d ${D} - [ "${fn}" == "download.bit" ] || mv ${D}/${fn} ${D}/download.bit + install -d ${D}/boot/bitstream + mv ${D}/*.bit ${D}/boot/bitstream/${BITSTREAM_BASE_NAME}.bit + ln -s ${BITSTREAM_BASE_NAME}.bit ${D}/boot/bitstream/${BITSTREAM_NAME}-${MACHINE}.bit install -d ${D}${PLATFORM_INIT_DIR} for fn in ${PLATFORM_INIT_FILES}; do unzip -o ${S}/${HDF} ${fn} -d ${D}${PLATFORM_INIT_DIR} done + + } do_deploy () { if [ -e ${D}/download.bit ]; then install -d ${DEPLOYDIR} - install -m 0644 ${D}/download.bit ${DEPLOYDIR}/${BITSTREAM} - ln -sf ${BITSTREAM} ${DEPLOYDIR}/download.bit - # for u-boot 2016.3 with spl load bitstream patch - ln -sf ${BITSTREAM} ${DEPLOYDIR}/bitstream + install -m 0644 ${D}/download.bit ${DEPLOYDIR}/${BITSTREAM_BASE_NAME}.bit + ln -sf ${BITSTREAM_BASE_NAME}.bit ${DEPLOYDIR}/${BITSTREAM_NAME}-${MACHINE}.bit fi } addtask deploy before do_build after do_install diff --git a/meta-xilinx-contrib/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/meta-xilinx-contrib/recipes-kernel/linux-firmware/linux-firmware_%.bbappend new file mode 100644 index 00000000..99793df2 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux-firmware/linux-firmware_%.bbappend @@ -0,0 +1,41 @@ + +SRC_URI:append:minized-zynq7 = " \ + git://github.com/murata-wireless/cyw-fmac-nvram;protocol=git;branch=orga;destsuffix=cyw-fmac-nvram;name=cyw-fmac-nvram;protocol=https \ + git://github.com/murata-wireless/cyw-bt-patch;protocol=git;branch=morty-orga;destsuffix=cyw-bt-patch;name=cyw-bt-patch;protocol=https \ + git://github.com/murata-wireless/cyw-fmac-utils-imx32;protocol=git;branch=orga;destsuffix=cyw-fmac-utils-imx32;name=cyw-fmac-utils-imx32;protocol=https \ +" + +SRCREV_cyw-fmac-nvram = "d12c2ac1b93941eaa03063bb7cb3c1ee1aa1b7d0" +SRCREV_cyw-bt-patch = "9216e0d9f778009b5667d032886dfd49174c4b3a" +SRCREV_cyw-fmac-utils-imx32 = "060688dfe76df98751207c8146268ce7fd80b6ab" +SRCREV_FORMAT = "default+cyw-fmac-nvram+cyw-bt-patch+cyw-fmac-utils-imx32" + +do_install:append:minized-zynq7() { + + install -d ${D}${bindir} + + install -m 0644 ${WORKDIR}/cyw-fmac-nvram/brcmfmac43430-sdio.txt ${D}${nonarch_base_libdir}/firmware/brcm/ + install -m 0644 ${WORKDIR}/cyw-bt-patch/CYW43430A1.1DX.hcd ${D}${nonarch_base_libdir}/firmware/brcm/ + install -m 0644 ${WORKDIR}/cyw-fmac-utils-imx32/wl ${D}${bindir} +} + +PACKAGES:prepend:minized-zynq7 = "\ + ${PN}-bcm43430a1-hcd \ + ${PN}-mfgtest \ +" + +FILES:${PN}-mfgtest:minized-zynq7 = " \ + ${bindir}/wl \ +" + +FILES:${PN}-bcm43430:append:minized-zynq7 = " \ + ${nonarch_base_libdir}/firmware/brcm/ brcmfmac43430-sdio.txt \ +" + +LICENSE:${PN}-bcm43430a1-hcd = "Firmware-cypress" + +FILES:${PN}-bcm43430a1-hcd = " \ + ${nonarch_base_libdir}/firmware/brcm/BCM43430A1.1DX.hcd \ +" + +RDEPENDS:${PN}-bcm43430a1-hcd += "${PN}-cypress-license" diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2017.3/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch index b8ba70ea..660bc218 100644 --- a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2017.3/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch @@ -1,4 +1,4 @@ -From c1bf9e8c50baa237b514715dcb9c8fd367694c93 Mon Sep 17 00:00:00 2001 +From 21cc8144efdaa3cd8dbd7279f87b14fa3432fae4 Mon Sep 17 00:00:00 2001 From: Jason Wu <jason.wu.misc@gmail.com> Date: Sun, 10 Apr 2016 13:14:13 +1000 Subject: [PATCH 1/3] drm: xilinx: Add encoder for Digilent boards @@ -21,7 +21,7 @@ Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> diff --git a/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt b/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt new file mode 100644 -index 0000000000..242b24e482 +index 0000000..242b24e --- /dev/null +++ b/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt @@ -0,0 +1,23 @@ @@ -49,21 +49,24 @@ index 0000000000..242b24e482 + dglnt,edid-i2c = <&i2c1>; + }; diff --git a/drivers/gpu/drm/xilinx/Kconfig b/drivers/gpu/drm/xilinx/Kconfig -index 12b548c2a9..c3e2562e53 100644 +index 57e18a9..d9ecff2 100644 --- a/drivers/gpu/drm/xilinx/Kconfig +++ b/drivers/gpu/drm/xilinx/Kconfig -@@ -57,3 +57,9 @@ config DRM_XILINX_SDI - depends on DRM_XILINX +@@ -33,6 +33,12 @@ config DRM_XILINX_DP_SUB help DRM driver for Xilinx Display Port Subsystem. -+ + +config DRM_DIGILENT_ENCODER + tristate "Digilent VGA/HDMI DRM Encoder Driver" + depends on DRM_XILINX + help + DRM slave encoder for Video-out on Digilent boards. ++ + config DRM_XILINX_DP_SUB_DEBUG_FS + bool "Xilinx DRM DPSUB debugfs" + depends on DEBUG_FS && DRM_XILINX_DP_SUB diff --git a/drivers/gpu/drm/xilinx/Makefile b/drivers/gpu/drm/xilinx/Makefile -index 19bc1541ca..c2717e40ea 100644 +index 19bc154..c2717e40 100644 --- a/drivers/gpu/drm/xilinx/Makefile +++ b/drivers/gpu/drm/xilinx/Makefile @@ -7,6 +7,7 @@ xilinx_drm-y := xilinx_drm_crtc.o xilinx_drm_connector.o xilinx_drm_drv.o \ @@ -76,7 +79,7 @@ index 19bc1541ca..c2717e40ea 100644 obj-$(CONFIG_DRM_XILINX_DP_SUB) += xilinx_drm_dp_sub.o diff --git a/drivers/gpu/drm/xilinx/dglnt_encoder.c b/drivers/gpu/drm/xilinx/dglnt_encoder.c new file mode 100644 -index 0000000000..26a23986f9 +index 0000000..cb9fc7d --- /dev/null +++ b/drivers/gpu/drm/xilinx/dglnt_encoder.c @@ -0,0 +1,217 @@ @@ -177,7 +180,7 @@ index 0000000000..26a23986f9 + + if (dglnt->i2c_present) { + edid = drm_get_edid(connector, dglnt->i2c_bus); -+ drm_mode_connector_update_edid_property(connector, edid); ++ drm_connector_update_edid_property(connector, edid); + if (edid) { + num_modes = drm_add_edid_modes(connector, edid); + kfree(edid); @@ -298,5 +301,5 @@ index 0000000000..26a23986f9 +MODULE_DESCRIPTION("DRM slave encoder for Video-out on Digilent boards"); +MODULE_LICENSE("GPL v2"); -- -2.14.2 +2.7.4 diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2017.3/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch index 9b6229db..9b6229db 100644 --- a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2017.3/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2017.3/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch index a98d84c5..a98d84c5 100644 --- a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2017.3/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0004-minized-wifi-bluetooth.cfg b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0004-minized-wifi-bluetooth.cfg new file mode 100644 index 00000000..f71e53ab --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.1/0004-minized-wifi-bluetooth.cfg @@ -0,0 +1,33 @@ +# +# Bluetooth config +# +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +CONFIG_BT_BCM=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HIDP=y +CONFIG_CFG80211=y +CONFIG_CFG80211_DEFAULT_PS=y +CONFIG_CFG80211_CRDA_SUPPORT=y +CONFIG_BRCMUTIL=y +CONFIG_BRCMFMAC=y +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_SHA256=y + +# +# Regulator config +# +CONFIG_REGMAP_IRQ=y +CONFIG_I2C_XILINX=y +CONFIG_MFD_DA9062=y +CONFIG_REGULATOR_DA9062=y + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch new file mode 100644 index 00000000..660bc218 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch @@ -0,0 +1,305 @@ +From 21cc8144efdaa3cd8dbd7279f87b14fa3432fae4 Mon Sep 17 00:00:00 2001 +From: Jason Wu <jason.wu.misc@gmail.com> +Date: Sun, 10 Apr 2016 13:14:13 +1000 +Subject: [PATCH 1/3] drm: xilinx: Add encoder for Digilent boards + +Add the dglnt_encoder driver that enables DRM support for the VGA and +HDMI output ports found on many Digilent boards. + +Upstream-Status: Pending + +Signed-off-by: Sam Bobrowicz <sbobrowicz@digilentinc.com> +Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> +--- + .../bindings/drm/xilinx/dglnt_encoder.txt | 23 +++ + drivers/gpu/drm/xilinx/Kconfig | 6 + + drivers/gpu/drm/xilinx/Makefile | 1 + + drivers/gpu/drm/xilinx/dglnt_encoder.c | 217 +++++++++++++++++++++ + 4 files changed, 247 insertions(+) + create mode 100644 Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt + create mode 100644 drivers/gpu/drm/xilinx/dglnt_encoder.c + +diff --git a/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt b/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt +new file mode 100644 +index 0000000..242b24e +--- /dev/null ++++ b/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt +@@ -0,0 +1,23 @@ ++Device-Tree bindings for Digilent DRM Encoder Slave ++ ++This driver provides support for VGA and HDMI outputs on Digilent FPGA boards. ++The VGA or HDMI port must be connected to a Xilinx display pipeline via an ++axi2vid IP core. ++ ++Required properties: ++ - compatible: Should be "digilent,drm-encoder". ++ ++Optional properties: ++ - dglnt,edid-i2c: The I2C device connected to the DDC bus on the video ++ connector. This is used to obtain the supported resolutions ++ of an attached monitor. If not defined, then a default ++ set of resolutions is used and the display will initialize ++ to 720p. Note most VGA connectors on Digilent boards do ++ not have the DDC bus routed out. ++ ++Example: ++ ++ encoder_0: digilent_encoder { ++ compatible = "digilent,drm-encoder"; ++ dglnt,edid-i2c = <&i2c1>; ++ }; +diff --git a/drivers/gpu/drm/xilinx/Kconfig b/drivers/gpu/drm/xilinx/Kconfig +index 57e18a9..d9ecff2 100644 +--- a/drivers/gpu/drm/xilinx/Kconfig ++++ b/drivers/gpu/drm/xilinx/Kconfig +@@ -33,6 +33,12 @@ config DRM_XILINX_DP_SUB + help + DRM driver for Xilinx Display Port Subsystem. + ++config DRM_DIGILENT_ENCODER ++ tristate "Digilent VGA/HDMI DRM Encoder Driver" ++ depends on DRM_XILINX ++ help ++ DRM slave encoder for Video-out on Digilent boards. ++ + config DRM_XILINX_DP_SUB_DEBUG_FS + bool "Xilinx DRM DPSUB debugfs" + depends on DEBUG_FS && DRM_XILINX_DP_SUB +diff --git a/drivers/gpu/drm/xilinx/Makefile b/drivers/gpu/drm/xilinx/Makefile +index 19bc154..c2717e40 100644 +--- a/drivers/gpu/drm/xilinx/Makefile ++++ b/drivers/gpu/drm/xilinx/Makefile +@@ -7,6 +7,7 @@ xilinx_drm-y := xilinx_drm_crtc.o xilinx_drm_connector.o xilinx_drm_drv.o \ + xilinx_drm_plane.o + xilinx_drm-y += xilinx_cresample.o xilinx_osd.o xilinx_rgb2yuv.o xilinx_vtc.o + ++obj-$(CONFIG_DRM_DIGILENT_ENCODER) += dglnt_encoder.o + obj-$(CONFIG_DRM_XILINX) += xilinx_drm.o + obj-$(CONFIG_DRM_XILINX_DP) += xilinx_drm_dp.o + obj-$(CONFIG_DRM_XILINX_DP_SUB) += xilinx_drm_dp_sub.o +diff --git a/drivers/gpu/drm/xilinx/dglnt_encoder.c b/drivers/gpu/drm/xilinx/dglnt_encoder.c +new file mode 100644 +index 0000000..cb9fc7d +--- /dev/null ++++ b/drivers/gpu/drm/xilinx/dglnt_encoder.c +@@ -0,0 +1,217 @@ ++/* ++ * dglnt_encoder.c - DRM slave encoder for Video-out on Digilent boards ++ * ++ * Copyright (C) 2015 Digilent ++ * Author: Sam Bobrowicz <sbobrowicz@digilentinc.com> ++ * ++ * Based on udl_encoder.c and udl_connector.c, Copyright (C) 2012 Red Hat. ++ * Also based on xilinx_drm_dp.c, Copyright (C) 2014 Xilinx, Inc. ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include <drm/drmP.h> ++#include <drm/drm_edid.h> ++#include <drm/drm_encoder_slave.h> ++ ++#include <linux/device.h> ++#include <linux/module.h> ++#include <linux/err.h> ++#include <linux/i2c.h> ++#include <linux/of.h> ++#include <linux/of_platform.h> ++#include <linux/platform_device.h> ++ ++#define DGLNT_ENC_MAX_FREQ 150000 ++#define DGLNT_ENC_MAX_H 1920 ++#define DGLNT_ENC_MAX_V 1080 ++#define DGLNT_ENC_PREF_H 1280 ++#define DGLNT_ENC_PREF_V 720 ++ ++struct dglnt_encoder { ++ struct drm_encoder *encoder; ++ struct i2c_adapter *i2c_bus; ++ bool i2c_present; ++}; ++ ++static inline struct dglnt_encoder *to_dglnt_encoder( ++ struct drm_encoder *encoder) ++{ ++ return to_encoder_slave(encoder)->slave_priv; ++} ++ ++static bool dglnt_mode_fixup(struct drm_encoder *encoder, ++ const struct drm_display_mode *mode, ++ struct drm_display_mode *adjusted_mode) ++{ ++ return true; ++} ++ ++static void dglnt_encoder_mode_set(struct drm_encoder *encoder, ++ struct drm_display_mode *mode, ++ struct drm_display_mode *adjusted_mode) ++{ ++} ++ ++static void ++dglnt_encoder_dpms(struct drm_encoder *encoder, int mode) ++{ ++} ++ ++static void dglnt_encoder_save(struct drm_encoder *encoder) ++{ ++} ++ ++static void dglnt_encoder_restore(struct drm_encoder *encoder) ++{ ++} ++ ++static int dglnt_encoder_mode_valid(struct drm_encoder *encoder, ++ struct drm_display_mode *mode) ++{ ++ if (mode && ++ !(mode->flags & ((DRM_MODE_FLAG_INTERLACE | ++ DRM_MODE_FLAG_DBLCLK) | DRM_MODE_FLAG_3D_MASK)) && ++ (mode->clock <= DGLNT_ENC_MAX_FREQ) && ++ (mode->hdisplay <= DGLNT_ENC_MAX_H) && ++ (mode->vdisplay <= DGLNT_ENC_MAX_V)) ++ return MODE_OK; ++ return MODE_BAD; ++} ++ ++static int dglnt_encoder_get_modes(struct drm_encoder *encoder, ++ struct drm_connector *connector) ++{ ++ struct dglnt_encoder *dglnt = to_dglnt_encoder(encoder); ++ struct edid *edid; ++ int num_modes = 0; ++ ++ if (dglnt->i2c_present) { ++ edid = drm_get_edid(connector, dglnt->i2c_bus); ++ drm_connector_update_edid_property(connector, edid); ++ if (edid) { ++ num_modes = drm_add_edid_modes(connector, edid); ++ kfree(edid); ++ } ++ } else { ++ num_modes = drm_add_modes_noedid(connector, DGLNT_ENC_MAX_H, ++ DGLNT_ENC_MAX_V); ++ drm_set_preferred_mode(connector, DGLNT_ENC_PREF_H, ++ DGLNT_ENC_PREF_V); ++ } ++ return num_modes; ++} ++ ++static enum drm_connector_status dglnt_encoder_detect( ++ struct drm_encoder *encoder, ++ struct drm_connector *connector) ++{ ++ struct dglnt_encoder *dglnt = to_dglnt_encoder(encoder); ++ ++ if (dglnt->i2c_present) { ++ if (drm_probe_ddc(dglnt->i2c_bus)) ++ return connector_status_connected; ++ return connector_status_disconnected; ++ } else ++ return connector_status_unknown; ++} ++ ++static struct drm_encoder_slave_funcs dglnt_encoder_slave_funcs = { ++ .dpms = dglnt_encoder_dpms, ++ .save = dglnt_encoder_save, ++ .restore = dglnt_encoder_restore, ++ .mode_fixup = dglnt_mode_fixup, ++ .mode_valid = dglnt_encoder_mode_valid, ++ .mode_set = dglnt_encoder_mode_set, ++ .detect = dglnt_encoder_detect, ++ .get_modes = dglnt_encoder_get_modes, ++}; ++ ++static int dglnt_encoder_encoder_init(struct platform_device *pdev, ++ struct drm_device *dev, ++ struct drm_encoder_slave *encoder) ++{ ++ struct dglnt_encoder *dglnt = platform_get_drvdata(pdev); ++ struct device_node *sub_node; ++ ++ encoder->slave_priv = dglnt; ++ encoder->slave_funcs = &dglnt_encoder_slave_funcs; ++ ++ dglnt->encoder = &encoder->base; ++ ++ /* get i2c adapter for edid */ ++ dglnt->i2c_present = false; ++ sub_node = of_parse_phandle(pdev->dev.of_node, "dglnt,edid-i2c", 0); ++ if (sub_node) { ++ dglnt->i2c_bus = of_find_i2c_adapter_by_node(sub_node); ++ if (!dglnt->i2c_bus) ++ DRM_INFO("failed to get the edid i2c adapter, using default modes\n"); ++ else ++ dglnt->i2c_present = true; ++ of_node_put(sub_node); ++ } ++ ++ return 0; ++} ++ ++static int dglnt_encoder_probe(struct platform_device *pdev) ++{ ++ struct dglnt_encoder *dglnt; ++ ++ dglnt = devm_kzalloc(&pdev->dev, sizeof(*dglnt), GFP_KERNEL); ++ if (!dglnt) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, dglnt); ++ ++ return 0; ++} ++ ++static int dglnt_encoder_remove(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++static const struct of_device_id dglnt_encoder_of_match[] = { ++ { .compatible = "digilent,drm-encoder", }, ++ { /* end of table */ }, ++}; ++MODULE_DEVICE_TABLE(of, dglnt_encoder_of_match); ++ ++static struct drm_platform_encoder_driver dglnt_encoder_driver = { ++ .platform_driver = { ++ .probe = dglnt_encoder_probe, ++ .remove = dglnt_encoder_remove, ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = "dglnt-drm-enc", ++ .of_match_table = dglnt_encoder_of_match, ++ }, ++ }, ++ ++ .encoder_init = dglnt_encoder_encoder_init, ++}; ++ ++static int __init dglnt_encoder_init(void) ++{ ++ return platform_driver_register(&dglnt_encoder_driver.platform_driver); ++} ++ ++static void __exit dglnt_encoder_exit(void) ++{ ++ platform_driver_unregister(&dglnt_encoder_driver.platform_driver); ++} ++ ++module_init(dglnt_encoder_init); ++module_exit(dglnt_encoder_exit); ++ ++MODULE_AUTHOR("Digilent, Inc."); ++MODULE_DESCRIPTION("DRM slave encoder for Video-out on Digilent boards"); ++MODULE_LICENSE("GPL v2"); +-- +2.7.4 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch new file mode 100644 index 00000000..9b6229db --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch @@ -0,0 +1,607 @@ +From 217e3b6f4393926b8dcad841381527ef3fc808c2 Mon Sep 17 00:00:00 2001 +From: Jason Wu <jason.wu.misc@gmail.com> +Date: Sun, 10 Apr 2016 13:16:06 +1000 +Subject: [PATCH 2/3] clk: Add driver for axi_dynclk IP Core + +Add support for the axi_dynclk IP Core available from Digilent. This IP +core dynamically configures the clock resources inside a Xilinx FPGA to +generate a clock with a software programmable frequency. + +Upstream-Status: Pending + +Signed-off-by: Sam Bobrowicz <sbobrowicz@digilentinc.com> +Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> +--- + drivers/clk/Kconfig | 8 + + drivers/clk/Makefile | 1 + + drivers/clk/clk-dglnt-dynclk.c | 547 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 556 insertions(+) + create mode 100644 drivers/clk/clk-dglnt-dynclk.c + +diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig +index dccb111100..7fe65a702b 100644 +--- a/drivers/clk/Kconfig ++++ b/drivers/clk/Kconfig +@@ -148,6 +148,14 @@ config CLK_QORIQ + This adds the clock driver support for Freescale QorIQ platforms + using common clock framework. + ++config COMMON_CLK_DGLNT_DYNCLK ++ tristate "Digilent axi_dynclk Driver" ++ depends on ARCH_ZYNQ || MICROBLAZE ++ help ++ ---help--- ++ Support for the Digilent AXI Dynamic Clock core for Xilinx ++ FPGAs. ++ + config COMMON_CLK_XGENE + bool "Clock driver for APM XGene SoC" + default y +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index 0760449dde..45ce97d053 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o + obj-$(CONFIG_COMMON_CLK_CDCE925) += clk-cdce925.o + obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o + obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o ++obj-$(CONFIG_COMMON_CLK_DGLNT_DYNCLK) += clk-dglnt-dynclk.o + obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o + obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o + obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o +diff --git a/drivers/clk/clk-dglnt-dynclk.c b/drivers/clk/clk-dglnt-dynclk.c +new file mode 100644 +index 0000000000..496ad5fc90 +--- /dev/null ++++ b/drivers/clk/clk-dglnt-dynclk.c +@@ -0,0 +1,547 @@ ++/* ++ * clk-dglnt-dynclk.c - Digilent AXI Dynamic Clock (axi_dynclk) Driver ++ * ++ * Copyright (C) 2015 Digilent ++ * Author: Sam Bobrowicz <sbobrowicz@digilentinc.com> ++ * ++ * Reused code from clk-axi-clkgen.c, Copyright (C) 2012-2013 Analog Devices Inc. ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include <linux/platform_device.h> ++#include <linux/clk-provider.h> ++#include <linux/clk.h> ++#include <linux/slab.h> ++#include <linux/io.h> ++#include <linux/of.h> ++#include <linux/module.h> ++#include <linux/err.h> ++#include <linux/kernel.h> ++ ++#define CLK_BIT_WEDGE 13 ++#define CLK_BIT_NOCOUNT 12 ++ ++/* This value is used to signal an error */ ++#define ERR_CLKCOUNTCALC 0xFFFFFFFF ++#define ERR_CLKDIVIDER (1 << CLK_BIT_WEDGE | 1 << CLK_BIT_NOCOUNT) ++ ++#define DYNCLK_DIV_1_REGMASK 0x1041 ++/* 25 MHz (125 KHz / 5) */ ++#define DYNCLK_DEFAULT_FREQ 125000 ++ ++#define MMCM_FREQ_VCOMIN 600000 ++#define MMCM_FREQ_VCOMAX 1200000 ++#define MMCM_FREQ_PFDMIN 10000 ++#define MMCM_FREQ_PFDMAX 450000 ++#define MMCM_FREQ_OUTMIN 4000 ++#define MMCM_FREQ_OUTMAX 800000 ++#define MMCM_DIV_MAX 106 ++#define MMCM_FB_MIN 2 ++#define MMCM_FB_MAX 64 ++#define MMCM_CLKDIV_MAX 128 ++#define MMCM_CLKDIV_MIN 1 ++ ++#define OFST_DISPLAY_CTRL 0x0 ++#define OFST_DISPLAY_STATUS 0x4 ++#define OFST_DISPLAY_CLK_L 0x8 ++#define OFST_DISPLAY_FB_L 0x0C ++#define OFST_DISPLAY_FB_H_CLK_H 0x10 ++#define OFST_DISPLAY_DIV 0x14 ++#define OFST_DISPLAY_LOCK_L 0x18 ++#define OFST_DISPLAY_FLTR_LOCK_H 0x1C ++ ++static const u64 lock_lookup[64] = { ++ 0b0011000110111110100011111010010000000001, ++ 0b0011000110111110100011111010010000000001, ++ 0b0100001000111110100011111010010000000001, ++ 0b0101101011111110100011111010010000000001, ++ 0b0111001110111110100011111010010000000001, ++ 0b1000110001111110100011111010010000000001, ++ 0b1001110011111110100011111010010000000001, ++ 0b1011010110111110100011111010010000000001, ++ 0b1100111001111110100011111010010000000001, ++ 0b1110011100111110100011111010010000000001, ++ 0b1111111111111000010011111010010000000001, ++ 0b1111111111110011100111111010010000000001, ++ 0b1111111111101110111011111010010000000001, ++ 0b1111111111101011110011111010010000000001, ++ 0b1111111111101000101011111010010000000001, ++ 0b1111111111100111000111111010010000000001, ++ 0b1111111111100011111111111010010000000001, ++ 0b1111111111100010011011111010010000000001, ++ 0b1111111111100000110111111010010000000001, ++ 0b1111111111011111010011111010010000000001, ++ 0b1111111111011101101111111010010000000001, ++ 0b1111111111011100001011111010010000000001, ++ 0b1111111111011010100111111010010000000001, ++ 0b1111111111011001000011111010010000000001, ++ 0b1111111111011001000011111010010000000001, ++ 0b1111111111010111011111111010010000000001, ++ 0b1111111111010101111011111010010000000001, ++ 0b1111111111010101111011111010010000000001, ++ 0b1111111111010100010111111010010000000001, ++ 0b1111111111010100010111111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001 ++}; ++ ++static const u32 filter_lookup_low[64] = { ++ 0b0001011111, ++ 0b0001010111, ++ 0b0001111011, ++ 0b0001011011, ++ 0b0001101011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001001011, ++ 0b0001001011, ++ 0b0001001011, ++ 0b0010110011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011 ++}; ++ ++struct dglnt_dynclk_reg; ++struct dglnt_dynclk_mode; ++struct dglnt_dynclk; ++ ++struct dglnt_dynclk_reg { ++ u32 clk0L; ++ u32 clkFBL; ++ u32 clkFBH_clk0H; ++ u32 divclk; ++ u32 lockL; ++ u32 fltr_lockH; ++}; ++ ++struct dglnt_dynclk_mode { ++ u32 freq; ++ u32 fbmult; ++ u32 clkdiv; ++ u32 maindiv; ++}; ++ ++struct dglnt_dynclk { ++ void __iomem *base; ++ struct clk_hw clk_hw; ++ unsigned long freq; ++}; ++ ++u32 dglnt_dynclk_divider(u32 divide) ++{ ++ u32 output = 0; ++ u32 highTime = 0; ++ u32 lowTime = 0; ++ ++ if ((divide < 1) || (divide > 128)) ++ return ERR_CLKDIVIDER; ++ ++ if (divide == 1) ++ return DYNCLK_DIV_1_REGMASK; ++ ++ highTime = divide / 2; ++ /* if divide is odd */ ++ if (divide & 0x1) { ++ lowTime = highTime + 1; ++ output = 1 << CLK_BIT_WEDGE; ++ } else { ++ lowTime = highTime; ++ } ++ ++ output |= 0x03F & lowTime; ++ output |= 0xFC0 & (highTime << 6); ++ return output; ++} ++ ++u32 dglnt_dynclk_count_calc(u32 divide) ++{ ++ u32 output = 0; ++ u32 divCalc = 0; ++ ++ divCalc = dglnt_dynclk_divider(divide); ++ if (divCalc == ERR_CLKDIVIDER) ++ output = ERR_CLKCOUNTCALC; ++ else ++ output = (0xFFF & divCalc) | ((divCalc << 10) & 0x00C00000); ++ return output; ++} ++ ++ ++int dglnt_dynclk_find_reg(struct dglnt_dynclk_reg *regValues, ++ struct dglnt_dynclk_mode *clkParams) ++{ ++ if ((clkParams->fbmult < 2) || clkParams->fbmult > 64) ++ return -EINVAL; ++ ++ regValues->clk0L = dglnt_dynclk_count_calc(clkParams->clkdiv); ++ if (regValues->clk0L == ERR_CLKCOUNTCALC) ++ return -EINVAL; ++ ++ regValues->clkFBL = dglnt_dynclk_count_calc(clkParams->fbmult); ++ if (regValues->clkFBL == ERR_CLKCOUNTCALC) ++ return -EINVAL; ++ ++ regValues->clkFBH_clk0H = 0; ++ ++ regValues->divclk = dglnt_dynclk_divider(clkParams->maindiv); ++ if (regValues->divclk == ERR_CLKDIVIDER) ++ return -EINVAL; ++ ++ regValues->lockL = (u32)(lock_lookup[clkParams->fbmult - 1] & ++ 0xFFFFFFFF); ++ ++ regValues->fltr_lockH = (u32)((lock_lookup[clkParams->fbmult - 1] >> ++ 32) & 0x000000FF); ++ regValues->fltr_lockH |= ((filter_lookup_low[clkParams->fbmult - 1] << ++ 16) & 0x03FF0000); ++ ++ return 0; ++} ++ ++void dglnt_dynclk_write_reg(struct dglnt_dynclk_reg *regValues, ++ void __iomem *baseaddr) ++{ ++ writel(regValues->clk0L, baseaddr + OFST_DISPLAY_CLK_L); ++ writel(regValues->clkFBL, baseaddr + OFST_DISPLAY_FB_L); ++ writel(regValues->clkFBH_clk0H, baseaddr + OFST_DISPLAY_FB_H_CLK_H); ++ writel(regValues->divclk, baseaddr + OFST_DISPLAY_DIV); ++ writel(regValues->lockL, baseaddr + OFST_DISPLAY_LOCK_L); ++ writel(regValues->fltr_lockH, baseaddr + OFST_DISPLAY_FLTR_LOCK_H); ++} ++ ++u32 dglnt_dynclk_find_mode(u32 freq, u32 parentFreq, ++ struct dglnt_dynclk_mode *bestPick) ++{ ++ u32 bestError = MMCM_FREQ_OUTMAX; ++ u32 curError; ++ u32 curClkMult; ++ u32 curFreq; ++ u32 divVal; ++ u32 curFb, curClkDiv; ++ u32 minFb = 0; ++ u32 maxFb = 0; ++ u32 curDiv = 1; ++ u32 maxDiv; ++ bool freq_found = false; ++ ++ bestPick->freq = 0; ++ if (parentFreq == 0) ++ return 0; ++ ++ /* minimum frequency is actually dictated by VCOmin */ ++ if (freq < MMCM_FREQ_OUTMIN) ++ freq = MMCM_FREQ_OUTMIN; ++ if (freq > MMCM_FREQ_OUTMAX) ++ freq = MMCM_FREQ_OUTMAX; ++ ++ if (parentFreq > MMCM_FREQ_PFDMAX) ++ curDiv = 2; ++ maxDiv = parentFreq / MMCM_FREQ_PFDMIN; ++ if (maxDiv > MMCM_DIV_MAX) ++ maxDiv = MMCM_DIV_MAX; ++ ++ while (curDiv <= maxDiv && !freq_found) { ++ minFb = curDiv * DIV_ROUND_UP(MMCM_FREQ_VCOMIN, parentFreq); ++ maxFb = curDiv * (MMCM_FREQ_VCOMAX / parentFreq); ++ if (maxFb > MMCM_FB_MAX) ++ maxFb = MMCM_FB_MAX; ++ if (minFb < MMCM_FB_MIN) ++ minFb = MMCM_FB_MIN; ++ ++ divVal = curDiv * freq; ++ /* ++ * This multiplier is used to find the best clkDiv value for ++ * each FB value ++ */ ++ curClkMult = ((parentFreq * 1000) + (divVal / 2)) / divVal; ++ ++ curFb = minFb; ++ while (curFb <= maxFb && !freq_found) { ++ curClkDiv = ((curClkMult * curFb) + 500) / 1000; ++ if (curClkDiv > MMCM_CLKDIV_MAX) ++ curClkDiv = MMCM_CLKDIV_MAX; ++ if (curClkDiv < MMCM_CLKDIV_MIN) ++ curClkDiv = MMCM_CLKDIV_MIN; ++ curFreq = (((parentFreq * curFb) / curDiv) / curClkDiv); ++ if (curFreq >= freq) ++ curError = curFreq - freq; ++ else ++ curError = freq - curFreq; ++ if (curError < bestError) { ++ bestError = curError; ++ bestPick->clkdiv = curClkDiv; ++ bestPick->fbmult = curFb; ++ bestPick->maindiv = curDiv; ++ bestPick->freq = curFreq; ++ } ++ if (!curError) ++ freq_found = true; ++ curFb++; ++ } ++ curDiv++; ++ } ++ return bestPick->freq; ++} ++ ++static struct dglnt_dynclk *clk_hw_to_dglnt_dynclk(struct clk_hw *clk_hw) ++{ ++ return container_of(clk_hw, struct dglnt_dynclk, clk_hw); ++} ++ ++ ++static int dglnt_dynclk_enable(struct clk_hw *clk_hw) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ unsigned int clock_state; ++ ++ if (dglnt_dynclk->freq) { ++ writel(1, dglnt_dynclk->base + OFST_DISPLAY_CTRL); ++ do { ++ clock_state = readl(dglnt_dynclk->base + ++ OFST_DISPLAY_STATUS); ++ } while (!clock_state); ++ } ++ return 0; ++} ++ ++static void dglnt_dynclk_disable(struct clk_hw *clk_hw) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ ++ writel(0, dglnt_dynclk->base + OFST_DISPLAY_CTRL); ++} ++ ++static int dglnt_dynclk_set_rate(struct clk_hw *clk_hw, ++ unsigned long rate, unsigned long parent_rate) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ struct dglnt_dynclk_reg clkReg; ++ struct dglnt_dynclk_mode clkMode; ++ ++ if (parent_rate == 0 || rate == 0) ++ return -EINVAL; ++ if (rate == dglnt_dynclk->freq) ++ return 0; ++ ++ /* ++ * Convert from Hz to KHz, then multiply by five to account for ++ * BUFR division ++ */ ++ rate = (rate + 100) / 200; ++ /* convert from Hz to KHz */ ++ parent_rate = (parent_rate + 500) / 1000; ++ if (!dglnt_dynclk_find_mode(rate, parent_rate, &clkMode)) ++ return -EINVAL; ++ ++ /* ++ * Write to the PLL dynamic configuration registers to configure it ++ * with the calculated parameters. ++ */ ++ dglnt_dynclk_find_reg(&clkReg, &clkMode); ++ dglnt_dynclk_write_reg(&clkReg, dglnt_dynclk->base); ++ dglnt_dynclk->freq = clkMode.freq * 200; ++ dglnt_dynclk_disable(clk_hw); ++ dglnt_dynclk_enable(clk_hw); ++ ++ return 0; ++} ++ ++static long dglnt_dynclk_round_rate(struct clk_hw *hw, unsigned long rate, ++ unsigned long *parent_rate) ++{ ++ struct dglnt_dynclk_mode clkMode; ++ ++ dglnt_dynclk_find_mode(((rate + 100) / 200), ++ ((*parent_rate) + 500) / 1000, &clkMode); ++ ++ return (clkMode.freq * 200); ++} ++ ++static unsigned long dglnt_dynclk_recalc_rate(struct clk_hw *clk_hw, ++ unsigned long parent_rate) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ ++ return dglnt_dynclk->freq; ++} ++ ++ ++static const struct clk_ops dglnt_dynclk_ops = { ++ .recalc_rate = dglnt_dynclk_recalc_rate, ++ .round_rate = dglnt_dynclk_round_rate, ++ .set_rate = dglnt_dynclk_set_rate, ++ .enable = dglnt_dynclk_enable, ++ .disable = dglnt_dynclk_disable, ++}; ++ ++static const struct of_device_id dglnt_dynclk_ids[] = { ++ { .compatible = "digilent,axi-dynclk", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, dglnt_dynclk_ids); ++ ++static int dglnt_dynclk_probe(struct platform_device *pdev) ++{ ++ const struct of_device_id *id; ++ struct dglnt_dynclk *dglnt_dynclk; ++ struct clk_init_data init; ++ const char *parent_name; ++ const char *clk_name; ++ struct resource *mem; ++ struct clk *clk; ++ ++ if (!pdev->dev.of_node) ++ return -ENODEV; ++ ++ id = of_match_node(dglnt_dynclk_ids, pdev->dev.of_node); ++ if (!id) ++ return -ENODEV; ++ ++ dglnt_dynclk = devm_kzalloc(&pdev->dev, sizeof(*dglnt_dynclk), ++ GFP_KERNEL); ++ if (!dglnt_dynclk) ++ return -ENOMEM; ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ dglnt_dynclk->base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(dglnt_dynclk->base)) ++ return PTR_ERR(dglnt_dynclk->base); ++ ++ parent_name = of_clk_get_parent_name(pdev->dev.of_node, 0); ++ if (!parent_name) ++ return -EINVAL; ++ ++ clk_name = pdev->dev.of_node->name; ++ of_property_read_string(pdev->dev.of_node, "clock-output-names", ++ &clk_name); ++ ++ init.name = clk_name; ++ init.ops = &dglnt_dynclk_ops; ++ init.flags = 0; ++ init.parent_names = &parent_name; ++ init.num_parents = 1; ++ ++ dglnt_dynclk->freq = 0; ++ dglnt_dynclk_disable(&dglnt_dynclk->clk_hw); ++ ++ dglnt_dynclk->clk_hw.init = &init; ++ clk = devm_clk_register(&pdev->dev, &dglnt_dynclk->clk_hw); ++ if (IS_ERR(clk)) ++ return PTR_ERR(clk); ++ ++ return of_clk_add_provider(pdev->dev.of_node, of_clk_src_simple_get, ++ clk); ++} ++ ++static int dglnt_dynclk_remove(struct platform_device *pdev) ++{ ++ of_clk_del_provider(pdev->dev.of_node); ++ ++ return 0; ++} ++ ++static struct platform_driver dglnt_dynclk_driver = { ++ .driver = { ++ .name = "dglnt-dynclk", ++ .owner = THIS_MODULE, ++ .of_match_table = dglnt_dynclk_ids, ++ }, ++ .probe = dglnt_dynclk_probe, ++ .remove = dglnt_dynclk_remove, ++}; ++module_platform_driver(dglnt_dynclk_driver); ++ ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Sam Bobrowicz <sbobrowicz@digilentinc.com>"); ++MODULE_DESCRIPTION("CCF Driver for Digilent axi_dynclk IP Core"); +-- +2.14.2 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch new file mode 100644 index 00000000..a98d84c5 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch @@ -0,0 +1,54 @@ +From 1a18e2b514ae9e75145597ac509a87f656c976ba Mon Sep 17 00:00:00 2001 +From: Nathan Rossi <nathan@nathanrossi.com> +Date: Mon, 2 May 2016 23:46:42 +1000 +Subject: [PATCH 3/3] drm: xilinx: Fix DPMS transition to on + +Fix the issues where the VTC is reset (losing its timing config). + +Also fix the issue where the plane destroys its DMA descriptors and +marks the DMA channels as inactive but never recreates the descriptors +and never updates the active state when turning DPMS back on. + +Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> +Upstream-Status: Pending [This is a workaround] +--- + drivers/gpu/drm/xilinx/xilinx_drm_crtc.c | 1 - + drivers/gpu/drm/xilinx/xilinx_drm_plane.c | 3 ++- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c b/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c +index 631d35b921..93dbd4b58a 100644 +--- a/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c ++++ b/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c +@@ -88,7 +88,6 @@ static void xilinx_drm_crtc_dpms(struct drm_crtc *base_crtc, int dpms) + default: + if (crtc->vtc) { + xilinx_vtc_disable(crtc->vtc); +- xilinx_vtc_reset(crtc->vtc); + } + if (crtc->cresample) { + xilinx_cresample_disable(crtc->cresample); +diff --git a/drivers/gpu/drm/xilinx/xilinx_drm_plane.c b/drivers/gpu/drm/xilinx/xilinx_drm_plane.c +index 6a248b72d4..d2518a4bdf 100644 +--- a/drivers/gpu/drm/xilinx/xilinx_drm_plane.c ++++ b/drivers/gpu/drm/xilinx/xilinx_drm_plane.c +@@ -140,7 +140,7 @@ void xilinx_drm_plane_commit(struct drm_plane *base_plane) + for (i = 0; i < MAX_NUM_SUB_PLANES; i++) { + struct xilinx_drm_plane_dma *dma = &plane->dma[i]; + +- if (dma->chan && dma->is_active) { ++ if (dma->chan) { + flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; + desc = dmaengine_prep_interleaved_dma(dma->chan, + &dma->xt, +@@ -153,6 +153,7 @@ void xilinx_drm_plane_commit(struct drm_plane *base_plane) + dmaengine_submit(desc); + + dma_async_issue_pending(dma->chan); ++ dma->is_active = true; + } + } + } +-- +2.14.2 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0004-minized-wifi-bluetooth.cfg b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0004-minized-wifi-bluetooth.cfg new file mode 100644 index 00000000..f71e53ab --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2022.2/0004-minized-wifi-bluetooth.cfg @@ -0,0 +1,33 @@ +# +# Bluetooth config +# +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +CONFIG_BT_BCM=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HIDP=y +CONFIG_CFG80211=y +CONFIG_CFG80211_DEFAULT_PS=y +CONFIG_CFG80211_CRDA_SUPPORT=y +CONFIG_BRCMUTIL=y +CONFIG_BRCMFMAC=y +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_SHA256=y + +# +# Regulator config +# +CONFIG_REGMAP_IRQ=y +CONFIG_I2C_XILINX=y +CONFIG_MFD_DA9062=y +CONFIG_REGULATOR_DA9062=y + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch new file mode 100644 index 00000000..660bc218 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch @@ -0,0 +1,305 @@ +From 21cc8144efdaa3cd8dbd7279f87b14fa3432fae4 Mon Sep 17 00:00:00 2001 +From: Jason Wu <jason.wu.misc@gmail.com> +Date: Sun, 10 Apr 2016 13:14:13 +1000 +Subject: [PATCH 1/3] drm: xilinx: Add encoder for Digilent boards + +Add the dglnt_encoder driver that enables DRM support for the VGA and +HDMI output ports found on many Digilent boards. + +Upstream-Status: Pending + +Signed-off-by: Sam Bobrowicz <sbobrowicz@digilentinc.com> +Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> +--- + .../bindings/drm/xilinx/dglnt_encoder.txt | 23 +++ + drivers/gpu/drm/xilinx/Kconfig | 6 + + drivers/gpu/drm/xilinx/Makefile | 1 + + drivers/gpu/drm/xilinx/dglnt_encoder.c | 217 +++++++++++++++++++++ + 4 files changed, 247 insertions(+) + create mode 100644 Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt + create mode 100644 drivers/gpu/drm/xilinx/dglnt_encoder.c + +diff --git a/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt b/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt +new file mode 100644 +index 0000000..242b24e +--- /dev/null ++++ b/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt +@@ -0,0 +1,23 @@ ++Device-Tree bindings for Digilent DRM Encoder Slave ++ ++This driver provides support for VGA and HDMI outputs on Digilent FPGA boards. ++The VGA or HDMI port must be connected to a Xilinx display pipeline via an ++axi2vid IP core. ++ ++Required properties: ++ - compatible: Should be "digilent,drm-encoder". ++ ++Optional properties: ++ - dglnt,edid-i2c: The I2C device connected to the DDC bus on the video ++ connector. This is used to obtain the supported resolutions ++ of an attached monitor. If not defined, then a default ++ set of resolutions is used and the display will initialize ++ to 720p. Note most VGA connectors on Digilent boards do ++ not have the DDC bus routed out. ++ ++Example: ++ ++ encoder_0: digilent_encoder { ++ compatible = "digilent,drm-encoder"; ++ dglnt,edid-i2c = <&i2c1>; ++ }; +diff --git a/drivers/gpu/drm/xilinx/Kconfig b/drivers/gpu/drm/xilinx/Kconfig +index 57e18a9..d9ecff2 100644 +--- a/drivers/gpu/drm/xilinx/Kconfig ++++ b/drivers/gpu/drm/xilinx/Kconfig +@@ -33,6 +33,12 @@ config DRM_XILINX_DP_SUB + help + DRM driver for Xilinx Display Port Subsystem. + ++config DRM_DIGILENT_ENCODER ++ tristate "Digilent VGA/HDMI DRM Encoder Driver" ++ depends on DRM_XILINX ++ help ++ DRM slave encoder for Video-out on Digilent boards. ++ + config DRM_XILINX_DP_SUB_DEBUG_FS + bool "Xilinx DRM DPSUB debugfs" + depends on DEBUG_FS && DRM_XILINX_DP_SUB +diff --git a/drivers/gpu/drm/xilinx/Makefile b/drivers/gpu/drm/xilinx/Makefile +index 19bc154..c2717e40 100644 +--- a/drivers/gpu/drm/xilinx/Makefile ++++ b/drivers/gpu/drm/xilinx/Makefile +@@ -7,6 +7,7 @@ xilinx_drm-y := xilinx_drm_crtc.o xilinx_drm_connector.o xilinx_drm_drv.o \ + xilinx_drm_plane.o + xilinx_drm-y += xilinx_cresample.o xilinx_osd.o xilinx_rgb2yuv.o xilinx_vtc.o + ++obj-$(CONFIG_DRM_DIGILENT_ENCODER) += dglnt_encoder.o + obj-$(CONFIG_DRM_XILINX) += xilinx_drm.o + obj-$(CONFIG_DRM_XILINX_DP) += xilinx_drm_dp.o + obj-$(CONFIG_DRM_XILINX_DP_SUB) += xilinx_drm_dp_sub.o +diff --git a/drivers/gpu/drm/xilinx/dglnt_encoder.c b/drivers/gpu/drm/xilinx/dglnt_encoder.c +new file mode 100644 +index 0000000..cb9fc7d +--- /dev/null ++++ b/drivers/gpu/drm/xilinx/dglnt_encoder.c +@@ -0,0 +1,217 @@ ++/* ++ * dglnt_encoder.c - DRM slave encoder for Video-out on Digilent boards ++ * ++ * Copyright (C) 2015 Digilent ++ * Author: Sam Bobrowicz <sbobrowicz@digilentinc.com> ++ * ++ * Based on udl_encoder.c and udl_connector.c, Copyright (C) 2012 Red Hat. ++ * Also based on xilinx_drm_dp.c, Copyright (C) 2014 Xilinx, Inc. ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include <drm/drmP.h> ++#include <drm/drm_edid.h> ++#include <drm/drm_encoder_slave.h> ++ ++#include <linux/device.h> ++#include <linux/module.h> ++#include <linux/err.h> ++#include <linux/i2c.h> ++#include <linux/of.h> ++#include <linux/of_platform.h> ++#include <linux/platform_device.h> ++ ++#define DGLNT_ENC_MAX_FREQ 150000 ++#define DGLNT_ENC_MAX_H 1920 ++#define DGLNT_ENC_MAX_V 1080 ++#define DGLNT_ENC_PREF_H 1280 ++#define DGLNT_ENC_PREF_V 720 ++ ++struct dglnt_encoder { ++ struct drm_encoder *encoder; ++ struct i2c_adapter *i2c_bus; ++ bool i2c_present; ++}; ++ ++static inline struct dglnt_encoder *to_dglnt_encoder( ++ struct drm_encoder *encoder) ++{ ++ return to_encoder_slave(encoder)->slave_priv; ++} ++ ++static bool dglnt_mode_fixup(struct drm_encoder *encoder, ++ const struct drm_display_mode *mode, ++ struct drm_display_mode *adjusted_mode) ++{ ++ return true; ++} ++ ++static void dglnt_encoder_mode_set(struct drm_encoder *encoder, ++ struct drm_display_mode *mode, ++ struct drm_display_mode *adjusted_mode) ++{ ++} ++ ++static void ++dglnt_encoder_dpms(struct drm_encoder *encoder, int mode) ++{ ++} ++ ++static void dglnt_encoder_save(struct drm_encoder *encoder) ++{ ++} ++ ++static void dglnt_encoder_restore(struct drm_encoder *encoder) ++{ ++} ++ ++static int dglnt_encoder_mode_valid(struct drm_encoder *encoder, ++ struct drm_display_mode *mode) ++{ ++ if (mode && ++ !(mode->flags & ((DRM_MODE_FLAG_INTERLACE | ++ DRM_MODE_FLAG_DBLCLK) | DRM_MODE_FLAG_3D_MASK)) && ++ (mode->clock <= DGLNT_ENC_MAX_FREQ) && ++ (mode->hdisplay <= DGLNT_ENC_MAX_H) && ++ (mode->vdisplay <= DGLNT_ENC_MAX_V)) ++ return MODE_OK; ++ return MODE_BAD; ++} ++ ++static int dglnt_encoder_get_modes(struct drm_encoder *encoder, ++ struct drm_connector *connector) ++{ ++ struct dglnt_encoder *dglnt = to_dglnt_encoder(encoder); ++ struct edid *edid; ++ int num_modes = 0; ++ ++ if (dglnt->i2c_present) { ++ edid = drm_get_edid(connector, dglnt->i2c_bus); ++ drm_connector_update_edid_property(connector, edid); ++ if (edid) { ++ num_modes = drm_add_edid_modes(connector, edid); ++ kfree(edid); ++ } ++ } else { ++ num_modes = drm_add_modes_noedid(connector, DGLNT_ENC_MAX_H, ++ DGLNT_ENC_MAX_V); ++ drm_set_preferred_mode(connector, DGLNT_ENC_PREF_H, ++ DGLNT_ENC_PREF_V); ++ } ++ return num_modes; ++} ++ ++static enum drm_connector_status dglnt_encoder_detect( ++ struct drm_encoder *encoder, ++ struct drm_connector *connector) ++{ ++ struct dglnt_encoder *dglnt = to_dglnt_encoder(encoder); ++ ++ if (dglnt->i2c_present) { ++ if (drm_probe_ddc(dglnt->i2c_bus)) ++ return connector_status_connected; ++ return connector_status_disconnected; ++ } else ++ return connector_status_unknown; ++} ++ ++static struct drm_encoder_slave_funcs dglnt_encoder_slave_funcs = { ++ .dpms = dglnt_encoder_dpms, ++ .save = dglnt_encoder_save, ++ .restore = dglnt_encoder_restore, ++ .mode_fixup = dglnt_mode_fixup, ++ .mode_valid = dglnt_encoder_mode_valid, ++ .mode_set = dglnt_encoder_mode_set, ++ .detect = dglnt_encoder_detect, ++ .get_modes = dglnt_encoder_get_modes, ++}; ++ ++static int dglnt_encoder_encoder_init(struct platform_device *pdev, ++ struct drm_device *dev, ++ struct drm_encoder_slave *encoder) ++{ ++ struct dglnt_encoder *dglnt = platform_get_drvdata(pdev); ++ struct device_node *sub_node; ++ ++ encoder->slave_priv = dglnt; ++ encoder->slave_funcs = &dglnt_encoder_slave_funcs; ++ ++ dglnt->encoder = &encoder->base; ++ ++ /* get i2c adapter for edid */ ++ dglnt->i2c_present = false; ++ sub_node = of_parse_phandle(pdev->dev.of_node, "dglnt,edid-i2c", 0); ++ if (sub_node) { ++ dglnt->i2c_bus = of_find_i2c_adapter_by_node(sub_node); ++ if (!dglnt->i2c_bus) ++ DRM_INFO("failed to get the edid i2c adapter, using default modes\n"); ++ else ++ dglnt->i2c_present = true; ++ of_node_put(sub_node); ++ } ++ ++ return 0; ++} ++ ++static int dglnt_encoder_probe(struct platform_device *pdev) ++{ ++ struct dglnt_encoder *dglnt; ++ ++ dglnt = devm_kzalloc(&pdev->dev, sizeof(*dglnt), GFP_KERNEL); ++ if (!dglnt) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, dglnt); ++ ++ return 0; ++} ++ ++static int dglnt_encoder_remove(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++static const struct of_device_id dglnt_encoder_of_match[] = { ++ { .compatible = "digilent,drm-encoder", }, ++ { /* end of table */ }, ++}; ++MODULE_DEVICE_TABLE(of, dglnt_encoder_of_match); ++ ++static struct drm_platform_encoder_driver dglnt_encoder_driver = { ++ .platform_driver = { ++ .probe = dglnt_encoder_probe, ++ .remove = dglnt_encoder_remove, ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = "dglnt-drm-enc", ++ .of_match_table = dglnt_encoder_of_match, ++ }, ++ }, ++ ++ .encoder_init = dglnt_encoder_encoder_init, ++}; ++ ++static int __init dglnt_encoder_init(void) ++{ ++ return platform_driver_register(&dglnt_encoder_driver.platform_driver); ++} ++ ++static void __exit dglnt_encoder_exit(void) ++{ ++ platform_driver_unregister(&dglnt_encoder_driver.platform_driver); ++} ++ ++module_init(dglnt_encoder_init); ++module_exit(dglnt_encoder_exit); ++ ++MODULE_AUTHOR("Digilent, Inc."); ++MODULE_DESCRIPTION("DRM slave encoder for Video-out on Digilent boards"); ++MODULE_LICENSE("GPL v2"); +-- +2.7.4 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch new file mode 100644 index 00000000..9b6229db --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch @@ -0,0 +1,607 @@ +From 217e3b6f4393926b8dcad841381527ef3fc808c2 Mon Sep 17 00:00:00 2001 +From: Jason Wu <jason.wu.misc@gmail.com> +Date: Sun, 10 Apr 2016 13:16:06 +1000 +Subject: [PATCH 2/3] clk: Add driver for axi_dynclk IP Core + +Add support for the axi_dynclk IP Core available from Digilent. This IP +core dynamically configures the clock resources inside a Xilinx FPGA to +generate a clock with a software programmable frequency. + +Upstream-Status: Pending + +Signed-off-by: Sam Bobrowicz <sbobrowicz@digilentinc.com> +Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> +--- + drivers/clk/Kconfig | 8 + + drivers/clk/Makefile | 1 + + drivers/clk/clk-dglnt-dynclk.c | 547 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 556 insertions(+) + create mode 100644 drivers/clk/clk-dglnt-dynclk.c + +diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig +index dccb111100..7fe65a702b 100644 +--- a/drivers/clk/Kconfig ++++ b/drivers/clk/Kconfig +@@ -148,6 +148,14 @@ config CLK_QORIQ + This adds the clock driver support for Freescale QorIQ platforms + using common clock framework. + ++config COMMON_CLK_DGLNT_DYNCLK ++ tristate "Digilent axi_dynclk Driver" ++ depends on ARCH_ZYNQ || MICROBLAZE ++ help ++ ---help--- ++ Support for the Digilent AXI Dynamic Clock core for Xilinx ++ FPGAs. ++ + config COMMON_CLK_XGENE + bool "Clock driver for APM XGene SoC" + default y +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index 0760449dde..45ce97d053 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o + obj-$(CONFIG_COMMON_CLK_CDCE925) += clk-cdce925.o + obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o + obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o ++obj-$(CONFIG_COMMON_CLK_DGLNT_DYNCLK) += clk-dglnt-dynclk.o + obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o + obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o + obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o +diff --git a/drivers/clk/clk-dglnt-dynclk.c b/drivers/clk/clk-dglnt-dynclk.c +new file mode 100644 +index 0000000000..496ad5fc90 +--- /dev/null ++++ b/drivers/clk/clk-dglnt-dynclk.c +@@ -0,0 +1,547 @@ ++/* ++ * clk-dglnt-dynclk.c - Digilent AXI Dynamic Clock (axi_dynclk) Driver ++ * ++ * Copyright (C) 2015 Digilent ++ * Author: Sam Bobrowicz <sbobrowicz@digilentinc.com> ++ * ++ * Reused code from clk-axi-clkgen.c, Copyright (C) 2012-2013 Analog Devices Inc. ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include <linux/platform_device.h> ++#include <linux/clk-provider.h> ++#include <linux/clk.h> ++#include <linux/slab.h> ++#include <linux/io.h> ++#include <linux/of.h> ++#include <linux/module.h> ++#include <linux/err.h> ++#include <linux/kernel.h> ++ ++#define CLK_BIT_WEDGE 13 ++#define CLK_BIT_NOCOUNT 12 ++ ++/* This value is used to signal an error */ ++#define ERR_CLKCOUNTCALC 0xFFFFFFFF ++#define ERR_CLKDIVIDER (1 << CLK_BIT_WEDGE | 1 << CLK_BIT_NOCOUNT) ++ ++#define DYNCLK_DIV_1_REGMASK 0x1041 ++/* 25 MHz (125 KHz / 5) */ ++#define DYNCLK_DEFAULT_FREQ 125000 ++ ++#define MMCM_FREQ_VCOMIN 600000 ++#define MMCM_FREQ_VCOMAX 1200000 ++#define MMCM_FREQ_PFDMIN 10000 ++#define MMCM_FREQ_PFDMAX 450000 ++#define MMCM_FREQ_OUTMIN 4000 ++#define MMCM_FREQ_OUTMAX 800000 ++#define MMCM_DIV_MAX 106 ++#define MMCM_FB_MIN 2 ++#define MMCM_FB_MAX 64 ++#define MMCM_CLKDIV_MAX 128 ++#define MMCM_CLKDIV_MIN 1 ++ ++#define OFST_DISPLAY_CTRL 0x0 ++#define OFST_DISPLAY_STATUS 0x4 ++#define OFST_DISPLAY_CLK_L 0x8 ++#define OFST_DISPLAY_FB_L 0x0C ++#define OFST_DISPLAY_FB_H_CLK_H 0x10 ++#define OFST_DISPLAY_DIV 0x14 ++#define OFST_DISPLAY_LOCK_L 0x18 ++#define OFST_DISPLAY_FLTR_LOCK_H 0x1C ++ ++static const u64 lock_lookup[64] = { ++ 0b0011000110111110100011111010010000000001, ++ 0b0011000110111110100011111010010000000001, ++ 0b0100001000111110100011111010010000000001, ++ 0b0101101011111110100011111010010000000001, ++ 0b0111001110111110100011111010010000000001, ++ 0b1000110001111110100011111010010000000001, ++ 0b1001110011111110100011111010010000000001, ++ 0b1011010110111110100011111010010000000001, ++ 0b1100111001111110100011111010010000000001, ++ 0b1110011100111110100011111010010000000001, ++ 0b1111111111111000010011111010010000000001, ++ 0b1111111111110011100111111010010000000001, ++ 0b1111111111101110111011111010010000000001, ++ 0b1111111111101011110011111010010000000001, ++ 0b1111111111101000101011111010010000000001, ++ 0b1111111111100111000111111010010000000001, ++ 0b1111111111100011111111111010010000000001, ++ 0b1111111111100010011011111010010000000001, ++ 0b1111111111100000110111111010010000000001, ++ 0b1111111111011111010011111010010000000001, ++ 0b1111111111011101101111111010010000000001, ++ 0b1111111111011100001011111010010000000001, ++ 0b1111111111011010100111111010010000000001, ++ 0b1111111111011001000011111010010000000001, ++ 0b1111111111011001000011111010010000000001, ++ 0b1111111111010111011111111010010000000001, ++ 0b1111111111010101111011111010010000000001, ++ 0b1111111111010101111011111010010000000001, ++ 0b1111111111010100010111111010010000000001, ++ 0b1111111111010100010111111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001 ++}; ++ ++static const u32 filter_lookup_low[64] = { ++ 0b0001011111, ++ 0b0001010111, ++ 0b0001111011, ++ 0b0001011011, ++ 0b0001101011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001001011, ++ 0b0001001011, ++ 0b0001001011, ++ 0b0010110011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011 ++}; ++ ++struct dglnt_dynclk_reg; ++struct dglnt_dynclk_mode; ++struct dglnt_dynclk; ++ ++struct dglnt_dynclk_reg { ++ u32 clk0L; ++ u32 clkFBL; ++ u32 clkFBH_clk0H; ++ u32 divclk; ++ u32 lockL; ++ u32 fltr_lockH; ++}; ++ ++struct dglnt_dynclk_mode { ++ u32 freq; ++ u32 fbmult; ++ u32 clkdiv; ++ u32 maindiv; ++}; ++ ++struct dglnt_dynclk { ++ void __iomem *base; ++ struct clk_hw clk_hw; ++ unsigned long freq; ++}; ++ ++u32 dglnt_dynclk_divider(u32 divide) ++{ ++ u32 output = 0; ++ u32 highTime = 0; ++ u32 lowTime = 0; ++ ++ if ((divide < 1) || (divide > 128)) ++ return ERR_CLKDIVIDER; ++ ++ if (divide == 1) ++ return DYNCLK_DIV_1_REGMASK; ++ ++ highTime = divide / 2; ++ /* if divide is odd */ ++ if (divide & 0x1) { ++ lowTime = highTime + 1; ++ output = 1 << CLK_BIT_WEDGE; ++ } else { ++ lowTime = highTime; ++ } ++ ++ output |= 0x03F & lowTime; ++ output |= 0xFC0 & (highTime << 6); ++ return output; ++} ++ ++u32 dglnt_dynclk_count_calc(u32 divide) ++{ ++ u32 output = 0; ++ u32 divCalc = 0; ++ ++ divCalc = dglnt_dynclk_divider(divide); ++ if (divCalc == ERR_CLKDIVIDER) ++ output = ERR_CLKCOUNTCALC; ++ else ++ output = (0xFFF & divCalc) | ((divCalc << 10) & 0x00C00000); ++ return output; ++} ++ ++ ++int dglnt_dynclk_find_reg(struct dglnt_dynclk_reg *regValues, ++ struct dglnt_dynclk_mode *clkParams) ++{ ++ if ((clkParams->fbmult < 2) || clkParams->fbmult > 64) ++ return -EINVAL; ++ ++ regValues->clk0L = dglnt_dynclk_count_calc(clkParams->clkdiv); ++ if (regValues->clk0L == ERR_CLKCOUNTCALC) ++ return -EINVAL; ++ ++ regValues->clkFBL = dglnt_dynclk_count_calc(clkParams->fbmult); ++ if (regValues->clkFBL == ERR_CLKCOUNTCALC) ++ return -EINVAL; ++ ++ regValues->clkFBH_clk0H = 0; ++ ++ regValues->divclk = dglnt_dynclk_divider(clkParams->maindiv); ++ if (regValues->divclk == ERR_CLKDIVIDER) ++ return -EINVAL; ++ ++ regValues->lockL = (u32)(lock_lookup[clkParams->fbmult - 1] & ++ 0xFFFFFFFF); ++ ++ regValues->fltr_lockH = (u32)((lock_lookup[clkParams->fbmult - 1] >> ++ 32) & 0x000000FF); ++ regValues->fltr_lockH |= ((filter_lookup_low[clkParams->fbmult - 1] << ++ 16) & 0x03FF0000); ++ ++ return 0; ++} ++ ++void dglnt_dynclk_write_reg(struct dglnt_dynclk_reg *regValues, ++ void __iomem *baseaddr) ++{ ++ writel(regValues->clk0L, baseaddr + OFST_DISPLAY_CLK_L); ++ writel(regValues->clkFBL, baseaddr + OFST_DISPLAY_FB_L); ++ writel(regValues->clkFBH_clk0H, baseaddr + OFST_DISPLAY_FB_H_CLK_H); ++ writel(regValues->divclk, baseaddr + OFST_DISPLAY_DIV); ++ writel(regValues->lockL, baseaddr + OFST_DISPLAY_LOCK_L); ++ writel(regValues->fltr_lockH, baseaddr + OFST_DISPLAY_FLTR_LOCK_H); ++} ++ ++u32 dglnt_dynclk_find_mode(u32 freq, u32 parentFreq, ++ struct dglnt_dynclk_mode *bestPick) ++{ ++ u32 bestError = MMCM_FREQ_OUTMAX; ++ u32 curError; ++ u32 curClkMult; ++ u32 curFreq; ++ u32 divVal; ++ u32 curFb, curClkDiv; ++ u32 minFb = 0; ++ u32 maxFb = 0; ++ u32 curDiv = 1; ++ u32 maxDiv; ++ bool freq_found = false; ++ ++ bestPick->freq = 0; ++ if (parentFreq == 0) ++ return 0; ++ ++ /* minimum frequency is actually dictated by VCOmin */ ++ if (freq < MMCM_FREQ_OUTMIN) ++ freq = MMCM_FREQ_OUTMIN; ++ if (freq > MMCM_FREQ_OUTMAX) ++ freq = MMCM_FREQ_OUTMAX; ++ ++ if (parentFreq > MMCM_FREQ_PFDMAX) ++ curDiv = 2; ++ maxDiv = parentFreq / MMCM_FREQ_PFDMIN; ++ if (maxDiv > MMCM_DIV_MAX) ++ maxDiv = MMCM_DIV_MAX; ++ ++ while (curDiv <= maxDiv && !freq_found) { ++ minFb = curDiv * DIV_ROUND_UP(MMCM_FREQ_VCOMIN, parentFreq); ++ maxFb = curDiv * (MMCM_FREQ_VCOMAX / parentFreq); ++ if (maxFb > MMCM_FB_MAX) ++ maxFb = MMCM_FB_MAX; ++ if (minFb < MMCM_FB_MIN) ++ minFb = MMCM_FB_MIN; ++ ++ divVal = curDiv * freq; ++ /* ++ * This multiplier is used to find the best clkDiv value for ++ * each FB value ++ */ ++ curClkMult = ((parentFreq * 1000) + (divVal / 2)) / divVal; ++ ++ curFb = minFb; ++ while (curFb <= maxFb && !freq_found) { ++ curClkDiv = ((curClkMult * curFb) + 500) / 1000; ++ if (curClkDiv > MMCM_CLKDIV_MAX) ++ curClkDiv = MMCM_CLKDIV_MAX; ++ if (curClkDiv < MMCM_CLKDIV_MIN) ++ curClkDiv = MMCM_CLKDIV_MIN; ++ curFreq = (((parentFreq * curFb) / curDiv) / curClkDiv); ++ if (curFreq >= freq) ++ curError = curFreq - freq; ++ else ++ curError = freq - curFreq; ++ if (curError < bestError) { ++ bestError = curError; ++ bestPick->clkdiv = curClkDiv; ++ bestPick->fbmult = curFb; ++ bestPick->maindiv = curDiv; ++ bestPick->freq = curFreq; ++ } ++ if (!curError) ++ freq_found = true; ++ curFb++; ++ } ++ curDiv++; ++ } ++ return bestPick->freq; ++} ++ ++static struct dglnt_dynclk *clk_hw_to_dglnt_dynclk(struct clk_hw *clk_hw) ++{ ++ return container_of(clk_hw, struct dglnt_dynclk, clk_hw); ++} ++ ++ ++static int dglnt_dynclk_enable(struct clk_hw *clk_hw) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ unsigned int clock_state; ++ ++ if (dglnt_dynclk->freq) { ++ writel(1, dglnt_dynclk->base + OFST_DISPLAY_CTRL); ++ do { ++ clock_state = readl(dglnt_dynclk->base + ++ OFST_DISPLAY_STATUS); ++ } while (!clock_state); ++ } ++ return 0; ++} ++ ++static void dglnt_dynclk_disable(struct clk_hw *clk_hw) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ ++ writel(0, dglnt_dynclk->base + OFST_DISPLAY_CTRL); ++} ++ ++static int dglnt_dynclk_set_rate(struct clk_hw *clk_hw, ++ unsigned long rate, unsigned long parent_rate) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ struct dglnt_dynclk_reg clkReg; ++ struct dglnt_dynclk_mode clkMode; ++ ++ if (parent_rate == 0 || rate == 0) ++ return -EINVAL; ++ if (rate == dglnt_dynclk->freq) ++ return 0; ++ ++ /* ++ * Convert from Hz to KHz, then multiply by five to account for ++ * BUFR division ++ */ ++ rate = (rate + 100) / 200; ++ /* convert from Hz to KHz */ ++ parent_rate = (parent_rate + 500) / 1000; ++ if (!dglnt_dynclk_find_mode(rate, parent_rate, &clkMode)) ++ return -EINVAL; ++ ++ /* ++ * Write to the PLL dynamic configuration registers to configure it ++ * with the calculated parameters. ++ */ ++ dglnt_dynclk_find_reg(&clkReg, &clkMode); ++ dglnt_dynclk_write_reg(&clkReg, dglnt_dynclk->base); ++ dglnt_dynclk->freq = clkMode.freq * 200; ++ dglnt_dynclk_disable(clk_hw); ++ dglnt_dynclk_enable(clk_hw); ++ ++ return 0; ++} ++ ++static long dglnt_dynclk_round_rate(struct clk_hw *hw, unsigned long rate, ++ unsigned long *parent_rate) ++{ ++ struct dglnt_dynclk_mode clkMode; ++ ++ dglnt_dynclk_find_mode(((rate + 100) / 200), ++ ((*parent_rate) + 500) / 1000, &clkMode); ++ ++ return (clkMode.freq * 200); ++} ++ ++static unsigned long dglnt_dynclk_recalc_rate(struct clk_hw *clk_hw, ++ unsigned long parent_rate) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ ++ return dglnt_dynclk->freq; ++} ++ ++ ++static const struct clk_ops dglnt_dynclk_ops = { ++ .recalc_rate = dglnt_dynclk_recalc_rate, ++ .round_rate = dglnt_dynclk_round_rate, ++ .set_rate = dglnt_dynclk_set_rate, ++ .enable = dglnt_dynclk_enable, ++ .disable = dglnt_dynclk_disable, ++}; ++ ++static const struct of_device_id dglnt_dynclk_ids[] = { ++ { .compatible = "digilent,axi-dynclk", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, dglnt_dynclk_ids); ++ ++static int dglnt_dynclk_probe(struct platform_device *pdev) ++{ ++ const struct of_device_id *id; ++ struct dglnt_dynclk *dglnt_dynclk; ++ struct clk_init_data init; ++ const char *parent_name; ++ const char *clk_name; ++ struct resource *mem; ++ struct clk *clk; ++ ++ if (!pdev->dev.of_node) ++ return -ENODEV; ++ ++ id = of_match_node(dglnt_dynclk_ids, pdev->dev.of_node); ++ if (!id) ++ return -ENODEV; ++ ++ dglnt_dynclk = devm_kzalloc(&pdev->dev, sizeof(*dglnt_dynclk), ++ GFP_KERNEL); ++ if (!dglnt_dynclk) ++ return -ENOMEM; ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ dglnt_dynclk->base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(dglnt_dynclk->base)) ++ return PTR_ERR(dglnt_dynclk->base); ++ ++ parent_name = of_clk_get_parent_name(pdev->dev.of_node, 0); ++ if (!parent_name) ++ return -EINVAL; ++ ++ clk_name = pdev->dev.of_node->name; ++ of_property_read_string(pdev->dev.of_node, "clock-output-names", ++ &clk_name); ++ ++ init.name = clk_name; ++ init.ops = &dglnt_dynclk_ops; ++ init.flags = 0; ++ init.parent_names = &parent_name; ++ init.num_parents = 1; ++ ++ dglnt_dynclk->freq = 0; ++ dglnt_dynclk_disable(&dglnt_dynclk->clk_hw); ++ ++ dglnt_dynclk->clk_hw.init = &init; ++ clk = devm_clk_register(&pdev->dev, &dglnt_dynclk->clk_hw); ++ if (IS_ERR(clk)) ++ return PTR_ERR(clk); ++ ++ return of_clk_add_provider(pdev->dev.of_node, of_clk_src_simple_get, ++ clk); ++} ++ ++static int dglnt_dynclk_remove(struct platform_device *pdev) ++{ ++ of_clk_del_provider(pdev->dev.of_node); ++ ++ return 0; ++} ++ ++static struct platform_driver dglnt_dynclk_driver = { ++ .driver = { ++ .name = "dglnt-dynclk", ++ .owner = THIS_MODULE, ++ .of_match_table = dglnt_dynclk_ids, ++ }, ++ .probe = dglnt_dynclk_probe, ++ .remove = dglnt_dynclk_remove, ++}; ++module_platform_driver(dglnt_dynclk_driver); ++ ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Sam Bobrowicz <sbobrowicz@digilentinc.com>"); ++MODULE_DESCRIPTION("CCF Driver for Digilent axi_dynclk IP Core"); +-- +2.14.2 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch new file mode 100644 index 00000000..a98d84c5 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch @@ -0,0 +1,54 @@ +From 1a18e2b514ae9e75145597ac509a87f656c976ba Mon Sep 17 00:00:00 2001 +From: Nathan Rossi <nathan@nathanrossi.com> +Date: Mon, 2 May 2016 23:46:42 +1000 +Subject: [PATCH 3/3] drm: xilinx: Fix DPMS transition to on + +Fix the issues where the VTC is reset (losing its timing config). + +Also fix the issue where the plane destroys its DMA descriptors and +marks the DMA channels as inactive but never recreates the descriptors +and never updates the active state when turning DPMS back on. + +Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> +Upstream-Status: Pending [This is a workaround] +--- + drivers/gpu/drm/xilinx/xilinx_drm_crtc.c | 1 - + drivers/gpu/drm/xilinx/xilinx_drm_plane.c | 3 ++- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c b/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c +index 631d35b921..93dbd4b58a 100644 +--- a/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c ++++ b/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c +@@ -88,7 +88,6 @@ static void xilinx_drm_crtc_dpms(struct drm_crtc *base_crtc, int dpms) + default: + if (crtc->vtc) { + xilinx_vtc_disable(crtc->vtc); +- xilinx_vtc_reset(crtc->vtc); + } + if (crtc->cresample) { + xilinx_cresample_disable(crtc->cresample); +diff --git a/drivers/gpu/drm/xilinx/xilinx_drm_plane.c b/drivers/gpu/drm/xilinx/xilinx_drm_plane.c +index 6a248b72d4..d2518a4bdf 100644 +--- a/drivers/gpu/drm/xilinx/xilinx_drm_plane.c ++++ b/drivers/gpu/drm/xilinx/xilinx_drm_plane.c +@@ -140,7 +140,7 @@ void xilinx_drm_plane_commit(struct drm_plane *base_plane) + for (i = 0; i < MAX_NUM_SUB_PLANES; i++) { + struct xilinx_drm_plane_dma *dma = &plane->dma[i]; + +- if (dma->chan && dma->is_active) { ++ if (dma->chan) { + flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; + desc = dmaengine_prep_interleaved_dma(dma->chan, + &dma->xt, +@@ -153,6 +153,7 @@ void xilinx_drm_plane_commit(struct drm_plane *base_plane) + dmaengine_submit(desc); + + dma_async_issue_pending(dma->chan); ++ dma->is_active = true; + } + } + } +-- +2.14.2 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0004-minized-wifi-bluetooth.cfg b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0004-minized-wifi-bluetooth.cfg new file mode 100644 index 00000000..f71e53ab --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.1/0004-minized-wifi-bluetooth.cfg @@ -0,0 +1,33 @@ +# +# Bluetooth config +# +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +CONFIG_BT_BCM=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HIDP=y +CONFIG_CFG80211=y +CONFIG_CFG80211_DEFAULT_PS=y +CONFIG_CFG80211_CRDA_SUPPORT=y +CONFIG_BRCMUTIL=y +CONFIG_BRCMFMAC=y +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_SHA256=y + +# +# Regulator config +# +CONFIG_REGMAP_IRQ=y +CONFIG_I2C_XILINX=y +CONFIG_MFD_DA9062=y +CONFIG_REGULATOR_DA9062=y + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch new file mode 100644 index 00000000..660bc218 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch @@ -0,0 +1,305 @@ +From 21cc8144efdaa3cd8dbd7279f87b14fa3432fae4 Mon Sep 17 00:00:00 2001 +From: Jason Wu <jason.wu.misc@gmail.com> +Date: Sun, 10 Apr 2016 13:14:13 +1000 +Subject: [PATCH 1/3] drm: xilinx: Add encoder for Digilent boards + +Add the dglnt_encoder driver that enables DRM support for the VGA and +HDMI output ports found on many Digilent boards. + +Upstream-Status: Pending + +Signed-off-by: Sam Bobrowicz <sbobrowicz@digilentinc.com> +Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> +--- + .../bindings/drm/xilinx/dglnt_encoder.txt | 23 +++ + drivers/gpu/drm/xilinx/Kconfig | 6 + + drivers/gpu/drm/xilinx/Makefile | 1 + + drivers/gpu/drm/xilinx/dglnt_encoder.c | 217 +++++++++++++++++++++ + 4 files changed, 247 insertions(+) + create mode 100644 Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt + create mode 100644 drivers/gpu/drm/xilinx/dglnt_encoder.c + +diff --git a/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt b/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt +new file mode 100644 +index 0000000..242b24e +--- /dev/null ++++ b/Documentation/devicetree/bindings/drm/xilinx/dglnt_encoder.txt +@@ -0,0 +1,23 @@ ++Device-Tree bindings for Digilent DRM Encoder Slave ++ ++This driver provides support for VGA and HDMI outputs on Digilent FPGA boards. ++The VGA or HDMI port must be connected to a Xilinx display pipeline via an ++axi2vid IP core. ++ ++Required properties: ++ - compatible: Should be "digilent,drm-encoder". ++ ++Optional properties: ++ - dglnt,edid-i2c: The I2C device connected to the DDC bus on the video ++ connector. This is used to obtain the supported resolutions ++ of an attached monitor. If not defined, then a default ++ set of resolutions is used and the display will initialize ++ to 720p. Note most VGA connectors on Digilent boards do ++ not have the DDC bus routed out. ++ ++Example: ++ ++ encoder_0: digilent_encoder { ++ compatible = "digilent,drm-encoder"; ++ dglnt,edid-i2c = <&i2c1>; ++ }; +diff --git a/drivers/gpu/drm/xilinx/Kconfig b/drivers/gpu/drm/xilinx/Kconfig +index 57e18a9..d9ecff2 100644 +--- a/drivers/gpu/drm/xilinx/Kconfig ++++ b/drivers/gpu/drm/xilinx/Kconfig +@@ -33,6 +33,12 @@ config DRM_XILINX_DP_SUB + help + DRM driver for Xilinx Display Port Subsystem. + ++config DRM_DIGILENT_ENCODER ++ tristate "Digilent VGA/HDMI DRM Encoder Driver" ++ depends on DRM_XILINX ++ help ++ DRM slave encoder for Video-out on Digilent boards. ++ + config DRM_XILINX_DP_SUB_DEBUG_FS + bool "Xilinx DRM DPSUB debugfs" + depends on DEBUG_FS && DRM_XILINX_DP_SUB +diff --git a/drivers/gpu/drm/xilinx/Makefile b/drivers/gpu/drm/xilinx/Makefile +index 19bc154..c2717e40 100644 +--- a/drivers/gpu/drm/xilinx/Makefile ++++ b/drivers/gpu/drm/xilinx/Makefile +@@ -7,6 +7,7 @@ xilinx_drm-y := xilinx_drm_crtc.o xilinx_drm_connector.o xilinx_drm_drv.o \ + xilinx_drm_plane.o + xilinx_drm-y += xilinx_cresample.o xilinx_osd.o xilinx_rgb2yuv.o xilinx_vtc.o + ++obj-$(CONFIG_DRM_DIGILENT_ENCODER) += dglnt_encoder.o + obj-$(CONFIG_DRM_XILINX) += xilinx_drm.o + obj-$(CONFIG_DRM_XILINX_DP) += xilinx_drm_dp.o + obj-$(CONFIG_DRM_XILINX_DP_SUB) += xilinx_drm_dp_sub.o +diff --git a/drivers/gpu/drm/xilinx/dglnt_encoder.c b/drivers/gpu/drm/xilinx/dglnt_encoder.c +new file mode 100644 +index 0000000..cb9fc7d +--- /dev/null ++++ b/drivers/gpu/drm/xilinx/dglnt_encoder.c +@@ -0,0 +1,217 @@ ++/* ++ * dglnt_encoder.c - DRM slave encoder for Video-out on Digilent boards ++ * ++ * Copyright (C) 2015 Digilent ++ * Author: Sam Bobrowicz <sbobrowicz@digilentinc.com> ++ * ++ * Based on udl_encoder.c and udl_connector.c, Copyright (C) 2012 Red Hat. ++ * Also based on xilinx_drm_dp.c, Copyright (C) 2014 Xilinx, Inc. ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include <drm/drmP.h> ++#include <drm/drm_edid.h> ++#include <drm/drm_encoder_slave.h> ++ ++#include <linux/device.h> ++#include <linux/module.h> ++#include <linux/err.h> ++#include <linux/i2c.h> ++#include <linux/of.h> ++#include <linux/of_platform.h> ++#include <linux/platform_device.h> ++ ++#define DGLNT_ENC_MAX_FREQ 150000 ++#define DGLNT_ENC_MAX_H 1920 ++#define DGLNT_ENC_MAX_V 1080 ++#define DGLNT_ENC_PREF_H 1280 ++#define DGLNT_ENC_PREF_V 720 ++ ++struct dglnt_encoder { ++ struct drm_encoder *encoder; ++ struct i2c_adapter *i2c_bus; ++ bool i2c_present; ++}; ++ ++static inline struct dglnt_encoder *to_dglnt_encoder( ++ struct drm_encoder *encoder) ++{ ++ return to_encoder_slave(encoder)->slave_priv; ++} ++ ++static bool dglnt_mode_fixup(struct drm_encoder *encoder, ++ const struct drm_display_mode *mode, ++ struct drm_display_mode *adjusted_mode) ++{ ++ return true; ++} ++ ++static void dglnt_encoder_mode_set(struct drm_encoder *encoder, ++ struct drm_display_mode *mode, ++ struct drm_display_mode *adjusted_mode) ++{ ++} ++ ++static void ++dglnt_encoder_dpms(struct drm_encoder *encoder, int mode) ++{ ++} ++ ++static void dglnt_encoder_save(struct drm_encoder *encoder) ++{ ++} ++ ++static void dglnt_encoder_restore(struct drm_encoder *encoder) ++{ ++} ++ ++static int dglnt_encoder_mode_valid(struct drm_encoder *encoder, ++ struct drm_display_mode *mode) ++{ ++ if (mode && ++ !(mode->flags & ((DRM_MODE_FLAG_INTERLACE | ++ DRM_MODE_FLAG_DBLCLK) | DRM_MODE_FLAG_3D_MASK)) && ++ (mode->clock <= DGLNT_ENC_MAX_FREQ) && ++ (mode->hdisplay <= DGLNT_ENC_MAX_H) && ++ (mode->vdisplay <= DGLNT_ENC_MAX_V)) ++ return MODE_OK; ++ return MODE_BAD; ++} ++ ++static int dglnt_encoder_get_modes(struct drm_encoder *encoder, ++ struct drm_connector *connector) ++{ ++ struct dglnt_encoder *dglnt = to_dglnt_encoder(encoder); ++ struct edid *edid; ++ int num_modes = 0; ++ ++ if (dglnt->i2c_present) { ++ edid = drm_get_edid(connector, dglnt->i2c_bus); ++ drm_connector_update_edid_property(connector, edid); ++ if (edid) { ++ num_modes = drm_add_edid_modes(connector, edid); ++ kfree(edid); ++ } ++ } else { ++ num_modes = drm_add_modes_noedid(connector, DGLNT_ENC_MAX_H, ++ DGLNT_ENC_MAX_V); ++ drm_set_preferred_mode(connector, DGLNT_ENC_PREF_H, ++ DGLNT_ENC_PREF_V); ++ } ++ return num_modes; ++} ++ ++static enum drm_connector_status dglnt_encoder_detect( ++ struct drm_encoder *encoder, ++ struct drm_connector *connector) ++{ ++ struct dglnt_encoder *dglnt = to_dglnt_encoder(encoder); ++ ++ if (dglnt->i2c_present) { ++ if (drm_probe_ddc(dglnt->i2c_bus)) ++ return connector_status_connected; ++ return connector_status_disconnected; ++ } else ++ return connector_status_unknown; ++} ++ ++static struct drm_encoder_slave_funcs dglnt_encoder_slave_funcs = { ++ .dpms = dglnt_encoder_dpms, ++ .save = dglnt_encoder_save, ++ .restore = dglnt_encoder_restore, ++ .mode_fixup = dglnt_mode_fixup, ++ .mode_valid = dglnt_encoder_mode_valid, ++ .mode_set = dglnt_encoder_mode_set, ++ .detect = dglnt_encoder_detect, ++ .get_modes = dglnt_encoder_get_modes, ++}; ++ ++static int dglnt_encoder_encoder_init(struct platform_device *pdev, ++ struct drm_device *dev, ++ struct drm_encoder_slave *encoder) ++{ ++ struct dglnt_encoder *dglnt = platform_get_drvdata(pdev); ++ struct device_node *sub_node; ++ ++ encoder->slave_priv = dglnt; ++ encoder->slave_funcs = &dglnt_encoder_slave_funcs; ++ ++ dglnt->encoder = &encoder->base; ++ ++ /* get i2c adapter for edid */ ++ dglnt->i2c_present = false; ++ sub_node = of_parse_phandle(pdev->dev.of_node, "dglnt,edid-i2c", 0); ++ if (sub_node) { ++ dglnt->i2c_bus = of_find_i2c_adapter_by_node(sub_node); ++ if (!dglnt->i2c_bus) ++ DRM_INFO("failed to get the edid i2c adapter, using default modes\n"); ++ else ++ dglnt->i2c_present = true; ++ of_node_put(sub_node); ++ } ++ ++ return 0; ++} ++ ++static int dglnt_encoder_probe(struct platform_device *pdev) ++{ ++ struct dglnt_encoder *dglnt; ++ ++ dglnt = devm_kzalloc(&pdev->dev, sizeof(*dglnt), GFP_KERNEL); ++ if (!dglnt) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, dglnt); ++ ++ return 0; ++} ++ ++static int dglnt_encoder_remove(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++static const struct of_device_id dglnt_encoder_of_match[] = { ++ { .compatible = "digilent,drm-encoder", }, ++ { /* end of table */ }, ++}; ++MODULE_DEVICE_TABLE(of, dglnt_encoder_of_match); ++ ++static struct drm_platform_encoder_driver dglnt_encoder_driver = { ++ .platform_driver = { ++ .probe = dglnt_encoder_probe, ++ .remove = dglnt_encoder_remove, ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = "dglnt-drm-enc", ++ .of_match_table = dglnt_encoder_of_match, ++ }, ++ }, ++ ++ .encoder_init = dglnt_encoder_encoder_init, ++}; ++ ++static int __init dglnt_encoder_init(void) ++{ ++ return platform_driver_register(&dglnt_encoder_driver.platform_driver); ++} ++ ++static void __exit dglnt_encoder_exit(void) ++{ ++ platform_driver_unregister(&dglnt_encoder_driver.platform_driver); ++} ++ ++module_init(dglnt_encoder_init); ++module_exit(dglnt_encoder_exit); ++ ++MODULE_AUTHOR("Digilent, Inc."); ++MODULE_DESCRIPTION("DRM slave encoder for Video-out on Digilent boards"); ++MODULE_LICENSE("GPL v2"); +-- +2.7.4 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch new file mode 100644 index 00000000..9b6229db --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch @@ -0,0 +1,607 @@ +From 217e3b6f4393926b8dcad841381527ef3fc808c2 Mon Sep 17 00:00:00 2001 +From: Jason Wu <jason.wu.misc@gmail.com> +Date: Sun, 10 Apr 2016 13:16:06 +1000 +Subject: [PATCH 2/3] clk: Add driver for axi_dynclk IP Core + +Add support for the axi_dynclk IP Core available from Digilent. This IP +core dynamically configures the clock resources inside a Xilinx FPGA to +generate a clock with a software programmable frequency. + +Upstream-Status: Pending + +Signed-off-by: Sam Bobrowicz <sbobrowicz@digilentinc.com> +Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> +--- + drivers/clk/Kconfig | 8 + + drivers/clk/Makefile | 1 + + drivers/clk/clk-dglnt-dynclk.c | 547 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 556 insertions(+) + create mode 100644 drivers/clk/clk-dglnt-dynclk.c + +diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig +index dccb111100..7fe65a702b 100644 +--- a/drivers/clk/Kconfig ++++ b/drivers/clk/Kconfig +@@ -148,6 +148,14 @@ config CLK_QORIQ + This adds the clock driver support for Freescale QorIQ platforms + using common clock framework. + ++config COMMON_CLK_DGLNT_DYNCLK ++ tristate "Digilent axi_dynclk Driver" ++ depends on ARCH_ZYNQ || MICROBLAZE ++ help ++ ---help--- ++ Support for the Digilent AXI Dynamic Clock core for Xilinx ++ FPGAs. ++ + config COMMON_CLK_XGENE + bool "Clock driver for APM XGene SoC" + default y +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index 0760449dde..45ce97d053 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o + obj-$(CONFIG_COMMON_CLK_CDCE925) += clk-cdce925.o + obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o + obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o ++obj-$(CONFIG_COMMON_CLK_DGLNT_DYNCLK) += clk-dglnt-dynclk.o + obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o + obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o + obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o +diff --git a/drivers/clk/clk-dglnt-dynclk.c b/drivers/clk/clk-dglnt-dynclk.c +new file mode 100644 +index 0000000000..496ad5fc90 +--- /dev/null ++++ b/drivers/clk/clk-dglnt-dynclk.c +@@ -0,0 +1,547 @@ ++/* ++ * clk-dglnt-dynclk.c - Digilent AXI Dynamic Clock (axi_dynclk) Driver ++ * ++ * Copyright (C) 2015 Digilent ++ * Author: Sam Bobrowicz <sbobrowicz@digilentinc.com> ++ * ++ * Reused code from clk-axi-clkgen.c, Copyright (C) 2012-2013 Analog Devices Inc. ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include <linux/platform_device.h> ++#include <linux/clk-provider.h> ++#include <linux/clk.h> ++#include <linux/slab.h> ++#include <linux/io.h> ++#include <linux/of.h> ++#include <linux/module.h> ++#include <linux/err.h> ++#include <linux/kernel.h> ++ ++#define CLK_BIT_WEDGE 13 ++#define CLK_BIT_NOCOUNT 12 ++ ++/* This value is used to signal an error */ ++#define ERR_CLKCOUNTCALC 0xFFFFFFFF ++#define ERR_CLKDIVIDER (1 << CLK_BIT_WEDGE | 1 << CLK_BIT_NOCOUNT) ++ ++#define DYNCLK_DIV_1_REGMASK 0x1041 ++/* 25 MHz (125 KHz / 5) */ ++#define DYNCLK_DEFAULT_FREQ 125000 ++ ++#define MMCM_FREQ_VCOMIN 600000 ++#define MMCM_FREQ_VCOMAX 1200000 ++#define MMCM_FREQ_PFDMIN 10000 ++#define MMCM_FREQ_PFDMAX 450000 ++#define MMCM_FREQ_OUTMIN 4000 ++#define MMCM_FREQ_OUTMAX 800000 ++#define MMCM_DIV_MAX 106 ++#define MMCM_FB_MIN 2 ++#define MMCM_FB_MAX 64 ++#define MMCM_CLKDIV_MAX 128 ++#define MMCM_CLKDIV_MIN 1 ++ ++#define OFST_DISPLAY_CTRL 0x0 ++#define OFST_DISPLAY_STATUS 0x4 ++#define OFST_DISPLAY_CLK_L 0x8 ++#define OFST_DISPLAY_FB_L 0x0C ++#define OFST_DISPLAY_FB_H_CLK_H 0x10 ++#define OFST_DISPLAY_DIV 0x14 ++#define OFST_DISPLAY_LOCK_L 0x18 ++#define OFST_DISPLAY_FLTR_LOCK_H 0x1C ++ ++static const u64 lock_lookup[64] = { ++ 0b0011000110111110100011111010010000000001, ++ 0b0011000110111110100011111010010000000001, ++ 0b0100001000111110100011111010010000000001, ++ 0b0101101011111110100011111010010000000001, ++ 0b0111001110111110100011111010010000000001, ++ 0b1000110001111110100011111010010000000001, ++ 0b1001110011111110100011111010010000000001, ++ 0b1011010110111110100011111010010000000001, ++ 0b1100111001111110100011111010010000000001, ++ 0b1110011100111110100011111010010000000001, ++ 0b1111111111111000010011111010010000000001, ++ 0b1111111111110011100111111010010000000001, ++ 0b1111111111101110111011111010010000000001, ++ 0b1111111111101011110011111010010000000001, ++ 0b1111111111101000101011111010010000000001, ++ 0b1111111111100111000111111010010000000001, ++ 0b1111111111100011111111111010010000000001, ++ 0b1111111111100010011011111010010000000001, ++ 0b1111111111100000110111111010010000000001, ++ 0b1111111111011111010011111010010000000001, ++ 0b1111111111011101101111111010010000000001, ++ 0b1111111111011100001011111010010000000001, ++ 0b1111111111011010100111111010010000000001, ++ 0b1111111111011001000011111010010000000001, ++ 0b1111111111011001000011111010010000000001, ++ 0b1111111111010111011111111010010000000001, ++ 0b1111111111010101111011111010010000000001, ++ 0b1111111111010101111011111010010000000001, ++ 0b1111111111010100010111111010010000000001, ++ 0b1111111111010100010111111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010010110011111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111010001001111111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001, ++ 0b1111111111001111101011111010010000000001 ++}; ++ ++static const u32 filter_lookup_low[64] = { ++ 0b0001011111, ++ 0b0001010111, ++ 0b0001111011, ++ 0b0001011011, ++ 0b0001101011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001110011, ++ 0b0001001011, ++ 0b0001001011, ++ 0b0001001011, ++ 0b0010110011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001010011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0001100011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010010011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011, ++ 0b0010100011 ++}; ++ ++struct dglnt_dynclk_reg; ++struct dglnt_dynclk_mode; ++struct dglnt_dynclk; ++ ++struct dglnt_dynclk_reg { ++ u32 clk0L; ++ u32 clkFBL; ++ u32 clkFBH_clk0H; ++ u32 divclk; ++ u32 lockL; ++ u32 fltr_lockH; ++}; ++ ++struct dglnt_dynclk_mode { ++ u32 freq; ++ u32 fbmult; ++ u32 clkdiv; ++ u32 maindiv; ++}; ++ ++struct dglnt_dynclk { ++ void __iomem *base; ++ struct clk_hw clk_hw; ++ unsigned long freq; ++}; ++ ++u32 dglnt_dynclk_divider(u32 divide) ++{ ++ u32 output = 0; ++ u32 highTime = 0; ++ u32 lowTime = 0; ++ ++ if ((divide < 1) || (divide > 128)) ++ return ERR_CLKDIVIDER; ++ ++ if (divide == 1) ++ return DYNCLK_DIV_1_REGMASK; ++ ++ highTime = divide / 2; ++ /* if divide is odd */ ++ if (divide & 0x1) { ++ lowTime = highTime + 1; ++ output = 1 << CLK_BIT_WEDGE; ++ } else { ++ lowTime = highTime; ++ } ++ ++ output |= 0x03F & lowTime; ++ output |= 0xFC0 & (highTime << 6); ++ return output; ++} ++ ++u32 dglnt_dynclk_count_calc(u32 divide) ++{ ++ u32 output = 0; ++ u32 divCalc = 0; ++ ++ divCalc = dglnt_dynclk_divider(divide); ++ if (divCalc == ERR_CLKDIVIDER) ++ output = ERR_CLKCOUNTCALC; ++ else ++ output = (0xFFF & divCalc) | ((divCalc << 10) & 0x00C00000); ++ return output; ++} ++ ++ ++int dglnt_dynclk_find_reg(struct dglnt_dynclk_reg *regValues, ++ struct dglnt_dynclk_mode *clkParams) ++{ ++ if ((clkParams->fbmult < 2) || clkParams->fbmult > 64) ++ return -EINVAL; ++ ++ regValues->clk0L = dglnt_dynclk_count_calc(clkParams->clkdiv); ++ if (regValues->clk0L == ERR_CLKCOUNTCALC) ++ return -EINVAL; ++ ++ regValues->clkFBL = dglnt_dynclk_count_calc(clkParams->fbmult); ++ if (regValues->clkFBL == ERR_CLKCOUNTCALC) ++ return -EINVAL; ++ ++ regValues->clkFBH_clk0H = 0; ++ ++ regValues->divclk = dglnt_dynclk_divider(clkParams->maindiv); ++ if (regValues->divclk == ERR_CLKDIVIDER) ++ return -EINVAL; ++ ++ regValues->lockL = (u32)(lock_lookup[clkParams->fbmult - 1] & ++ 0xFFFFFFFF); ++ ++ regValues->fltr_lockH = (u32)((lock_lookup[clkParams->fbmult - 1] >> ++ 32) & 0x000000FF); ++ regValues->fltr_lockH |= ((filter_lookup_low[clkParams->fbmult - 1] << ++ 16) & 0x03FF0000); ++ ++ return 0; ++} ++ ++void dglnt_dynclk_write_reg(struct dglnt_dynclk_reg *regValues, ++ void __iomem *baseaddr) ++{ ++ writel(regValues->clk0L, baseaddr + OFST_DISPLAY_CLK_L); ++ writel(regValues->clkFBL, baseaddr + OFST_DISPLAY_FB_L); ++ writel(regValues->clkFBH_clk0H, baseaddr + OFST_DISPLAY_FB_H_CLK_H); ++ writel(regValues->divclk, baseaddr + OFST_DISPLAY_DIV); ++ writel(regValues->lockL, baseaddr + OFST_DISPLAY_LOCK_L); ++ writel(regValues->fltr_lockH, baseaddr + OFST_DISPLAY_FLTR_LOCK_H); ++} ++ ++u32 dglnt_dynclk_find_mode(u32 freq, u32 parentFreq, ++ struct dglnt_dynclk_mode *bestPick) ++{ ++ u32 bestError = MMCM_FREQ_OUTMAX; ++ u32 curError; ++ u32 curClkMult; ++ u32 curFreq; ++ u32 divVal; ++ u32 curFb, curClkDiv; ++ u32 minFb = 0; ++ u32 maxFb = 0; ++ u32 curDiv = 1; ++ u32 maxDiv; ++ bool freq_found = false; ++ ++ bestPick->freq = 0; ++ if (parentFreq == 0) ++ return 0; ++ ++ /* minimum frequency is actually dictated by VCOmin */ ++ if (freq < MMCM_FREQ_OUTMIN) ++ freq = MMCM_FREQ_OUTMIN; ++ if (freq > MMCM_FREQ_OUTMAX) ++ freq = MMCM_FREQ_OUTMAX; ++ ++ if (parentFreq > MMCM_FREQ_PFDMAX) ++ curDiv = 2; ++ maxDiv = parentFreq / MMCM_FREQ_PFDMIN; ++ if (maxDiv > MMCM_DIV_MAX) ++ maxDiv = MMCM_DIV_MAX; ++ ++ while (curDiv <= maxDiv && !freq_found) { ++ minFb = curDiv * DIV_ROUND_UP(MMCM_FREQ_VCOMIN, parentFreq); ++ maxFb = curDiv * (MMCM_FREQ_VCOMAX / parentFreq); ++ if (maxFb > MMCM_FB_MAX) ++ maxFb = MMCM_FB_MAX; ++ if (minFb < MMCM_FB_MIN) ++ minFb = MMCM_FB_MIN; ++ ++ divVal = curDiv * freq; ++ /* ++ * This multiplier is used to find the best clkDiv value for ++ * each FB value ++ */ ++ curClkMult = ((parentFreq * 1000) + (divVal / 2)) / divVal; ++ ++ curFb = minFb; ++ while (curFb <= maxFb && !freq_found) { ++ curClkDiv = ((curClkMult * curFb) + 500) / 1000; ++ if (curClkDiv > MMCM_CLKDIV_MAX) ++ curClkDiv = MMCM_CLKDIV_MAX; ++ if (curClkDiv < MMCM_CLKDIV_MIN) ++ curClkDiv = MMCM_CLKDIV_MIN; ++ curFreq = (((parentFreq * curFb) / curDiv) / curClkDiv); ++ if (curFreq >= freq) ++ curError = curFreq - freq; ++ else ++ curError = freq - curFreq; ++ if (curError < bestError) { ++ bestError = curError; ++ bestPick->clkdiv = curClkDiv; ++ bestPick->fbmult = curFb; ++ bestPick->maindiv = curDiv; ++ bestPick->freq = curFreq; ++ } ++ if (!curError) ++ freq_found = true; ++ curFb++; ++ } ++ curDiv++; ++ } ++ return bestPick->freq; ++} ++ ++static struct dglnt_dynclk *clk_hw_to_dglnt_dynclk(struct clk_hw *clk_hw) ++{ ++ return container_of(clk_hw, struct dglnt_dynclk, clk_hw); ++} ++ ++ ++static int dglnt_dynclk_enable(struct clk_hw *clk_hw) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ unsigned int clock_state; ++ ++ if (dglnt_dynclk->freq) { ++ writel(1, dglnt_dynclk->base + OFST_DISPLAY_CTRL); ++ do { ++ clock_state = readl(dglnt_dynclk->base + ++ OFST_DISPLAY_STATUS); ++ } while (!clock_state); ++ } ++ return 0; ++} ++ ++static void dglnt_dynclk_disable(struct clk_hw *clk_hw) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ ++ writel(0, dglnt_dynclk->base + OFST_DISPLAY_CTRL); ++} ++ ++static int dglnt_dynclk_set_rate(struct clk_hw *clk_hw, ++ unsigned long rate, unsigned long parent_rate) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ struct dglnt_dynclk_reg clkReg; ++ struct dglnt_dynclk_mode clkMode; ++ ++ if (parent_rate == 0 || rate == 0) ++ return -EINVAL; ++ if (rate == dglnt_dynclk->freq) ++ return 0; ++ ++ /* ++ * Convert from Hz to KHz, then multiply by five to account for ++ * BUFR division ++ */ ++ rate = (rate + 100) / 200; ++ /* convert from Hz to KHz */ ++ parent_rate = (parent_rate + 500) / 1000; ++ if (!dglnt_dynclk_find_mode(rate, parent_rate, &clkMode)) ++ return -EINVAL; ++ ++ /* ++ * Write to the PLL dynamic configuration registers to configure it ++ * with the calculated parameters. ++ */ ++ dglnt_dynclk_find_reg(&clkReg, &clkMode); ++ dglnt_dynclk_write_reg(&clkReg, dglnt_dynclk->base); ++ dglnt_dynclk->freq = clkMode.freq * 200; ++ dglnt_dynclk_disable(clk_hw); ++ dglnt_dynclk_enable(clk_hw); ++ ++ return 0; ++} ++ ++static long dglnt_dynclk_round_rate(struct clk_hw *hw, unsigned long rate, ++ unsigned long *parent_rate) ++{ ++ struct dglnt_dynclk_mode clkMode; ++ ++ dglnt_dynclk_find_mode(((rate + 100) / 200), ++ ((*parent_rate) + 500) / 1000, &clkMode); ++ ++ return (clkMode.freq * 200); ++} ++ ++static unsigned long dglnt_dynclk_recalc_rate(struct clk_hw *clk_hw, ++ unsigned long parent_rate) ++{ ++ struct dglnt_dynclk *dglnt_dynclk = clk_hw_to_dglnt_dynclk(clk_hw); ++ ++ return dglnt_dynclk->freq; ++} ++ ++ ++static const struct clk_ops dglnt_dynclk_ops = { ++ .recalc_rate = dglnt_dynclk_recalc_rate, ++ .round_rate = dglnt_dynclk_round_rate, ++ .set_rate = dglnt_dynclk_set_rate, ++ .enable = dglnt_dynclk_enable, ++ .disable = dglnt_dynclk_disable, ++}; ++ ++static const struct of_device_id dglnt_dynclk_ids[] = { ++ { .compatible = "digilent,axi-dynclk", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, dglnt_dynclk_ids); ++ ++static int dglnt_dynclk_probe(struct platform_device *pdev) ++{ ++ const struct of_device_id *id; ++ struct dglnt_dynclk *dglnt_dynclk; ++ struct clk_init_data init; ++ const char *parent_name; ++ const char *clk_name; ++ struct resource *mem; ++ struct clk *clk; ++ ++ if (!pdev->dev.of_node) ++ return -ENODEV; ++ ++ id = of_match_node(dglnt_dynclk_ids, pdev->dev.of_node); ++ if (!id) ++ return -ENODEV; ++ ++ dglnt_dynclk = devm_kzalloc(&pdev->dev, sizeof(*dglnt_dynclk), ++ GFP_KERNEL); ++ if (!dglnt_dynclk) ++ return -ENOMEM; ++ ++ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ dglnt_dynclk->base = devm_ioremap_resource(&pdev->dev, mem); ++ if (IS_ERR(dglnt_dynclk->base)) ++ return PTR_ERR(dglnt_dynclk->base); ++ ++ parent_name = of_clk_get_parent_name(pdev->dev.of_node, 0); ++ if (!parent_name) ++ return -EINVAL; ++ ++ clk_name = pdev->dev.of_node->name; ++ of_property_read_string(pdev->dev.of_node, "clock-output-names", ++ &clk_name); ++ ++ init.name = clk_name; ++ init.ops = &dglnt_dynclk_ops; ++ init.flags = 0; ++ init.parent_names = &parent_name; ++ init.num_parents = 1; ++ ++ dglnt_dynclk->freq = 0; ++ dglnt_dynclk_disable(&dglnt_dynclk->clk_hw); ++ ++ dglnt_dynclk->clk_hw.init = &init; ++ clk = devm_clk_register(&pdev->dev, &dglnt_dynclk->clk_hw); ++ if (IS_ERR(clk)) ++ return PTR_ERR(clk); ++ ++ return of_clk_add_provider(pdev->dev.of_node, of_clk_src_simple_get, ++ clk); ++} ++ ++static int dglnt_dynclk_remove(struct platform_device *pdev) ++{ ++ of_clk_del_provider(pdev->dev.of_node); ++ ++ return 0; ++} ++ ++static struct platform_driver dglnt_dynclk_driver = { ++ .driver = { ++ .name = "dglnt-dynclk", ++ .owner = THIS_MODULE, ++ .of_match_table = dglnt_dynclk_ids, ++ }, ++ .probe = dglnt_dynclk_probe, ++ .remove = dglnt_dynclk_remove, ++}; ++module_platform_driver(dglnt_dynclk_driver); ++ ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Sam Bobrowicz <sbobrowicz@digilentinc.com>"); ++MODULE_DESCRIPTION("CCF Driver for Digilent axi_dynclk IP Core"); +-- +2.14.2 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch new file mode 100644 index 00000000..a98d84c5 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0003-drm-xilinx-Fix-DPMS-transition-to-on.patch @@ -0,0 +1,54 @@ +From 1a18e2b514ae9e75145597ac509a87f656c976ba Mon Sep 17 00:00:00 2001 +From: Nathan Rossi <nathan@nathanrossi.com> +Date: Mon, 2 May 2016 23:46:42 +1000 +Subject: [PATCH 3/3] drm: xilinx: Fix DPMS transition to on + +Fix the issues where the VTC is reset (losing its timing config). + +Also fix the issue where the plane destroys its DMA descriptors and +marks the DMA channels as inactive but never recreates the descriptors +and never updates the active state when turning DPMS back on. + +Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> +Upstream-Status: Pending [This is a workaround] +--- + drivers/gpu/drm/xilinx/xilinx_drm_crtc.c | 1 - + drivers/gpu/drm/xilinx/xilinx_drm_plane.c | 3 ++- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c b/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c +index 631d35b921..93dbd4b58a 100644 +--- a/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c ++++ b/drivers/gpu/drm/xilinx/xilinx_drm_crtc.c +@@ -88,7 +88,6 @@ static void xilinx_drm_crtc_dpms(struct drm_crtc *base_crtc, int dpms) + default: + if (crtc->vtc) { + xilinx_vtc_disable(crtc->vtc); +- xilinx_vtc_reset(crtc->vtc); + } + if (crtc->cresample) { + xilinx_cresample_disable(crtc->cresample); +diff --git a/drivers/gpu/drm/xilinx/xilinx_drm_plane.c b/drivers/gpu/drm/xilinx/xilinx_drm_plane.c +index 6a248b72d4..d2518a4bdf 100644 +--- a/drivers/gpu/drm/xilinx/xilinx_drm_plane.c ++++ b/drivers/gpu/drm/xilinx/xilinx_drm_plane.c +@@ -140,7 +140,7 @@ void xilinx_drm_plane_commit(struct drm_plane *base_plane) + for (i = 0; i < MAX_NUM_SUB_PLANES; i++) { + struct xilinx_drm_plane_dma *dma = &plane->dma[i]; + +- if (dma->chan && dma->is_active) { ++ if (dma->chan) { + flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; + desc = dmaengine_prep_interleaved_dma(dma->chan, + &dma->xt, +@@ -153,6 +153,7 @@ void xilinx_drm_plane_commit(struct drm_plane *base_plane) + dmaengine_submit(desc); + + dma_async_issue_pending(dma->chan); ++ dma->is_active = true; + } + } + } +-- +2.14.2 + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0004-minized-wifi-bluetooth.cfg b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0004-minized-wifi-bluetooth.cfg new file mode 100644 index 00000000..f71e53ab --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx/v2023.2/0004-minized-wifi-bluetooth.cfg @@ -0,0 +1,33 @@ +# +# Bluetooth config +# +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +CONFIG_BT_BCM=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HIDP=y +CONFIG_CFG80211=y +CONFIG_CFG80211_DEFAULT_PS=y +CONFIG_CFG80211_CRDA_SUPPORT=y +CONFIG_BRCMUTIL=y +CONFIG_BRCMFMAC=y +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_SHA256=y + +# +# Regulator config +# +CONFIG_REGMAP_IRQ=y +CONFIG_I2C_XILINX=y +CONFIG_MFD_DA9062=y +CONFIG_REGULATOR_DA9062=y + diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2017.3.bbappend b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2017.3.bbappend deleted file mode 100644 index 83b08f1b..00000000 --- a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2017.3.bbappend +++ /dev/null @@ -1,8 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/linux-xlnx:" - -SRC_URI_append_zybo-linux-bd-zynq7 = " \ - file://0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch \ - file://0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch \ - file://0003-drm-xilinx-Fix-DPMS-transition-to-on.patch \ - " - diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2022.1.bbappend b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2022.1.bbappend new file mode 100644 index 00000000..c789c7a9 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2022.1.bbappend @@ -0,0 +1,12 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/linux-xlnx/v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}:" + +# Note: These patches are very old and doesn't apply on top of 5.x +# kernel. For more details refer README.md file. + +#SRC_URI:append:zybo-linux-bd-zynq7 = " \ +# file://0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch \ +# file://0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch \ +# file://0003-drm-xilinx-Fix-DPMS-transition-to-on.patch \ +# " + +SRC_URI:append:minized-zynq7 = " file://0004-minized-wifi-bluetooth.cfg" diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2022.2.bbappend b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2022.2.bbappend new file mode 100644 index 00000000..c789c7a9 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2022.2.bbappend @@ -0,0 +1,12 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/linux-xlnx/v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}:" + +# Note: These patches are very old and doesn't apply on top of 5.x +# kernel. For more details refer README.md file. + +#SRC_URI:append:zybo-linux-bd-zynq7 = " \ +# file://0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch \ +# file://0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch \ +# file://0003-drm-xilinx-Fix-DPMS-transition-to-on.patch \ +# " + +SRC_URI:append:minized-zynq7 = " file://0004-minized-wifi-bluetooth.cfg" diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2023.1.bbappend b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2023.1.bbappend new file mode 100644 index 00000000..c789c7a9 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2023.1.bbappend @@ -0,0 +1,12 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/linux-xlnx/v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}:" + +# Note: These patches are very old and doesn't apply on top of 5.x +# kernel. For more details refer README.md file. + +#SRC_URI:append:zybo-linux-bd-zynq7 = " \ +# file://0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch \ +# file://0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch \ +# file://0003-drm-xilinx-Fix-DPMS-transition-to-on.patch \ +# " + +SRC_URI:append:minized-zynq7 = " file://0004-minized-wifi-bluetooth.cfg" diff --git a/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2023.2.bbappend b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2023.2.bbappend new file mode 100644 index 00000000..c789c7a9 --- /dev/null +++ b/meta-xilinx-contrib/recipes-kernel/linux/linux-xlnx_2023.2.bbappend @@ -0,0 +1,12 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/linux-xlnx/v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}:" + +# Note: These patches are very old and doesn't apply on top of 5.x +# kernel. For more details refer README.md file. + +#SRC_URI:append:zybo-linux-bd-zynq7 = " \ +# file://0001-drm-xilinx-Add-encoder-for-Digilent-boards.patch \ +# file://0002-clk-Add-driver-for-axi_dynclk-IP-Core.patch \ +# file://0003-drm-xilinx-Fix-DPMS-transition-to-on.patch \ +# " + +SRC_URI:append:minized-zynq7 = " file://0004-minized-wifi-bluetooth.cfg" diff --git a/meta-xilinx-core/COPYING.MIT b/meta-xilinx-core/COPYING.MIT new file mode 100644 index 00000000..89de3547 --- /dev/null +++ b/meta-xilinx-core/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/meta-xilinx-core/README.md b/meta-xilinx-core/README.md new file mode 100644 index 00000000..ec5b663b --- /dev/null +++ b/meta-xilinx-core/README.md @@ -0,0 +1,75 @@ +# meta-xilinx-core + +This layer enables AMD Xilinx hardware devices metadata such as tune files, +generic and soc variant machine configurations, boot firmware components, kernel, +multimedia, graphics, xrt etc. + +## Dependencies + +This layer depends on: + + URI: https://git.yoctoproject.org/poky + layers: meta, meta-poky + branch: langdale + + URI: https://git.openembedded.org/meta-openembedded + layers: meta-oe + branch: langdale +--- + +## Configuring Machines + +All machines that use meta-xilinx-tools should be derived from one of the +following: microblaze-generic, zynq-generic, zynqmp-generic, or +versal-generic. + +microblaze-generic requries the include of the meta-microblaze layer + +zynq-generic, zynqmp-generic and versal-generic each require a device-tree +to be defined. The device tree can be manually passed in via the +variable CONFIG_DTFILE. Note, some items in the system may expect the +device-tree to be referenced to system-top.dtb. +Enabling meta-xilinx-tools will generate the appropriate device tree in most +cases. + +Zynqmp-generic requires pmu-firmware. The firmware can be passed directly +as a path to a binary: PMU_FILE, you may use the generic built version +by including meta-xilinx-standalone, the XSCT version by adding +meta-xilinx-tools or the DTB workflow version using +meta-xilinx-standalone-experimental. + +Versal-generic requires both PLM and PSM firmware to be specified. They can +be specified as a path to a binary using PLM_FILE and PSM_FILE. Or they can +be generated by including meta-xilinx-standalone, the XSCT version by adding +meta-xilinx-tools or the DTB workflow version using +meta-xilinx-standalone-experimental. Additionally some configurations may +require you to specify the path to a PDI file using PDI_PATH. The XSCT +version will extract the PDI automatically. +--- + +## Recipe Licenses + +Due to licensing restrictions some recipes in this layer rely on closed source +or restricted content provided by Xilinx. In order to use these recipes you must +accept or agree to the licensing terms (e.g. EULA, Export Compliance, NDA, +Redistribution, etc). This layer **does not enforce** any legal requirement, it +is the **responsibility of the user** the ensure that they are in compliance +with any licenses or legal requirements for content used. + +In order to use recipes that rely on restricted content the `xilinx` license +flag must be white-listed in the build configuration (e.g. `local.conf`). This +can be done on a per package basis: + + LICENSE_FLAGS_ACCEPTED += "xilinx_pmu-rom-native" + +or generally: + + LICENSE_FLAGS_ACCEPTED += "xilinx" + +Generally speaking Xilinx content that is provided as a restricted download +cannot be obtained without a Xilinx account, in order to use this content you +must first download it with your Xilinx account and place the downloaded content +in the `downloads/` directory of your build or on a `PREMIRROR`. Attempting to +fetch the content using bitbake will fail, indicating the URL from which to +acquire the content. + diff --git a/meta-xilinx-core/README.qemu.md b/meta-xilinx-core/README.qemu.md new file mode 100644 index 00000000..941fa937 --- /dev/null +++ b/meta-xilinx-core/README.qemu.md @@ -0,0 +1,20 @@ + +ZynqMP - PMU ROM +---------------- + +Since Xilinx tool release v2017.1 multiple components (arm-trusted-firmware, +linux, u-boot, etc.) require the PMU firmware to be loaded. For QEMU this also +means that the PMU ROM must be loaded so that the PMU firmware can be used. + +The PMU ROM is available for download, and a specific recipe has been created +to make this available: pmu-rom-native. + +The license on the software is Xilinx proprietary, so you may be required to +enable the approprate LICENSE_FLAGS_ACCEPTED to trigger the download. +The license itself is available within the download at the URL referred to in +meta-xilinx-core/recipes-bsp/pmu-firmware/pmu-rom-native_2022.2.bb. + +Add the following to your local.conf to acknowledge you accept the proprietary +xilinx license. + + LICENSE_FLAGS_ACCEPTED:append = " xilinx" diff --git a/meta-xilinx-core/classes/dfx_user_dts.bbclass b/meta-xilinx-core/classes/dfx_user_dts.bbclass new file mode 100644 index 00000000..4404aa05 --- /dev/null +++ b/meta-xilinx-core/classes/dfx_user_dts.bbclass @@ -0,0 +1,267 @@ +# This bbclass is inherited by flat, DFx Static and DFx RP firmware recipes. +# dfx_user_dts.bbclass expects user to generate pl dtsi for flat, DFx Static +# and DFx RP xsa outside of yocto. + +inherit devicetree + +DEPENDS = "dtc-native bootgen-native" + +# recipes that inherit from this class need to use an appropriate machine +# override for COMPATIBLE_MACHINE to build successfully; don't allow building +# for microblaze MACHINE +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:microblaze = "^$" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +PROVIDES = "" + +do_fetch[cleandirs] = "${B}" + +DT_PADDING_SIZE = "0x1000" +BOOTGEN_FLAGS ?= " -arch ${SOC_FAMILY} -w ${@bb.utils.contains('SOC_FAMILY','zynqmp','','-process_bitstream bin',d)}" + +S ?= "${WORKDIR}" +FW_DIR ?= "" +DTSI_PATH ?= "" +DTBO_PATH ?= "" +DT_FILES_PATH = "${S}/${DTSI_PATH}" +FIRMWARE_NAME_DT_FILE ?= "" +USER_DTS_FILE ?= "" + +FIRMWARE_NAME_DT_FILE[doc] = "DT file which has firmware-name device-tree property" +USER_DTS_FILE[doc] = "Final DTSI or DTS file which is used for packaging final DT overlay" + +python() { + import re + soc_family = d.getVar("SOC_FAMILY") + if "git://" in d.getVar("SRC_URI") or "https://" in d.getVar("SRC_URI"): + d.setVar("S",'${WORKDIR}/git/'+d.getVar("FW_DIR")) + else: + dtsi_found = False + dtbo_found = False + bit_found = False + bin_found = False + pdi_found = False + + # Required Inputs + if '.dtsi' in d.getVar("SRC_URI") or '.dts' in d.getVar("SRC_URI"): + dtsi_found = True + d.setVar("DTSI_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.dtsi' in a or '.dts' in a][0].lstrip('file://'))) + + if '.dtbo' in d.getVar("SRC_URI"): + dtbo_found = True + d.setVar("DTBO_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.dtbo' in a][0].lstrip('file://'))) + + if '.bit' in d.getVar("SRC_URI") and soc_family != "versal": + bit_found = True + d.setVar("BIT_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.bit' in a][0].lstrip('file://'))) + + if '.bin' in d.getVar("SRC_URI") and soc_family != "versal": + bin_found = True + d.setVar("BIT_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.bin' in a][0].lstrip('file://'))) + + if '.pdi' in d.getVar("SRC_URI") and soc_family == "versal": + pdi_found = True + d.setVar("PDI_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.pdi' in a][0].lstrip('file://'))) + + # Check for valid combination of input files in SRC_URI + if dtsi_found or dtbo_found: + bb.debug(2, "dtsi or dtbo found in SRC_URI") + if bit_found or pdi_found or bin_found: + bb.debug(2, "bitstream or pdi found in SRC_URI") + elif bit_found and bin_found: + raise bb.parse.SkipRecipe("Both '.bit' and '.bin' file found in SRC_URI, either .bit or .bin file is supported but not both.") + else: + raise bb.parse.SkipRecipe("Need one '.bit' or one '.pdi' file added to SRC_URI ") + else: + raise bb.parse.SkipRecipe("Need one '.dtsi' or one '.dtbo' file added to SRC_URI ") + + # Check for valid combination of dtsi and dts files in SRC_URI + # Following file combinations are not supported use case. + # 1. More than one '.dtsi' and zero '.dts' file. + # 2. More than one '.dts' and zero or more than one '.dtsi'file . + pattern_dts = re.compile(r'[.]+dts\b') + pattern_dtsi = re.compile(r'[.]+dtsi\b') + dts_count = len([*re.finditer(pattern_dts, d.getVar('SRC_URI'))]) + dtsi_count = len([*re.finditer(pattern_dtsi, d.getVar("SRC_URI"))]) + + if dtsi_count > 1 and dts_count == 0: + raise bb.parse.SkipRecipe("Recipe has more than one '.dtsi' and zero '.dts' found, this is an unsupported use case") + elif dts_count > 1: + raise bb.parse.SkipRecipe("Recipe has more than one '.dts' and zero or more than one '.dtsi' found, this is an unsupported use case") + + # Optional input + if '.json' in d.getVar("SRC_URI"): + d.setVar("JSON_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.json' in a][0].lstrip('file://'))) + + if '.xclbin' in d.getVar("SRC_URI"): + d.setVar("XCL_PATH",os.path.dirname([a for a in d.getVar('SRC_URI').split() if '.xclbin' in a][0].lstrip('file://'))) +} + +# Function to get dts or dtsi file count. +def get_dt_count(d, dt_ext): + import glob + dt_count = sum(1 for f in glob.iglob((d.getVar('S') + (d.getVar('DTSI_PATH')) + '/*.' + dt_ext),recursive=True) if os.path.isfile(f)) + return dt_count + +# Function to search for dt firmware-name property in dts or dtsi file. +python find_firmware_file() { + import glob + pattern_fw = 'firmware-name' + search_count = 0 + for dt_files in glob.iglob((d.getVar('S') + (d.getVar('DTSI_PATH')) + '/*.dts*'),recursive=True): + with open(dt_files, "r") as f: + current_fd = f.read() + if pattern_fw in current_fd: + search_count += 1 + if search_count > 1: + bb.error("firmware-name dt property found in more than one dt files! Please fix the dts or dtsi file.") + break + else: + d.setVar('FIRMWARE_NAME_DT_FILE', os.path.basename(dt_files)) +} + +do_configure[prefuncs] += "find_firmware_file" + +python do_configure() { + import glob, re, shutil + soc_family = d.getVar("SOC_FAMILY") + + if bb.utils.contains('MACHINE_FEATURES', 'fpga-overlay', False, True, d): + bb.warn("Using fpga-manager.bbclass requires fpga-overlay MACHINE_FEATURE to be enabled") + + # Renaming firmware-name using $PN as bitstream/PDI will be renamed using + # $PN when generating the bin/pdi file. + if os.path.isfile(d.getVar('S') + (d.getVar('DTSI_PATH') or '') + '/' + d.getVar('FIRMWARE_NAME_DT_FILE')): + orig_dtsi = glob.glob(d.getVar('S')+ (d.getVar('DTSI_PATH') or '') + '/' + d.getVar('FIRMWARE_NAME_DT_FILE'))[0] + new_dtsi = d.getVar('S') + '/pl.dtsi_firmwarename' + with open(new_dtsi, 'w') as newdtsi: + with open(orig_dtsi) as olddtsi: + for line in olddtsi: + if soc_family == 'versal': + newdtsi.write(re.sub('firmware-name.*\".*\"','firmware-name = \"'+d.getVar('PN')+'.pdi\"',line)) + else: + newdtsi.write(re.sub('firmware-name.*\".*\"','firmware-name = \"'+d.getVar('PN')+'.bit.bin\"',line)) + shutil.move(new_dtsi,orig_dtsi) +} + +do_compile[prefuncs] += "find_firmware_file" + +python devicetree_do_compile:append() { + import glob, subprocess, shutil + soc_family = d.getVar("SOC_FAMILY") + + dtbo_count = sum(1 for f in glob.iglob((d.getVar('S') + '/*.dtbo'),recursive=True) if os.path.isfile(f)) + + # Skip devicetree do_compile task if input file is dtbo in SRC_URI + if not dtbo_count: + # Convert .bit to bit.bin format only if dtsi is input. + # In case of dtbo as input, bbclass doesn't know if firmware-name is .bit or + # .bit.bin format and corresponding file name. Hence we are not doing + # bit.bin conversion. + if soc_family != 'versal' and glob.glob(d.getVar('S') + '/' + d.getVar('FIRMWARE_NAME_DT_FILE')): + pn = d.getVar('PN') + biffile = pn + '.bif' + + with open(biffile, 'w') as f: + f.write('all:\n{\n\t' + glob.glob(d.getVar('S')+(d.getVar('BIT_PATH') or '') + '/*.bit')[0] + '\n}') + + bootgenargs = ["bootgen"] + (d.getVar("BOOTGEN_FLAGS") or "").split() + bootgenargs += ["-image", biffile, "-o", pn + ".bit.bin"] + subprocess.run(bootgenargs, check = True) + + # In Zynq7k using both "-process_bitstream bin" and "-o" in bootgen flag, + # to convert bit file to bin format, "-o" option will not be effective + # and generated output file name is ${S}+${BIT_PATH}/<bit_file_name>.bit.bin + # file, Hence we need to rename this file from <bit_file_name>.bit.bin to + # ${PN}.bit.bin which matches the firmware name in dtbo and move + # ${PN}.bit.bin to ${B} directory. + if soc_family == 'zynq': + src_bitbin_file = glob.glob(d.getVar('S') + (d.getVar('BIT_PATH') or '') + '/*.bit.bin')[0] + dst_bitbin_file = d.getVar('B') + '/' + pn + '.bit.bin' + shutil.move(src_bitbin_file, dst_bitbin_file) + + if not os.path.isfile(pn + ".bit.bin"): + bb.fatal("Couldn't find %s file, Enable '-log trace' in BOOTGEN_FLAGS" \ + "and check bootgen_log.txt" % (d.getVar('B') + '/' + pn + '.bit.bin')) +} + +# If user inputs both dtsi and dts files then device-tree will generate dtbo +# files for each dt file, Hence to package the firmware pick the right user dt +# overlay file. +python find_user_dts_overlay_file() { + import glob + dtbo_count = sum(1 for f in glob.iglob((d.getVar('S') + '/*.dtbo'),recursive=True) if os.path.isfile(f)) + # Skip if input file is dtbo in SRC_URI + if not dtbo_count: + dts_count = get_dt_count(d, 'dts') + dtsi_count = get_dt_count(d, 'dtsi') + if dtsi_count == 1 and dts_count == 0: + dts_file =glob.glob(d.getVar('S')+ (d.getVar('DTSI_PATH') or '') + '/*.dtsi')[0] + elif dtsi_count >=0 and dts_count == 1: + dts_file = glob.glob(d.getVar('S')+ (d.getVar('DTSI_PATH') or '') + '/*.dts')[0] + + d.setVar('USER_DTS_FILE', os.path.splitext(os.path.basename(dts_file))[0]) +} + +do_install[prefuncs] += "find_user_dts_overlay_file" + +do_install() { + install -d ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/ + + # In case of dtbo as input, dtbo will be copied from directly from ${S} + # In case of dtsi as input, dtbo will be copied from directly from ${B} + if [ `ls ${S}/*.dtbo | wc -l` -eq 1 ]; then + install -Dm 0644 ${S}/*.dtbo ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/ + elif [ `ls ${S}/*.dtbo | wc -l` -gt 1 ]; then + bbfatal "Multiple DTBO found, use the right DTBO in SRC_URI from the following:\n$(basename -a ${S}/*.dtbo)" + elif [ -f ${B}/${USER_DTS_FILE}.dtbo ]; then + install -Dm 0644 ${B}/${USER_DTS_FILE}.dtbo ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.dtbo + else + bbfatal "A dtbo ending '.dtbo' expected but not found" + fi + + if [ "${SOC_FAMILY}" == "versal" ]; then + # In case of dtbo as input, pdi will be copied from directly from ${S} + # without renaming the pdi name to ${PN}.pdi + if [ `ls ${S}/*.pdi | wc -l` -eq 1 ] && [ `ls ${S}/*.dtbo | wc -l` -eq 1 ]; then + install -Dm 0644 ${S}/*.pdi ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/ + elif [ `ls ${S}/*.pdi | wc -l` -gt 1 ]; then + bbfatal "Multiple PDI found, use the right PDI in SRC_URI from the following:\n$(basename -a ${S}/*.pdi)" + elif [ `ls ${S}/*.pdi | wc -l` -eq 1 ] && [ -f ${B}/${USER_DTS_FILE}.dtbo ]; then + install -Dm 0644 ${S}/*.pdi ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.pdi + else + bbfatal "A PDI file with '.pdi' expected but not found" + fi + else + # In case of dtbo as input, .bit or .bin will be copied from directly + # from ${S} without renaming the .bit/.bin name to ${PN}.bit/${PN}.bin + # if more than one .bit/.bin file is found then fail the task. + if [ `ls ${S}/*.bit | wc -l` -gt 1 ]; then + bbfatal "Multiple .bit found, use the right .bit in SRC_URI from the following:\n$(basename -a ${S}/*.bit)" + elif [ `ls ${S}/*.bin | wc -l` -gt 1 ]; then + bbfatal "Multiple .bin found, use the right .bin in SRC_URI from the following:\n$(basename -a ${S}/*.bin)" + elif [ `ls ${S}/*.bit | wc -l` -eq 1 ] && [ `ls ${S}/*.dtbo | wc -l` -eq 1 ]; then + install -Dm 0644 ${S}/*.bit ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/ + elif [ `ls ${S}/*.bin | wc -l` -eq 1 ] && [ `ls ${S}/*.dtbo | wc -l` -eq 1 ]; then + install -Dm 0644 ${S}/*.bin ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/ + elif [ -f ${B}/${PN}.bit.bin ] && [ -f ${B}/${USER_DTS_FILE}.dtbo ]; then + install -Dm 0644 ${B}/${PN}.bit.bin ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.bit.bin + else + bbfatal "A bitstream file with '.bit' or '.bin' expected but not found" + fi + fi + + if ls ${S}/${XCL_PATH}/*.xclbin >/dev/null 2>&1; then + install -Dm 0644 ${S}/${XCL_PATH}/*.xclbin ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/${PN}.xclbin + fi + + if [ -f ${S}/${JSON_PATH}/shell.json ] || [ -f ${S}/${JSON_PATH}/accel.json ]; then + install -Dm 0644 ${S}/${JSON_PATH}/*.json ${D}/${nonarch_base_libdir}/firmware/xilinx/${PN}/ + fi +} + +do_deploy[noexec] = "1" + +FILES:${PN} += "${nonarch_base_libdir}/firmware/xilinx/${PN}" diff --git a/meta-xilinx-core/classes/fpgamanager_custom.bbclass b/meta-xilinx-core/classes/fpgamanager_custom.bbclass new file mode 100644 index 00000000..8c8997a1 --- /dev/null +++ b/meta-xilinx-core/classes/fpgamanager_custom.bbclass @@ -0,0 +1,24 @@ +# This class inherits dfx_user_dts.bbclass for below use cases. +# Zynq-7000 and ZynqMP: Full bitstream loading. +# ZynqMP: DFx Static and Partial bitstream loading. +# Versal: DFx Static and Parial pdi loading. +# Versal: Full PDI loading. + +inherit dfx_user_dts + +python fpgamanager_warn_msg () { + if not d.getVar("FPGAMANAGER_NO_WARN"): + arch = d.getVar('SOC_FAMILY') + pn = d.getVar('PN') + warn_msg = 'Users should start using dfx_user_dts bbclass for ' + if arch == 'zynq': + warn_msg += 'Zynq-7000 Full bitstream loading use case.' + elif arch == 'zynqmp': + warn_msg += 'ZynqMP Full or DFx Static or DFx Partial bitstream loading use case.' + elif arch == 'versal': + warn_msg += 'Versal DFx Static or DFx Partial or Full PDI loading use case.' + + bb.warn("Recipe %s has inherited fpgamanager_custom bbclass which will be deprecated in 2024.1 release. \n%s" % (pn, warn_msg)) +} + +do_install[postfuncs] += "fpgamanager_warn_msg"
\ No newline at end of file diff --git a/meta-xilinx-core/classes/gen-machine-conf.bbclass b/meta-xilinx-core/classes/gen-machine-conf.bbclass new file mode 100644 index 00000000..25960cd1 --- /dev/null +++ b/meta-xilinx-core/classes/gen-machine-conf.bbclass @@ -0,0 +1,6 @@ +#Add scripts path with the tools to PATH to be able to use from eSDK +sdk_ext_postinst:append() { + if [ -d $target_sdk_dir/layers/meta-xilinx/meta-xilinx-core/gen-machine-conf ]; then + echo "export PATH=$target_sdk_dir/layers/meta-xilinx/meta-xilinx-core/gen-machine-conf:\$PATH" >> $env_setup_script + fi +} diff --git a/meta-xilinx-core/classes/image-types-xilinx-qemu.bbclass b/meta-xilinx-core/classes/image-types-xilinx-qemu.bbclass new file mode 100644 index 00000000..b4de5ee1 --- /dev/null +++ b/meta-xilinx-core/classes/image-types-xilinx-qemu.bbclass @@ -0,0 +1,59 @@ +# Define the 'qemu-sd' conversion type +# +# This conversion type pads any image to the 512K boundary to ensure that the +# image file can be used directly with QEMU's SD emulation which requires the +# block device to match that of valid SD card sizes (which are multiples of +# 512K). + +CONVERSIONTYPES:append = " qemu-sd qemu-sd-fatimg" +CONVERSION_CMD:qemu-sd () { + cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.${type} ${IMGDEPLOYDIR}/${IMAGE_NAME}.${type}.qemu-sd + # Get the wic.qemu-sd file size + file_size=`stat -c '%s' ${IMGDEPLOYDIR}/${IMAGE_NAME}.${type}.qemu-sd` + powerof2=1 + file_size=${file_size%.*} + # Get the next power of 2 value for the image size value + while [ ${powerof2} -lt ${file_size} ]; do + powerof2=$(expr $powerof2 \* 2) + done + # Resize the image using qemu-img + qemu-img resize -f raw ${IMGDEPLOYDIR}/${IMAGE_NAME}.${type}.qemu-sd ${powerof2} +} + +BOOT_VOLUME_ID ?= "BOOT" +BOOT_SPACE ?= "1047552" +IMAGE_ALIGNMENT ?= "1024" + +# Create SD image in case of INITRAMFS_IMAGE set due to circular dependencies. +# This creates FAT partitioned SD image containing boot.bin,boot.scr and rootfs.cpio.gz.u-boot files. +# This is a workaround fix until we fix the circular dependencies +# Usage: IMAGE_FSTYPES:append = " cpio.gz.u-boot.qemu-sd-fatimg" +CONVERSION_CMD:qemu-sd-fatimg () { + QEMU_IMG="${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd-fatimg" + BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ALIGNMENT} - 1) + BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ALIGNMENT}) + QEMUIMG_SIZE=$(expr ${IMAGE_ALIGNMENT} + ${BOOT_SPACE_ALIGNED}) + dd if=/dev/zero of=${QEMU_IMG} bs=1024 count=0 seek=${QEMUIMG_SIZE} + parted -s ${QEMU_IMG} mklabel msdos + parted -s ${QEMU_IMG} unit KiB mkpart primary fat32 ${IMAGE_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ALIGNMENT} \- 1) + parted -s ${QEMU_IMG} set 1 boot on + parted ${QEMU_IMG} print + BOOT_BLOCKS=$(LC_ALL=C parted -s ${QEMU_IMG} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') + rm -f ${WORKDIR}/${BOOT_VOLUME_ID}.img + mkfs.vfat -n "${BOOT_VOLUME_ID}" -S 512 -C ${WORKDIR}/${BOOT_VOLUME_ID}.img $BOOT_BLOCKS + if [ -e ${DEPLOY_DIR_IMAGE}/boot.bin ]; then + mcopy -i ${WORKDIR}/${BOOT_VOLUME_ID}.img -s ${DEPLOY_DIR_IMAGE}/boot.bin ::/ + fi + if [ -e ${DEPLOY_DIR_IMAGE}/boot.scr ]; then + mcopy -i ${WORKDIR}/${BOOT_VOLUME_ID}.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::/ + fi + if [ ${INITRAMFS_IMAGE} = ${IMAGE_BASENAME} ] && [ x"${INITRAMFS_IMAGE_BUNDLE}" != "x1" ]; then + mcopy -i ${WORKDIR}/${BOOT_VOLUME_ID}.img -s ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ::rootfs.cpio.gz.u-boot + fi + dd if=${WORKDIR}/${BOOT_VOLUME_ID}.img of=${QEMU_IMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ALIGNMENT} \* 1024) +} + +CONVERSION_DEPENDS_qemu-sd = "qemu-system-native" +CONVERSION_DEPENDS_qemu-sd-fatimg = "mtools-native:do_populate_sysroot \ + dosfstools-native:do_populate_sysroot \ + parted-native:do_populate_sysroot" diff --git a/meta-xilinx-core/classes/image-wic-utils.bbclass b/meta-xilinx-core/classes/image-wic-utils.bbclass new file mode 100644 index 00000000..41ad8148 --- /dev/null +++ b/meta-xilinx-core/classes/image-wic-utils.bbclass @@ -0,0 +1,54 @@ +# Helper/utility functions to work with the IMAGE_BOOT_FILES variable and its +# expected behvaior with regards to the contents of the DEPLOY_DIR_IMAGE. +# +# The use of these functions assume that the deploy directory is populated with +# any dependent files/etc. Such that the recipe using these functions depends +# on the recipe that provides the files being used/queried. + +def boot_files_split_expand(d): + # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>' + for f in (d.getVar("IMAGE_BOOT_FILES") or "").split(" "): + parts = f.split(";", 1) + sources = [parts[0].strip()] + if "*" in parts[0]: + # has glob part + import glob + deployroot = d.getVar("DEPLOY_DIR_IMAGE") + sources = [] + for i in glob.glob(os.path.join(deployroot, parts[0])): + sources.append(os.path.basename(i)) + + # for all sources, yield an entry + for s in sources: + if len(parts) == 2: + if parts[1].endswith('/'): + yield s, '%s%s' % (parts[1].strip(), s) + else: + yield s, parts[1].strip() + yield s, s + +def boot_files_bitstream(d): + expectedfiles = [("bitstream", True)] + expectedexts = [(".bit", True), (".bin", False)] + # search for bitstream paths, use the renamed file. First matching is used + for source, target in boot_files_split_expand(d): + # skip boot.bin and u-boot.bin, it is not a bitstream + skip = ["boot.bin", "u-boot.bin"] + if source in skip or target in skip: + continue + + for e, t in expectedfiles: + if source == e or target == e: + return target, t + for e, t in expectedexts: + if source.endswith(e) or target.endswith(e): + return target, t + return "", False + +def boot_files_dtb_filepath(d): + dtbs = (d.getVar("IMAGE_BOOT_FILES") or "").split(" ") + for source, target in boot_files_split_expand(d): + if target.endswith(".dtb"): + return target + return "" + diff --git a/meta-xilinx-core/classes/kernel-simpleimage.bbclass b/meta-xilinx-core/classes/kernel-simpleimage.bbclass new file mode 100644 index 00000000..110ee254 --- /dev/null +++ b/meta-xilinx-core/classes/kernel-simpleimage.bbclass @@ -0,0 +1,35 @@ +python __anonymous () { + kerneltypes = set((d.getVar("KERNEL_IMAGETYPE") or "").split()) + kerneltypes |= set((d.getVar("KERNEL_IMAGETYPES") or "").split()) + if any(t.startswith("simpleImage.") for t in kerneltypes): + # Enable building of simpleImage + bb.build.addtask('do_prep_simpleimage', 'do_compile', 'do_configure', d) + uarch = d.getVar("UBOOT_ARCH") + if uarch == "microblaze": + d.appendVarFlag('do_prep_simpleimage', 'depends', ' virtual/dtb:do_populate_sysroot') +} + +do_prep_simpleimage[dirs] += "${B}" +do_prep_simpleimage () { + install -d ${B}/arch/${ARCH}/boot/dts + for type in ${KERNEL_IMAGETYPES} ; do + if [ -z "${type##*simpleImage*}" ] && [ ${ARCH} = "microblaze" ]; then + ext="${type##*.}" + # Microblaze simpleImage only works with dts file + cp ${RECIPE_SYSROOT}/boot/devicetree/${ext}.dts ${B}/arch/${ARCH}/boot/dts/ + fi + done +} + +do_deploy:append () { + for type in ${KERNEL_IMAGETYPES} ; do + if [ -z "${type##*simpleImage*}" ] && [ ${ARCH} = "microblaze" ]; then + base_name=${type}-${KERNEL_IMAGE_NAME} + install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.strip $deployDir/${base_name}.strip + install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.unstrip $deployDir/${base_name}.unstrip + symlink_name=${type}-${KERNEL_IMAGE_LINK_NAME} + ln -sf ${base_name}.strip $deployDir/${symlink_name}.strip + ln -sf ${base_name}.unstrip $deployDir/${symlink_name}.unstrip + fi + done +} diff --git a/meta-xilinx-core/classes/qemuboot-xilinx.bbclass b/meta-xilinx-core/classes/qemuboot-xilinx.bbclass new file mode 100644 index 00000000..7466ab5e --- /dev/null +++ b/meta-xilinx-core/classes/qemuboot-xilinx.bbclass @@ -0,0 +1,140 @@ + +# enable the overrides for the context of the conf only +OVERRIDES .= ":qemuboot-xilinx" + +# Default machine targets for Xilinx QEMU (FDT Generic) +# Allow QB_MACHINE to be overridden by a BSP config +QB_MACHINE ?= "${QB_MACHINE_XILINX}" +QB_RNG="" +QB_MACHINE_XILINX:aarch64 = "-machine arm-generic-fdt" +QB_MACHINE_XILINX:arm = "-M arm-generic-fdt-7series" +QB_MACHINE_XILINX:microblaze = "-M microblaze-fdt-plnx" + +QB_SYSTEM_NAME ?= "${@qemu_target_binary(d)}" +QB_DEFAULT_FSTYPE ?= "${@qemu_rootfs_params(d,'fstype')}" +QB_ROOTFS ?= "${@qemu_rootfs_params(d,'rootfs')}" +QB_ROOTFS_OPT ?= "${@qemu_rootfs_params(d,'rootfs-opt')}" +QB_DTB ?= "${@qemu_default_dtb(d)}" + +# defaults +QB_DEFAULT_KERNEL ?= "none" +QB_DEFAULT_KERNEL:zynq ?= "${@'zImage' if \ + d.getVar('INITRAMFS_IMAGE_BUNDLE') != '1' else 'zImage-initramfs-${MACHINE}.bin'}" +QB_DEFAULT_KERNEL:microblaze ?= "${@'simpleImage.mb' if \ + d.getVar('INITRAMFS_IMAGE_BUNDLE') != '1' else 'simpleImage.mb-initramfs-${MACHINE}.bin'}" + +inherit qemuboot + +def qemu_target_binary(data): + package_arch = data.getVar("PACKAGE_ARCH") + qemu_target_binary = (data.getVar("QEMU_TARGET_BINARY_%s" % package_arch) or "") + if qemu_target_binary: + return qemu_target_binary + + target_arch = data.getVar("TARGET_ARCH") + if target_arch == "microblazeeb": + target_arch = "microblaze" + elif target_arch == "aarch64": + target_arch += "-multiarch" + elif target_arch == "arm": + target_arch = "aarch64" + return "qemu-system-%s" % target_arch + +def qemu_add_extra_args(data): + initramfs_image = data.getVar('INITRAMFS_IMAGE') or "" + bundle_image = data.getVar('INITRAMFS_IMAGE_BUNDLE') or "" + deploy_dir = data.getVar('DEPLOY_DIR_IMAGE') or "" + machine_name = data.getVar('MACHINE') or "" + soc_family = data.getVar('SOC_FAMILY') or "" + qb_extra_args = '' + # Add kernel image and boot.scr to qemu boot command when initramfs_image supplied + kernel_name = '' + bootscr_image = '%s/boot.scr' % deploy_dir + if soc_family in ('zynqmp', 'versal'): + kernel_name = 'Image' + bootscr_loadaddr = '0x20000000' + if initramfs_image: + kernel_image = '%s/%s' % (deploy_dir, kernel_name) + if bundle_image == "1": + kernel_image = '%s/%s-initramfs-%s.bin' % (deploy_dir, kernel_name, machine_name) + kernel_loadaddr = '0x200000' + if kernel_name: + qb_extra_args = ' -device loader,file=%s,addr=%s,force-raw=on' % (kernel_image, kernel_loadaddr) + qb_extra_args += ' -device loader,file=%s,addr=%s,force-raw=on' % (bootscr_image, bootscr_loadaddr) + if soc_family == 'versal': + qb_extra_args += ' -boot mode=5' + else: + if soc_family in ('zynqmp', 'versal'): + qb_extra_args = ' -boot mode=5' + return qb_extra_args + +def qemu_rootfs_params(data, param): + initramfs_image = data.getVar('INITRAMFS_IMAGE') or "" + bundle_image = data.getVar('INITRAMFS_IMAGE_BUNDLE') or "" + soc_family = data.getVar('SOC_FAMILY') or "" + tune_features = (data.getVar('TUNE_FEATURES') or []).split() + if 'microblaze' in tune_features: + soc_family = 'microblaze' + soc_variant = data.getVar('SOC_VARIANT') or "" + + if param == 'rootfs': + return 'none' if bundle_image == "1" else '' + + elif param == 'fstype': + fstype_dict = { + "microblaze": "cpio.gz", + "zynq": "cpio.gz", + "zynqmp": "cpio.gz.u-boot", + "versal": "cpio.gz.u-boot.qemu-sd-fatimg" + } + if not initramfs_image: + image_fs = data.getVar('IMAGE_FSTYPES') + if 'wic.qemu-sd' in image_fs: + return 'wic.qemu-sd' + if soc_family not in fstype_dict: + return "" + return fstype_dict[soc_family] + + elif param == 'rootfs-opt': + sd_index = "1" + if soc_family == 'zynq': + sd_index = "0" + if soc_family == 'versal' and soc_variant == 'net': + sd_index = "0" + + # Device is using a disk + if not initramfs_image: + return ' -drive if=sd,index=%s,file=@ROOTFS@,format=raw' % (sd_index) + + # Device is using a ramdisk + if soc_family not in ('zynq', 'microblaze'): + return ' -device loader,file=@ROOTFS@,addr=0x04000000,force-raw=on' + + # Ramdisk must be compiled into the kernel + return '' + +def qemu_default_dtb(data): + if data.getVar("IMAGE_BOOT_FILES", True): + dtbs = data.getVar("IMAGE_BOOT_FILES", True).split(" ") + # IMAGE_BOOT_FILES has extra renaming info in the format '<source>;<target>' + # Note: Wildcard sources work here only because runqemu expands them at run time + dtbs = [f.split(";")[0] for f in dtbs] + dtbs = [f for f in dtbs if f.endswith(".dtb")] + if len(dtbs) != 0: + return dtbs[0] + return "" + +def qemu_default_serial(data): + if data.getVar("SERIAL_CONSOLES", True): + first_console = data.getVar("SERIAL_CONSOLES", True).split(" ")[0] + speed, console = first_console.split(";", 1) + # zynqmp uses earlycon and stdout (in dtb) + if "zynqmp" in data.getVar("MACHINEOVERRIDES", True).split(":"): + return "" + return "console=%s,%s earlyprintk" % (console, speed) + return "" + +def qemu_zynqmp_unhalt(data, multiarch): + if multiarch: + return "-global xlnx,zynqmp-boot.cpu-num=0 -global xlnx,zynqmp-boot.use-pmufw=true" + return "-device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4" diff --git a/meta-xilinx-core/classes/xilinx-deprecated.bbclass b/meta-xilinx-core/classes/xilinx-deprecated.bbclass new file mode 100644 index 00000000..1aee2fe1 --- /dev/null +++ b/meta-xilinx-core/classes/xilinx-deprecated.bbclass @@ -0,0 +1,18 @@ +# Class to add a deprecated warning from various configuration files. + +# Immediately after the ConfigParsed event handler, warn the user of any +# deprecated files the user has used. +addhandler xilinx_deprecated_config_eventhandler +xilinx_deprecated_config_eventhandler[eventmask] = "bb.event.ConfigParsed" +python xilinx_deprecated_config_eventhandler () { + # Check for BOARD & BOARD_VARIANT usage + if d.getVar('BOARD') or d.getVar('BOARD_VARIANT'): + bb.error("Deprecated BOARD (%s) or BOARD_VARIANT (%s) is being used, they are no longer supported and are ignored." % (d.getVar('BOARD'), d.getVar('BOARD_VARIANT'))) + + msg_list = d.getVarFlags('XILINX_DEPRECATED') or [] + for msg_source in msg_list: + if msg_source == "doc": + continue + msg = d.getVarFlag('XILINX_DEPRECATED', msg_source) or "" + bb.warn('%s: %s' % (msg_source, msg)) +} diff --git a/meta-xilinx-bsp/classes/xilinx-fetch-restricted.bbclass b/meta-xilinx-core/classes/xilinx-fetch-restricted.bbclass index a778ec7d..a778ec7d 100644 --- a/meta-xilinx-bsp/classes/xilinx-fetch-restricted.bbclass +++ b/meta-xilinx-core/classes/xilinx-fetch-restricted.bbclass diff --git a/meta-xilinx-core/classes/xilinx-microblaze.bbclass b/meta-xilinx-core/classes/xilinx-microblaze.bbclass new file mode 100644 index 00000000..ed231a3a --- /dev/null +++ b/meta-xilinx-core/classes/xilinx-microblaze.bbclass @@ -0,0 +1,11 @@ +# Class to add a deprecated warning from various configuration files. + +# Immediately after the ConfigParsed event handler, warn the user of any +# deprecated files the user has used. +addhandler xilinx_microblaze_config_eventhandler +xilinx_microblaze_config_eventhandler[eventmask] = "bb.event.ConfigParsed" +python xilinx_microblaze_config_eventhandler () { + if d.getVar('DEFAULTTUNE').startswith('microblaze'): + if 'xilinx-microblaze' not in d.getVar('BBFILE_COLLECTIONS').split(): + bb.fatal('You must include the meta-microblaze layer to build for this configuration.') +} diff --git a/meta-xilinx-bsp/classes/xilinx-platform-init.bbclass b/meta-xilinx-core/classes/xilinx-platform-init.bbclass index 5d099500..99f7863a 100644 --- a/meta-xilinx-bsp/classes/xilinx-platform-init.bbclass +++ b/meta-xilinx-core/classes/xilinx-platform-init.bbclass @@ -9,6 +9,6 @@ PLATFORM_INIT_STAGE_DIR = "${STAGING_DIR_HOST}${PLATFORM_INIT_DIR}" # Target files use for platform init PLATFORM_INIT_FILES ?= "" -PLATFORM_INIT_FILES_zynq = "ps7_init_gpl.c ps7_init_gpl.h" -PLATFORM_INIT_FILES_zynqmp = "psu_init_gpl.c psu_init_gpl.h" +PLATFORM_INIT_FILES:zynq = "ps7_init_gpl.c ps7_init_gpl.h" +PLATFORM_INIT_FILES:zynqmp = "psu_init_gpl.c psu_init_gpl.h" diff --git a/meta-xilinx-core/classes/xilinx-testimage.bbclass b/meta-xilinx-core/classes/xilinx-testimage.bbclass new file mode 100644 index 00000000..74020da1 --- /dev/null +++ b/meta-xilinx-core/classes/xilinx-testimage.bbclass @@ -0,0 +1,10 @@ +inherit testimage + +HOSTTOOLS += 'ip ping ps scp ssh stty' + +python do_testimage:prepend () { + from oeqa.core.target.qemu import supported_fstypes + supported_fstypes.append('wic.qemu-sd') +} + +IMAGE_FSTYPES = "wic.qemu-sd" diff --git a/meta-xilinx-core/classes/xilinx-vars.bbclass b/meta-xilinx-core/classes/xilinx-vars.bbclass new file mode 100644 index 00000000..51d3cd87 --- /dev/null +++ b/meta-xilinx-core/classes/xilinx-vars.bbclass @@ -0,0 +1,32 @@ +# Check variable usage to make sure that the machine is probably configured +# properly. +addhandler xilinx_variables_config_eventhandler +xilinx_variables_config_eventhandler[eventmask] = "bb.event.ConfigParsed" + +# It's up to the base sytem to define the variables being used here, we're +# only going to check them. +python xilinx_variables_config_eventhandler () { + # Verify HDF_MACHINE + hdf_prior = d.getVar('HDF_MACHINE_PRIOR') + hdf_final = d.getVar('HDF_MACHINE') + + if hdf_prior and hdf_prior != hdf_final: + bb.fatal("HDF_MACHINE is set to %s, it appears you intended %s. " \ + "This is usually as a result of specifying it in the local.conf or before the 'require' in the machine .conf file. " \ + "See meta-xilinx-core/conf/machine/README." % (hdf_final, hdf_prior)) + + # Verify DEFAULTTUNE + tune_prior = d.getVar('DEFAULTTUNE_PRIOR') + tune_final = d.getVar('DEFAULTTUNE') + + if tune_prior and tune_prior != tune_final: + bb.fatal("The loaded DEFAULTTUNE is %s, but it appears you intended %s. " \ + "This is usually as a result of specifying it after the 'require' in the machine .conf file. " \ + "See meta-xilinx-core/conf/machine/README." % (tune_prior, tune_final)) + + # Verify 'xilinx' is in LICENSE_FLAGS_ACCEPTED + license_flags = d.getVar('LICENSE_FLAGS_ACCEPTED') or "" + if 'xilinx' not in license_flags.split(): + bb.warn("The ZynqMP pmu-rom is not enabled, qemu may not be able to emulate a ZynqMP system without it. " \ + "To enable this you must add 'xilinx' to the LICENSE_FLAGS_ACCEPTED to indicate you accept the software license.") +} diff --git a/meta-xilinx-core/conf/layer.conf b/meta-xilinx-core/conf/layer.conf new file mode 100644 index 00000000..b9804261 --- /dev/null +++ b/meta-xilinx-core/conf/layer.conf @@ -0,0 +1,82 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have a packages directory, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb" +BBFILES += "${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "xilinx" +BBFILE_PATTERN_xilinx = "^${LAYERDIR}/" +BBFILE_PRIORITY_xilinx = "5" + +BBFILES_DYNAMIC += " \ +openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bb \ +openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bbappend \ +meta-python:${LAYERDIR}/dynamic-layers/meta-python/recipes-*/*/*.bb \ +meta-python:${LAYERDIR}/dynamic-layers/meta-python/recipes-*/*/*.bbappend \ +openamp-layer:${LAYERDIR}/dynamic-layers/openamp-layer/recipes-*/*/*.bb \ +openamp-layer:${LAYERDIR}/dynamic-layers/openamp-layer/recipes-*/*/*.bbappend \ +virtualization-layer:${LAYERDIR}/dynamic-layers/virtualization-layer/recipes-*/*/*.bb \ +virtualization-layer:${LAYERDIR}/dynamic-layers/virtualization-layer/recipes-*/*/*.bbappend \ +xilinx-tools:${LAYERDIR}/dynamic-layers/meta-xilinx-tools/recipes-*/*/*.bb \ +xilinx-tools:${LAYERDIR}/dynamic-layers/meta-xilinx-tools/recipes-*/*/*.bbappend \ +" + +LAYERDEPENDS_xilinx = "core" +LAYERRECOMMENDS_xilinx = "openembedded-layer" + +LAYERSERIES_COMPAT_xilinx = "scarthgap" + +SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \ + *->xrt \ + *->zocl \ + *->cairo \ + *->libepoxy \ + *->gstreamer1.0-plugins-base \ + *->gtk+ \ + *->gtk+3 \ + *->libglu \ + *->libsdl \ + *->libsdl2 \ + *->qemu \ + *->xserver-xorg \ +" + +XILINX_RELEASE_VERSION ??= "v2023.2" + +BUILDCFG_VARS:append = " SOC_VARIANT XILINX_RELEASE_VERSION" + +XILINX_QEMU_VERSION[v2022.1] = "v7.1.0-xilinx-v2022.1%" +XILINX_QEMU_VERSION[v2022.2] = "v7.1.0-xilinx-v2022.2%" +XILINX_QEMU_VERSION[v2023.1] = "v7.1.0-xilinx-v2023.1%" +XILINX_QEMU_VERSION[v2023.2] = "v7.1.0-xilinx-v2023.2%" +PREFERRED_VERSION_qemu-xilinx ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" +PREFERRED_VERSION_qemu-xilinx-native ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" +PREFERRED_VERSION_qemu-xilinx-system-native ?= "${@d.getVarFlag('XILINX_QEMU_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" +PREFERRED_VERSION_qemu-devicetrees ?= "xilinx-${XILINX_RELEASE_VERSION}%" + +DEFAULT_XILINX_QEMU = "qemu-xilinx" +DEFAULT_XILINX_QEMU:arm = "qemu" +PREFERRED_PROVIDER_qemu ?= "${DEFAULT_XILINX_QEMU}" + +XILINX_ATF_VERSION[v2023.1] = "2.8-xilinx-v2023.1%" +XILINX_ATF_VERSION[v2023.2] = "2.8-xilinx-v2023.2%" +PREFERRED_VERSION_arm-trusted-firmware ?= "${@d.getVarFlag('XILINX_ATF_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" + +XILINX_UBOOT_VERSION[v2023.1] = "v2023.01-xilinx-v2023.1%" +XILINX_UBOOT_VERSION[v2023.2] = "v2023.01-xilinx-v2023.2%" + +PREFERRED_VERSION_u-boot-xlnx ?= "${@d.getVarFlag('XILINX_UBOOT_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" +PREFERRED_VERSION_u-boot-tools-xlnx ?= "${@d.getVarFlag('XILINX_UBOOT_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" + +XILINX_LINUX_VERSION[v2022.1] = "5.15.19-xilinx-v2022.1%" +XILINX_LINUX_VERSION[v2022.2] = "5.15.36-xilinx-v2022.2%" +XILINX_LINUX_VERSION[v2023.1] = "6.1.30-xilinx-v2023.1%" +XILINX_LINUX_VERSION[v2023.2] = "6.1.60-xilinx-v2023.2%" +PREFERRED_VERSION_linux-xlnx ?= "${@d.getVarFlag('XILINX_LINUX_VERSION', d.getVar('XILINX_RELEASE_VERSION')) or 'undefined'}" + +# Add support to eSDK for gen-machine-conf if it exists +PLNX_SCRIPTS_PATH = "${LAYERDIR}/gen-machine-conf/gen-machine-scripts" +BB_HASHEXCLUDE_COMMON:append = " PLNX_SCRIPTS_PATH" + +IMAGE_CLASSES += "gen-machine-conf" diff --git a/meta-xilinx-core/conf/machine/README b/meta-xilinx-core/conf/machine/README new file mode 100644 index 00000000..de8cf58d --- /dev/null +++ b/meta-xilinx-core/conf/machine/README @@ -0,0 +1,224 @@ +Xilinx Machines +=============== + +Xilinx uses an inheritence model to define defaults in a heirarchical +model. This allows for machines to include other machines and then +override defaults. + +For example, a carrier board with a system on module using a zynqmp ev +can be implements as: + +k26_kv -> k26 -> zynqmp-ev-generic -> zynqmp-generic + +The above needs to result MACHINEOVERRIDES and PACKAGE_ARCHS that include +all 4 machines. This facilitates sstate-cache and binary distribution +package re-use. + +To accomplish this, each machine.conf file should contain the following +preamble and postamble. This ensures that the machine overrides and +package archs can be extended by another machine configuration file. + +#### Preamble +MACHINEOVERRIDES =. "${@['', '<machine>:']['<machine>' != '${MACHINE}']}" +#### Regular settings follow + + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' <machine_arch>']['<machine>' != "${MACHINE}"]}" + + +Between the Preamble and Postamble, you should "require" the machine +configuration that your machine is based on. After the 'require' is where +most variables should be defined. (See variable requirements at the end +of this document.) This will allow you to extend other configurations +to match your specific requirements. Values should be set using = and ++=, but not :append or :prepend. This allows a machine inheriting your +machine file to add or overwrite the value easily. Such as: + +Typical case example (my-example.conf): + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'my-example:']['my-example' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/zynqmp-generic.conf + +HDF_MACHINE = "zcu102-zynqmp" +MACHINE_FEATURES += "pci" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' my_example']['my-example' != "${MACHINE}"]}" + + +A few variable must be set BEFORE the requires, DEFAULTTUNE for example. +(See variable requirements at the end of this document.) Usually ?= is the +correct way to set these, as the machine inheriting your machine may need +to override the value. + +Example of defaulttune override: + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'my-example:']['my-example' != '${MACHINE}']}" +#### Regular settings follow + +DEFAULTTUNE ?= "aarch64" + +require conf/machine/zynqmp-generic.conf + +HDF_MACHINE = "zcu102-zynqmp" +MACHINE_FEATURES += "pci" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' my_example']['my-example' != "${MACHINE}"]}" + + +Additionally, for microblaze you may need to define a specific microblaze +tune-features. Like DEFAULTTUNE, this needs to be set before the require line. + +Example of microblaze tune override: + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'my-example:']['my-example' != '${MACHINE}']}" +#### Regular settings follow + +TUNE_FEATURES:tune-microblaze ?= "microblaze v8.50 barrel-shift reorder pattern-compare divide-hard multiply-high fpu-hard" + +require conf/machine/microblaze-generic.conf + +HDF_MACHINE = "ml605" +SERIAL_CONSOLE = "115200,ttyUL0" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' my_example']['my-example' != "${MACHINE}"]}" + + +Variable Requirements +===================== + +The question has been raised why we don't use ?= or ??= for all default +values, instead we rely on specific ordering of the override components? + +This is done intentionally, as it forces the user to create a new machine +configuration file to extend their system. In the past, it was common +for people to just set values in their local.conf file, but this lead to +problems reproducing success and failures, as well as trying to support +the overall configuration. Moving to a model where most variables must +be added to, or replaced after the require has simplified this model. +There are a few exception, these will be covered first. + +The following variables must be set using ?= BEFORE the 'require' line +of the inherited base machine .conf file. This is due to them being +used to control inclusion of tune data. + +DEFAULTTUNE - Default Tune for this machine + +TUNEFILE[<tune>] - The tune file, based on DEFAULTTUNE, to load + +For DEFAULTTUNE, see the Yocto Project documentation. For +TUNEFILE[<tune>] see include/soc-tune-include.inc for the defined ones. + + +The following variables should be set using ?= BEFORE the 'require' line +of the inherited base machine .conf file, if the user may override them. +If the values are fixed, then it should be set after the requires per +the next section. + +These are common values a user may want to override and will let the user +easiy make a local change, if allowed by the machine .conf: + +UBOOT_MACHINE - The defconfig for u-boot. (Note, this may be an error TBD). + +SOC_VARIANT - See include/soc-*.inc (Note, most machines this is fixed). + + +The following variables must be set AFTER the 'require' line, using '=' +or '+='/'=+' as required. Using ':append', ':prepend', or ':remove' will +prevent an inheriting machine from overriding that value. Similarly +you should not use :<machine> override values for the same reason. Note, +not every machine file will have all of these variables, only the ones +you need to override should be set. + +Variables set before required inclusion file: +Variables that changes based on hw design or board specific requirement must be +set before required inclusion file else pre-expansion value defined in generic +machine conf will be set. This way user can also override these variables from +local.conf + +System wide setting: +TUNE_FEATURES:tune-<tune> - Specific tune features + +external-hdf recipe from meta-xilinx-tools: +HDF_MACHINE - Machine to load from reference defign xsa using hdf-examples recipe +HDF_EXT - Only ".xsa" externsion is supported, legacy variable. +HDF_BASE - Download protocol (file://, git://, http:// or https://) protocol if + not using the default external-hdf repository. +HDF_PATH - Path to the repository or XSA file + +fs-boot recipe from meta-xilinx-tools: +YAML_SERIAL_CONSOLE_STDIN:pn-fs-boot - YAML based uart stdin configuration for +MicroBlaze. Example: axi_uartlite_0 or axi_uart16550_0 etc,. +YAML_SERIAL_CONSOLE_STDOUT:pn-fs-boot - YAML based uart stdout configuration for +MicroBlaze. Example: axi_uartlite_0 or axi_uart16550_0 etc,. +YAML_MAIN_MEMORY_CONFIG:pn-fs-boot - YAML based DDR4 or MIG configuration for +MicroBlaze. Example: DDR4_0 or MIG_7SERIES_0 etc,. +YAML_FLASH_MEMORY_CONFIG:pn-fs-boot - YAML based flash configuration for +MicroBlaze. Example: axi_emc_0 or axi_quad_spi_0 etc,. +XSCTH_PROC:pn-fs-boot - Processor IP used while configuring embeddedsw compoments. +Example: microblaze_0 or microblaze_1 etc,. + +fsbl-firmware recipe from meta-xilinx-tools: +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware - YAML based FSBL uart stdin configuration +for Zynq-7000 and ZynqMP devices. +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware - YAML based FSBL uart stdout configuration +for Zynq-7000 and ZynqMP devices. + +pmu-firmware recipe from meta-xilinx-tools: +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware - YAML based PMUFW uart stdin configuration +for ZynqMP devices. +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware - YAML based PMUFW uart stdout configuration +for ZynqMP devices. + +plm-firmware recipe from meta-xilinx-tools: +YAML_SERIAL_CONSOLE_STDIN:pn-plm-firmware - YAML based PLM uart stdin configuration +for Versal devices. +YAML_SERIAL_CONSOLE_STDOUT:pn-fplmsbl-firmware - YAML based PLM uart stdout +configuration for Versal devices. + +device-tree recipe from meta-xilinx-tools: +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree - YAML based uart console configuration +for all device families. Example: axi_uartlite_0 or psu_uart_0 etc,. +YAML_MAIN_MEMORY_CONFIG:pn-device-tree - YAML based memory configuration for all +device families. Example: DDR4_0 or PS7_DDR_0 or PSU_DDR_0 etc,. +XSCTH_PROC:pn-device-tree - Processor IP used while configuring device-tree +compoments. Example: microblaze_0 or microblaze_1 etc,. +YAML_DT_BOARD_FLAGS:pn-device-tree - YAML based configuration for setting eval +board specific dtsi files available in DTG repo. + +arm-trusted-firmware recipe from meta-xilinx-core: +ATF_CONSOLE - Uart console configuration for all aarch64 device families. +Example: pl011 or cadence or cadence1 etc,. +TFA_BL33_LOAD - BL33 preloadded base address to EXTRA_OEMAKE for aarch64. + +u-boot-xlnx recipe from meta-xilinx-core: +UBOOT_MACHINE - Name of the defconfig to use +HAS_PLATFORM_INIT - List of defconfig files available for u-boot only for SPL boot. + +u-boot-xlnx-scr recipe from meta-xilinx-core: +DDR_BASEADDR - Base address for DDR used for loading the images from u-boot env. +SKIP_APPEND_BASEADDR - Skip appending ${DDR_BASEADDR} for image offsets. + +Varibable set after required inclusion file: +Varibables that does not intend to change must be set before required inclusion +file. + +external-hdf recipe from meta-xilinx-tools: +HDF_MACHINE - Used by the recipe to find the correct XSA +HDF_EXT - only xsa is supported, legacy variable +HDF_BASE - protocol if not using the default external-hdf repository +HDF_PATH - path to the repository or XSA file + +...and more... diff --git a/meta-xilinx-core/conf/machine/include/README b/meta-xilinx-core/conf/machine/include/README new file mode 100644 index 00000000..38596d0f --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/README @@ -0,0 +1,32 @@ +The files in this directory make up the infrastructure that defines +a Xilinx FPGA based system. + +A machine.conf is expected to require the soc-<soc>.inc or +soc-tune-include.inc file, followed by machine-xilinx-default.inc. +Additionally, machine-xilinx-qemu.inc should be required if the +machine supports QEMU. Each of the 'generic' machines include +these files. + +Doing the above, will ensure that someone can use the machine.conf +in a multiconf setting by simply adjusting DEFAULTTUNE and/or +other basic parameters. + +soc-tune-include.inc - Load the correct tune file based on DEFAULTTUNE + +xilinx-microblaze.inc - Microblaze architecture settings, loaded by + soc-tune-include.inc + +soc-versal.inc - Set the defaults for Versal, includes soc-tune-include + +soc-zynq.inc - Set the defaults for Zynq, includes soc-tune-include + +soc-zynqmp.inc - Set the defaults for ZynqMP, includes soc-tune-include + +machine-xilinx-default - Set Xilinx FPGA wide defaults, all machines + should require this file. It defines correct + PREFERRED_PROVIDER for various components, as well as + other settings. + +machine-xilinx-qemu - Settings required for qemu-xilinx support. + +xilinx-board-*.inc - DEPRECATED - enabled BOARD and BOARD_VARIANT diff --git a/meta-xilinx-core/conf/machine/include/machine-xilinx-default.inc b/meta-xilinx-core/conf/machine/include/machine-xilinx-default.inc new file mode 100644 index 00000000..e99b1f0e --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/machine-xilinx-default.inc @@ -0,0 +1,138 @@ +# HDF_MACHINE should be set _AFTER_ this has been loaded +HDF_MACHINE_PRIOR := "${HDF_MACHINE}" +INHERIT += "xilinx-vars" +INHERIT += "xilinx-deprecated" + +# Default Xilinx BSP Machine settings + +MACHINE_FEATURES_BACKFILL_CONSIDERED += "rtc" + +# File System Configuration +IMAGE_FSTYPES ?= "tar.gz cpio cpio.gz cpio.gz.u-boot" + +# Kernel Configuration +PREFERRED_PROVIDER_virtual/kernel ??= "linux-xlnx" + +# Device tree Configuration +PREFERRED_PROVIDER_virtual/dtb ??= "device-tree" + +# U-Boot Configuration +PREFERRED_PROVIDER_virtual/bootloader ??= "u-boot-xlnx" +PREFERRED_PROVIDER_virtual/boot-bin ??= "xilinx-bootbin" +PREFERRED_PROVIDER_u-boot-tools ??= "u-boot-tools-xlnx" +PREFERRED_PROVIDER_u-boot-tools-native ??= "u-boot-tools-xlnx-native" +PREFERRED_PROVIDER_nativesdk-u-boot-tools ??= "nativesdk-u-boot-tools-xlnx" + +do_image_wic[depends] += "${@' '.join('%s:do_deploy' % r for r in (d.getVar('WIC_DEPENDS') or "").split())}" + +UBOOT_SUFFIX ?= "bin" + +UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" +UBOOT_ELF ?= "u-boot" +UBOOT_ELF:aarch64 ?= "u-boot.elf" + +# libmali is selected by DISTRO_FEATURE of libmali & MACHINE_FEATURES of mali400 +# lima is selected by DISTRO_FEATURE != libmali & MACHINE_FEATURES of mali400 +# default mesa because otherwise +def xlnx_is_libmali_enabled(d): + if bb.utils.contains('MACHINE_FEATURES', 'mali400', '1', '', d) == '1': + if bb.utils.contains('DISTRO_FEATURES', 'libmali', '1', '', d) == '1': + return True + return False + +# libmali requires certain preferred providers to be selected +PREFERRED_PROVIDER_virtual/egl ?= "${@'libmali-xlnx' if xlnx_is_libmali_enabled(d) else 'mesa'}" +PREFERRED_PROVIDER_virtual/libgl ?= "${@'mesa-gl' if xlnx_is_libmali_enabled(d) else 'mesa'}" +PREFERRED_PROVIDER_virtual/libgles1 ?= "${@'libmali-xlnx' if xlnx_is_libmali_enabled(d) else 'mesa'}" +PREFERRED_PROVIDER_virtual/libgles2 ?= "${@'libmali-xlnx' if xlnx_is_libmali_enabled(d) else 'mesa'}" +PREFERRED_PROVIDER_virtual/libgles3 ?= "${@'NOT_SUPPORTED' if xlnx_is_libmali_enabled(d) else 'mesa'}" +PREFERRED_PROVIDER_virtual/libgbm ?= "${@'libmali-xlnx' if xlnx_is_libmali_enabled(d) else 'mesa'}" +PREFERRED_PROVIDER_virtual/mesa ?= "${@'mesa-gl' if xlnx_is_libmali_enabled(d) else 'mesa'}" + +XSERVER ?= " \ + xserver-xorg \ + xf86-input-evdev \ + xf86-input-mouse \ + xf86-video-fbdev \ + ${XSERVER_EXT} \ + " + +SYSTEM_DTFILE ??= "" +CONFIG_DTFILE ??= "${SYSTEM_DTFILE}" +FIT_CONF_DEFAULT_DTB ?= "${@os.path.basename(d.getVar('CONFIG_DTFILE')).replace('.dts', '.dtb') if d.getVar('CONFIG_DTFILE') else ''}" + +# Define to avoid parsse errors below if undefind elsewhere +INITRAMFS_IMAGE ??= "" + +# IMAGE_BOOT_FILES is a whitespace-separated list of entries specifying files to be installed into the boot partition +# entries can change the installed filename by specifying the destination name after a semicolon (e.g. u-boot.img;uboot) +# make sure to use the installed filename when scanning IMAGE_BOOT_FILES +IMAGE_BOOT_FILES_INSTALLED = "${@' '.join([x.split(';')[-1] for x in d.getVar('IMAGE_BOOT_FILES').split()])}" + +# Automatically add WKS_FILE_DEPENDS based on the configuration +# Initial value from oe-core/meta/classes-recipe/image_types_wic.bbclass +WKS_FILE_DEPENDS ?= "${WKS_FILE_DEPENDS_DEFAULT} ${WKS_FILE_DEPENDS_BOOTLOADERS}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'boot.bin', ' virtual/boot-bin', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'system.dtb', ' virtual/dtb', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'boot.scr', ' u-boot-xlnx-scr', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'uEnv.txt', ' u-boot-xlnx-uenv', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'atf-uboot.ub', ' arm-trusted-firmware', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'Image', ' virtual/kernel', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'uImage', ' virtual/kernel', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'zImage', ' virtual/kernel', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'u-boot.bin', ' virtual/bootloader', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'u-boot.elf', ' virtual/bootloader', '', d)}" +WKS_FILE_DEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', '${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot', ' ${INITRAMFS_IMAGE}', '', d)}" + +# Automatically add IMAGE_BOOT_FILES to /boot via packages +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'boot.bin', ' ${PREFERRED_PROVIDER_virtual/boot-bin}', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'system.dtb', ' ${PREFERRED_PROVIDER_virtual/dtb}', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'boot.scr', ' u-boot-xlnx-scr', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'uEnv.txt', ' u-boot-xlnx-uenv', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'atf-uboot.ub', ' arm-trusted-firmware', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'u-boot.bin', ' ${PREFERRED_PROVIDER_virtual/bootloader}-bin', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'u-boot.elf', ' ${PREFERRED_PROVIDER_virtual/bootloader}-elf', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'Image', ' kernel-image-image', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'uImage', ' kernel-image-uimage', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', 'zImage', ' kernel-image-zimage', '', d)}" +MACHINE_ESSENTIAL_EXTRA_RDEPENDS .= "${@bb.utils.contains('IMAGE_BOOT_FILES_INSTALLED', '${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot', ' initramdisk-${INITRAMFS_IMAGE}', '', d)}" + +# Default SD card wks file, split /boot and / +WKS_FILES ?= "xilinx-default-sd.wks" + +IMAGE_BOOT_FILES ?= "${@get_default_image_boot_files(d)}" + +def get_default_image_boot_files(d): + files = [] + + # kernel images + kerneltypes = set((d.getVar("KERNEL_IMAGETYPE") or "").split()) + kerneltypes |= set((d.getVar("KERNEL_IMAGETYPES") or "").split()) + kerneltypes |= set((d.getVar("KERNEL_ALT_IMAGETYPE") or "").split()) + for i in kerneltypes: + files.append(i) + + # u-boot image + if d.getVar("UBOOT_BINARY"): + files.append(d.getVar("UBOOT_BINARY")) + + # device trees (device-tree only), these are first as they are likely desired over the kernel ones + if "device-tree" in (d.getVar("PREFERRED_PROVIDER_virtual/dtb") or ""): + files.append("devicetree/*.dtb;devicetree/") + files.append("devicetree/*.dtbo;devicetree/") + + # device trees (kernel only) + if d.getVar("KERNEL_DEVICETREE"): + dtbs = d.getVar("KERNEL_DEVICETREE").split(" ") + dtbs = [os.path.basename(d) for d in dtbs] + for dtb in dtbs: + files.append(dtb) + + return " ".join(files) + +XSERVER_EXT ?= "" + +FPGA_MNGR_RECONFIG_ENABLE ?= "1" + +# This variable is supported only with SysVinit. +SERIAL_CONSOLES_CHECK = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${SERIAL_CONSOLES}', '', d)}" diff --git a/meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc b/meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc new file mode 100644 index 00000000..c450b542 --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/machine-xilinx-qemu.inc @@ -0,0 +1,25 @@ +# This include is used to setup default QEMU and qemuboot config for meta-xilinx +# machines. + +PREFERRED_PROVIDER_qemu-native = "qemu-xilinx-native" +PREFERRED_PROVIDER_qemu-system-native = "qemu-xilinx-system-native" +PREFERRED_PROVIDER_nativesdk-qemu = "nativesdk-qemu-xilinx" + +# enable the overrides for the context of the conf only +MACHINEOVERRIDES =. "qemuboot-xilinx:" + +# depend on qemu-helper-native, which will depend on QEMU +EXTRA_IMAGEDEPENDS += "qemu-system-native qemu-helper-native:do_addto_recipe_sysroot" + +# Use the xilinx specific version for these users +IMAGE_CLASSES += "qemuboot-xilinx" + +# As of Yocto Project nanbield, if a -serial is pass in QB_OPT_APPEND the +# runqemu may add additional null entries or simply skip further setup. +# +# To help us be able to adjust for this behavior add a special +# QB_XILINX_SERIAL that will allow us to define serial ports for qemu +# emulated boards that may not match the standard Linux behavior. +# +QB_XILINX_SERIAL ?= "" +QB_OPT_APPEND += "${QB_XILINX_SERIAL}" diff --git a/meta-xilinx-core/conf/machine/include/soc-tune-include.inc b/meta-xilinx-core/conf/machine/include/soc-tune-include.inc new file mode 100644 index 00000000..b3216426 --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/soc-tune-include.inc @@ -0,0 +1,24 @@ +DEFAULTTUNE ??= "armv8a" + +# Unfortunately various tunefiles don't include each other, so create +# a list of things to require based on the DEFAULTTUNE setting. +TUNEFILE[cortexr5] = "conf/machine/include/arm/armv7r/tune-cortexr5.inc" +TUNEFILE[cortexr5hf] = "conf/machine/include/arm/armv7r/tune-cortexr5.inc" +TUNEFILE[cortexr52] = "conf/machine/include/arm/armv8r/tune-cortexr52.inc" +TUNEFILE[cortexr52hf] = "conf/machine/include/arm/armv8r/tune-cortexr52.inc" +TUNEFILE[cortexa9thf-neon] = "conf/machine/include/arm/armv7a/tune-cortexa9.inc" +TUNEFILE[armv8a] = "conf/machine/include/arm/arch-armv8a.inc" +TUNEFILE[cortexa53] = "conf/machine/include/arm/armv8a/tune-cortexa53.inc" +TUNEFILE[cortexa72] = "conf/machine/include/arm/armv8a/tune-cortexa72.inc" +TUNEFILE[cortexa78] = "conf/machine/include/arm/armv8-2a/tune-cortexa78.inc" +TUNEFILE[cortexa72-cortexa53] = "conf/machine/include/arm/armv8a/tune-cortexa72-cortexa53.inc" +TUNEFILE[cortexa72-cortexa53-crypto] = "conf/machine/include/arm/armv8a/tune-cortexa72-cortexa53.inc" +TUNEFILE[microblaze] = "conf/machine/include/xilinx-microblaze.inc" + +# Capture the defaulttune, to make sure it's been modified in the right order +DEFAULTTUNE_PRIOR := "${DEFAULTTUNE}" + +# Default to arch-armv8a.inc +TUNEFILE = "${@ d.getVarFlag('TUNEFILE', d.getVar('DEFAULTTUNE')) or 'conf/machine/include/arm/arch-armv8a.inc'}" + +require ${TUNEFILE} diff --git a/meta-xilinx-core/conf/machine/include/soc-versal.inc b/meta-xilinx-core/conf/machine/include/soc-versal.inc new file mode 100644 index 00000000..dcf3796e --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/soc-versal.inc @@ -0,0 +1,36 @@ +DEFAULTTUNE ?= "cortexa72-cortexa53" +SOC_FAMILY ?= "versal" + +# Available SOC_VARIANT's for versal: +# "prime" - Versal deafult Prime Devices +# "premium" - Versal Premium Devices +# "hbm" - Versal HMB Devices +# "ai-core" - Versal AI-core Devices +# "ai-edge" - Versal AI-Edge Devices +# "net" - Versal Net Devices + +SOC_VARIANT ?= "prime" + +require xilinx-soc-family.inc +require soc-tune-include.inc + +# Linux Configuration +KERNEL_IMAGETYPE ?= "Image" + +WIC_DEPENDS ?= "virtual/kernel virtual/bootloader virtual/boot-bin virtual/arm-trusted-firmware" + +UBOOT_ELF ?= "u-boot.elf" + +# Default, if multiconfig is off, call plm/psm-firmware directly, otherwise call the versal-fw multiconfig version +# The Linux compatible plm/psm-firmware though requires meta-xilinx-tools +PLM_DEPENDS ??= "" +PLM_MCDEPENDS ??= "" +PLM_DEPLOY_DIR ??= "${DEPLOY_DIR_IMAGE}" +PLM_IMAGE_NAME ??= "plm-${MACHINE}" +PLM_DEPLOY_DIR[vardepsexclude] += "TOPDIR" + +PSM_DEPENDS ??= "" +PSM_MCDEPENDS ??= "" +PSM_FIRMWARE_DEPLOY_DIR ??= "${DEPLOY_DIR_IMAGE}" +PSM_FIRMWARE_IMAGE_NAME ??= "psm-firmware-${MACHINE}" +PSM_DEPLOY_DIR[vardepsexclude] += "TOPDIR" diff --git a/meta-xilinx-core/conf/machine/include/soc-zynq.inc b/meta-xilinx-core/conf/machine/include/soc-zynq.inc new file mode 100644 index 00000000..eea02a6c --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/soc-zynq.inc @@ -0,0 +1,28 @@ +DEFAULTTUNE ?= "cortexa9thf-neon" +SOC_FAMILY ?= "zynq" + +# Available SOC_VARIANT's for zynq: +# 7zs - Zynq-7000 Single A9 Core +# 7z - Zynq-7000 Dual A9 Core + +SOC_VARIANT ?= "7z" + +require xilinx-soc-family.inc +require soc-tune-include.inc + +# Linux Configuration +KERNEL_IMAGETYPE ?= "uImage" +KERNEL_IMAGETYPES += "zImage" + +# WIC Specific dependencies +WIC_DEPENDS ?= "virtual/kernel virtual/bootloader virtual/boot-bin" + +UBOOT_ELF ?= "u-boot.elf" + +# Default, if multiconfig is off, the fsbl is in the regular deploydir, otherwise +# it is located under a multiconfig specific deploydir +FSBL_DEPENDS ?= "${@bb.utils.contains('BBMULTICONFIG', 'fsbl-fw', '', 'fsbl-firmware:do_deploy', d)}" +FSBL_MCDEPENDS ?= "${@bb.utils.contains('BBMULTICONFIG', 'fsbl-fw', 'mc::fsbl-fw:fsbl-firmware:do_deploy', '', d)}" +FSBL_DEPLOY_DIR ?= "${@bb.utils.contains('BBMULTICONFIG', 'fsbl-fw', '${TOPDIR}/tmp-fsbl-fw/deploy/images/${MACHINE}', '${DEPLOY_DIR_IMAGE}', d)}" +FSBL_DEPLOY_DIR[vardepsexclude] += "TOPDIR" +FSBL_IMAGE_NAME ?= "fsbl-${MACHINE}" diff --git a/meta-xilinx-core/conf/machine/include/soc-zynqmp.inc b/meta-xilinx-core/conf/machine/include/soc-zynqmp.inc new file mode 100644 index 00000000..95ac54e2 --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/soc-zynqmp.inc @@ -0,0 +1,50 @@ +DEFAULTTUNE ?= "cortexa72-cortexa53" +SOC_FAMILY ?= "zynqmp" + +# Available SOC_VARIANT's for zynqmp: +# "cg" - Zynq UltraScale+ CG Devices (default lowest common denominator) +# "eg" - Zynq UltraScale+ EG Devices +# "ev" - Zynq UltraScale+ EV Devices +# "dr" - Zynq UltraScale+ DR Devices + +SOC_VARIANT ?= "cg" + +# Add VCU feature on "ev" devices +VCU_MACHINE_FEATURE = "" +VCU_MACHINE_FEATURE:zynqmp-ev = " vcu" +MACHINE_FEATURES .= "${VCU_MACHINE_FEATURE}" + +# Add mali400 a.k.a Mali Utgard, "ev" and "eg" devices +MALI_MACHINE_FEATURE = "" +MALI_MACHINE_FEATURE:zynqmp-eg = " mali400" +MALI_MACHINE_FEATURE:zynqmp-ev = " mali400" +MACHINE_FEATURES .= "${MALI_MACHINE_FEATURE}" + +require xilinx-soc-family.inc + +require soc-tune-include.inc + +# Linux Configuration +KERNEL_IMAGETYPE ?= "Image" + +# Support multilib on zynqmp +DEFAULTTUNE:virtclass-multilib-lib32 ?= "armv7vethf-neon-vfpv4" + +WIC_DEPENDS ?= "virtual/kernel virtual/bootloader virtual/boot-bin virtual/arm-trusted-firmware" + +UBOOT_SUFFIX ?= "bin" + +XSERVER_EXT:zynqmp ?= "xf86-video-armsoc" + +# Default PMU ROM +PMU_ROM ?= "${DEPLOY_DIR_IMAGE}/pmu-rom.elf" + + +# Default expects the user to provide a specific pmu-firwmare in the deploy +# directory, named "pmu-firmware-${MACHINE}.elf" and "pmu-firmware-${MACHINE}.bin" +PMU_DEPENDS ??= "" +PMU_MCDEPENDS ??= "" +PMU_FIRMWARE_DEPLOY_DIR ??= "${DEPLOY_DIR_IMAGE}" +PMU_FIRMWARE_IMAGE_NAME ??= "pmu-firmware-${MACHINE}" + +PMU_FIRMWARE_DEPLOY_DIR[vardepsexclude] += "TOPDIR" diff --git a/meta-xilinx-core/conf/machine/include/xilinx-microblaze.inc b/meta-xilinx-core/conf/machine/include/xilinx-microblaze.inc new file mode 100644 index 00000000..93f7d0d1 --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/xilinx-microblaze.inc @@ -0,0 +1,20 @@ +# Verify meta-microblaze is part of the config! +INHERIT += "xilinx-microblaze" + +# To avoid the require overriding previous defaults we use the override to make this the default +TUNE_FEATURES_save := "${TUNE_FEATURES:tune-microblaze}" + +require conf/machine/include/microblaze/tune-microblaze.inc + +# Reset the default value back to what it was previously set to... +TUNE_FEATURES:tune-microblaze := "${TUNE_FEATURES_save}" + +# Various microblaze architecture defaults + +# microblaze does not get on with pie for reasons not looked into as yet +GCCPIE:microblaze = "" +GLIBCPIE:microblaze = "" +SECURITY_CFLAGS:microblaze = "" +SECURITY_LDFLAGS:microblaze = "" +# Microblaze does not support gnu hash style +LINKER_HASH_STYLE:microblaze = "sysv" diff --git a/meta-xilinx-core/conf/machine/include/xilinx-soc-family.inc b/meta-xilinx-core/conf/machine/include/xilinx-soc-family.inc new file mode 100644 index 00000000..dd54f5c6 --- /dev/null +++ b/meta-xilinx-core/conf/machine/include/xilinx-soc-family.inc @@ -0,0 +1,10 @@ +SOC_VARIANT ??= "" +MACHINEOVERRIDES =. "${@['', '${SOC_FAMILY}-${SOC_VARIANT}:']['${SOC_VARIANT}' != '']}" + +require conf/machine/include/soc-family.inc + +SOC_FAMILY_ARCH ?= "${SOC_FAMILY}" +SOC_VARIANT_ARCH ?= "${@['${SOC_FAMILY}-${SOC_VARIANT}','${SOC_FAMILY}'][d.getVar('SOC_VARIANT')=='']}" + +PACKAGE_EXTRA_ARCHS:append = " ${SOC_FAMILY_ARCH}" +PACKAGE_EXTRA_ARCHS:append = "${@['', ' ${SOC_VARIANT_ARCH}'][d.getVar('SOC_VARIANT_ARCH') != d.getVar('SOC_FAMILY_ARCH')]}" diff --git a/meta-xilinx-core/conf/machine/microblaze-generic.conf b/meta-xilinx-core/conf/machine/microblaze-generic.conf new file mode 100644 index 00000000..8fb40070 --- /dev/null +++ b/meta-xilinx-core/conf/machine/microblaze-generic.conf @@ -0,0 +1,111 @@ +#@TYPE: Machine +#@NAME: microblaze-generic +#@DESCRIPTION: Machine configuration for the microblaze-generic devices + +# Deprecated board config +USE_BOARD = "${@"conf/machine/include/xilinx-board-pre.inc" if d.getVar("BOARD") or d.getVar("BOARD_VARIANT") else ""}" +require ${USE_BOARD} +unset USE_BOARD + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'microblaze-generic:']['microblaze-generic' != '${MACHINE}']}" +#### Regular settings follow + +# Set the default for a modern full feature microblaze... +TUNE_FEATURES:tune-microblaze ?= "microblaze v11.0 pattern-compare barrel-shift divide-hard multiply-high fpu-hard reorder" +DEFAULTTUNE ?= "microblaze" + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in local.conf without machine override will not be reflected. + +# Yocto Microblaze device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "DDR4_0" +DT_PADDING_SIZE:pn-device-tree ?= "0x1000" +DTC_FLAGS:pn-device-tree ?= "" +XSCTH_PROC:pn-device-tree ?= "microblaze_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD kcu105}" + +# Yocto Microblaze FS-Boot variables +YAML_SERIAL_CONSOLE_STDIN:pn-fs-boot ?= "axi_uartlite_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fs-boot ?= "axi_uartlite_0" +YAML_MAIN_MEMORY_CONFIG:pn-fs-boot ?= "DDR4_0" +YAML_FLASH_MEMORY_CONFIG:pn-fs-boot ?= "axi_quad_spi_0" +XSCTH_PROC:pn-fs-boot ?= "microblaze_0" + +# Yocto Microblaze u-boot-xlnx variables +UBOOT_MACHINE ?= "microblaze-generic_defconfig" +UBOOT_INITIAL_ENV = "" +BOOTMODE ?= "generic.root" + +# Yocto Microblaze KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x80000000" +UBOOT_LOADADDRESS ?= "0x80000000" +KERNEL_EXTRA_ARGS += "UIMAGE_LOADADDR=${UBOOT_ENTRYPOINT}" + +# Microblaze Serial Console settings +SERIAL_CONSOLES ?= "115200;ttyUL0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +require conf/machine/include/soc-tune-include.inc +require conf/machine/include/machine-xilinx-default.inc +require conf/machine/include/machine-xilinx-qemu.inc + +# The default MACHINE_ARCH is dynmic for microblaze, since the architecture is not fixed +# Based on core bitbake.conf +DEF_MACHINE_ARCH = "${@[d.getVar('TUNE_PKGARCH'), d.getVar('MACHINE')][bool(d.getVar('MACHINE'))].replace('-', '_')}" +# Enable a dynamic machine_arch +MB_MACHINE_ARCH = "${@[d.getVar('TUNE_PKGARCH'), d.getVar('TUNE_PKGARCH') + '-generic'][bool(d.getVar('MACHINE'))].replace('-', '_')}" + +MACHINE_ARCH = "${@['${MB_MACHINE_ARCH}', '${DEF_MACHINE_ARCH}']['microblaze-generic' != "${MACHINE}"]}" + +# microblaze-generic.conf uses kcu105-microblazeel xsa as reference input. +# User can override with custom xsa using HDF_BASE and HDF_PATH variables from +# local.conf. +HDF_MACHINE = "kcu105-microblazeel" + +MACHINE_FEATURES = "" + +KERNEL_IMAGETYPE ?= "linux.bin.ub" +KERNEL_IMAGETYPES = "" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "${PREFERRED_PROVIDER_virtual/dtb}" + +IMAGE_BOOT_FILES += " \ + ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 'device-tree', 'system.dtb', '', d)} \ + " + +EXTRA_IMAGEDEPENDS += " \ + libyaml-native \ + python3-cython-native \ + python3-pyyaml-native \ + virtual/bitstream \ + virtual/bootloader \ + virtual/elfrealloc \ + u-boot-xlnx-scr \ + " + +IMAGE_FSTYPES += "cpio.gz" + +# Microblaze QEMU Configurations +QB_MEM = "-m 2G" +QB_KERNEL_CMDLINE_APPEND = "console=ttyUL0,115200 root=/dev/ram0 rw" +QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@" + +# This will work with the default runqemu, as the first serial port is the +# correct console +# +# One total serial port defined in this model (according to the generated dts) +# +# hw serial0 axi_uartlite_0 (40600000) - linux serial0 (ttyUL0) +QB_XILINX_SERIAL = "" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' ${MB_MACHINE_ARCH}']['microblaze-generic' != "${MACHINE}"]}" + +# Deprecated board config +USE_BOARD = "${@"conf/machine/include/xilinx-board-post.inc" if d.getVar("BOARD") or d.getVar("BOARD_VARIANT") else ""}" +require ${USE_BOARD} +unset USE_BOARD diff --git a/meta-xilinx-core/conf/machine/versal-ai-core-generic.conf b/meta-xilinx-core/conf/machine/versal-ai-core-generic.conf new file mode 100644 index 00000000..34f57691 --- /dev/null +++ b/meta-xilinx-core/conf/machine/versal-ai-core-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'versal-ai-core-generic:']['versal-ai-core-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/versal-generic.conf + +SOC_VARIANT = "ai-core" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' versal_ai_core_generic']['versal-ai-core-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/versal-ai-edge-generic.conf b/meta-xilinx-core/conf/machine/versal-ai-edge-generic.conf new file mode 100644 index 00000000..bf5523ed --- /dev/null +++ b/meta-xilinx-core/conf/machine/versal-ai-edge-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'versal-ai-edge-generic:']['versal-ai-edge-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/versal-generic.conf + +SOC_VARIANT = "ai-edge" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' versal_ai_edge_generic']['versal-ai-edge-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/versal-generic.conf b/meta-xilinx-core/conf/machine/versal-generic.conf new file mode 100644 index 00000000..2f35ba24 --- /dev/null +++ b/meta-xilinx-core/conf/machine/versal-generic.conf @@ -0,0 +1,120 @@ +#@TYPE: Machine +#@NAME: versal-generic +#@DESCRIPTION: Machine configuration for the versal-generic devices + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'versal-generic:']['versal-generic' != '${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in local.conf without machine override will not be reflected. + +# Yocto Versal device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "CIPS_0_pspmc_0_psv_sbsauart_0" +DT_PADDING_SIZE:pn-device-tree ?= "0x1000" +DTC_FLAGS:pn-device-tree = "-@" +YAML_DT_BOARD_FLAGS ?= "{BOARD versal-vck190-reva-x-ebm-01-reva}" + +# Yocto Versal u-boot-xlnx variables +UBOOT_MACHINE ?= "xilinx_versal_virt_defconfig" +BOOTMODE ?= "generic.root" + +# Yocto Versal arm-trusted-firmware(TF-A) variables +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto Versal PLM variables +YAML_SERIAL_CONSOLE_STDIN:pn-plm-firmware ?= "CIPS_0_pspmc_0_psv_sbsauart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-plm-firmware ?= "CIPS_0_pspmc_0_psv_sbsauart_0" + +# Yocto Versal KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# Versal Serial Console +SERIAL_CONSOLES ?= "115200;ttyAMA0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +require conf/machine/include/soc-versal.inc +require conf/machine/include/machine-xilinx-default.inc +require conf/machine/include/machine-xilinx-qemu.inc + +# versal-generic.conf uses vck190-versal xsa as reference input. +# User can override with custom xsa using HDF_BASE and HDF_PATH variables from +# local.conf. +HDF_MACHINE = "vck190-versal" + +MACHINE_FEATURES += "rtc ext2 ext3 vfat usbhost" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "${PREFERRED_PROVIDER_virtual/dtb}" + +# Default SD image build onfiguration, use qemu-sd to pad +IMAGE_CLASSES += "image-types-xilinx-qemu" +# Add wic.qemu-sd only if initramfs_image not set due to circular dependecies +IMAGE_FSTYPES += "${@'wic.qemu-sd' if (d.getVar('INITRAMFS_IMAGE') or '') == '' else 'cpio.gz.u-boot.qemu-sd-fatimg'}" + +EXTRA_IMAGEDEPENDS += " \ + libyaml-native \ + python3-cython-native \ + python3-pyyaml-native \ + arm-trusted-firmware \ + virtual/boot-bin \ + virtual/bootloader \ + virtual/psm-firmware \ + virtual/plm \ + u-boot-xlnx-scr \ + qemu-devicetrees:do_deploy \ + virtual/cdo:do_deploy \ + " + +IMAGE_BOOT_FILES += " \ + boot.bin \ + ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 'device-tree', 'system.dtb', '', d)} \ + Image \ + boot.scr \ + " + +# Versal QEMU Configurations +# This machine has a QEMU model, runqemu setup: +QB_MEM = "-m 8G" +QB_DEFAULT_KERNEL = "none" +# Iteration appears to be eth0 then eth1 +QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@ -net nic" +QB_KERNEL_CMDLINE_APPEND ?= "" + +QEMU_HW_DTB_PATH = "${DEPLOY_DIR_IMAGE}/qemu-hw-devicetrees/multiarch" +QEMU_HW_DTB_PS = "${QEMU_HW_DTB_PATH}/board-versal-ps-vck190.dtb" +QEMU_HW_DTB_PMC = "${QEMU_HW_DTB_PATH}/board-versal-pmc-vc-p-a2197-00.dtb" + +# Four total serial ports defined in this model (according to the dts) +# +# hw serial0 xps-uartlite (f0110000) - +# hw serial1 ddrmc/xps-uartlite (f0310000) - +# hw serial2 pl011 (ff000000) - linux serial0 (ttyAMA0) +# hw serial3 pl011 (ff010000) - linux serial1 (ttyAMA1) (disabled) +# ? dcc ? - linux serial2 (????) +QB_XILINX_SERIAL = "-serial null -serial null -serial mon:stdio -serial null" + +QB_OPT_APPEND += " \ + -hw-dtb ${QEMU_HW_DTB_PS} \ + ${@qemu_add_extra_args(d)} \ + " + +# PLM instance args +QB_PLM_OPT = " \ + -M microblaze-fdt \ + -device loader,file=${DEPLOY_DIR_IMAGE}/BOOT-${MACHINE}_bh.bin,addr=0xF201E000,force-raw \ + -device loader,addr=0xf0000000,data=0xba020004,data-len=4 \ + -device loader,addr=0xf0000004,data=0xb800fffc,data-len=4 \ + -device loader,file=${DEPLOY_DIR_IMAGE}/CDO/pmc_cdo.bin,addr=0xf2000000,force-raw \ + -device loader,file=${DEPLOY_DIR_IMAGE}/plm-${MACHINE}.elf,cpu-num=1 \ + -device loader,addr=0xF1110624,data=0x0,data-len=4 \ + -device loader,addr=0xF1110620,data=0x1,data-len=4 \ + -hw-dtb ${QEMU_HW_DTB_PMC} \ + -display none \ + " +QB_OPT_APPEND += " -plm-args '${QB_PLM_OPT}'" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' versal_generic']['versal-generic' != "${MACHINE}"]}" diff --git a/meta-xilinx-core/conf/machine/versal-hbm-generic.conf b/meta-xilinx-core/conf/machine/versal-hbm-generic.conf new file mode 100644 index 00000000..23fffcb9 --- /dev/null +++ b/meta-xilinx-core/conf/machine/versal-hbm-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'versal-hbm-generic:']['versal-hbm-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/versal-generic.conf + +SOC_VARIANT = "hbm" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' versal_hbm_generic']['versal-hbm-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/versal-net-generic.conf b/meta-xilinx-core/conf/machine/versal-net-generic.conf new file mode 100644 index 00000000..9945d301 --- /dev/null +++ b/meta-xilinx-core/conf/machine/versal-net-generic.conf @@ -0,0 +1,49 @@ +XILINX_DEPRECATED[versal-net] = "Versal-net is not supported in 2023.2" + +#@TYPE: Machine +#@NAME: versal-net-generic +#@DESCRIPTION: Machine configuration for the versal-net-generic devices + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'versal-net-generic:']['versal-net-generic' != '${MACHINE}']}" +#### Regular settings follow + +# Must be set first, or versal-generic will set it +UBOOT_MACHINE ?= "xilinx_versal_net_virt_defconfig" + +# Yocto Versal Net device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psx_wizard_0_psxl_0_psx_sbsauart_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD versal-net-ipp-rev1.9}" + +# Yocto Versal Net PLM variables +YAML_SERIAL_CONSOLE_STDIN:pn-plm-firmware ?= "psx_wizard_0_psxl_0_psx_sbsauart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-plm-firmware ?= "psx_wizard_0_psxl_0_psx_sbsauart_0" + +# Versal Serial Console +SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;ttyAMA1" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +require conf/machine/versal-generic.conf + +SOC_VARIANT = "net" + +# versal-generic.conf uses vck190-versal xsa as reference input. +# User can override with custom xsa using HDF_BASE and HDF_PATH variables from +# local.conf. +HDF_MACHINE = "versal-net-generic" + +QEMU_HW_DTB_PS = "${QEMU_HW_DTB_PATH}/board-versal-net-psx-spp-1.4.dtb" +QEMU_HW_DTB_PMC = "${QEMU_HW_DTB_PATH}/board-versal-pmx-virt.dtb" + +# Four total serial ports defined in this model (according to the dts) +# +# hw serial0 xps-uartlite (0xf0110000) - +# hw serial1 xps-uartlite (0xf0310000) - +# hw serial2 pl011 (0xf1920000) - linux serial0 (ttyAMA0) +# hw serial3 pl011 (0xf1930000) - linux serial1 (ttyAMA1) +QB_XILINX_SERIAL = "-serial null -serial null -serial mon:stdio -serial null" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' versal_net_generic']['versal-net-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/versal-premium-generic.conf b/meta-xilinx-core/conf/machine/versal-premium-generic.conf new file mode 100644 index 00000000..d785edff --- /dev/null +++ b/meta-xilinx-core/conf/machine/versal-premium-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'versal-premium-generic:']['versal-premium-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/versal-generic.conf + +SOC_VARIANT = "premium" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' versal_premium_generic']['versal-premium-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/versal-prime-generic.conf b/meta-xilinx-core/conf/machine/versal-prime-generic.conf new file mode 100644 index 00000000..94e9b05e --- /dev/null +++ b/meta-xilinx-core/conf/machine/versal-prime-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'versal-prime-generic:']['versal-prime-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/versal-generic.conf + +SOC_VARIANT = "prime" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' versal_prime_generic']['versal-prime-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/zynq-generic.conf b/meta-xilinx-core/conf/machine/zynq-generic.conf new file mode 100644 index 00000000..3dea2012 --- /dev/null +++ b/meta-xilinx-core/conf/machine/zynq-generic.conf @@ -0,0 +1,99 @@ +#@TYPE: Machine +#@NAME: zynq-generic +#@DESCRIPTION: Machine configuration for the zynq-generic devices + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zynq-generic:']['zynq-generic' != '${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in local.conf without machine override will not be reflected. + +# Yocto Zynq-7000 device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "ps7_uart_1" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PS7_DDR_0" +DT_PADDING_SIZE:pn-device-tree ?= "0x1000" +DTC_FLAGS:pn-device-tree = "-@" +YAML_DT_BOARD_FLAGS ?= "{BOARD zc702}" + +# Yocto Zynq-7000 u-boot-xlnx variables +UBOOT_MACHINE ?= "xilinx_zynq_virt_defconfig" +BOOTMODE ?= "generic.root" + +# Yocto Zynq-7000 FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "ps7_uart_1" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "ps7_uart_1" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" +KERNEL_EXTRA_ARGS += "UIMAGE_LOADADDR=${UBOOT_ENTRYPOINT}" + +# Zynq-7000 Serial Console settings +SERIAL_CONSOLES ?= "115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +require conf/machine/include/soc-zynq.inc +require conf/machine/include/machine-xilinx-default.inc +require conf/machine/include/machine-xilinx-qemu.inc + +# zynq-generic.conf uses zc702-zynq7 xsa as reference input. +# User can override with custom xsa using HDF_BASE and HDF_PATH variables from +# local.conf. +HDF_MACHINE = "zc702-zynq7" + +MACHINE_FEATURES += "rtc ext2 ext3 vfat usbhost usbgadget" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "${PREFERRED_PROVIDER_virtual/dtb}" + +EXTRA_IMAGEDEPENDS += " \ + libyaml-native \ + python3-cython-native \ + python3-pyyaml-native \ + virtual/fsbl \ + virtual/boot-bin \ + virtual/bootloader \ + u-boot-xlnx-scr \ + " + +IMAGE_BOOT_FILES += " \ + boot.bin \ + ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 'device-tree', 'system.dtb', '', d)} \ + boot.scr \ + uImage \ + " + +IMAGE_CLASSES += "image-types-xilinx-qemu" +# Add wic.qemu-sd only if initramfs_image not set due to circular dependecies +IMAGE_FSTYPES += "${@'wic.qemu-sd' if (d.getVar('INITRAMFS_IMAGE') or '') == '' else 'cpio.gz'}" + +# Zynq-7000 QEMU Configurations +# This machine has a QEMU model, runqemu setup: +QB_MEM = "-m 1024" +QB_NETWORK_DEVICE = "-net nic,netdev=net0,macaddr=@MAC@" + +QB_KERNEL_ROOT = "/dev/mmcblk0p2" + +# Side effect of not-enabled serial port is we have to lock +# the second (console) to mon:stdio. +# +# Two total serial ports defined in this model (according to the generated dts) +# +# hw uart0 xuartps (e0000000) - +# hw uart1 xuartps (e0001000) - linux serial0 (ttyPS0) +QB_XILINX_SERIAL = "-serial null -serial mon:stdio" + +# Replicate BootROM like behaviour, having loaded SPL and PMU(ROM+FW) +QB_OPT_APPEND += " \ + -device loader,addr=0xf8000008,data=0xDF0D,data-len=4 \ + -device loader,addr=0xf8000140,data=0x00500801,data-len=4 \ + -device loader,addr=0xf800012c,data=0x1ed044d,data-len=4 \ + -device loader,addr=0xf8000108,data=0x0001e008,data-len=4 \ + -device loader,addr=0xF8000910,data=0xF,data-len=0x4 \ + -machine linux=on \ + " + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zynq_generic']['zynq-generic' != "${MACHINE}"]}" diff --git a/meta-xilinx-core/conf/machine/zynqmp-cg-generic.conf b/meta-xilinx-core/conf/machine/zynqmp-cg-generic.conf new file mode 100644 index 00000000..38c9126f --- /dev/null +++ b/meta-xilinx-core/conf/machine/zynqmp-cg-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zynqmp-cg-generic:']['zynqmp-cg-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/zynqmp-generic.conf + +SOC_VARIANT = "cg" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zynqmp_cg_generic']['zynqmp-cg-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/zynqmp-dr-generic.conf b/meta-xilinx-core/conf/machine/zynqmp-dr-generic.conf new file mode 100644 index 00000000..fbe445aa --- /dev/null +++ b/meta-xilinx-core/conf/machine/zynqmp-dr-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zynqmp-dr-generic:']['zynqmp-dr-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/zynqmp-generic.conf + +SOC_VARIANT = "dr" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zynqmp_dr_generic']['zynqmp-dr-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/zynqmp-eg-generic.conf b/meta-xilinx-core/conf/machine/zynqmp-eg-generic.conf new file mode 100644 index 00000000..33375b46 --- /dev/null +++ b/meta-xilinx-core/conf/machine/zynqmp-eg-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zynqmp-eg-generic:']['zynqmp-eg-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/zynqmp-generic.conf + +SOC_VARIANT = "eg" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zynqmp_eg_generic']['zynqmp-eg-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/zynqmp-ev-generic.conf b/meta-xilinx-core/conf/machine/zynqmp-ev-generic.conf new file mode 100644 index 00000000..f2ffe40f --- /dev/null +++ b/meta-xilinx-core/conf/machine/zynqmp-ev-generic.conf @@ -0,0 +1,12 @@ +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zynqmp-ev-generic:']['zynqmp-ev-generic' != '${MACHINE}']}" +#### Regular settings follow + +require conf/machine/zynqmp-generic.conf + +SOC_VARIANT = "ev" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zynqmp_ev_generic']['zynqmp-ev-generic' != "${MACHINE}"]}" + diff --git a/meta-xilinx-core/conf/machine/zynqmp-generic.conf b/meta-xilinx-core/conf/machine/zynqmp-generic.conf new file mode 100644 index 00000000..055c7e5b --- /dev/null +++ b/meta-xilinx-core/conf/machine/zynqmp-generic.conf @@ -0,0 +1,162 @@ +#@TYPE: Machine +#@NAME: zynqmp-generic +#@DESCRIPTION: Machine configuration for the zynqmp-generic devices + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'zynqmp-generic:']['zynqmp-generic' != '${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in local.conf without machine override will not be reflected. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_0" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +DT_PADDING_SIZE:pn-device-tree ?= "0x1000" +DTC_FLAGS:pn-device-tree = "-@" +YAML_DT_BOARD_FLAGS ?= "{BOARD zcu102-rev1.0}" + +# Yocto ZynqMP u-boot-xlnx variables +UBOOT_MACHINE ?= "xilinx_zynqmp_virt_defconfig" +BOOTMODE ?= "generic.root" + +# By default U-boot SPL boot is disabled +SPL_BINARY ?= "" + +# If user needs U-boot SPL boot, then enable SPL from local.conf as shown below. +# SPL_BINARY = "spl/boot.bin" + +# Yocto ZynqMP arm-trusted-firmware(TF-A) variables +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto ZynqMP PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_0" + +# Yocto ZynqMP FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_0" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_0" + +# Yocto ZynqMP KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# ZynqMP Serial Console +SERIAL_CONSOLES ?= "115200;ttyPS0 115200;ttyPS1" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +require conf/machine/include/soc-zynqmp.inc +require conf/machine/include/machine-xilinx-default.inc +require conf/machine/include/machine-xilinx-qemu.inc + +# zynqmp-generic.conf uses zcu102-zynqmp xsa as reference input. +# User can override with custom xsa using HDF_BASE and HDF_PATH variables from +# local.conf. +HDF_MACHINE = "zcu102-zynqmp" + +# Machine features must result in a superset +# Basic features: +MACHINE_FEATURES += "rtc ext2 ext3 vfat usbhost usbgadget wifi bluetooth" + +# Default SD image build onfiguration, use qemu-sd to pad +IMAGE_CLASSES += "image-types-xilinx-qemu" +# Add wic.qemu-sd only if initramfs_image not set due to circular dependecies +IMAGE_FSTYPES += "${@'wic.qemu-sd' if (d.getVar('INITRAMFS_IMAGE') or '') == '' else 'cpio.gz.u-boot'}" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "${PREFERRED_PROVIDER_virtual/dtb}" + +EXTRA_IMAGEDEPENDS += " \ + libyaml-native \ + python3-cython-native \ + python3-pyyaml-native \ + virtual/fsbl \ + virtual/pmu-firmware \ + arm-trusted-firmware \ + virtual/boot-bin \ + virtual/bootloader \ + qemu-devicetrees:do_deploy \ + u-boot-xlnx-uenv \ + u-boot-xlnx-scr \ + " + +IMAGE_BOOT_FILES += " \ + boot.bin \ + ${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 'device-tree', 'system.dtb', '', d)} \ + boot.scr \ + Image \ + " + +# ZynqMP QEMU Configurations +# This machine has a QEMU model, runqemu setup: +QB_MEM = "-m 4096" +# Iteration appears to be eth3, eth2, eth1, eth0 +QB_NETWORK_DEVICE = "-net nic -net nic -net nic -net nic,netdev=net0,macaddr=@MAC@" + +# Set variables for QEMU DTB PATH, PS DTB and PMU DTB for zynqmp_generic, this +# allows user to use different QEMU HW DTB to match their board. +QEMU_HW_DTB_PATH = "${DEPLOY_DIR_IMAGE}/qemu-hw-devicetrees/multiarch" +QEMU_HW_DTB_PS = "${QEMU_HW_DTB_PATH}/zcu102-arm.dtb" +QEMU_HW_DTB_PMU = "${QEMU_HW_DTB_PATH}/zynqmp-pmu.dtb" + +# Two total serial ports defined in this model (according to the dts) +# +# hw ps7_uart_0 (0xFF000000) - linux serial1 (ttyPS1) +# hw ps7_uart_1 (0xFF010000) - linux serial0 (ttyPS0) +# +# Default configuration will evaluate to: +#QB_XILINX_SERIAL = "-serial mon:stdio -serial null" + +# Replicate BootROM like behaviour, having loaded SPL and PMU(ROM+FW) +# +# In an actual device the FSBL will run first, load ATF and setup the +# following data structure to tell ATF what to continue booting with. +# +# In QEMU emulation we start booting directly from ATF, so we need to +# setup the structure ourselves. +# +# Write to OCM (See UG1085 for more information), address 0xfffc0000 +# the address to boot from (where u-boot is): +# fffc0000 58 4c 4e 58 01 00 00 00 |XLNX....| +# fffc0008 00 00 00 08 00 00 00 00 |........| +# fffc0010 10 00 00 00 00 00 00 00 |........| +# +# Then write that address (fffc0000) to 0xffd80048 so ATF can find this block +# +# fffc0008 defines the u-boot load address as 0x8000000, if u-boot is +# expected to be elsewhere in memory, you must adjust the value. +# +# We write the structure as big endian to make it easier to match/read +# the table above. Remember the CPU is running in little endian mode, +# with the default resulting in: +# 00000000fffc0000: 0x584e4c58 0x00000001 0x08000000 0x00000000 +# 00000000fffc0010: 0x00000010 0x00000000 +# +QB_OPT_APPEND += " \ + -hw-dtb ${QEMU_HW_DTB_PS} \ + ${@qemu_zynqmp_unhalt(d, True)} \ + -device loader,addr=0xfffc0000,data=0x584c4e5801000000,data-be=true,data-len=8 \ + -device loader,addr=0xfffc0008,data=0x0000000800000000,data-be=true,data-len=8 \ + -device loader,addr=0xfffc0010,data=0x1000000000000000,data-be=true,data-len=8 \ + -device loader,addr=0xffd80048,data=0xfffc0000,data-len=4,attrs-secure=on \ + -device loader,file=${DEPLOY_DIR_IMAGE}/arm-trusted-firmware.elf,cpu-num=0 \ + -device loader,file=${DEPLOY_DIR_IMAGE}/u-boot.elf \ + -device loader,file=${DEPLOY_DIR_IMAGE}/system.dtb,addr=0x100000,force-raw=on \ + ${@qemu_add_extra_args(d)} \ + " + +QB_PMU_OPT = " \ + -M microblaze-fdt \ + -display none \ + -hw-dtb ${QEMU_HW_DTB_PMU} \ + -kernel ${PMU_ROM} \ + -device loader,file=${PMU_FIRMWARE_DEPLOY_DIR}/${PMU_FIRMWARE_IMAGE_NAME}.elf \ + -device loader,addr=0xfd1a0074,data=0x1011003,data-len=4 \ + -device loader,addr=0xfd1a007C,data=0x1010f03,data-len=4 \ + " + +QB_OPT_APPEND += " -pmu-args '${QB_PMU_OPT}'" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' zynqmp_generic']['zynqmp-generic' != "${MACHINE}"]}" diff --git a/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-flask-restful_%.bbappend b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-flask-restful_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-flask-restful_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-flask_%.bbappend b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-flask_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-flask_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-itsdangerous_%.bbappend b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-itsdangerous_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-itsdangerous_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-pandas_%.bbappend b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-pandas_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-pandas_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-werkzeug_%.bbappend b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-werkzeug_%.bbappend new file mode 100644 index 00000000..608377e3 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/meta-python/recipes-devtools/python/python3-werkzeug_%.bbappend @@ -0,0 +1 @@ +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/device-tree.bbappend b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/device-tree.bbappend new file mode 100644 index 00000000..7dcee565 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/device-tree.bbappend @@ -0,0 +1,21 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +# openamp.dtsi is in the WORKDIR +DT_INCLUDE:append = " ${WORKDIR}" + +do_configure[vardeps] += "ENABLE_OPENAMP_DTSI OPENAMP_EXTRA_OVERLAYS" + +OPENAMP_EXTRA_OVERLAYS:zynq = "zynq-openamp.dtsi" +OPENAMP_EXTRA_OVERLAYS:zynqmp = "zynqmp-openamp.dtsi" +OPENAMP_EXTRA_OVERLAYS:versal = "versal-openamp.dtsi" +OPENAMP_EXTRA_OVERLAYS:versal-net = "versal-net-openamp.dtsi" + +def set_openamp_extra_overlays(d): + distro_features = d.getVar('DISTRO_FEATURES', True) + enable_openamp_dtsi = d.getVar('ENABLE_OPENAMP_DTSI') + if 'openamp' in distro_features and enable_openamp_dtsi == '1': + return ' ${OPENAMP_EXTRA_OVERLAYS}' + else: + return '' + +EXTRA_OVERLAYS:append = "${@set_openamp_extra_overlays(d)}" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-net-openamp-overlay.dts b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-net-openamp-overlay.dts new file mode 100644 index 00000000..9fdebe39 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-net-openamp-overlay.dts @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: MIT + * + * dts overlay file for Versal NET OpenAMP + * + * Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved. + * + */ + +/dts-v1/; +/plugin/; + +#include "versal-net-openamp.dtsi" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-net-openamp.dtsi b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-net-openamp.dtsi new file mode 100644 index 00000000..694a2fd0 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-net-openamp.dtsi @@ -0,0 +1,97 @@ +/* + * SPDX-License-Identifier: MIT + * + * dts file for Versal NET OpenAMP + * + * Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved. + * + */ + +&{/} { + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + rproc_0_reserved: rproc@3ed00000 { + no-map; + reg = <0x0 0x3ed00000 0x0 0x40000>; + }; + rpu0vdev0vring0: rpu0vdev0vring0@3ed40000 { + no-map; + reg = <0x0 0x3ed40000 0x0 0x4000>; + }; + rpu0vdev0vring1: rpu0vdev0vring1@3ed44000 { + no-map; + reg = <0x0 0x3ed44000 0x0 0x4000>; + }; + rpu0vdev0buffer: rpu0vdev0buffer@3ed48000 { + no-map; + reg = <0x0 0x3ed48000 0x0 0x100000>; + }; + }; + + tcm_0a: tcm_0a@eba00000 { + no-map; + reg = <0x0 0xeba00000 0x0 0x10000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&versal_net_firmware 0x183180cb>; + }; + + tcm_0b: tcm_0b@eba10000 { + no-map; + reg = <0x0 0xeba10000 0x0 0x8000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&versal_net_firmware 0x183180cc>; + }; + + tcm_0c: tcm_0b@eba20000 { + no-map; + reg = <0x0 0xeba20000 0x0 0x8000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&versal_net_firmware 0x183180cd>; + }; + + r52ss { + compatible = "xlnx,versal-net-r52-remoteproc"; + #address-cells = <0x2>; + #size-cells = <0x2>; + ranges; + xlnx,cluster-mode = <1>; + + r52_0 { + compatible = "xilinx,r52"; + #address-cells = <0x2>; + #size-cells = <0x2>; + ranges; + sram = <&tcm_0a>, <&tcm_0b>, <&tcm_0c>; + memory-region = <&rproc_0_reserved>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; + power-domain = <&versal_net_firmware 0x181100BF>; + mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; + mbox-names = "tx", "rx"; + }; + }; + + zynqmp_ipi1 { + compatible = "xlnx,zynqmp-ipi-mailbox"; + interrupt-parent = <&gic>; + interrupts = <0x00 0x3c 0x04>; + xlnx,ipi-id = <5>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* APU<->RPU0 IPI mailbox controller */ + ipi_mailbox_rpu0: mailbox@eb3f0ac0 { + reg = <0xeb3f0ac0 0x20 0xeb3f0ae0 0x20 0xeb3f0740 0x20 0xeb3f0760 0x20>; + reg-names = "local_request_region", + "local_response_region", + "remote_request_region", + "remote_response_region"; + #mbox-cells = <0x01>; + xlnx,ipi-id = <0x03>; + }; + }; +}; diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-openamp-overlay.dts b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-openamp-overlay.dts new file mode 100644 index 00000000..80ed4639 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-openamp-overlay.dts @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: MIT + * + * dts overlay file for Versal OpenAMP + * + * Copyright (C) 2022, Advanced Micro Devices, Inc. All rights reserved. + * + */ + +/dts-v1/; +/plugin/; + +#include "versal-openamp.dtsi" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-openamp.dtsi b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-openamp.dtsi new file mode 100644 index 00000000..01e337c7 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/versal-openamp.dtsi @@ -0,0 +1,150 @@ +/* + * SPDX-License-Identifier: MIT + * + * dts file for Versal OpenAMP + * + * Copyright (C) 2022, Advanced Micro Devices, Inc. All rights reserved. + * + */ + +&{/} { + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + rproc_0_reserved: rproc@3ed00000 { + no-map; + reg = <0x0 0x3ed00000 0x0 0x40000>; + }; + rpu0vdev0vring0: rpu0vdev0vring0@3ed40000 { + no-map; + reg = <0x0 0x3ed40000 0x0 0x4000>; + }; + rpu0vdev0vring1: rpu0vdev0vring1@3ed44000 { + no-map; + reg = <0x0 0x3ed44000 0x0 0x4000>; + }; + rpu0vdev0buffer: rpu0vdev0buffer@3ed48000 { + no-map; + reg = <0x0 0x3ed48000 0x0 0x100000>; + }; + rproc_1_reserved: rproc@3ef00000 { + no-map; + reg = <0x0 0x3ef00000 0x0 0x40000>; + }; + rpu1vdev0vring0: rpu1vdev0vring0@3ef40000 { + no-map; + reg = <0x0 0x3ef40000 0x0 0x4000>; + }; + rpu1vdev0vring1: rpu1vdev0vring1@3ef44000 { + no-map; + reg = <0x0 0x3ef44000 0x0 0x4000>; + }; + rpu1vdev0buffer: rpu1vdev0buffer@3ef48000 { + no-map; + compatible = "shared-dma-pool"; + reg = <0x0 0x3ef48000 0x0 0x100000>; + }; + }; + + tcm_0a: tcm_0a@ffe00000 { + no-map; + reg = <0x0 0xffe00000 0x0 0x10000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&versal_firmware 0x1831800b>; + }; + + tcm_0b: tcm_0b@ffe20000 { + no-map; + reg = <0x0 0xffe20000 0x0 0x10000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&versal_firmware 0x1831800c>; + }; + + tcm_1a: tcm_1a@ffe90000 { + no-map; + reg = <0x0 0xffe90000 0x0 0x10000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&versal_firmware 0x1831800d>; + }; + + tcm_1b: tcm_1b@ffeb0000 { + no-map; + reg = <0x0 0xffeb0000 0x0 0x10000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&versal_firmware 0x1831800e>; + }; + + rf5ss@ff9a0000 { + compatible = "xlnx,zynqmp-r5-remoteproc"; + #address-cells = <0x2>; + #size-cells = <0x2>; + ranges; + xlnx,cluster-mode = <1>; + reg = <0x0 0xff9a0000 0x0 0x10000>; + + r5f_0 { + compatible = "xilinx,r5f"; + #address-cells = <0x2>; + #size-cells = <0x2>; + ranges; + sram = <&tcm_0a>, <&tcm_0b>; + memory-region = <&rproc_0_reserved>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; + power-domain = <&versal_firmware 0x18110005>; + mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; + mbox-names = "tx", "rx"; + }; + r5f_1 { + compatible = "xilinx,r5f"; + #address-cells = <0x2>; + #size-cells = <0x2>; + ranges; + sram = <&tcm_1a>, <&tcm_1b>; + memory-region = <&rproc_1_reserved>, <&rpu1vdev0buffer>, <&rpu1vdev0vring0>, <&rpu1vdev0vring1>; + power-domain = <&versal_firmware 0x18110006>; + mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>; + mbox-names = "tx", "rx"; + }; + }; + + zynqmp_ipi1 { + compatible = "xlnx,zynqmp-ipi-mailbox"; + interrupt-parent = <&gic>; + interrupts = <0 33 4>; + xlnx,ipi-id = <5>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* APU<->RPU0 IPI mailbox controller */ + ipi_mailbox_rpu0: mailbox@ff990600 { + reg = <0xff3f0ac0 0x20>, + <0xff3f0ae0 0x20>, + <0xff3f0740 0x20>, + <0xff3f0760 0x20>; + reg-names = "local_request_region", + "local_response_region", + "remote_request_region", + "remote_response_region"; + #mbox-cells = <1>; + xlnx,ipi-id = <3>; + }; + /* APU<->RPU1 IPI mailbox controller */ + ipi_mailbox_rpu1: mailbox@ff990640 { + reg = <0xff3f0b00 0x20>, + <0xff3f0b20 0x20>, + <0xff3f0940 0x20>, + <0xff3f0960 0x20>; + reg-names = "local_request_region", + "local_response_region", + "remote_request_region", + "remote_response_region"; + #mbox-cells = <1>; + xlnx,ipi-id = <4>; + }; + }; +}; diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynq-openamp-overlay.dts b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynq-openamp-overlay.dts new file mode 100644 index 00000000..b5d238ff --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynq-openamp-overlay.dts @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: MIT + * + * dts overlay file for Zynq OpenAMP + * + * Copyright (C) 2022, Advanced Micro Devices, Inc. All rights reserved. + * + */ + +/dts-v1/; +/plugin/; + +#include "zynq-openamp.dtsi" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynq-openamp.dtsi b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynq-openamp.dtsi new file mode 100644 index 00000000..0e822202 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynq-openamp.dtsi @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: MIT + * + * dts file for Zynq OpenAMP + * + * Copyright (C) 2022, Advanced Micro Devices, Inc. All rights reserved. + * + */ + +&{/} { + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + vdev0vring0: vdev0vring0@3e800000 { + no-map; + compatible = "shared-dma-pool"; + reg = <0x3e800000 0x4000>; + }; + vdev0vring1: vdev0vring1@3e804000 { + no-map; + compatible = "shared-dma-pool"; + reg = <0x3e804000 0x4000>; + }; + vdev0buffer: vdev0buffer@3e808000 { + no-map; + compatible = "shared-dma-pool"; + reg = <0x3e808000 0x100000>; + }; + rproc_0_reserved: rproc@3e000000 { + no-map; + compatible = "shared-dma-pool"; + reg = <0x3e000000 0x800000>; + }; + }; + + remoteproc0: remoteproc@0 { + compatible = "xlnx,zynq_remoteproc"; + firmware = "firmware"; + memory-region = <&rproc_0_reserved>, <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>; + interrupt-parent = <&intc>; + }; +}; diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynqmp-openamp-overlay.dts b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynqmp-openamp-overlay.dts new file mode 100644 index 00000000..da1d171e --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynqmp-openamp-overlay.dts @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: MIT + * + * dts overlay file for ZynqMP OpenAMP + * + * Copyright (C) 2022, Advanced Micro Devices, Inc. All rights reserved. + * + */ + +/dts-v1/; +/plugin/; + +#include "zynqmp-openamp.dtsi" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynqmp-openamp.dtsi b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynqmp-openamp.dtsi new file mode 100644 index 00000000..c8a60d81 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/files/zynqmp-openamp.dtsi @@ -0,0 +1,93 @@ +/* + * SPDX-License-Identifier: MIT + * + * dts file for ZynqMP OpenAMP + * + * Copyright (C) 2022, Advanced Micro Devices, Inc. All rights reserved. + * + */ + +&{/} { + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + rpu0vdev0vring0: rpu0vdev0vring0@3ed40000 { + no-map; + reg = <0x0 0x3ed40000 0x0 0x4000>; + }; + rpu0vdev0vring1: rpu0vdev0vring1@3ed44000 { + no-map; + reg = <0x0 0x3ed44000 0x0 0x4000>; + }; + rpu0vdev0buffer: rpu0vdev0buffer@3ed48000 { + no-map; + reg = <0x0 0x3ed48000 0x0 0x100000>; + }; + rproc_0_reserved: rproc@3ed00000 { + no-map; + reg = <0x0 0x3ed00000 0x0 0x40000>; + }; + }; + + tcm_0a: tcm_0a@ffe00000 { + no-map; + reg = <0x0 0xffe00000 0x0 0x10000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&zynqmp_firmware 15>; + }; + + tcm_0b: tcm_0b@ffe20000 { + no-map; + reg = <0x0 0xffe20000 0x0 0x10000>; + status = "okay"; + compatible = "mmio-sram"; + power-domain = <&zynqmp_firmware 16>; + }; + + rf5ss@ff9a0000 { + compatible = "xlnx,zynqmp-r5-remoteproc"; + xlnx,cluster-mode = <1>; + ranges; + reg = <0x0 0xFF9A0000 0x0 0x10000>; + #address-cells = <0x2>; + #size-cells = <0x2>; + + r5f_0: r5f@0 { + compatible = "xilinx,r5f"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + sram = <&tcm_0a>, <&tcm_0b>; + memory-region = <&rproc_0_reserved>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; + power-domain = <&zynqmp_firmware 7>; + mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; + mbox-names = "tx", "rx"; + }; + }; + + zynqmp_ipi1 { + compatible = "xlnx,zynqmp-ipi-mailbox"; + interrupt-parent = <&gic>; + interrupts = <0 29 4>; + xlnx,ipi-id = <7>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* APU<->RPU0 IPI mailbox controller */ + ipi_mailbox_rpu0: mailbox@ff990600 { + reg = <0xff990600 0x20>, + <0xff990620 0x20>, + <0xff9900c0 0x20>, + <0xff9900e0 0x20>; + reg-names = "local_request_region", + "local_response_region", + "remote_request_region", + "remote_response_region"; + #mbox-cells = <1>; + xlnx,ipi-id = <1>; + }; + }; +}; diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/open-amp-device-tree.bb b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/open-amp-device-tree.bb new file mode 100644 index 00000000..9f481fec --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-bsp/device-tree/open-amp-device-tree.bb @@ -0,0 +1,54 @@ +SUMMARY = "OpenAMP Device Tree Overlay for Xilinx devices." +SECTION = "bsp" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = " \ + file://zynq-openamp.dtsi \ + file://zynq-openamp-overlay.dts \ + file://zynqmp-openamp.dtsi \ + file://zynqmp-openamp-overlay.dts \ + file://versal-openamp.dtsi \ + file://versal-openamp-overlay.dts \ + file://versal-net-openamp.dtsi \ + file://versal-net-openamp-overlay.dts \ +" + +# We don't have anything to include from the kernel +KERNEL_INCLUDE = "" + +COMPATIBLE_MACHINE:zynq = "${MACHINE}" +COMPATIBLE_MACHINE:zynqmp = "${MACHINE}" +COMPATIBLE_MACHINE:versal = "${MACHINE}" +COMPATIBLE_MACHINE:versal-net = "${MACHINE}" + +inherit devicetree image-artifact-names features_check + +REQUIRED_DISTRO_FEATURES = "openamp" + +# We are not _THE_ virtual/dtb provider +PROVIDES:remove = "virtual/dtb" + +DEPENDS += "python3-dtc-native" + +S = "${WORKDIR}/source" + +# Set a default so something resolves +SOC_FAMILY ??= "SOC_FAMILY" + +do_configure:prepend() { + mkdir -p source + + if [ -e ${WORKDIR}/${MACHINE}-openamp-overlay.dts ]; then + install ${WORKDIR}/${MACHINE}-openamp.dtsi ${WORKDIR}/source/. || : + install ${WORKDIR}/${MACHINE}-openamp-overlay.dts ${WORKDIR}/source/openamp.dts + elif [ -e ${WORKDIR}/${SOC_FAMILY}-openamp-overlay.dts ]; then + install ${WORKDIR}/${SOC_FAMILY}-openamp.dtsi ${WORKDIR}/source/. || : + install ${WORKDIR}/${SOC_FAMILY}-openamp-overlay.dts ${WORKDIR}/source/openamp.dts + else + bbfatal "${MACHINE}-openamp-overlay.dts or ${SOC_FAMILY}-openamp-overlay.dts file is not available. Cannot automatically add OpenAMP dtbo file." + fi +} + +FILES:${PN} = "/boot/devicetree/openamp.dtbo" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/libmetal/libmetal-xlnx_v2023.1.bb b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/libmetal/libmetal-xlnx_v2023.1.bb new file mode 100644 index 00000000..30ca3501 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/libmetal/libmetal-xlnx_v2023.1.bb @@ -0,0 +1,15 @@ +SRCBRANCH ?= "2023.1" +SRCREV = "be635252271de342014a146825870b64bd41d6eb" +BRANCH = "xlnx_rel_v2023.1" +LIC_FILES_CHKSUM ?= "file://LICENSE.md;md5=f4d5df0f12dcea1b1a0124219c0dbab4" +PV = "${SRCBRANCH}+git${SRCPV}" + +REPO = "git://github.com/Xilinx/libmetal.git;protocol=https" + +include ${LAYER_PATH_openamp-layer}/recipes-openamp/libmetal/libmetal.inc + +RPROVIDES:${PN}-dbg += "libmetal-dbg" +RPROVIDES:${PN}-dev += "libmetal-dev" +RPROVIDES:${PN}-lic += "libmetal-lic" +RPROVIDES:${PN}-src += "libmetal-src" +RPROVIDES:${PN}-staticdev += "libmetal-staticdev" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/libmetal/libmetal-xlnx_v2023.2.bb b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/libmetal/libmetal-xlnx_v2023.2.bb new file mode 100644 index 00000000..5618ae88 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/libmetal/libmetal-xlnx_v2023.2.bb @@ -0,0 +1,15 @@ +SRCBRANCH ?= "2023.2" +SRCREV = "00fd771adc7adaed664ed6c5bc3d48d25856fe5c" +BRANCH = "xlnx_rel_v2023.2" +LIC_FILES_CHKSUM ?= "file://LICENSE.md;md5=f4d5df0f12dcea1b1a0124219c0dbab4" +PV = "${SRCBRANCH}+git${SRCPV}" + +REPO = "git://github.com/Xilinx/libmetal.git;protocol=https" + +include ${LAYER_PATH_openamp-layer}/recipes-openamp/libmetal/libmetal.inc + +RPROVIDES:${PN}-dbg += "libmetal-dbg" +RPROVIDES:${PN}-dev += "libmetal-dev" +RPROVIDES:${PN}-lic += "libmetal-lic" +RPROVIDES:${PN}-src += "libmetal-src" +RPROVIDES:${PN}-staticdev += "libmetal-staticdev" diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/open-amp/open-amp-xlnx_v2023.1.bb b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/open-amp/open-amp-xlnx_v2023.1.bb new file mode 100644 index 00000000..e295b869 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/open-amp/open-amp-xlnx_v2023.1.bb @@ -0,0 +1,16 @@ +SRCBRANCH ?= "2023.1" +SRCREV = "c8aaf2f26d5493f492f0af09dd558d45908636da" +BRANCH = "xlnx_rel_v2023.1" +LIC_FILES_CHKSUM ?= "file://LICENSE.md;md5=ab88daf995c0bd0071c2e1e55f3d3505" +PV = "${SRCBRANCH}+git${SRCPV}" +REPO = "git://github.com/Xilinx/open-amp.git;protocol=https" + +include ${LAYER_PATH_openamp-layer}/recipes-openamp/open-amp/open-amp.inc +require ${LAYER_PATH_openamp-layer}/vendor/xilinx/recipes-openamp/open-amp/open-amp-xlnx.inc + +RPROVIDES:${PN}-dbg += "open-amp-dbg" +RPROVIDES:${PN}-dev += "open-amp-dev" +RPROVIDES:${PN}-lic += "open-amp-lic" +RPROVIDES:${PN}-src += "open-amp-src" +RPROVIDES:${PN}-staticdev += "open-amp-staticdev" + diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/open-amp/open-amp-xlnx_v2023.2.bb b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/open-amp/open-amp-xlnx_v2023.2.bb new file mode 100644 index 00000000..8c6b4431 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-openamp/open-amp/open-amp-xlnx_v2023.2.bb @@ -0,0 +1,16 @@ +SRCBRANCH ?= "2023.2" +SRCREV = "73a546f2b5faffe71680b1e5389f3328be60773f" +BRANCH = "xlnx_rel_v2023.2" +LIC_FILES_CHKSUM ?= "file://LICENSE.md;md5=ab88daf995c0bd0071c2e1e55f3d3505" +PV = "${SRCBRANCH}+git${SRCPV}" +REPO = "git://github.com/Xilinx/open-amp.git;protocol=https" + +include ${LAYER_PATH_openamp-layer}/recipes-openamp/open-amp/open-amp.inc +require ${LAYER_PATH_openamp-layer}/vendor/xilinx/recipes-openamp/open-amp/open-amp-xlnx.inc + +RPROVIDES:${PN}-dbg += "open-amp-dbg" +RPROVIDES:${PN}-dev += "open-amp-dev" +RPROVIDES:${PN}-lic += "open-amp-lic" +RPROVIDES:${PN}-src += "open-amp-src" +RPROVIDES:${PN}-staticdev += "open-amp-staticdev" + diff --git a/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-xrt/xrt/xrt_git.bbappend b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-xrt/xrt/xrt_git.bbappend new file mode 100644 index 00000000..2b96f152 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openamp-layer/recipes-xrt/xrt/xrt_git.bbappend @@ -0,0 +1,14 @@ +# Use libmetal for systems with AIE +# For vck190 kind of devices +PACKAGE_ARCH:versal-ai-core = "${SOC_VARIANT_ARCH}" +EXTRA_OECMAKE:append:versal-ai-core = " -DXRT_AIE_BUILD=true" +TARGET_CXXFLAGS:append:versal-ai-core = " -DXRT_ENABLE_AIE" +DEPENDS:append:versal-ai-core = " libmetal libxaiengine aiefal" +RDEPENDS:${PN}:append:versal-ai-core = " libxaiengine aiefal" + +# For vek280 kind of devices +PACKAGE_ARCH:versal-ai-edge = "${SOC_VARIANT_ARCH}" +EXTRA_OECMAKE:append:versal-ai-edge = " -DXRT_AIE_BUILD=true" +TARGET_CXXFLAGS:append:versal-ai-edge = " -DXRT_ENABLE_AIE" +DEPENDS:append:versal-ai-edge = " libmetal libxaiengine aiefal" +RDEPENDS:${PN}:append:versal-ai-edge = " libxaiengine aiefal" diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0001-Resolve-macro-redefination-and-presion-differ-error.patch b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0001-Resolve-macro-redefination-and-presion-differ-error.patch new file mode 100644 index 00000000..fbcc9f4a --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0001-Resolve-macro-redefination-and-presion-differ-error.patch @@ -0,0 +1,61 @@ +From e27d75a274d038b94c908b3ade844301794b5920 Mon Sep 17 00:00:00 2001 +From: Yash Ladani <yash.ladani@amd.com> +Date: Tue, 31 Jan 2023 01:55:03 -0800 +Subject: [PATCH] Resolve macro redefination and presion differ error + +While running glmark2-es2 facing macro redefination error +Error: 0:24: P0001: Macro 'HIGHP_OR_DEFAULT' redefined +When glmark is compiling the fragment shaders macro +HIGHP_OR_DEFAULT is being redefined. +Added the guard(#if !defined(HIGHP_OR_DEFAULT)) to avoid +this sceneario. + +We are also getting the precision differ error as same +uCurrentTime variable is defined in both fragment and +vertex shader and they both have different precision. +Error: Failed to link program created from files None and None: +L0010 Uniform 'uCurrentTime' differ on precision +Added highp in jellyfish fragment shader file to avoid this. + +Signed-off-by: Yash Ladani <yash.ladani@amd.com> +--- + data/shaders/jellyfish.frag | 4 ++++ + src/libmatrix/shader-source.cc | 3 +++ + 2 files changed, 7 insertions(+) + +diff --git a/data/shaders/jellyfish.frag b/data/shaders/jellyfish.frag +index c10477a..3431f22 100644 +--- a/data/shaders/jellyfish.frag ++++ b/data/shaders/jellyfish.frag +@@ -1,3 +1,7 @@ ++#ifdef GL_ES ++precision highp float; ++#endif ++ + uniform sampler2D uSampler; + uniform sampler2D uSampler1; + uniform float uCurrentTime; +diff --git a/src/libmatrix/shader-source.cc b/src/libmatrix/shader-source.cc +index 659832e..4d13500 100644 +--- a/src/libmatrix/shader-source.cc ++++ b/src/libmatrix/shader-source.cc +@@ -490,6 +490,8 @@ ShaderSource::str() + /* Create the precision statements */ + std::stringstream precision_macros_ss; + ++ precision_macros_ss << "#if !defined(HIGHP_OR_DEFAULT)"; ++ precision_macros_ss << std::endl; + precision_macros_ss << "#if defined(GL_ES)"; + if (type_ == ShaderSource::ShaderTypeFragment) + precision_macros_ss << " && defined(GL_FRAGMENT_PRECISION_HIGH)"; +@@ -498,6 +500,7 @@ ShaderSource::str() + precision_macros_ss << "#else" << std::endl; + precision_macros_ss << "#define HIGHP_OR_DEFAULT" << std::endl; + precision_macros_ss << "#endif" << std::endl; ++ precision_macros_ss << "#endif" << std::endl; + precision_macros_ss << "#if defined(GL_ES)" << std::endl; + precision_macros_ss << "#define MEDIUMP_OR_DEFAULT mediump" << std::endl; + precision_macros_ss << "#else" << std::endl; +-- +2.34.1 + diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0002-native-state-fbdev-Add-support-for-glmark2-es2-fbdev.patch b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0002-native-state-fbdev-Add-support-for-glmark2-es2-fbdev.patch new file mode 100644 index 00000000..83e5b58a --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0002-native-state-fbdev-Add-support-for-glmark2-es2-fbdev.patch @@ -0,0 +1,370 @@ +From f5d9664b86592dabeec33421f62eb3cfb43d7f05 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Thu, 30 Jan 2020 14:30:06 -0800 +Subject: [PATCH 2/3] native-state-fbdev: Add support for glmark2-es2-fbdev + +This patch add support for mali specific fbdev backend. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Upstream-status: Inappropriate [Xilinx specific] +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/gl-state-egl.cpp | 4 + + src/main.cpp | 4 + + src/native-state-fbdev.cpp | 172 +++++++++++++++++++++++++++++++++++++ + src/native-state-fbdev.h | 59 +++++++++++++ + src/wscript_build | 5 ++ + wscript | 2 + + 6 files changed, 246 insertions(+) + create mode 100644 src/native-state-fbdev.cpp + create mode 100644 src/native-state-fbdev.h + +Index: git/src/gl-state-egl.cpp +=================================================================== +--- git.orig/src/gl-state-egl.cpp ++++ git/src/gl-state-egl.cpp +@@ -508,6 +508,7 @@ GLStateEGL::gotValidDisplay() + return false; + } + ++#ifndef GLMARK2_USE_FBDEV + char const * __restrict const supported_extensions = + egl_query_string(EGL_NO_DISPLAY, EGL_EXTENSIONS); + +@@ -541,6 +542,9 @@ GLStateEGL::gotValidDisplay() + Log::debug("Falling back to eglGetDisplay()\n"); + egl_display_ = egl_get_display(native_display_); + } ++#else ++ egl_display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY); ++#endif + + if (!egl_display_) { + Log::error("eglGetDisplay() failed with error: 0x%x\n", egl_get_error()); +Index: git/src/main.cpp +=================================================================== +--- git.orig/src/main.cpp ++++ git/src/main.cpp +@@ -37,6 +37,8 @@ + + #if GLMARK2_USE_X11 + #include "native-state-x11.h" ++#elif GLMARK2_USE_FBDEV ++#include "native-state-fbdev.h" + #elif GLMARK2_USE_DRM + #include "native-state-drm.h" + #elif GLMARK2_USE_GBM +@@ -160,6 +162,8 @@ main(int argc, char *argv[]) + { + #if GLMARK2_USE_X11 + NativeStateX11 native_state; ++#elif GLMARK2_USE_FBDEV ++ NativeStateFbdev native_state; + #elif GLMARK2_USE_DRM + NativeStateDRM native_state; + #elif GLMARK2_USE_GBM +Index: git/src/native-state-fbdev.cpp +=================================================================== +--- /dev/null ++++ git/src/native-state-fbdev.cpp +@@ -0,0 +1,172 @@ ++ ++/* ++ * Copyright © 2018 Xilinx Inc ++ * ++ * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark. ++ * ++ * glmark2 is free software: you can redistribute it and/or modify it under the ++ * terms of the GNU General Public License as published by the Free Software ++ * Foundation, either version 3 of the License, or (at your option) any later ++ * version. ++ * ++ * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY ++ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ++ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ++ * details. ++ * ++ * You should have received a copy of the GNU General Public License along with ++ * glmark2. If not, see <http://www.gnu.org/licenses/>. ++ * ++ * Authors: ++ * Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> ++ */ ++ ++#include <cstring> ++#include <csignal> ++#include <fcntl.h> ++#include <libudev.h> ++#include <linux/fb.h> ++#include "log.h" ++#include "native-state-fbdev.h" ++#include <sys/ioctl.h> ++#include <unistd.h> ++ ++volatile bool NativeStateFbdev::should_quit_ = false; ++ ++NativeStateFbdev::~NativeStateFbdev() ++{ ++ if (isvalid_fd(fd_)) { ++ close(fd_); ++ fd_ = -1; ++ } ++} ++ ++bool ++NativeStateFbdev::init_display() ++{ ++ struct sigaction new_action; ++ ++ new_action.sa_handler = &NativeStateFbdev::quit_handler; ++ new_action.sa_flags = 0; ++ sigemptyset(&new_action.sa_mask); ++ ++ sigaction(SIGINT, &new_action, NULL); ++ sigaction(SIGTERM, &new_action, NULL); ++ ++ fd_ = get_fd(); ++ if (!isvalid_fd(fd_)) { ++ Log::error("Failed to find a suitable FB device\n"); ++ return false; ++ } ++ ++ return true; ++} ++ ++void* ++NativeStateFbdev::display() ++{ ++ if (!isvalid_fd(fd_)) { ++ Log::error("Failed to initalize display\n"); ++ return NULL; ++ } ++ ++ return reinterpret_cast<void*>(fd_); ++} ++ ++bool ++NativeStateFbdev::create_window(WindowProperties const& /*properties*/) ++{ ++ if (!isvalid_fd(fd_)) { ++ Log::error("Failed to initalize display\n"); ++ should_quit_ = true; ++ return false; ++ } ++ ++ if (ioctl(fd_, FBIOGET_VSCREENINFO, &fb_info_)) { ++ Log::error("Failed to get Frame buffer info\n"); ++ should_quit_ = true; ++ return false; ++ } ++ return true; ++} ++ ++void* ++NativeStateFbdev::window(WindowProperties& properties) ++{ ++ properties = WindowProperties(fb_info_.xres, fb_info_.yres, true, 0); ++ ++ return 0; ++} ++ ++void ++NativeStateFbdev::visible(bool /*visible*/) ++{ ++} ++ ++bool ++NativeStateFbdev::should_quit() ++{ ++ return should_quit_; ++} ++ ++void ++NativeStateFbdev::flip() ++{ ++} ++ ++void ++NativeStateFbdev::quit_handler(int /*signum*/) ++{ ++ should_quit_ = true; ++} ++ ++bool ++NativeStateFbdev::isvalid_fd(int fd) ++{ ++ return fd >= 0; ++} ++ ++int ++NativeStateFbdev::get_fd() ++{ ++ std::string node_path; ++ struct fb_var_screeninfo fb_info; ++ int fd = -1, temp_fd; ++ ++ Log::debug("Using Udev to detect the right fb node to use\n"); ++ auto udev_cntx = udev_new(); ++ auto dev_enum = udev_enumerate_new(udev_cntx); ++ ++ udev_enumerate_add_match_sysname(dev_enum, "fb[0-9]*"); ++ udev_enumerate_scan_devices(dev_enum); ++ ++ Log::debug("Looking for the right fb node...\n"); ++ ++ auto entity = udev_enumerate_get_list_entry(dev_enum); ++ ++ while (entity && !isvalid_fd(fd)) { ++ char const * __restrict entity_sys_path = ++ udev_list_entry_get_name(entity); ++ ++ if (entity_sys_path) { ++ struct udev_device* dev = ++ udev_device_new_from_syspath(udev_cntx, ++ entity_sys_path); ++ const char * dev_node_path = ++ udev_device_get_devnode(dev); ++ ++ temp_fd = open(dev_node_path, O_RDWR); ++ ++ if (!ioctl(temp_fd, FBIOGET_VSCREENINFO, &fb_info)) { ++ fd = temp_fd; ++ break; ++ } ++ ++ udev_device_unref(dev); ++ } ++ ++ entity = udev_list_entry_get_next(entity); ++ } ++ ++ return fd; ++} +Index: git/src/native-state-fbdev.h +=================================================================== +--- /dev/null ++++ git/src/native-state-fbdev.h +@@ -0,0 +1,59 @@ ++/* ++ * Copyright © 2018 Xilinx Inc ++ * ++ * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark. ++ * ++ * glmark2 is free software: you can redistribute it and/or modify it under the ++ * terms of the GNU General Public License as published by the Free Software ++ * Foundation, either version 3 of the License, or (at your option) any later ++ * version. ++ * ++ * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY ++ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ++ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ++ * details. ++ * ++ * You should have received a copy of the GNU General Public License along with ++ * glmark2. If not, see <http://www.gnu.org/licenses/>. ++ * ++ * Authors: ++ * Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> ++ */ ++ ++#ifndef GLMARK2_NATIVE_STATE_FBDEV_H_ ++#define GLMARK2_NATIVE_STATE_FBDEV_H_ ++ ++#include <csignal> ++#include <cstring> ++#include <EGL/egl.h> ++#include <EGL/eglplatform.h> ++#include <linux/fb.h> ++#include "native-state.h" ++ ++class NativeStateFbdev : public NativeState ++{ ++public: ++ NativeStateFbdev() : ++ fd_(-1), ++ native_window_((EGLNativeWindowType)NULL) {} ++ ~NativeStateFbdev(); ++ ++ bool init_display(); ++ void* display(); ++ bool create_window(WindowProperties const& properties); ++ void* window(WindowProperties& properties); ++ void visible(bool v); ++ bool should_quit(); ++ void flip(); ++ ++private: ++ int fd_; ++ struct fb_var_screeninfo fb_info_; ++ NativeWindowType native_window_; ++ static volatile bool should_quit_; ++ static void quit_handler(int signum); ++ static bool isvalid_fd(int fd); ++ static int get_fd(); ++}; ++ ++#endif /* GLMARK2_NATIVE_STATE_FBDEV_H_ */ +Index: git/src/wscript_build +=================================================================== +--- git.orig/src/wscript_build ++++ git/src/wscript_build +@@ -88,6 +88,7 @@ flavor_sources = { + 'win32-glesv2': common_flavor_sources + ['native-state-win32.cpp', 'gl-state-egl.cpp'], + 'x11-gl' : common_flavor_sources + ['native-state-x11.cpp', 'gl-state-glx.cpp'], + 'x11-glesv2' : common_flavor_sources + ['native-state-x11.cpp', 'gl-state-egl.cpp'], ++ 'fbdev-glesv2' : common_flavor_sources + ['native-state-fbdev.cpp', 'gl-state-egl.cpp'] + } + flavor_uselibs = { + 'dispmanx-glesv2' : ['glad-egl-dispmanx', 'glad-glesv2', 'matrix-glesv2', 'common-glesv2', 'dispmanx'], +@@ -99,6 +100,7 @@ flavor_uselibs = { + 'win32-glesv2': ['glad-egl-win32', 'glad-glesv2', 'matrix-glesv2', 'common-glesv2'], + 'x11-gl' : ['x11', 'glad-gl', 'glad-glx', 'matrix-gl', 'common-gl'], + 'x11-glesv2' : ['x11', 'glad-egl-x11', 'glad-glesv2', 'matrix-glesv2', 'common-glesv2'], ++ 'fbdev-glesv2' : ['udev', 'glad-egl-fbdev', 'glad-glesv2', 'matrix-glesv2', 'common-glesv2'] + } + + flavor_defines = { +@@ -111,6 +113,7 @@ flavor_defines = { + 'win32-glesv2': ['GLMARK2_USE_WIN32', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'], + 'x11-gl' : ['GLMARK2_USE_X11', 'GLMARK2_USE_GL', 'GLMARK2_USE_GLX'], + 'x11-glesv2' : ['GLMARK2_USE_X11', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'], ++ 'fbdev-glesv2' : ['GLMARK2_USE_FBDEV', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'] + } + flavor_libs = { + 'dispmanx-glesv2' : [], +@@ -144,6 +147,7 @@ flavor_sources_gen = { + 'win32-glesv2' : [], + 'x11-gl' : [], + 'x11-glesv2' : [], ++ 'fbdev-glesv2' : [] + } + egl_platform_defines = { + 'dispmanx' : ['MESA_EGL_NO_X11_HEADERS'], +@@ -151,6 +155,7 @@ egl_platform_defines = { + 'wayland' : ['WL_EGL_PLATFORM'], + 'win32' : [], + 'x11' : [], ++ 'fbdev' : ['MESA_EGL_NO_X11_HEADERS'] + } + + includes = ['.', 'scene-ideas', 'scene-terrain'] + platform_includes +Index: git/wscript +=================================================================== +--- git.orig/wscript ++++ git/wscript +@@ -17,6 +17,7 @@ FLAVORS = { + 'win32-glesv2': 'glmark2-es2', + 'x11-gl' : 'glmark2', + 'x11-glesv2' : 'glmark2-es2', ++ 'fbdev-glesv2' : 'glmark2-es2-fbdev', + } + FLAVORS_STR = ", ".join(sorted(list(FLAVORS) + ['all-linux', 'all-win32'])) + +@@ -210,6 +211,7 @@ def configure_linux(ctx): + ('libdrm','drm', None, list_contains(ctx.options.flavors, 'drm')), + ('gbm','gbm', None, list_contains(ctx.options.flavors, 'drm')), + ('libudev', 'udev', None, list_contains(ctx.options.flavors, 'drm')), ++ ('libudev', 'udev', None, list_contains(ctx.options.flavors, 'fbdev')), + ('wayland-client','wayland-client', None, list_contains(ctx.options.flavors, 'wayland')), + ('wayland-cursor','wayland-cursor', None, list_contains(ctx.options.flavors, 'wayland')), + ('wayland-egl','wayland-egl', None, list_contains(ctx.options.flavors, 'wayland'))] diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0003-EGL-eglplatform.h-Remove-the-eglplatform.h-header.patch b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0003-EGL-eglplatform.h-Remove-the-eglplatform.h-header.patch new file mode 100644 index 00000000..5cdeda6a --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/files/0003-EGL-eglplatform.h-Remove-the-eglplatform.h-header.patch @@ -0,0 +1,194 @@ +From 60f7cd3378f2ce6c1202dbe1593f8617d8a1e178 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Thu, 18 Mar 2021 11:53:50 -0700 +Subject: [PATCH 3/3] EGL: eglplatform.h: Remove the eglplatform.h header + +As eglplatform.h header is provided by the EGL library provider, we need +not have a copy of it within the src directory as it causes ambiguity. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Upstream-status: Pending +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/glad/include/EGL/eglplatform.h | 169 ----------------------------- + 1 file changed, 169 deletions(-) + delete mode 100644 src/glad/include/EGL/eglplatform.h + +diff --git a/src/glad/include/EGL/eglplatform.h b/src/glad/include/EGL/eglplatform.h +deleted file mode 100644 +index 1edbafa..0000000 +--- a/src/glad/include/EGL/eglplatform.h ++++ /dev/null +@@ -1,169 +0,0 @@ +-#ifndef __eglplatform_h_ +-#define __eglplatform_h_ +- +-/* +-** Copyright 2007-2020 The Khronos Group Inc. +-** SPDX-License-Identifier: Apache-2.0 +-*/ +- +-/* Platform-specific types and definitions for egl.h +- * +- * Adopters may modify khrplatform.h and this file to suit their platform. +- * You are encouraged to submit all modifications to the Khronos group so that +- * they can be included in future versions of this file. Please submit changes +- * by filing an issue or pull request on the public Khronos EGL Registry, at +- * https://www.github.com/KhronosGroup/EGL-Registry/ +- */ +- +-#include <KHR/khrplatform.h> +- +-/* Macros used in EGL function prototype declarations. +- * +- * EGL functions should be prototyped as: +- * +- * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); +- * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); +- * +- * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h +- */ +- +-#ifndef EGLAPI +-#define EGLAPI KHRONOS_APICALL +-#endif +- +-#ifndef EGLAPIENTRY +-#define EGLAPIENTRY KHRONOS_APIENTRY +-#endif +-#define EGLAPIENTRYP EGLAPIENTRY* +- +-/* The types NativeDisplayType, NativeWindowType, and NativePixmapType +- * are aliases of window-system-dependent types, such as X Display * or +- * Windows Device Context. They must be defined in platform-specific +- * code below. The EGL-prefixed versions of Native*Type are the same +- * types, renamed in EGL 1.3 so all types in the API start with "EGL". +- * +- * Khronos STRONGLY RECOMMENDS that you use the default definitions +- * provided below, since these changes affect both binary and source +- * portability of applications using EGL running on different EGL +- * implementations. +- */ +- +-#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES) +- +-typedef void *EGLNativeDisplayType; +-typedef void *EGLNativePixmapType; +-typedef void *EGLNativeWindowType; +- +-#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +-#ifndef WIN32_LEAN_AND_MEAN +-#define WIN32_LEAN_AND_MEAN 1 +-#endif +-#include <windows.h> +- +-typedef HDC EGLNativeDisplayType; +-typedef HBITMAP EGLNativePixmapType; +-typedef HWND EGLNativeWindowType; +- +-#elif defined(__EMSCRIPTEN__) +- +-typedef int EGLNativeDisplayType; +-typedef int EGLNativePixmapType; +-typedef int EGLNativeWindowType; +- +-#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ +- +-typedef int EGLNativeDisplayType; +-typedef void *EGLNativePixmapType; +-typedef void *EGLNativeWindowType; +- +-#elif defined(WL_EGL_PLATFORM) +- +-typedef struct wl_display *EGLNativeDisplayType; +-typedef struct wl_egl_pixmap *EGLNativePixmapType; +-typedef struct wl_egl_window *EGLNativeWindowType; +- +-#elif defined(__GBM__) +- +-typedef struct gbm_device *EGLNativeDisplayType; +-typedef struct gbm_bo *EGLNativePixmapType; +-typedef void *EGLNativeWindowType; +- +-#elif defined(__ANDROID__) || defined(ANDROID) +- +-struct ANativeWindow; +-struct egl_native_pixmap_t; +- +-typedef void* EGLNativeDisplayType; +-typedef struct egl_native_pixmap_t* EGLNativePixmapType; +-typedef struct ANativeWindow* EGLNativeWindowType; +- +-#elif defined(USE_OZONE) +- +-typedef intptr_t EGLNativeDisplayType; +-typedef intptr_t EGLNativePixmapType; +-typedef intptr_t EGLNativeWindowType; +- +-#elif defined(__unix__) && defined(EGL_NO_X11) +- +-typedef void *EGLNativeDisplayType; +-typedef khronos_uintptr_t EGLNativePixmapType; +-typedef khronos_uintptr_t EGLNativeWindowType; +- +-#elif defined(__unix__) || defined(USE_X11) +- +-/* X11 (tentative) */ +-#include <X11/Xlib.h> +-#include <X11/Xutil.h> +- +-typedef Display *EGLNativeDisplayType; +-typedef Pixmap EGLNativePixmapType; +-typedef Window EGLNativeWindowType; +- +-#elif defined(__APPLE__) +- +-typedef int EGLNativeDisplayType; +-typedef void *EGLNativePixmapType; +-typedef void *EGLNativeWindowType; +- +-#elif defined(__HAIKU__) +- +-#include <kernel/image.h> +- +-typedef void *EGLNativeDisplayType; +-typedef khronos_uintptr_t EGLNativePixmapType; +-typedef khronos_uintptr_t EGLNativeWindowType; +- +-#elif defined(__Fuchsia__) +- +-typedef void *EGLNativeDisplayType; +-typedef khronos_uintptr_t EGLNativePixmapType; +-typedef khronos_uintptr_t EGLNativeWindowType; +- +-#else +-#error "Platform not recognized" +-#endif +- +-/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +-typedef EGLNativeDisplayType NativeDisplayType; +-typedef EGLNativePixmapType NativePixmapType; +-typedef EGLNativeWindowType NativeWindowType; +- +- +-/* Define EGLint. This must be a signed integral type large enough to contain +- * all legal attribute names and values passed into and out of EGL, whether +- * their type is boolean, bitmask, enumerant (symbolic constant), integer, +- * handle, or other. While in general a 32-bit integer will suffice, if +- * handles are 64 bit types, then EGLint should be defined as a signed 64-bit +- * integer type. +- */ +-typedef khronos_int32_t EGLint; +- +- +-/* C++ / C typecast macros for special EGL handle values */ +-#if defined(__cplusplus) +-#define EGL_CAST(type, value) (static_cast<type>(value)) +-#else +-#define EGL_CAST(type, value) ((type) (value)) +-#endif +- +-#endif /* __eglplatform_h */ +-- +2.17.1 + diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/glmark2_%.bbappend b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/glmark2_%.bbappend new file mode 100644 index 00000000..81aa8e9e --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-benchmark/glmark2/glmark2_%.bbappend @@ -0,0 +1,19 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = " \ + file://0002-native-state-fbdev-Add-support-for-glmark2-es2-fbdev.patch \ + file://0003-EGL-eglplatform.h-Remove-the-eglplatform.h-header.patch \ + file://0001-Resolve-macro-redefination-and-presion-differ-error.patch \ +" + +PACKAGECONFIG[fbdev-glesv2] = ",,virtual/libgles2 virtual/egl" + +EXTRA_OECONF:append = "${@bb.utils.contains('DISTRO_FEATURES', 'fbdev', ' --with-flavors=fbdev-glesv2', '', d)}" + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" + diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-core/opencl-headers/opencl-headers_%.bbappend b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-core/opencl-headers/opencl-headers_%.bbappend new file mode 100644 index 00000000..b90c754d --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-core/opencl-headers/opencl-headers_%.bbappend @@ -0,0 +1 @@ +ALLOW_EMPTY:${PN} = "1" diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-armsoc_driver.c-Bypass-the-exa-layer-to-free-the-roo.patch b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-armsoc_driver.c-Bypass-the-exa-layer-to-free-the-roo.patch new file mode 100644 index 00000000..2e024794 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-armsoc_driver.c-Bypass-the-exa-layer-to-free-the-roo.patch @@ -0,0 +1,33 @@ +From 497de8b16265468cacad880f4a371756924ae0c1 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Tue, 14 Apr 2020 15:25:13 -0700 +Subject: [xf86-video-armsoc][PATCH v2] armsoc_driver.c: Bypass the exa layer + to free the root pixmap + +Since the root pixmap was allocated through miCreateScreenResources, +the exa layer is not aware of the pixmap resulting in the assertion +to fail. Instead, we can directly invoke fbDestroyPixmap, thereby +freeing the pixmap and avoiding a memory leak. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + src/armsoc_driver.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/armsoc_driver.c b/src/armsoc_driver.c +index 3ace3c7..a4a1ba3 100644 +--- a/src/armsoc_driver.c ++++ b/src/armsoc_driver.c +@@ -1259,7 +1259,8 @@ ARMSOCCloseScreen(CLOSE_SCREEN_ARGS_DECL) + * we do it here, before calling the CloseScreen chain which would just free pScreen->devPrivate in fbCloseScreen() + */ + if (pScreen->devPrivate) { +- (void) (*pScreen->DestroyPixmap)(pScreen->devPrivate); ++ fbDestroyPixmap (pScreen->devPrivate); ++ armsoc_bo_unreference(pARMSOC->scanout); + pScreen->devPrivate = NULL; + } + +-- +2.7.4 + diff --git a/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch index 50f43393..bf2169ee 100644 --- a/meta-xilinx-bsp/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch +++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch @@ -124,7 +124,7 @@ index 0000000000..f4faceb0b4 +} + +struct drmmode_interface xilinx_interface = { -+ "xilinx_drm" /* name of drm driver */, ++ "xlnx" /* name of drm driver */, + 1 /* use_page_flip_events */, + 1 /* use_early_display */, + 0 /* cursor width */, diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc_%.bbappend b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc_%.bbappend new file mode 100644 index 00000000..f7b52f58 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc_%.bbappend @@ -0,0 +1,5 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/xf86-video-armsoc:" + +SRC_URI:append = " file://0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch \ + file://0001-armsoc_driver.c-Bypass-the-exa-layer-to-free-the-roo.patch \ + " diff --git a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx-package-split.inc b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx-package-split.inc new file mode 100644 index 00000000..2c73d931 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx-package-split.inc @@ -0,0 +1,46 @@ +PACKAGES:prepend:class-target = "${PN}-x86_64 \ + ${PN}-aarch64 \ + ${PN}-arm \ + ${PN}-i386 \ + ${PN}-system-i386 \ + ${PN}-microblaze \ + ${PN}-support \ + ${PN}-keymaps \ + ${PN}-firmware \ + " + +FILES:${PN}-x86_64:class-target = "${bindir}/qemu-system-x86_64 ${bindir}/qemu-x86_64" +RDEPENDS:${PN}-x86_64:append:class-target = "${PN}" +INSANE_SKIP:${PN}-x86_64:class-target = "file-rdeps" + +FILES:${PN}-i386:class-target = "${bindir}/qemu-i386" +RDEPENDS:${PN}-i386:append:class-target = "${PN}" +INSANE_SKIP:${PN}-i386:class-target = "file-rdeps" + +FILES:${PN}-system-i386:class-target = "${bindir}/qemu-system-i386" +RDEPENDS:${PN}-system-i386:append:class-target = "${PN}" +INSANE_SKIP:${PN}-system-i386:class-target = "file-rdeps" + +FILES:${PN}-aarch64:class-target = "${bindir}/qemu-system-aarch64 ${bindir}/qemu-aarch64" +RDEPENDS:${PN}-aarch64:append:class-target = "${PN}" +INSANE_SKIP:${PN}-aarch64:class-target = "file-rdeps" + +FILES:${PN}-arm:class-target = "${bindir}/qemu-system-arm ${bindir}/qemu-arm" +RDEPENDS:${PN}-arm:append:class-target = "${PN}" +INSANE_SKIP:${PN}-arm:class-target = "file-rdeps" + +FILES:${PN}-microblaze:class-target = "${bindir}/qemu-system-microblaze* ${bindir}/qemu-microblaze*" +RDEPENDS:${PN}-microblaze:append:class-target = "${PN}" +INSANE_SKIP:${PN}-arm:class-target = "file-rdeps" + +FILES:${PN}-support:class-target = "${bindir}/* ${libexecdir}/*" +RDEPENDS:${PN}-support:class-target = "${PN} bash" + +FILES:${PN}-firmware:class-target = "${datadir}/${PN}/*.bin ${datadir}/${PN}/*.rom ${datadir}/${PN}/*.img ${datadir}/${PN}/openbios* ${datadir}/${PN}/*.dtb ${datadir}/${PN}/u-boot*" +RDEPENDS:${PN}-firmware:class-target = "${PN}" +INSANE_SKIP:${PN}-firmware:class-target = "arch" + +FILES:${PN}-keymaps:class-target = "${datadir}/${PN}/keymaps/*" +RDEPENDS:${PN}-keymaps:class-target = "${PN}" + +PACKAGECONFIG:append:class-target = " virtfs" diff --git a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx_%.bbappend b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx_%.bbappend new file mode 100644 index 00000000..5cca9e1f --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-devtools/qemu/qemu-xilinx_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('DISTRO_FEATURES', 'vmsep', '${BPN}-package-split.inc', '', d)} diff --git a/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-kernel/lopper/lopper_git.bbappend b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-kernel/lopper/lopper_git.bbappend new file mode 100644 index 00000000..56cb8a45 --- /dev/null +++ b/meta-xilinx-core/dynamic-layers/virtualization-layer/recipes-kernel/lopper/lopper_git.bbappend @@ -0,0 +1,13 @@ +SRC_URI = "git://github.com/devicetree-org/lopper.git;branch=master;protocol=https" +SRCREV = "807435ae6fa0a07e8c84b458d138f3f54614eb5c" + +FILESEXTRAPATHS:prepend := "${THISDIR}/lopper:" + +BASEVERSION = "1.1.0" + +RDEPENDS:${PN} += " \ + python3-ruamel-yaml \ + python3-anytree \ + python3-six \ + python3-pyyaml \ + " diff --git a/meta-xilinx-core/gen-machine-conf b/meta-xilinx-core/gen-machine-conf new file mode 160000 +Subproject 911941fc094dc0073c2f01a2b94de3cc6e993fe diff --git a/meta-xilinx-core/recipes-bsp/ai-engine/ai-engine-driver_3.3.bb b/meta-xilinx-core/recipes-bsp/ai-engine/ai-engine-driver_3.3.bb new file mode 100644 index 00000000..6a4fd880 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/ai-engine/ai-engine-driver_3.3.bb @@ -0,0 +1,47 @@ +SUMMARY = "Xilinx AI Engine runtime" +DESCRIPTION = "This library provides APIs for the runtime support of the Xilinx AI Engine IP" + +require aie-rt.inc + +SECTION = "libs" + +AIEDIR ?= "${S}/driver" +S = "${WORKDIR}/git" +I = "${AIEDIR}/include" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "${SOC_VARIANT_ARCH}" +PV = "3.3" + +IOBACKENDS ?= "Linux" + +DEPENDS = "${@bb.utils.contains('IOBACKENDS', 'metal', 'libmetal', '', d)}" +RDEPENDS:${PN} = "${@bb.utils.contains('IOBACKENDS', 'metal', 'libmetal', '', d)}" + +PROVIDES = "libxaiengine" +RPROVIDES:${PN} = "libxaiengine" + +# The makefile isn't ready for parallel execution at the moment +PARALLEL_MAKE = "-j 1" + +CFLAGS += "-Wall -Wextra -fno-thread-jumps -fno-tree-pre" +CFLAGS += "${@bb.utils.contains('IOBACKENDS', 'Linux', ' -D__AIELINUX__', '', d)}" +CFLAGS += "${@bb.utils.contains('IOBACKENDS', 'metal', ' -D__AIEMETAL__', '', d)}" +EXTRA_OEMAKE = "-C ${AIEDIR}/src -f Makefile.Linux CFLAGS='${CFLAGS}'" + + +do_compile(){ + oe_runmake +} + +do_install(){ + install -d ${D}${includedir} + install ${I}/*.h ${D}${includedir}/ + install -d ${D}${includedir}/xaiengine + install ${I}/xaiengine/*.h ${D}${includedir}/xaiengine/ + install -d ${D}${libdir} + cp -dr ${AIEDIR}/src/*.so* ${D}${libdir} +} + +PACKAGE_ARCH:versal-ai-core = "${SOC_VARIANT_ARCH}" diff --git a/meta-xilinx-core/recipes-bsp/ai-engine/ai-engine-driver_3.4.bb b/meta-xilinx-core/recipes-bsp/ai-engine/ai-engine-driver_3.4.bb new file mode 100644 index 00000000..f86c5985 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/ai-engine/ai-engine-driver_3.4.bb @@ -0,0 +1,49 @@ +SUMMARY = "Xilinx AI Engine runtime" +DESCRIPTION = "This library provides APIs for the runtime support of the Xilinx AI Engine IP" + +require aie-rt-2022.inc + +SECTION = "libs" + +AIEDIR ?= "${S}/driver" +S = "${WORKDIR}/git" +I = "${AIEDIR}/include" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "${SOC_VARIANT_ARCH}" +PV = "3.3" + +IOBACKENDS ?= "Linux" + +DEPENDS = "${@bb.utils.contains('IOBACKENDS', 'metal', 'libmetal', '', d)}" +RDEPENDS:${PN} = "${@bb.utils.contains('IOBACKENDS', 'metal', 'libmetal', '', d)}" + +PROVIDES = "libxaiengine" +RPROVIDES:${PN} = "libxaiengine" + +# The makefile isn't ready for parallel execution at the moment +PARALLEL_MAKE = "-j 1" + +CFLAGS += "-Wall -Wextra" +CFLAGS += "${@bb.utils.contains('IOBACKENDS', 'Linux', ' -D__AIELINUX__', '', d)}" +CFLAGS += "${@bb.utils.contains('IOBACKENDS', 'metal', ' -D__AIEMETAL__', '', d)}" +EXTRA_OEMAKE = "-C ${AIEDIR}/src -f Makefile.Linux CFLAGS='${CFLAGS}'" + + +do_compile(){ + oe_runmake +} + +do_install(){ + install -d ${D}${includedir} + install ${I}/*.h ${D}${includedir}/ + install -d ${D}${includedir}/xaiengine + install ${I}/xaiengine/*.h ${D}${includedir}/xaiengine/ + install -d ${D}${libdir} + cp -dr ${AIEDIR}/src/*.so* ${D}${libdir} +} + +PACKAGE_ARCH:versal-ai-core = "${SOC_VARIANT_ARCH}" +PACKAGE_ARCH:versal-ai-edge = "${SOC_VARIANT_ARCH}" + diff --git a/meta-xilinx-core/recipes-bsp/ai-engine/aie-rt-2022.inc b/meta-xilinx-core/recipes-bsp/ai-engine/aie-rt-2022.inc new file mode 100644 index 00000000..85121654 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/ai-engine/aie-rt-2022.inc @@ -0,0 +1,11 @@ +SECTION = "libs" + +REPO ?= "git://github.com/Xilinx/aie-rt.git;protocol=https" + +BRANCH ?= "xlnx_rel_v2022.2" +SRCREV ?= "ae24c8ede049906323510693f37e6167a963fd0e" + +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM ?= "file://license.txt;md5=b81abf1f508952331dd7d2ab36408f5b" + +SRC_URI = "${REPO};branch=${BRANCH}" diff --git a/meta-xilinx-core/recipes-bsp/ai-engine/aie-rt.inc b/meta-xilinx-core/recipes-bsp/ai-engine/aie-rt.inc new file mode 100644 index 00000000..11059465 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/ai-engine/aie-rt.inc @@ -0,0 +1,11 @@ +SECTION = "libs" + +REPO ?= "git://github.com/Xilinx/aie-rt.git;protocol=https" + +BRANCH ?= "xlnx_rel_v2023.2" +SRCREV ?= "84debe5d22c144fb09269b8410df4cb8a6aa3b2a" + +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM ?= "file://license.txt;md5=04a153cae61a8a606fc79dff49c2c897" + +SRC_URI = "${REPO};branch=${BRANCH}" diff --git a/meta-xilinx-core/recipes-bsp/ai-engine/aiefal_1.4.bb b/meta-xilinx-core/recipes-bsp/ai-engine/aiefal_1.4.bb new file mode 100644 index 00000000..641c39a9 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/ai-engine/aiefal_1.4.bb @@ -0,0 +1,33 @@ +SUMMARY = "Xilinx AI Engine FAL(Functional Abstraction Layer)" +DESCRIPTION = "AIE FAL provides functional abstraction APIs for runtime support of Xilinx AI Engine IP" + +require aie-rt.inc + +SECTION = "devel" + +XAIEFAL_DIR ?= "fal" +S = "${WORKDIR}/git" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "${SOC_VARIANT_ARCH}" + +IOBACKENDS ?= "Linux" + +PROVIDES = "aiefal" +ALLOW_EMPTY:${PN} = "1" + +inherit pkgconfig cmake + +DEPENDS = "libxaiengine" + +OECMAKE_SOURCEPATH = "${S}/${XAIEFAL_DIR}" + +EXTRA_OECMAKE = "-DWITH_TESTS=OFF " +EXTRA_OECMAKE:append = "${@'-DWITH_EXAMPLES=ON' if d.getVar('WITH_EXAMPLES') == 'y' else '-DWITH_EXAMPLES=OFF'}" + +FILES:${PN}-demos = " \ + ${bindir}/* \ +" + +PACKAGE_ARCH:versal-ai-core = "${SOC_VARIANT_ARCH}" diff --git a/meta-xilinx-core/recipes-bsp/ai-engine/aiefal_1.5.bb b/meta-xilinx-core/recipes-bsp/ai-engine/aiefal_1.5.bb new file mode 100644 index 00000000..2c6c9cd1 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/ai-engine/aiefal_1.5.bb @@ -0,0 +1,35 @@ +SUMMARY = "Xilinx AI Engine FAL(Functional Abstraction Layer)" +DESCRIPTION = "AIE FAL provides functional abstraction APIs for runtime support of Xilinx AI Engine IP" + +require aie-rt-2022.inc + +SECTION = "devel" + +XAIEFAL_DIR ?= "fal" +S = "${WORKDIR}/git" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "${SOC_VARIANT_ARCH}" + +IOBACKENDS ?= "Linux" + +PROVIDES = "aiefal" +ALLOW_EMPTY:${PN} = "1" + +inherit pkgconfig cmake + +DEPENDS = "libxaiengine" + +OECMAKE_SOURCEPATH = "${S}/${XAIEFAL_DIR}" + +EXTRA_OECMAKE = "-DWITH_TESTS=OFF " +EXTRA_OECMAKE:append = "${@'-DWITH_EXAMPLES=ON' if d.getVar('WITH_EXAMPLES') == 'y' else '-DWITH_EXAMPLES=OFF'}" + +FILES:${PN}-demos = " \ + ${bindir}/* \ +" + +PACKAGE_ARCH:versal-ai-core = "${SOC_VARIANT_ARCH}" +PACKAGE_ARCH:versal-ai-edge = "${SOC_VARIANT_ARCH}" + diff --git a/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc new file mode 100644 index 00000000..9249060c --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware.inc @@ -0,0 +1,129 @@ +DESCRIPTION = "ARM Trusted Firmware" + +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM ?= "file://license.rst;md5=1dd070c98a281d18d9eefd938729b031" + +PROVIDES = "virtual/arm-trusted-firmware" + +inherit deploy + +DEPENDS += "u-boot-mkimage-native" + +S = "${WORKDIR}/git" +B = "${WORKDIR}/build" + +SYSROOT_DIRS += "/boot" + +ATF_VERSION ?= "2.2" +ATF_VERSION_EXTENSION ?= "-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}" +PV = "${ATF_VERSION}${ATF_VERSION_EXTENSION}+git${SRCPV}" + +BRANCH ?= "" +REPO ?= "git://github.com/Xilinx/arm-trusted-firmware.git;protocol=https" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit image-artifact-names + +ATF_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}${IMAGE_VERSION_SUFFIX}" + +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynqmp = ".*" +COMPATIBLE_MACHINE:versal = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +PLATFORM:zynqmp = "zynqmp" +PLATFORM:versal = "versal" +PLATFORM:versal-net = "versal_net" + +# requires CROSS_COMPILE set by hand as there is no configure script +export CROSS_COMPILE="${TARGET_PREFIX}" + +# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application +CFLAGS[unexport] = "1" +LDFLAGS[unexport] = "1" +AS[unexport] = "1" +LD[unexport] = "1" + +ATF_CONSOLE_DEFAULT = "" +ATF_CONSOLE_DEFAULT:zynqmp = "cadence" +ATF_CONSOLE_DEFAULT:versal = "pl011" +ATF_CONSOLE ?= "${ATF_CONSOLE_DEFAULT}" + +DEBUG_ATF_DEFAULT = "" +DEBUG_ATF_DEFAULT:versal = "1" +DEBUG_ATF ?= "${DEBUG_ATF_DEFAULT}" + +EXTRA_OEMAKE:append:zynqmp = "${@' ZYNQMP_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}" +EXTRA_OEMAKE:append:versal = "${@' VERSAL_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}" +EXTRA_OEMAKE:append:versal-net = "${@' VERSAL_NET_CONSOLE=${ATF_CONSOLE}' if d.getVar('ATF_CONSOLE', True) != '' else ''}" +EXTRA_OEMAKE:append = " ${@bb.utils.contains('DEBUG_ATF', '1', ' DEBUG=${DEBUG_ATF}', '', d)}" + +OUTPUT_DIR = "${@bb.utils.contains('DEBUG_ATF', '1', '${B}/${PLATFORM}/debug', '${B}/${PLATFORM}/release', d)}" + +ATF_MEM_BASE ?= "" +ATF_MEM_SIZE ?= "" + +EXTRA_OEMAKE:append:zynqmp = "${@' ZYNQMP_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}" +EXTRA_OEMAKE:append:zynqmp = "${@' ZYNQMP_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}" + +EXTRA_OEMAKE:append:versal = "${@' VERSAL_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}" +EXTRA_OEMAKE:append:versal = "${@' VERSAL_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}" + +EXTRA_OEMAKE:append:versal-net = "${@' VERSAL_NET_ATF_MEM_BASE=${ATF_MEM_BASE}' if d.getVar('ATF_MEM_BASE', True) != '' else ''}" +EXTRA_OEMAKE:append:versal-net = "${@' VERSAL_NET_ATF_MEM_SIZE=${ATF_MEM_SIZE}' if d.getVar('ATF_MEM_SIZE', True) != '' else ''}" + +ATF_PROVENCORE = "SPD=pncd SPD_PNCD_NS_IRQ=51 ZYNQMP_BL32_MEM_BASE=0x70000000 ZYNQMP_BL32_MEM_SIZE=0x0FF00000" +EXTRA_OEMAKE:append = "${@bb.utils.contains('MACHINE_FEATURES', 'provencore', ' ${ATF_PROVENCORE}', '', d)}" + +TFA_BL33_LOAD ?= "" +EXTRA_OEMAKE:append = "${@' PRELOADED_BL33_BASE=${TFA_BL33_LOAD}' if d.getVar('TFA_BL33_LOAD', True) != '' else ''}" + +# Workaround for bl31.elf has a LOAD segment with RWX permissions +EXTRA_OEMAKE:append = ' TF_LDFLAGS="--no-warn-rwx-segments --fatal-warnings -O1 --gc-sections"' + +do_configure() { + oe_runmake clean -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} +} + +do_compile() { + oe_runmake -C ${S} BUILD_BASE=${B} PLAT=${PLATFORM} RESET_TO_BL31=1 bl31 V=1 +} + +do_install() { + install -d ${D}/boot + install -Dm 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${D}/boot/${ATF_BASE_NAME}.elf + ln -sf ${ATF_BASE_NAME}.elf ${D}/boot/${PN}.elf + install -m 0644 ${OUTPUT_DIR}/bl31.bin ${D}/boot/${ATF_BASE_NAME}.bin + ln -sf ${ATF_BASE_NAME}.bin ${D}/boot/${PN}.bin + + # Get the entry point address from the elf. + BL31_BASE_ADDR=$(${READELF} -h ${OUTPUT_DIR}/bl31/bl31.elf | egrep -m 1 -i "entry point.*?0x" | sed -r 's/.*?(0x.*?)/\1/g') + mkimage -A arm64 -O arm-trusted-firmware -T kernel -C none \ + -a $BL31_BASE_ADDR -e $BL31_BASE_ADDR \ + -d ${OUTPUT_DIR}/bl31.bin ${D}/boot/${ATF_BASE_NAME}.ub + ln -sf ${ATF_BASE_NAME}.ub ${D}/boot/${PN}.ub + ln -sf ${ATF_BASE_NAME}.ub ${D}/boot/atf-uboot.ub +} + +do_deploy() { + install -d ${DEPLOYDIR} + install -m 0644 ${OUTPUT_DIR}/bl31/bl31.elf ${DEPLOYDIR}/${ATF_BASE_NAME}.elf + ln -sf ${ATF_BASE_NAME}.elf ${DEPLOYDIR}/${PN}.elf + install -m 0644 ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.bin + ln -sf ${ATF_BASE_NAME}.bin ${DEPLOYDIR}/${PN}.bin + + # Get the entry point address from the elf. + BL31_BASE_ADDR=$(${READELF} -h ${OUTPUT_DIR}/bl31/bl31.elf | egrep -m 1 -i "entry point.*?0x" | sed -r 's/.*?(0x.*?)/\1/g') + mkimage -A arm64 -O arm-trusted-firmware -T kernel -C none \ + -a $BL31_BASE_ADDR -e $BL31_BASE_ADDR \ + -d ${OUTPUT_DIR}/bl31.bin ${DEPLOYDIR}/${ATF_BASE_NAME}.ub + ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/${PN}.ub + ln -sf ${ATF_BASE_NAME}.ub ${DEPLOYDIR}/atf-uboot.ub +} +addtask deploy before do_build after do_compile +FILES:${PN} += "/boot/*.elf /boot/*.bin /boot/*.ub" + +# Disable buildpaths QA check warnings for Versal. +INSANE_SKIP:${PN}:append:versal = " buildpaths" diff --git a/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2022.1.bb b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2022.1.bb new file mode 100644 index 00000000..f02bb879 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2022.1.bb @@ -0,0 +1,8 @@ +ATF_VERSION = "2.6" +SRCREV = "67ca59c67f542322554d78820bf9ddaa736d6a84" +BRANCH = "xlnx_rebase_v2.6" +LIC_FILES_CHKSUM = "file://license.rst;md5=1dd070c98a281d18d9eefd938729b031" + + +include arm-trusted-firmware.inc + diff --git a/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2022.2.bb b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2022.2.bb new file mode 100644 index 00000000..5ef2e6ac --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2022.2.bb @@ -0,0 +1,8 @@ +ATF_VERSION = "2.6" +SRCREV = "0897efd45ccad29a3dbab610578c70e3a52b2caa" +BRANCH = "xlnx_rebase_v2.6" +LIC_FILES_CHKSUM = "file://license.rst;md5=1dd070c98a281d18d9eefd938729b031" + + +include arm-trusted-firmware.inc + diff --git a/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2023.1.bb b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2023.1.bb new file mode 100644 index 00000000..2bcbe7d4 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2023.1.bb @@ -0,0 +1,8 @@ +ATF_VERSION = "2.8" +SRCREV = "c9b71dc96f3f18ca94cad590612aae3224c8c84d" +BRANCH = "xlnx_rebase_v2.8" +LIC_FILES_CHKSUM = "file://license.rst;md5=1dd070c98a281d18d9eefd938729b031" + + +include arm-trusted-firmware.inc + diff --git a/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2023.2.bb b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2023.2.bb new file mode 100644 index 00000000..6ebd6cb5 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_2023.2.bb @@ -0,0 +1,8 @@ +ATF_VERSION = "2.8" +SRCREV = "6be857cb66300fb21e3f61308e4197911c8ac30d" +BRANCH = "xlnx_rebase_v2.8" +LIC_FILES_CHKSUM = "file://license.rst;md5=1dd070c98a281d18d9eefd938729b031" + + +include arm-trusted-firmware.inc + diff --git a/meta-xilinx-core/recipes-bsp/base-pdi/base-pdi_1.0.bb b/meta-xilinx-core/recipes-bsp/base-pdi/base-pdi_1.0.bb new file mode 100644 index 00000000..deb8bb3d --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/base-pdi/base-pdi_1.0.bb @@ -0,0 +1,36 @@ +DESCRIPTION = "Recipe to deploy base pdi" + +LICENSE = "CLOSED" + +PROVIDES = "virtual/base-pdi" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:microblaze = ".*" +COMPATIBLE_MACHINE:versal = ".*" + +PACKAGE_ARCH ?= "${MACHINE_ARCH}" + +do_compile[noexec] = "1" + +PDI_PATH ?= "" +SRC_URI += "${@['file://'+d.getVar('PDI_PATH'),''][d.getVar('PDI_PATH') == '']}" + +python() { + if d.getVar('PDI_SKIP_CHECK') != "1" and not d.getVar('PDI_PATH'): + raise bb.parse.SkipRecipe("PDI_PATH is not configured with the base design pdi") +} + +#base install will just take from PDI_PATH variable +#will need to bbappend to this in meta-xilinx-tools to use xsct to extract pdi from xsa and install +do_install() { + + if [ -f ${WORKDIR}/${PDI_PATH} ];then + install -d ${D}/boot + install -m 0644 ${WORKDIR}/${PDI_PATH} ${D}/boot/base-design.pdi + else + bbfatal "No base pdi supplied" + fi +} +SYSROOT_DIRS += "/boot" + +FILES:${PN} += "/boot/*" diff --git a/meta-xilinx-core/recipes-bsp/bitstream/bitstream.bb b/meta-xilinx-core/recipes-bsp/bitstream/bitstream.bb new file mode 100644 index 00000000..f61761f4 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bitstream/bitstream.bb @@ -0,0 +1,59 @@ +DESCRIPTION = "Recipe to provide a bitstream via virtual/bitstream" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +INHIBIT_DEFAULT_DEPS = "1" + +# We never want to prefer this over another provider +DEFAULT_PREFERENCE = "-1" + +PROVIDES = "virtual/bitstream" + +COMPATIBLE_MACHINE = "$^" +COMPATIBLE_MACHINE:zynq = ".*" +COMPATIBLE_MACHINE:zynqmp = ".*" + +# Since we're just copying, we can run any config +COMPATIBLE_HOST = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Path where the bitstream can be found +BITSTREAM_PATH ?= "" + +inherit deploy + +do_install() { + if [ ! -e ${BITSTREAM_PATH} ]; then + echo "Unable to find BITSTREAM_PATH (${BITSTREAM_PATH})" + exit 1 + fi + + install -Dm 0644 ${BITSTREAM_PATH} ${D}/boot/. +} + +# If the item is already in OUR deploy_image_dir, nothing to deploy! +SHOULD_DEPLOY = "${@'false' if (d.getVar('BITSTREAM_PATH')).startswith(d.getVar('DEPLOY_DIR_IMAGE')) else 'true'}" +do_deploy() { + # If the item is already in OUR deploy_image_dir, nothing to deploy! + if ${SHOULD_DEPLOY}; then + install -Dm 0644 ${BITSTREAM_PATH} ${DEPLOYDIR}/. + fi +} + +def check_bitstream_vars(d): + # If BITSTREAM_PATH is not defined, we error and instruct the user + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + if d.getVar('BITSTREAM_PATH') and not os.path.exists(d.getVar('BITSTREAM_PATH')): + raise bb.parse.SkipRecipe("The expected bitstream file %s is not available.\nSee the meta-xilinx-core README.") + + if not d.getVar('BITSTREAM_PATH'): + raise bb.parse.SkipRecipe("Something is depending on virtual/bitstream and you have not provided a bitstream using BITSTREAM_PATH variable.\n See the meta-xilinx-core README.") + +python() { + # Need to allow bbappends to change the check + check_bitstream_vars(d) +} + diff --git a/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-versal.inc b/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-versal.inc new file mode 100644 index 00000000..fff2c7a3 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-versal.inc @@ -0,0 +1,39 @@ +#Extra args for versal +BOOTGEN_EXTRA_ARGS += "-dump bh" + +# specify BIF common attribute for FSBL +BIF_COMMON_ATTR ?= "" + +#specify BIF partition attributes required for BOOT.bin +BIF_FSBL_ATTR ??= "base-pdi plmfw psmfw" +BIF_ATF_ATTR ??= "arm-trusted-firmware" +BIF_DEVICETREE_ATTR ??= "device-tree" +BIF_SSBL_ATTR ??= "u-boot-xlnx" +BIF_PARTITION_ATTR ??= "${BIF_FSBL_ATTR} ${BIF_DEVICETREE_ATTR} ${BIF_ATF_ATTR} ${BIF_SSBL_ATTR}" + +# specify BIF partition attributes for base-pdi +BIF_PARTITION_ATTR[base-pdi] ?= "type=bootimage" +BIF_PARTITION_IMAGE[base-pdi] ?= "${RECIPE_SYSROOT}/boot/base-design.pdi" + +# specify BIF partition attributes for plmfw +BIF_PARTITION_ATTR[plmfw] ?= "type=bootloader" +BIF_PARTITION_IMAGE[plmfw] ?= "${RECIPE_SYSROOT}/boot/plmfw.elf" + +# specify BIF partition attributes for psmfw +BIF_PARTITION_ATTR[psmfw] ?= "core=psm" +BIF_PARTITION_IMAGE[psmfw] ?= "${RECIPE_SYSROOT}/boot/psmfw.elf" + +# specify BIF partition attributes for device-tree +BIF_PARTITION_ATTR[device-tree] ?= "type=raw, load=0x1000" +BIF_PARTITION_IMAGE[device-tree] ?= "${RECIPE_SYSROOT}/boot/devicetree/system-top.dtb" +BIF_PARTITION_ID[device-tree] ?= "0x1c000000" + +# specify BIF partition attributes for u-boot +BIF_PARTITION_ATTR[u-boot-xlnx] ?= "core=a72-0, exception_level = el-2" +BIF_PARTITION_IMAGE[u-boot-xlnx] ?= "${RECIPE_SYSROOT}/boot/u-boot.elf" +BIF_PARTITION_ID[u-boot-xlnx] ?= "0x1c000000" + +# specify BIF partition attributes for arm-trusted-firmware +BIF_PARTITION_ATTR[arm-trusted-firmware] ?= "core=a72-0, exception_level = el-3, trustzone" +BIF_PARTITION_IMAGE[arm-trusted-firmware] ?= "${RECIPE_SYSROOT}/boot/arm-trusted-firmware.elf" +BIF_PARTITION_ID[arm-trusted-firmware] ?= "0x1c000000" diff --git a/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-zynq.inc b/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-zynq.inc new file mode 100644 index 00000000..c630cda7 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-zynq.inc @@ -0,0 +1,22 @@ +#specify BIF partition attributes required for BOOT.bin +BIF_FSBL_ATTR ??= "fsbl" +BIF_BITSTREAM_ATTR ??= "" +BIF_DEVICETREE_ATTR ??= "device-tree" +BIF_SSBL_ATTR ??= "u-boot-xlnx" +BIF_PARTITION_ATTR ??= "${BIF_FSBL_ATTR} ${BIF_BITSTREAM_ATTR} ${BIF_SSBL_ATTR} ${BIF_DEVICETREE_ATTR}" + +#specify BIF partition attributes for FSBL +#bootloader is FSBL. Location where FSBL binary is present and dependency to build FSBL +BIF_PARTITION_ATTR[fsbl] ?= "bootloader" +BIF_PARTITION_IMAGE[fsbl] ?= "${RECIPE_SYSROOT}/boot/fsbl.elf" + +#specify BIF partition attributes for u-boot +#Location where u-boot binary is present +BIF_PARTITION_IMAGE[u-boot-xlnx] ?= "${RECIPE_SYSROOT}/boot/u-boot.elf" + +# specify BIF partition attributes for dtb +BIF_PARTITION_ATTR[device-tree] ?= "load=0x100000" +BIF_PARTITION_IMAGE[device-tree] ?= "${RECIPE_SYSROOT}/boot/devicetree/system-top.dtb" + +# enable bitstream-Note this is not enabled by default (missing in BIF_PARTITION_ATTR) +BIF_PARTITION_IMAGE[bitstream] ?= "${RECIPE_SYSROOT}/boot/bitstream/download-${MACHINE}.bit" diff --git a/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-zynqmp.inc b/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-zynqmp.inc new file mode 100644 index 00000000..c5c4e385 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootbin/machine-xilinx-zynqmp.inc @@ -0,0 +1,51 @@ +# specify BIF common attribute for FSBL +BIF_COMMON_ATTR ?= "" + +# specify BIF partition attributes required for BOOT.bin +# For details on ordering, see: +# https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842019/Zynq+UltraScale+FSBL#ZynqUltraScale%2BFSBL-IsthereanyorderinwhichIhavetospecifybitstreaminBIFfile(forbootimagecreation)%3F +# +# The loading rules: +# From the 2017.1 release, bistreams should be loaded bfore ATF... +# ...preferably immediately after the FSBL and PMUFW. +# +# While the first few components must be fsbl and pmufw per: +# https://www.xilinx.com/support/documentation/sw_manuals/xilinx2021_2/ug1283-bootgen-user-guide.pdf +# +# This combination restricts the boot order to be: +# FSBL & PMUFW -> Bitstream (if available) -> ATF -> Device Tree (if available) -> Second Stage Bootloader +# +BIF_FSBL_ATTR ??= "fsbl pmufw" +BIF_BITSTREAM_ATTR ??= "" +BIF_ATF_ATTR ??= "arm-trusted-firmware" +BIF_DEVICETREE_ATTR ??= "device-tree" +BIF_SSBL_ATTR ??= "u-boot-xlnx" +BIF_PARTITION_ATTR ??= "${BIF_FSBL_ATTR} ${BIF_BITSTREAM_ATTR} ${BIF_ATF_ATTR} ${BIF_DEVICETREE_ATTR} ${BIF_SSBL_ATTR}" + +# specify BIF partition attributes for FSBL +# bootloader is FSBL. Location where FSBL binary is present and dependency to build FSBL +BIF_PARTITION_ATTR[fsbl] ?= "bootloader, destination_cpu=a53-0" +BIF_PARTITION_IMAGE[fsbl] ?= "${RECIPE_SYSROOT}/boot/fsbl.elf" + +# specify BIF partition attributes for PMU Firmware +# destination cpu for PMU. Location where PMU binary is present and dependency to build PMU Firmware +BIF_PARTITION_ATTR[pmufw] ?= "destination_cpu=pmu" +BIF_PARTITION_IMAGE[pmufw] ?= "${RECIPE_SYSROOT}/boot/pmufw.elf" + +# specify BIF partition attributes for ATF +# destination cpu for ATF, security levels. Location where ATF binary is present (dependency is not required as ATF is always built for ZU+, see zcu102-zynqmp.conf) +BIF_PARTITION_ATTR[arm-trusted-firmware] ?= "destination_cpu=a53-0,exception_level=el-3,trustzone" +BIF_PARTITION_IMAGE[arm-trusted-firmware] ?= "${RECIPE_SYSROOT}/boot/arm-trusted-firmware.elf" + +# specify BIF partition attributes for u-boot +# destination cpu for u-boot, security levels. Location where u-boot binary is present (dependency is not required as u-boot is always built for ZU+, see zcu102-zynqmp.conf) +BIF_PARTITION_ATTR[u-boot-xlnx] ?= "destination_cpu=a53-0,exception_level=el-2" +BIF_PARTITION_IMAGE[u-boot-xlnx] ?= "${RECIPE_SYSROOT}/boot/u-boot.elf" + +# specify BIF partition attributes for dtb +BIF_PARTITION_ATTR[device-tree] ?= "destination_cpu=a53-0,load=0x100000" +BIF_PARTITION_IMAGE[device-tree] ?= "${RECIPE_SYSROOT}/boot/devicetree/system-top.dtb" + +# enable bitstream-Note this is not enabled by default (missing in BIF_PARTITION_ATTR) +BIF_PARTITION_ATTR[bitstream] ?= "destination_device=pl" +BIF_PARTITION_IMAGE[bitstream] ?= "${RECIPE_SYSROOT}/boot/bitstream/download-${MACHINE}.bit" diff --git a/meta-xilinx-core/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb b/meta-xilinx-core/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb new file mode 100644 index 00000000..4c8bfa0e --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootbin/xilinx-bootbin_1.0.bb @@ -0,0 +1,199 @@ +SUMMARY = "Generates boot.bin using bootgen tool" +DESCRIPTION = "Manages task dependencies and creation of boot.bin. Use the \ +BIF_PARTITION_xyz global variables and flags to determine what makes it into \ +the image." + +LICENSE = "BSD" + +include machine-xilinx-${SOC_FAMILY}.inc + +inherit deploy + +# Don't allow building for microblaze MACHINE +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynq = ".*" +COMPATIBLE_MACHINE:zynqmp = ".*" +COMPATIBLE_MACHINE:versal = ".*" + +PROVIDES = "virtual/boot-bin" + +DEPENDS += "bootgen-native" + +# There is no bitstream recipe, so really depend on virtual/bitstream +DEPENDS += "${@(d.getVar('BIF_PARTITION_ATTR') or "").replace('bitstream', 'virtual/bitstream')}" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +BIF_FILE_PATH ?= "${B}/bootgen.bif" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI += "${@('file://' + d.getVar("BIF_FILE_PATH")) if d.getVar("BIF_FILE_PATH") != (d.getVar('B') + '/bootgen.bif') else ''}" + +# bootgen command -arch option for different SOC architectures +# zynq7000 : zynq +# zynqmp : zynqmp +# versal : versal +# versal-net : versalnet +BOOTGEN_ARCH_DEFAULT = "${SOC_FAMILY}" +BOOTGEN_ARCH_DEFAULT:versal-net = "${SOC_FAMILY}${SOC_VARIANT}" +BOOTGEN_ARCH ?= "${BOOTGEN_ARCH_DEFAULT}" +BOOTGEN_EXTRA_ARGS ?= "" + +do_patch[noexec] = "1" + +def create_bif(config, attrflags, attrimage, ids, common_attr, biffd, d): + arch = d.getVar("SOC_FAMILY") + bb.error("create_bif function not defined for arch: %s" % (arch)) + +def create_zynq_bif(config, attrflags, attrimage, ids, common_attr, biffd, d): + import re, os + for cfg in config: + if cfg not in attrflags and common_attr: + error_msg = "%s: invalid ATTRIBUTE" % (cfg) + bb.error("BIF attribute Error: %s " % (error_msg)) + else: + if common_attr: + cfgval = d.expand(attrflags[cfg]).split(',') + cfgstr = "\t [%s] %s\n" % (cfg,', '.join(cfgval)) + else: + if cfg not in attrimage: + error_msg = "%s: invalid or missing elf or image" % (cfg) + bb.error("BIF atrribute Error: %s " % (error_msg)) + imagestr = d.expand(attrimage[cfg]) + if not os.path.exists(imagestr): + bb.fatal("Expected file %s, specified from the bif file does not exists!" %(imagestr)) + if os.stat(imagestr).st_size == 0: + bb.warn("Empty file %s, excluding from bif file" %(imagestr)) + continue + if cfg in attrflags: + cfgval = d.expand(attrflags[cfg]).split(',') + cfgstr = "\t [%s] %s\n" % (', '.join(cfgval), imagestr) + else: + cfgstr = "\t %s\n" % (imagestr) + biffd.write(cfgstr) + + return + +def create_versal_bif(config, attrflags, attrimage, ids, common_attr, biffd, d): + import re, os + id_dict = {} + for cfg in config: + if cfg not in attrflags and common_attr: + error_msg = "%s: invalid ATTRIBUTE" % (cfg) + bb.error("BIF attribute Error: %s " % (error_msg)) + else: + if common_attr: + cfgval = d.expand(attrflags[cfg]).split(',') + #TODO: Does common attribute syntax change in similar way for versal? + cfgstr = "\t { %s %s }\n" % (cfg,', '.join(cfgval)) + biffd.write(cfgstr) + else: + if cfg not in attrimage: + error_msg = "%s: invalid or missing elf or image" % (cfg) + bb.error("BIF atrribute Error: %s " % (error_msg)) + imagestr = d.expand(attrimage[cfg]) + if os.stat(imagestr).st_size == 0: + bb.warn("Empty file %s, excluding from bif file" %(imagestr)) + continue + if cfg in attrflags: + cfgval = d.expand(attrflags[cfg]).split(',') + try: + id = d.expand(ids[cfg]) + except: + id = '0' + cfgstr = "\t { %s, file=%s }\n" % (', '.join(cfgval), imagestr) + try: + id_dict[id] += cfgstr + except: + id_dict[id] = cfgstr + else: + cfgstr = "\t %s\n" % (imagestr) + for id, string in id_dict.items(): + biffd.write("\timage {\n") + if id != '0': + biffd.write("\t id = " + id + "\n") + biffd.write(string) + biffd.write("\t}\n") + return + +python do_configure() { + fp = d.getVar("BIF_FILE_PATH") + if fp == (d.getVar('B') + '/bootgen.bif'): + biffd = open(fp, 'w') + biffd.write("the_ROM_image:\n") + biffd.write("{\n") + + arch = d.getVar("SOC_FAMILY") + bifattr = (d.getVar("BIF_COMMON_ATTR") or "").split() + if bifattr: + attrflags = d.getVarFlags("BIF_COMMON_ATTR") or {} + if arch in ['zynq', 'zynqmp']: + create_zynq_bif(bifattr, attrflags,'','', 1, biffd, d) + elif arch in ['versal']: + create_versal_bif(bifattr, attrflags,'','', 1, biffd, d) + else: + create_bif(bifattr, attrflags,'','', 1, biffd, d) + + bifpartition = (d.getVar("BIF_PARTITION_ATTR") or "").split() + if bifpartition: + attrflags = d.getVarFlags("BIF_PARTITION_ATTR") or {} + attrimage = d.getVarFlags("BIF_PARTITION_IMAGE") or {} + ids = d.getVarFlags("BIF_PARTITION_ID") or {} + if arch in ['zynq', 'zynqmp']: + create_zynq_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) + elif arch in ['versal']: + create_versal_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) + else: + create_bif(bifpartition, attrflags, attrimage, ids, 0, biffd, d) + + biffd.write("}") + biffd.close() + else: + print("Using custom BIF file: " + d.getVar("BIF_FILE_PATH") ) +} + +do_configure[vardeps] += "BIF_PARTITION_ATTR BIF_PARTITION_IMAGE BIF_COMMON_ATTR" +do_configure[vardeps] += "BIF_FSBL_ATTR BIF_BITSTREAM_ATTR BIF_ATF_ATTR BIF_DEVICETREE_ATTR BIF_SSBL_ATTR" + +do_compile() { + cd ${WORKDIR} + rm -f ${B}/BOOT.bin + if [ "${BIF_FILE_PATH}" != "${B}/bootgen.bif" ];then + BIF_FILE_PATH="${WORKDIR}${BIF_FILE_PATH}" + fi + bootgen -image ${BIF_FILE_PATH} -arch ${BOOTGEN_ARCH} ${BOOTGEN_EXTRA_ARGS} -w -o ${B}/BOOT.bin + if [ ! -e ${B}/BOOT.bin ]; then + bbfatal "bootgen failed. See log" + fi +} + +do_install() { + install -d ${D}/boot + install -m 0644 ${B}/BOOT.bin ${D}/boot/BOOT.bin +} + +inherit image-artifact-names + +QEMUQSPI_BASE_NAME ?= "QEMU_qspi-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +BOOTBIN_BASE_NAME ?= "BOOT-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + install -d ${DEPLOYDIR} + install -m 0644 ${B}/BOOT.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}.bin + ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/BOOT-${MACHINE}.bin + ln -sf ${BOOTBIN_BASE_NAME}.bin ${DEPLOYDIR}/boot.bin +} + +do_deploy:append:versal () { + + install -m 0644 ${B}/BOOT_bh.bin ${DEPLOYDIR}/${BOOTBIN_BASE_NAME}_bh.bin + ln -sf ${BOOTBIN_BASE_NAME}_bh.bin ${DEPLOYDIR}/BOOT-${MACHINE}_bh.bin +} + +FILES:${PN} += "/boot/BOOT.bin" +SYSROOT_DIRS += "/boot" + +addtask do_deploy before do_build after do_compile diff --git a/meta-xilinx-core/recipes-bsp/bootbin/xilinx-mcs_1.0.bb b/meta-xilinx-core/recipes-bsp/bootbin/xilinx-mcs_1.0.bb new file mode 100644 index 00000000..48c7bca9 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootbin/xilinx-mcs_1.0.bb @@ -0,0 +1,69 @@ +SUMMARY = "Generates boot.mcs using vivado" +DESCRIPTION = "Manages task dependencies and creation of boot.mcs for microblaze" + +LICENSE = "BSD" + +PROVIDES = "virtual/boot-bin" + +DEPENDS = "bitstream-microblaze" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:microblaze = ".*" + +inherit deploy image-artifact-names + +do_fetch[noexec] = "1" +do_unpack[noexec] = "1" +do_patch[noexec] = "1" + +PROC ??= "kc705_i/microblaze_0" + +FLASH_SIZE ??= "0x80" +FLASH_INTERFACE ??= "BPIx16" +MB_OUT_FORMAT ??= "mcs" +BOOT_EXT = "${@d.getVar('MB_OUT_FORMAT').lower()}" + +BITSTREAM_FILE ?= "${RECIPE_SYSROOT}/boot/bitstream/download.bit" +B = "${WORKDIR}/build" +WR_CFGMEM_MISC ?= "-loadbit \" up 0 ${BITSTREAM_FILE}\"" + +do_check_for_vivado() { + bbnote "Checking Vivado install path" + which "vivado" 2>/dev/null || { + bbfatal "Vivado not found! Please add \"INHERIT += \"vivado\"\" to your local.conf" + } +} + +addtask do_check_for_vivado before do_configure + +do_configure() { + echo " write_cfgmem -force -format ${MB_OUT_FORMAT} -size ${FLASH_SIZE} -interface ${FLASH_INTERFACE} ${WR_CFGMEM_MISC} ${B}/BOOT.${BOOT_EXT} " > ${B}/write_cfgmem_boot_mcs.tcl + if [ ! -e ${B}/write_cfgmem_boot_mcs.tcl ]; then + bbfatal "write_cfgmem_boot_mcs.tcl creation failed. See log for details" + fi +} + + +do_compile() { + vivado -log "${B}/cfgmem_mcs.log" -jou "${B}/cfgmem_mcs.jou" -mode batch -s ${B}/write_cfgmem_boot_mcs.tcl + if [ ! -e ${B}/BOOT.${BOOT_EXT} ]; then + bbfatal "BOOT.${BOOT_EXT} failed. See log" + fi +} + +do_install() { + : +} + +BOOT_BASE_NAME ?= "BOOT-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + #install BOOT.mcs + if [ -e ${B}/BOOT.${BOOT_EXT} ]; then + install -Dm 0644 ${B}/BOOT.${BOOT_EXT} ${DEPLOYDIR}/${BOOT_BASE_NAME}.${BOOT_EXT} + ln -sf ${BOOT_BASE_NAME}.${BOOT_EXT} ${DEPLOYDIR}/BOOT-${MACHINE}.${BOOT_EXT} + fi +} +addtask do_deploy before do_build after do_compile diff --git a/meta-xilinx-core/recipes-bsp/bootgen/bootgen_1.0.bb b/meta-xilinx-core/recipes-bsp/bootgen/bootgen_1.0.bb new file mode 100644 index 00000000..fdf28f41 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootgen/bootgen_1.0.bb @@ -0,0 +1,31 @@ +SUMMARY = "Building and installing bootgen" +DESCRIPTION = "Building and installing bootgen, a Xilinx tool that lets you stitch binary files together and generate device boot images" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=d526b6d0807bf263b97da1da876f39b1" + +S = "${WORKDIR}/git" + +DEPENDS += "openssl" +RDEPENDS:${PN} += "openssl" + +REPO ?= "git://github.com/Xilinx/bootgen.git;protocol=https" +BRANCH ?= "xlnx_rel_v2022.2" +SRCREV = "cf4ba93b99644dc4429ef633471a639e1382f0e7" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +EXTRA_OEMAKE += 'CROSS_COMPILER="${CXX}" -C ${S}' +CXXFLAGS:append = " -std=c++0x" + +TARGET_CC_ARCH += "${LDFLAGS}" + +do_install() { + install -d ${D}${bindir} + install -Dm 0755 ${S}/bootgen ${D}${bindir} +} + +FILES:${PN} = "${bindir}/bootgen" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-bsp/bootgen/bootgen_2023.1.bb b/meta-xilinx-core/recipes-bsp/bootgen/bootgen_2023.1.bb new file mode 100644 index 00000000..a934230d --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootgen/bootgen_2023.1.bb @@ -0,0 +1,31 @@ +SUMMARY = "Building and installing bootgen" +DESCRIPTION = "Building and installing bootgen, a Xilinx tool that lets you stitch binary files together and generate device boot images" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=d526b6d0807bf263b97da1da876f39b1" + +S = "${WORKDIR}/git" + +DEPENDS += "openssl" +RDEPENDS:${PN} += "openssl" + +REPO ?= "git://github.com/Xilinx/bootgen.git;protocol=https" +BRANCH = "xlnx_rel_v2023.1" +SRCREV = "4f1e1caf2c09cdeacc35cbeedaf2550c6e44c7fd" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +EXTRA_OEMAKE += 'CROSS_COMPILER="${CXX}" -C ${S}' +CXXFLAGS:append = " -std=c++0x" + +TARGET_CC_ARCH += "${LDFLAGS}" + +do_install() { + install -d ${D}${bindir} + install -Dm 0755 ${S}/bootgen ${D}${bindir} +} + +FILES:${PN} = "${bindir}/bootgen" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-bsp/bootgen/bootgen_2023.2.bb b/meta-xilinx-core/recipes-bsp/bootgen/bootgen_2023.2.bb new file mode 100644 index 00000000..03f323e1 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootgen/bootgen_2023.2.bb @@ -0,0 +1,31 @@ +SUMMARY = "Building and installing bootgen" +DESCRIPTION = "Building and installing bootgen, a Xilinx tool that lets you stitch binary files together and generate device boot images" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=d526b6d0807bf263b97da1da876f39b1" + +S = "${WORKDIR}/git" + +DEPENDS += "openssl" +RDEPENDS:${PN} += "openssl" + +REPO ?= "git://github.com/Xilinx/bootgen.git;protocol=https" +BRANCH = "xlnx_rel_v2023.2" +SRCREV = "8e6702bb5064b806e45028486de7376962470a36" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +EXTRA_OEMAKE += 'CROSS_COMPILER="${CXX}" -C ${S}' +CXXFLAGS:append = " -std=c++0x" + +TARGET_CC_ARCH += "${LDFLAGS}" + +do_install() { + install -d ${D}${bindir} + install -Dm 0755 ${S}/bootgen ${D}${bindir} +} + +FILES:${PN} = "${bindir}/bootgen" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-bsp/cdo/extract-cdo_1.0.bb b/meta-xilinx-core/recipes-bsp/cdo/extract-cdo_1.0.bb new file mode 100644 index 00000000..8b1e52ac --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/cdo/extract-cdo_1.0.bb @@ -0,0 +1,39 @@ +DESCRIPTION = "Recipe to extract pmc_cdo for qemu usage" + +LICENSE = "CLOSED" + +inherit deploy + +PROVIDES = "virtual/cdo" + +DEPENDS += "bootgen-native" + +do_compile[depends] += "virtual/boot-bin:do_deploy" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal = "versal" + +PACKAGE_ARCH ?= "${MACHINE_ARCH}" + +B = "${WORKDIR}/build" + +BOOTGEN_CMD ?= "bootgen" +BOOTGEN_ARGS ?= "-arch versal" +BOOTGEN_OUTFILE ?= "${DEPLOY_DIR_IMAGE}/boot.bin" + +# bootgen extracts the pmc_cdo file from the boot.bin. By default this +# happens in the same directory as the boot.bin. We need to move it to +# this directory, as do_compile should never write into a deploy dir +do_compile() { + ${BOOTGEN_CMD} ${BOOTGEN_ARGS} -dump_dir ${B} -dump ${BOOTGEN_OUTFILE} pmc_cdo +} + +do_install[noexec] = '1' + +do_deploy() { + install -d ${DEPLOYDIR}/CDO + install -m 0644 ${B}/pmc_cdo.bin ${DEPLOYDIR}/CDO/pmc_cdo.bin + install -m 0644 ${B}/pmc_cdo.bin ${DEPLOYDIR}/pmc_cdo.bin +} + +addtask do_deploy after do_compile diff --git a/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb b/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb new file mode 100644 index 00000000..8d7211f5 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb @@ -0,0 +1,167 @@ +SUMMARY = "Xilinx BSP device trees" +DESCRIPTION = "Xilinx BSP device trees from within layer." +SECTION = "bsp" + +# the device trees from within the layer are licensed as MIT, kernel includes are GPL +LICENSE = "MIT & GPL-2.0-or-later" +LIC_FILES_CHKSUM = " \ + file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ + file://${COMMON_LICENSE_DIR}/GPL-2.0-or-later;md5=fed54355545ffd980b814dab4a3b312c \ + " + +# Since we're not based on a kernel default to nothing. +# This needs to be before the devicetree inherit, as it configured for use +# with a linux kernel by default. +KERNEL_INCLUDE ?= "" + +inherit devicetree image-artifact-names + +# Fall back to SYSTEM_DTFILE if specified... +# CONFIG_DTFILE is intended to hold a specific configuration's (multiconfig) +# device tree, while SYSTEM_DTFILE is used for the full heterogenous +# system. +SYSTEM_DTFILE ??= "" +CONFIG_DTFILE ??= "${SYSTEM_DTFILE}" + +BASE_DTS ?= "${@os.path.basename(d.getVar('CONFIG_DTFILE') or '').rstrip('.dtb').rstrip('.dts') or 'system-top'}" + +EXTRA_DT_FILES ?= "" +EXTRA_DTFILE_PREFIX ?= "system-top" +EXTRA_DTFILES_BUNDLE ?= "" +UBOOT_DT_FILES ?= "" +UBOOT_DTFILE_PREFIX ?= "system-top" +UBOOT_DTFILES_BUNDLE ?= "" +EXTRA_OVERLAYS ?= "" + +SYSTEM_DTFILE[doc] = "System Device Tree which accepts at 0...1 dts file" +CONFIG_DTFILE[doc] = "Domain Specific Device Tree which accepts 0...1 dts file" +EXTRA_DT_FILES[doc] = "Add extra files to DT_FILES_PATH, it accepts 1...n dtsi files and adds to SRC_URI" +EXTRA_OVERLAYS[doc] = "Add extra files to DT_FILES_PATH and adds a #include for each to the BASE_DTS, it access 1..n dtsi files and adds to SRC_URI" + +# There should only be ONE CONFIG_DTFILE listed +# These need to be passed in from global, not from a bbappend +FILESEXTRAPATHS:prepend := "${@'%s:' % os.path.dirname(d.getVar('CONFIG_DTFILE') or '') if (d.getVar('CONFIG_DTFILE')) else ''}" +SRC_URI:append := " ${@'file://%s' % os.path.basename(d.getVar('CONFIG_DTFILE') or '') if (d.getVar('CONFIG_DTFILE')) else ''}" + +SRC_URI:append = " ${@" ".join(["file://%s" % f for f in (d.getVar('EXTRA_DT_FILES') or "").split()])}" +SRC_URI:append = " ${@" ".join(["file://%s" % f for f in (d.getVar('EXTRA_OVERLAYS') or "").split()])}" + +COMPATIBLE_MACHINE:zynq = ".*" +COMPATIBLE_MACHINE:zynqmp = ".*" +COMPATIBLE_MACHINE:versal = ".*" + +DEPENDS += "python3-dtc-native" + +PROVIDES = "virtual/dtb" + +# common zynq include +SRC_URI:append:zynq = " file://zynq-7000-qspi-dummy.dtsi" + +DTB_FILE_NAME ?= "${BASE_DTS}.dtb" + +DTB_BASE_NAME ?= "${MACHINE}-system${IMAGE_VERSION_SUFFIX}" + +# Copy the EXTRA_DT_FILES and EXTRA_OVERLAYS files in prepend operation so that +# it can be preprocessed. +do_configure:prepend () { + # Create DT_FILES_PATH directory if doesn't exist during prepend operation. + if [ ! -d ${DT_FILES_PATH} ]; then + mkdir -p ${DT_FILES_PATH} + fi + + for f in ${EXTRA_DT_FILES} ${EXTRA_OVERLAYS}; do + if [ "$(realpath ${WORKDIR}/${f})" != "$(realpath ${DT_FILES_PATH}/`basename ${f}`)" ]; then + cp ${WORKDIR}/${f} ${DT_FILES_PATH}/ + fi + done +} + +do_configure:append () { + for f in ${EXTRA_OVERLAYS}; do + if [ ! -e ${DT_FILES_PATH}/${BASE_DTS}.dts ]; then + if [ -e ${DT_FILES_PATH}/${BASE_DTS}.dtb ]; then + bberror "Unable to find ${BASE_DTS}.dts, to use EXTRA_OVERLAYS you must use a 'dts' and not 'dtb' in CONFIG_DTFILE" + else + bberror "Unable to find ${BASE_DTS}.dts, to use EXTRA_OVERLAYS you must set a valid CONFIG_DTFILE or use system-top.dts" + fi + exit 1 + fi + echo "/include/ \"$f\"" >> ${DT_FILES_PATH}/${BASE_DTS}.dts + done +} + +devicetree_do_compile:append() { + import subprocess + + dtb_file = d.getVar('DTB_FILE_NAME') or '' + if not dtb_file or not os.path.isfile(dtb_file): + bb.error("Expected file ${DTB_FILE_NAME} doesn't exist") + + if d.getVar('EXTRA_DTFILES_BUNDLE'): + ccdtb_prefix = d.getVar('EXTRA_DTFILE_PREFIX') + extra_dt_files = d.getVar('EXTRA_DT_FILES').split() or [] + + for dtsfile in extra_dt_files: + dtname = os.path.splitext(os.path.basename(dtsfile))[0] + if os.path.isfile(f"{dtname}.dtbo"): + fdtargs = ["fdtoverlay", "-o", f"{ccdtb_prefix}-{dtname}.dtb", "-i", dtb_file, f"{dtname}.dtbo"] + bb.note("Running {0}".format(" ".join(fdtargs))) + subprocess.run(fdtargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + + if d.getVar('UBOOT_DTFILES_BUNDLE'): + uboot_ccdtb_prefix = d.getVar('UBOOT_DTFILE_PREFIX') + uboot_dt_files = d.getVar('UBOOT_DT_FILES').split() or [] + + for dtsfile in uboot_dt_files: + dtname = os.path.splitext(os.path.basename(dtsfile))[0] + if os.path.isfile(f"{dtname}.dtbo"): + fdtargs = ["fdtoverlay", "-o", f"{uboot_ccdtb_prefix}-{dtname}.dtb", "-i", dtb_file, f"{dtname}.dtbo"] + bb.note("Running {0}".format(" ".join(fdtargs))) + subprocess.run(fdtargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) +} + +FILES:${PN} += "/boot/system.dtb" + +devicetree_do_install:append() { + if [ -n "${DTB_FILE_NAME}" ]; then + # If it's already a dtb, we have to copy from the original location + if [ -e "${DT_FILES_PATH}/${DTB_FILE_NAME}" ]; then + install -Dm 0644 ${DT_FILES_PATH}/${DTB_FILE_NAME} ${D}/boot/devicetree/${DTB_FILE_NAME} + fi + if [ -e "${D}/boot/devicetree/${DTB_FILE_NAME}" ]; then + # We need the output to be system.dtb for WIC setup to match XSCT flow + ln -sf devicetree/${DTB_FILE_NAME} ${D}/boot/system.dtb + else + bberror "Expected filename ${DTB_FILE_NAME} doesn't exist in ${DEPLOYDIR}/devicetree" + fi + fi +} + +devicetree_do_deploy:append() { + if [ -n "${DTB_FILE_NAME}" ]; then + # If it's already a dtb, we have to copy from the original location + if [ -e "${DT_FILES_PATH}/${DTB_FILE_NAME}" ]; then + install -Dm 0644 ${DT_FILES_PATH}/${DTB_FILE_NAME} ${DEPLOYDIR}/devicetree/${DTB_FILE_NAME} + fi + if [ -e "${DEPLOYDIR}/devicetree/${DTB_FILE_NAME}" ]; then + # We need the output to be system.dtb for WIC setup to match XSCT flow + ln -sf devicetree/${DTB_FILE_NAME} ${DEPLOYDIR}/${DTB_BASE_NAME}.dtb + ln -sf devicetree/${DTB_FILE_NAME} ${DEPLOYDIR}/${MACHINE}-system.dtb + ln -sf devicetree/${DTB_FILE_NAME} ${DEPLOYDIR}/system.dtb + else + bberror "Expected filename ${DTB_FILE_NAME} doesn't exist in ${DEPLOYDIR}/devicetree" + fi + fi +} + +def check_devicetree_variables(d): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + if not d.getVar('CONFIG_DTFILE'): + raise bb.parse.SkipRecipe("CONFIG_DTFILE or SYSTEM_DTFILE is not defined.") + +python() { + # Need to allow bbappends to change the check + check_devicetree_variables(d) +} diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/zynq-7000-qspi-dummy.dtsi b/meta-xilinx-core/recipes-bsp/device-tree/files/zynq-7000-qspi-dummy.dtsi index d059a2da..d059a2da 100644 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/zynq-7000-qspi-dummy.dtsi +++ b/meta-xilinx-core/recipes-bsp/device-tree/files/zynq-7000-qspi-dummy.dtsi diff --git a/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_1.0.bb b/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_1.0.bb new file mode 100644 index 00000000..b4de4fe6 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_1.0.bb @@ -0,0 +1,78 @@ +SUMMARY = "Xilinx dfx-mgr libraries" +DESCRIPTION = "Xilinx Runtime User Space Libraries and Binaries" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=d67bcef754e935bf77b6d7051bd62b5e" + +REPO ?= "git://github.com/Xilinx/dfx-mgr.git;protocol=https" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +BRANCH = "xlnx_rel_v2022.2" +SRCREV = "bc06691eb35d7f0acb7c2508b6d050d77b0264a0" +SOMAJOR = "1" +SOMINOR = "0" +SOVERSION = "${SOMAJOR}.${SOMINOR}" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" + +S = "${WORKDIR}/git" + +inherit cmake update-rc.d systemd + +DEPENDS += " libwebsockets inotify-tools libdfx zocl libdrm" +RDEPENDS:${PN} += " fru-print" +EXTRA_OECMAKE += " \ + -DCMAKE_SYSROOT:PATH=${RECIPE_SYSROOT} \ + " + +# Workaround for: the comparison will always evaluate as 'true' for the address of 'defaul_accel_name' will never be NULL [-Werror=address] +CFLAGS += "-Wno-address" + +# Workaround for: '__builtin_strncpy' specified bound depends on the length of the source argument [-Werror=stringop-truncation] +CFLAGS += "-Wno-stringop-truncation" + +INITSCRIPT_NAME = "dfx-mgr.sh" +INITSCRIPT_PARAMS = "start 99 S ." + +SYSTEMD_PACKAGES="${PN}" +SYSTEMD_SERVICE:${PN}="dfx-mgr.service" +SYSTEMD_AUTO_ENABLE:${PN}="enable" + + +do_install(){ + install -d ${D}${bindir} + install -d ${D}${libdir} + install -d ${D}${includedir} + install -d ${D}${base_libdir}/firmware/xilinx + install -d ${D}${sysconfdir}/dfx-mgrd + + cp ${B}/example/sys/linux/dfx-mgrd-static ${D}${bindir}/dfx-mgrd + cp ${B}/example/sys/linux/dfx-mgr-client-static ${D}${bindir}/dfx-mgr-client + chrpath -d ${D}${bindir}/dfx-mgrd + chrpath -d ${D}${bindir}/dfx-mgr-client + install -m 0644 ${S}/src/dfxmgr_client.h ${D}${includedir} + + oe_soinstall ${B}/src/libdfx-mgr.so.${SOVERSION} ${D}${libdir} + + install -m 0755 ${S}/src/daemon.conf ${D}${sysconfdir}/dfx-mgrd/ + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${S}/src/dfx-mgr.sh ${D}${sysconfdir}/init.d/ + fi + + install -m 0755 ${S}/src/dfx-mgr.sh ${D}${bindir} + install -m 0755 ${S}/src/scripts/xlnx-firmware-detect ${D}${bindir} + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/src/dfx-mgr.service ${D}${systemd_system_unitdir} +} + +PACKAGES =+ "libdfx-mgr" + +FILES:${PN} += "${base_libdir}/firmware/xilinx" +FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${sysconfdir}/init.d/dfx-mgr.sh', '', d)} ${systemd_system_unitdir}" +FILES:libdfx-mgr = "${libdir}/libdfx-mgr.so.${SOVERSION} ${libdir}/libdfx-mgr.so.${SOMAJOR}" diff --git a/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_2023.1.bb b/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_2023.1.bb new file mode 100644 index 00000000..a4149d39 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_2023.1.bb @@ -0,0 +1,72 @@ +SUMMARY = "Xilinx dfx-mgr libraries" +DESCRIPTION = "Xilinx Runtime User Space Libraries and Binaries" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=d67bcef754e935bf77b6d7051bd62b5e" + +REPO ?= "git://github.com/Xilinx/dfx-mgr.git;protocol=https" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +BRANCH = "xlnx_rel_v2023.1" +SRCREV = "5918fb3406d828693cca484b77229ffd031b5dc4" +SOMAJOR = "1" +SOMINOR = "0" +SOVERSION = "${SOMAJOR}.${SOMINOR}" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" + +S = "${WORKDIR}/git" + +inherit cmake update-rc.d systemd + +DEPENDS += " libwebsockets inotify-tools libdfx zocl libdrm" +RDEPENDS:${PN} += " freeipmi" +EXTRA_OECMAKE += " \ + -DCMAKE_SYSROOT:PATH=${RECIPE_SYSROOT} \ + " + +INITSCRIPT_NAME = "dfx-mgr.sh" +INITSCRIPT_PARAMS = "start 99 S ." + +SYSTEMD_PACKAGES="${PN}" +SYSTEMD_SERVICE:${PN}="dfx-mgr.service" +SYSTEMD_AUTO_ENABLE:${PN}="enable" + + +do_install(){ + install -d ${D}${bindir} + install -d ${D}${libdir} + install -d ${D}${includedir} + install -d ${D}${base_libdir}/firmware/xilinx + install -d ${D}${sysconfdir}/dfx-mgrd + + cp ${B}/example/sys/linux/dfx-mgrd-static ${D}${bindir}/dfx-mgrd + cp ${B}/example/sys/linux/dfx-mgr-client-static ${D}${bindir}/dfx-mgr-client + chrpath -d ${D}${bindir}/dfx-mgrd + chrpath -d ${D}${bindir}/dfx-mgr-client + install -m 0644 ${S}/src/dfxmgr_client.h ${D}${includedir} + + oe_soinstall ${B}/src/libdfx-mgr.so.${SOVERSION} ${D}${libdir} + + install -m 0755 ${S}/src/daemon.conf ${D}${sysconfdir}/dfx-mgrd/ + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${S}/src/dfx-mgr.sh ${D}${sysconfdir}/init.d/ + fi + + install -m 0755 ${S}/src/dfx-mgr.sh ${D}${bindir} + install -m 0755 ${S}/src/scripts/xlnx-firmware-detect ${D}${bindir} + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/src/dfx-mgr.service ${D}${systemd_system_unitdir} +} + +PACKAGES =+ "libdfx-mgr" + +FILES:${PN} += "${base_libdir}/firmware/xilinx" +FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${sysconfdir}/init.d/dfx-mgr.sh', '', d)} ${systemd_system_unitdir}" +FILES:libdfx-mgr = "${libdir}/libdfx-mgr.so.${SOVERSION} ${libdir}/libdfx-mgr.so.${SOMAJOR}" diff --git a/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_2023.2.bb b/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_2023.2.bb new file mode 100644 index 00000000..0d24c9fc --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/dfx-mgr/dfx-mgr_2023.2.bb @@ -0,0 +1,72 @@ +SUMMARY = "Xilinx dfx-mgr libraries" +DESCRIPTION = "Xilinx Runtime User Space Libraries and Binaries" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=d67bcef754e935bf77b6d7051bd62b5e" + +REPO ?= "git://github.com/Xilinx/dfx-mgr.git;protocol=https" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +BRANCH = "xlnx_rel_v2023.2" +SRCREV = "4dbd33accb043bd92ecbec2a3507f85a22045c51" +SOMAJOR = "1" +SOMINOR = "0" +SOVERSION = "${SOMAJOR}.${SOMINOR}" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" + +S = "${WORKDIR}/git" + +inherit cmake update-rc.d systemd + +DEPENDS += " libwebsockets inotify-tools libdfx zocl libdrm" +RDEPENDS:${PN} += " freeipmi" +EXTRA_OECMAKE += " \ + -DCMAKE_SYSROOT:PATH=${RECIPE_SYSROOT} \ + " + +INITSCRIPT_NAME = "dfx-mgr.sh" +INITSCRIPT_PARAMS = "start 99 S ." + +SYSTEMD_PACKAGES="${PN}" +SYSTEMD_SERVICE:${PN}="dfx-mgr.service" +SYSTEMD_AUTO_ENABLE:${PN}="enable" + + +do_install(){ + install -d ${D}${bindir} + install -d ${D}${libdir} + install -d ${D}${includedir} + install -d ${D}${base_libdir}/firmware/xilinx + install -d ${D}${sysconfdir}/dfx-mgrd + + cp ${B}/example/sys/linux/dfx-mgrd-static ${D}${bindir}/dfx-mgrd + cp ${B}/example/sys/linux/dfx-mgr-client-static ${D}${bindir}/dfx-mgr-client + chrpath -d ${D}${bindir}/dfx-mgrd + chrpath -d ${D}${bindir}/dfx-mgr-client + install -m 0644 ${S}/src/dfxmgr_client.h ${D}${includedir} + + oe_soinstall ${B}/src/libdfx-mgr.so.${SOVERSION} ${D}${libdir} + + install -m 0755 ${S}/src/daemon.conf ${D}${sysconfdir}/dfx-mgrd/ + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${S}/src/dfx-mgr.sh ${D}${sysconfdir}/init.d/ + fi + + install -m 0755 ${S}/src/dfx-mgr.sh ${D}${bindir} + install -m 0755 ${S}/src/scripts/xlnx-firmware-detect ${D}${bindir} + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/src/dfx-mgr.service ${D}${systemd_system_unitdir} +} + +PACKAGES =+ "libdfx-mgr" + +FILES:${PN} += "${base_libdir}/firmware/xilinx" +FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${sysconfdir}/init.d/dfx-mgr.sh', '', d)} ${systemd_system_unitdir}" +FILES:libdfx-mgr = "${libdir}/libdfx-mgr.so.${SOVERSION} ${libdir}/libdfx-mgr.so.${SOMAJOR}" diff --git a/meta-xilinx-core/recipes-bsp/embeddedsw/fsbl.bb b/meta-xilinx-core/recipes-bsp/embeddedsw/fsbl.bb new file mode 100644 index 00000000..a704d3b5 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/embeddedsw/fsbl.bb @@ -0,0 +1,83 @@ +DESCRIPTION = "Xilinx First Stage Boot Loader" + +LICENSE = "CLOSED" + +PROVIDES = "virtual/fsbl" + +INHERIT_DEFAULT_DEPENDS = "1" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynq = "zynq" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" + +# Since we're just copying, we can run any config +COMPATIBLE_HOST = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Default expects the user to provide the fsbl in the deploy +# directory, named "fsbl.elf" +# A machine, multiconfig, or local.conf should override this +FSBL_DEPENDS ??= "" +FSBL_MCDEPENDS ??= "" +FSBL_DEPLOY_DIR ??= "${DEPLOY_DIR_IMAGE}" +FSBL_DEPLOY_DIR[vardepsexclude] += "TOPDIR" +FSBL_IMAGE_NAME ??= "fsbl-${MACHINE}" + +# Default is for the multilib case (without the extension .elf) +FSBL_FILE ??= "${FSBL_DEPLOY_DIR}/${FSBL_IMAGE_NAME}" +FSBL_FILE[vardepsexclude] = "FSBL_DEPLOY_DIR" + +do_fetch[depends] += "${FSBL_DEPENDS}" +do_fetch[mcdepends] += "${FSBL_MCDEPENDS}" + +inherit deploy + +do_install() { + if [ ! -e ${FSBL_FILE}.elf ]; then + echo "Unable to find FSBL_FILE (${FSBL_FILE}.elf)" + exit 1 + fi + + install -Dm 0644 ${FSBL_FILE}.elf ${D}/boot/${PN}.elf +} + +# If the item is already in OUR deploy_image_dir, nothing to deploy! +SHOULD_DEPLOY = "${@'false' if (d.getVar('FSBL_FILE')).startswith(d.getVar('DEPLOY_DIR_IMAGE')) else 'true'}" +do_deploy() { + # If the item is already in OUR deploy_image_dir, nothing to deploy! + if ${SHOULD_DEPLOY}; then + install -Dm 0644 ${FSBL_FILE}.elf ${DEPLOYDIR}/${FSBL_IMAGE_NAME}.elf + fi +} + +addtask deploy before do_build after do_install + +INSANE_SKIP:${PN} = "arch" +INSANE_SKIP:${PN}-dbg = "arch" + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" + +SYSROOT_DIRS += "/boot" +FILES:${PN} = "/boot/${PN}.elf" + +def check_fsbl_variables(d): + # If both are blank, the user MUST pass in the path to the firmware! + if not d.getVar('FSBL_DEPENDS') and not d.getVar('FSBL_MCDEPENDS'): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + if not os.path.exists(d.getVar('FSBL_FILE') + ".elf"): + if not d.getVar('WITHIN_EXT_SDK'): + raise bb.parse.SkipRecipe("The expected file %s.elf is not available.\nSet FSBL_FILE to the path with a precompiled FSBL binary. See the meta-xilinx-core README for more information." % d.getVar('FSBL_FILE')) + else: + # We found the file, so be sure to track it + d.setVar('SRC_URI', 'file://${FSBL_FILE}.elf') + d.setVarFlag('do_install', 'file-checksums', '${FSBL_FILE}.elf:True') + d.setVarFlag('do_deploy', 'file-checksums', '${FSBL_FILE}.elf:True') + +python() { + # Need to allow bbappends to change the check + check_fsbl_variables(d) +} diff --git a/meta-xilinx-core/recipes-bsp/embeddedsw/plmfw.bb b/meta-xilinx-core/recipes-bsp/embeddedsw/plmfw.bb new file mode 100644 index 00000000..d398ca88 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/embeddedsw/plmfw.bb @@ -0,0 +1,93 @@ +DESCRIPTION = "Platform Loader and Manager" +SUMMARY = "Platform Loader and Manager for Versal devices" + +LICENSE = "CLOSED" + +PROVIDES = "virtual/plm" + +INHERIT_DEFAULT_DEPENDS = "1" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal = ".*" + +# Since we're just copying, we can run any config +COMPATIBLE_HOST = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Default expects the user to provide the plm-firmware in the deploy +# directory, named "plm-${MACHINE}.elf" and "plm-${MACHINE}.bin" +# A machine, multiconfig, or local.conf should override this +PLM_DEPENDS ??= "" +PLM_MCDEPENDS ??= "" +PLM_DEPLOY_DIR ??= "${DEPLOY_DIR_IMAGE}" +PLM_DEPLOY_DIR[vardepsexclude] += "TOPDIR" +PLM_IMAGE_NAME ??= "plm-${MACHINE}" + +# Default is for the multilib case (without the extension .elf/.bin) +PLM_FILE ??= "${PLM_DEPLOY_DIR}/${PLM_IMAGE_NAME}" +PLM_FILE[vardepsexclude] = "PLM_DEPLOY_DIR" + +do_fetch[depends] += "${PLM_DEPENDS}" +do_fetch[mcdepends] += "${PLM_MCDEPENDS}" + +inherit deploy + +do_install() { + if [ ! -e ${PLM_FILE}.elf ]; then + echo "Unable to find PLM_FILE (${PLM_FILE}.elf)" + exit 1 + fi + + install -Dm 0644 ${PLM_FILE}.elf ${D}/boot/${PN}.elf +} + +# If the item is already in OUR deploy_image_dir, nothing to deploy! +SHOULD_DEPLOY = "${@'false' if (d.getVar('PLM_FILE')).startswith(d.getVar('DEPLOY_DIR_IMAGE')) else 'true'}" +do_deploy() { + # If the item is already in OUR deploy_image_dir, nothing to deploy! + if ${SHOULD_DEPLOY}; then + install -Dm 0644 ${PLM_FILE}.elf ${DEPLOYDIR}/${PLM_IMAGE_NAME}.elf + install -Dm 0644 ${PLM_FILE}.bin ${DEPLOYDIR}/${PLM_IMAGE_NAME}.bin + fi +} + +addtask deploy before do_build after do_install + +INSANE_SKIP:${PN} = "arch" +INSANE_SKIP:${PN}-dbg = "arch" + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" + +SYSROOT_DIRS += "/boot" +FILES:${PN} = "/boot/${PN}.elf" + +def check_plm_vars(d): + # If both are blank, the user MUST pass in the path to the firmware! + if not d.getVar('PLM_DEPENDS') and not d.getVar('PLM_MCDEPENDS'): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + msg = "" + fail = False + if not os.path.exists(d.getVar('PLM_FILE') + ".elf"): + msg = msg + "The expected file %s.elf is not available. " % d.getVar('PLM_FILE') + fail = True + if not os.path.exists(d.getVar('PLM_FILE') + ".bin"): + msg = msg + "The expected file %s.bin is not available. " % d.getVar('PLM_FILE') + fail = True + if fail: + if not d.getVar('WITHIN_EXT_SDK'): + raise bb.parse.SkipRecipe("%s\nSee the meta-xilinx-core README." % msg) + else: + # We found the file, so be sure to track it + d.setVar('SRC_URI', 'file://${PLM_FILE}.elf file://${PLM_FILE}.bin') + d.setVarFlag('do_install', 'file-checksums', '${PLM_FILE}.elf:True') + d.setVarFlag('do_deploy', 'file-checksums', '${PLM_FILE}.elf:True ${PLM_FILE}.bin:True') + +python() { + # Need to allow bbappends to change the check + check_plm_vars(d) +} + diff --git a/meta-xilinx-core/recipes-bsp/embeddedsw/pmufw.bb b/meta-xilinx-core/recipes-bsp/embeddedsw/pmufw.bb new file mode 100644 index 00000000..913e9088 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/embeddedsw/pmufw.bb @@ -0,0 +1,91 @@ +DESCRIPTION = "PMU Firmware" + +LICENSE = "CLOSED" + +PROVIDES = "virtual/pmu-firmware" + +INHERIT_DEFAULT_DEPENDS = "1" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = ".*" + +# Since we're just copying, we can run any config +COMPATIBLE_HOST = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Default expects the user to provide the pmu-firmware in the deploy +# directory, named "pmu-firmware-${MACHINE}.elf" and "pmu-firmware-${MACHINE}.bin" +# A machine, multiconfig, or local.conf should override this +PMU_DEPENDS ??= "" +PMU_MCDEPENDS ??= "" +PMU_FIRMWARE_DEPLOY_DIR ??= "${DEPLOY_DIR_IMAGE}" +PMU_FIRMWARE_DEPLOY_DIR[vardepsexclude] += "TOPDIR" +PMU_FIRMWARE_IMAGE_NAME ??= "pmu-firmware-${MACHINE}" + +# Default is for the multilib case (without the extension .elf/.bin) +PMU_FILE ??= "${PMU_FIRMWARE_DEPLOY_DIR}/${PMU_FIRMWARE_IMAGE_NAME}" +PMU_FILE[vardepsexclude] = "PMU_FIRMWARE_DEPLOY_DIR" + +do_fetch[depends] += "${PMU_DEPENDS}" +do_fetch[mcdepends] += "${PMU_MCDEPENDS}" + +inherit deploy + +do_install() { + if [ ! -e ${PMU_FILE}.elf ]; then + echo "Unable to find PMU_FILE (${PMU_FILE}.elf)" + exit 1 + fi + + install -Dm 0644 ${PMU_FILE}.elf ${D}/boot/${PN}.elf +} + +# If the item is already in OUR deploy_image_dir, nothing to deploy! +SHOULD_DEPLOY = "${@'false' if (d.getVar('PMU_FILE')).startswith(d.getVar('DEPLOY_DIR_IMAGE')) else 'true'}" +do_deploy() { + if ${SHOULD_DEPLOY}; then + install -Dm 0644 ${PMU_FILE}.elf ${DEPLOYDIR}/${PMU_FIRMWARE_IMAGE_NAME}.elf + install -Dm 0644 ${PMU_FILE}.bin ${DEPLOYDIR}/${PMU_FIRMWARE_IMAGE_NAME}.bin + fi +} + +addtask deploy before do_build after do_install + +INSANE_SKIP:${PN} = "arch" +INSANE_SKIP:${PN}-dbg = "arch" + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" + +SYSROOT_DIRS += "/boot" +FILES:${PN} = "/boot/${PN}.elf" + +def check_pmu_vars(d): + # If both are blank, the user MUST pass in the path to the firmware! + if not d.getVar('PMU_DEPENDS') and not d.getVar('PMU_MCDEPENDS'): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + msg = "" + fail = False + if not os.path.exists(d.getVar('PMU_FILE') + ".elf"): + msg = msg + "The expected file %s.elf is not available. " % d.getVar('PMU_FILE') + fail = True + if not os.path.exists(d.getVar('PMU_FILE') + ".bin"): + msg = msg + "The expected file %s.bin is not available. " % d.getVar('PMU_FILE') + fail = True + if fail: + if not d.getVar('WITHIN_EXT_SDK'): + raise bb.parse.SkipRecipe("%s See the meta-xilinx-core README." % msg) + else: + # We found the file, so be sure to track it + d.setVar('SRC_URI', 'file://${PMU_FILE}.elf file://${PMU_FILE}.bin') + d.setVarFlag('do_install', 'file-checksums', '${PMU_FILE}.elf:True') + d.setVarFlag('do_deploy', 'file-checksums', '${PMU_FILE}.elf:True ${PMU_FILE}.bin:True') + + +python() { + # Need to allow bbappends to change the check + check_pmu_vars(d) +} diff --git a/meta-xilinx-core/recipes-bsp/embeddedsw/psmfw.bb b/meta-xilinx-core/recipes-bsp/embeddedsw/psmfw.bb new file mode 100644 index 00000000..27f921b9 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/embeddedsw/psmfw.bb @@ -0,0 +1,94 @@ +DESCRIPTION = "PSM Firmware" +SUMMARY = "PSM firmware for versal devices" + +LICENSE = "CLOSED" + +PROVIDES = "virtual/psm-firmware" + +INHERIT_DEFAULT_DEPENDS = "1" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal = ".*" + +# Since we're just copying, we can run any config +COMPATIBLE_HOST = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Default expects the user to provide the psm-firmware in the deploy +# directory, named "psm-firmware-${MACHINE}.elf" and "psm-firmware-${MACHINE}.bin" +# A machine, multiconfig, or local.conf should override this +PSM_DEPENDS ??= "" +PSM_MCDEPENDS ??= "" +PSM_DEPLOY_DIR ??= "${DEPLOY_DIR_IMAGE}" +PSM_FIRMWARE_DEPLOY_DIR[vardepsexclude] += "TOPDIR" +PSM_FIRMWARE_IMAGE_NAME ??= "psm-firmware-${MACHINE}" + +# Default is for the multilib case (without the extension .elf/.bin) +PSM_FILE ??= "${PSM_FIRMWARE_DEPLOY_DIR}/${PSM_FIRMWARE_IMAGE_NAME}" +PSM_FILE[vardepsexclude] = "PSM_FIRMWARE_DEPLOY_DIR" + +do_fetch[depends] += "${PSM_DEPENDS}" +do_fetch[mcdepends] += "${PSM_MCDEPENDS}" + +inherit deploy + +do_install() { + if [ ! -e ${PSM_FILE}.elf ]; then + echo "Unable to find PSM_FILE (${PSM_FILE}.elf)" + exit 1 + fi + + install -Dm 0644 ${PSM_FILE}.elf ${D}/boot/${PN}.elf +} + +# If the item is already in OUR deploy_image_dir, nothing to deploy! +SHOULD_DEPLOY = "${@'false' if (d.getVar('PSM_FILE')).startswith(d.getVar('DEPLOY_DIR_IMAGE')) else 'true'}" +do_deploy() { + # If the item is already in OUR deploy_image_dir, nothing to deploy! + if ${SHOULD_DEPLOY}; then + install -Dm 0644 ${PSM_FILE}.elf ${DEPLOYDIR}/${PSM_FIRMWARE_IMAGE_NAME}.elf + install -Dm 0644 ${PSM_FILE}.bin ${DEPLOYDIR}/${PSM_FIRMWARE_IMAGE_NAME}.bin + fi +} + +addtask deploy before do_build after do_install + +INSANE_SKIP:${PN} = "arch" +INSANE_SKIP:${PN}-dbg = "arch" + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" + +SYSROOT_DIRS += "/boot" +FILES:${PN} = "/boot/${PN}.elf" + +def check_psm_vars(d): + # If both are blank, the user MUST pass in the path to the firmware! + if not d.getVar('PSM_DEPENDS') and not d.getVar('PSM_MCDEPENDS'): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + msg = "" + fail = False + if not os.path.exists(d.getVar('PSM_FILE') + ".elf"): + msg = msg + "The expected file %s.elf is not available. " % d.getVar('PSM_FILE') + fail = True + if not os.path.exists(d.getVar('PSM_FILE') + ".bin"): + msg = msg + "The expected file %s.bin is not available. " % d.getVar('PSM_FILE') + fail = True + + if fail: + if not d.getVar('WITHIN_EXT_SDK'): + raise bb.parse.SkipRecipe("%s\nSee the meta-xilinx-core README." % msg) + else: + # We found the file, so be sure to track it + d.setVar('SRC_URI', 'file://${PSM_FILE}.elf file://${PSM_FILE}.bin') + d.setVarFlag('do_install', 'file-checksums', '${PSM_FILE}.elf:True') + d.setVarFlag('do_deploy', 'file-checksums', '${PSM_FILE}.elf:True ${PSM_FILE}.bin:True') + +python() { + # Need to allow bbappends to change the check + check_psm_vars(d) +} + diff --git a/meta-xilinx-core/recipes-bsp/fpga-manager-script/files/fpgautil.c b/meta-xilinx-core/recipes-bsp/fpga-manager-script/files/fpgautil.c new file mode 100644 index 00000000..04777a91 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/fpga-manager-script/files/fpgautil.c @@ -0,0 +1,471 @@ +/****************************************************************************** + * + * Copyright (C) 2019-2022 Xilinx, Inc. All rights reserved. + * Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + ******************************************************************************/ +/*****************************************************************************/ +/** + * @file: fpgautil.c + * Simple command line tool to load fpga via overlay or through sysfs interface + * and read fpga configuration using Xilinx Zynq/ZynqMP fpga manager + * Author: Appana Durga Kedareswara Rao <appanad@xilinx.com> + * Author: Nava kishore Manne <navam@xilinx.com> + */ +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <string.h> +#include <signal.h> +#include <getopt.h> +#include <poll.h> +#include <ctype.h> +#include <libgen.h> +#include <time.h> +#include <errno.h> +#include <sys/time.h> +#include <sys/stat.h> + +#define OVERLAY 1 +#define FPGA_SYSFS 2 +#define READBACK 3 +#define ENCRYPTION_USERKEY_EN (0x20U) + +int fpga_getplatform() +{ + char fpstr[100]; + FILE *fptr; + char *zynqmpstr = "Xilinx ZynqMP FPGA Manager"; + + if ((fptr = fopen("/sys/class/fpga_manager/fpga0/name", "r")) == NULL) + { + printf("Error! opening file"); + // Program exits if file pointer returns NULL. + exit(1); + } + + // reads text until newline + fscanf(fptr,"%[^\n]", fpstr); + fclose(fptr); + + if (!strcmp(zynqmpstr, fpstr)) + return 1; + else + return 0; + +} + +void print_usage(char *prg) +{ + int iszynqmp = fpga_getplatform(); + + fprintf(stderr, "\n%s: FPGA Utility for Loading/reading PL Configuration\n\n", prg); + fprintf(stderr, "Usage: %s -b <bin file path> -o <dtbo file path>\n\r", prg); + fprintf(stderr, "\n"); + fprintf(stderr, "Options: -b <binfile> (Bin file path)\n"); + fprintf(stderr, " -o <dtbofile> (DTBO file path)\n"); + fprintf(stderr, " -f <flags> Optional: <Bitstream type flags>\n"); + fprintf(stderr, " f := <Full | Partial > \n"); + fprintf(stderr, " -n <Fpga region info> FPGA Regions represent FPGA's\n"); + fprintf(stderr, " and partial reconfiguration\n"); + fprintf(stderr, " regions of FPGA's in the\n"); + fprintf(stderr, " Device Tree\n"); + if (iszynqmp) + { + fprintf(stderr, " Default: <full>\n"); + fprintf(stderr, " -s <secure flags> Optional: <Secure flags>\n"); + fprintf(stderr, " s := <AuthDDR | AuthOCM | EnUsrKey | EnDevKey | AuthEnUsrKeyDDR | AuthEnUsrKeyOCM | AuthEnDevKeyDDR | AuthEnDevKeyOCM>\n"); + fprintf(stderr, " -k <AesKey> Optional: <AES User Key>\n"); + fprintf(stderr, " -r <Readback> Optional: <file name>\n"); + fprintf(stderr, " Default: By default Read back contents will be stored in readback.bin file\n"); + fprintf(stderr, " -t Optional: <Readback Type>\n"); + fprintf(stderr, " 0 - Configuration Register readback\n"); + fprintf(stderr, " 1 - Configuration Data Frames readback\n"); + fprintf(stderr, " Default: 0 (Configuration register readback)\n"); + fprintf(stderr, " -R Optional: Remove overlay from a live tree\n"); + } + + fprintf(stderr, " \n"); + fprintf(stderr, "Examples:\n"); + fprintf(stderr, "(Load Full bitstream using Overlay)\n"); + fprintf(stderr, "%s -b top.bit.bin -o can.dtbo -f Full -n full \n", prg); + fprintf(stderr, "(Load Partial bitstream using Overlay)\n"); + fprintf(stderr, "%s -b rm0.bit.bin -o rm0.dtbo -f Partial -n PR0\n", prg); + fprintf(stderr, "(Load Full bitstream using sysfs interface)\n"); + fprintf(stderr, "%s -b top.bit.bin -f Full\n", prg); + fprintf(stderr, "(Load Partial bitstream using sysfs interface)\n"); + fprintf(stderr, "%s -b rm0.bit.bin -f Partial\n", prg); + if (iszynqmp) + { + fprintf(stderr, "(Load Authenticated bitstream through the sysfs interface)\n"); + fprintf(stderr, "%s -b top.bit.bin -f Full -s AuthDDR \n", prg); + fprintf(stderr, "(Load Parital Encrypted Userkey bitstream using Overlay)\n"); + fprintf(stderr, "%s -b top.bit.bin -o pl.dtbo -f Partial -s EnUsrKey -k <32byte key value>\n", prg); + fprintf(stderr, "(Read PL Configuration Registers)\n"); + fprintf(stderr, "%s -b top.bit.bin -r\n", prg); + } + + fprintf(stderr, "(Remove Partial Overlay)\n"); + fprintf(stderr, "%s -R -n PR0\n", prg); + fprintf(stderr, "(Remove Full Overlay)\n"); + fprintf(stderr, "%s -R -n full\n", prg); + fprintf(stderr, "Note: %s -R is responsible for only removing the dtbo file from the livetree. it will not remove the PL logic from the FPGA region.\n", prg); + fprintf(stderr, " \n"); +} + +int gettime(struct timeval t0, struct timeval t1) +{ + return ((t1.tv_sec - t0.tv_sec) * 1000.0f + (t1.tv_usec -t0.tv_usec) / 1000.0f); +} + +int fpga_state() +{ + FILE *fptr; + char buf[10]; + char *state_operating = "operating"; + char *state_unknown = "unknown"; + + system("cat /sys/class/fpga_manager/fpga0/state >> state.txt"); + fptr = fopen("state.txt", "r"); + if (fptr) { + fgets(buf, 10, fptr); + fclose(fptr); + system("rm state.txt"); + if ((strncmp(buf, state_operating, 9) == 0) || (strncmp(buf, state_unknown, 7) == 0)) + return 0; + else + return 1; + } + + return 1; +} + +static int fpga_overlay_check(char *cmd, char *state) +{ + char buf[512]; + FILE *fptr; + int len; + + system(cmd); + len = strlen(state) + 1; + fptr = fopen("state.txt", "r"); + if (fptr) { + fgets(buf, len, fptr); + fclose(fptr); + system("rm state.txt"); + if (!strcmp(buf, state)) + return 0; + else + return 1; + } + + return 1; +} + +struct fpgaflag { + char *flag; + unsigned int value; +}; + +static struct fpgaflag flagdump[] = { + {.flag = "Full", .value = 0x0}, + {.flag = "Partial", .value = 0x1}, + {.flag = "AuthDDR", .value = 0x40}, + {.flag = "AuthOCM", .value = 0x80}, + {.flag = "EnUsrKey", .value = 0x20}, + {.flag = "EnDevKey", .value = 0x4}, + {.flag = "AuthEnUsrKeyDDR", .value = 0x60}, + {.flag = "AuthEnUsrKeyOCM", .value = 0xA0}, + {.flag = "AuthEnDevKeyDDR", .value = 0x44}, + {.flag = "AuthEnDevKeyOCM", .value = 0x84}, + {} +}; + +static int cmd_flags(int argc, const char *name) +{ + int valid_flag = 0; + int flag = 0; + struct fpgaflag *p = flagdump; + + while (p->flag) { + if (!strcmp(name, p->flag)) { + flag = p->value; + break; + } + p++; + } + + return flag; +} + +static int isvalid_flags(int argc, const char *name, bool is_secure) +{ + int valid_flag = 0; + int count = 0; + struct fpgaflag *p; + + if (!is_secure) + p = flagdump; + else + p = &flagdump[2]; + + while (p->flag) { + if (!strcmp(name, p->flag)) + return 0; + else if ((!is_secure) && (++count == 2)) + return 1; + p++; + } + + return 1; +} + +int main(int argc, char **argv) +{ + int ret; + int iszynqmp = fpga_getplatform(); + char *binfile = NULL, *overlay = NULL, *AesKey = NULL, *flag = NULL, *partial_overlay = NULL; + char *region = NULL, *Module[100] = {0}; + int opt, flags = 0, flow = 0,rm_overlay = 0, readback_type = 0, sflags = 0; + char command[2048], folder[512], *token, *tmp, *tmp1, *tmp2 , *tmp3; + const char *filename = "readback", *name; + struct stat sb; + double time; + struct timeval t1, t0; + + if (argc == 1) { + print_usage(basename(argv[0])); + return 1; + } + + while ((opt = getopt(argc, argv, "o:b:n:f:s:p:k:rt::Rh?:")) != -1) { + switch (opt) { + case 'o': + overlay = optarg; + flow = OVERLAY; + break; + case 'b': + binfile = optarg; + if (!(flow == OVERLAY)) + flow = FPGA_SYSFS; + break; + case 'n': + region = optarg; + break; + case 'f': + if (flow == OVERLAY) { + name = argv[6]; + flags = cmd_flags(argc, name); + } else if (flow == FPGA_SYSFS) { + name = argv[4]; + flags = cmd_flags(argc, name); + } + + ret = isvalid_flags(argc, name, false); + if (ret) { + printf("Error: Invalid arugments :%s\n", strerror(1)); + print_usage(basename(argv[0])); + return -EINVAL; + } + + flags += sflags; + break; + case 's': + if (flow == OVERLAY) { + name = argv[8]; + sflags = cmd_flags(argc, name); + } else if (flow == FPGA_SYSFS) { + name = argv[6]; + sflags = cmd_flags(argc, name); + } + + ret = isvalid_flags(argc, name, true); + if (ret) { + printf("Error: Invalid arugments :%s\n", strerror(1)); + print_usage(basename(argv[0])); + return -EINVAL; + } + + flags += sflags; + break; + case 'p': + partial_overlay = optarg; + break; + case 'k': + AesKey = optarg; + break; + case 't': + if (optarg == NULL && argv[4] != NULL) + readback_type = atoi(argv[4]); + break; + case 'r': + if (optarg == NULL && argv[2] != NULL) + filename = argv[2]; + flow = READBACK; + break; + case 'R': + rm_overlay = 1; + break; + case '?': + case 'h': + default: + print_usage(basename(argv[0])); + return 1; + break; + } + } + + if(region != NULL) + snprintf(folder, sizeof(folder), "/configfs/device-tree/overlays/%s", region); + else if (!(flags & 1)) + snprintf(folder, sizeof(folder), "/configfs/device-tree/overlays/full"); + else if (overlay != NULL) { + printf("Error: Provide valid Overlay region info\n\r"); + return 1; + } + system("mkdir -p /lib/firmware"); + if (rm_overlay) { + if (((stat(folder, &sb) == 0) && S_ISDIR(sb.st_mode))) { + snprintf(command, sizeof(command), "rmdir %s", folder); + system(command); + } + return 0; + } + + if (flow == OVERLAY) { + if (((stat(folder, &sb) == 0) && S_ISDIR(sb.st_mode))) { + printf("Error: Overlay already exists in the live tree\n\r"); + return 1; + } + + if (((stat("/configfs/device-tree/", &sb) == 0) && S_ISDIR(sb.st_mode))) { + } else { + system("mkdir /configfs"); + system("mount -t configfs configfs /configfs"); + } + + if (binfile != NULL) { + snprintf(command, sizeof(command), "cp %s /lib/firmware", binfile); + system(command); + } + + snprintf(command, sizeof(command), "cp %s /lib/firmware", overlay); + system(command); + tmp = strdup(overlay); + while((token = strsep(&tmp, "/"))) { + tmp1 = token; + } + + if (binfile != NULL) { + snprintf(command, sizeof(command), "echo %x > /sys/class/fpga_manager/fpga0/flags", flags); + system(command); + if (ENCRYPTION_USERKEY_EN & flags) { + snprintf(command, sizeof(command), "echo %s > /sys/class/fpga_manager/fpga0/key", AesKey); + system(command); + } + } + + snprintf(command, sizeof(command), "mkdir %s", folder); + system(command); + snprintf(command, sizeof(command), "echo -n %s > %s/path", tmp1, folder); + gettimeofday(&t0, NULL); + system(command); + gettimeofday(&t1, NULL); + time = gettime(t0, t1); + + snprintf(command, sizeof(command), "cat %s/path >> state.txt", folder); + ret = fpga_overlay_check(command, tmp1); + if (ret) { + printf("Failed to apply Overlay\n\r"); + } + + /* Delete Bin file and DTBO file*/ + snprintf(command, sizeof(command), "rm /lib/firmware/%s", tmp1); + system(command); + if (binfile != NULL) { + tmp = strdup(binfile); + while((token = strsep(&tmp, "/"))) { + tmp1 = token; + } + snprintf(command, sizeof(command), "rm /lib/firmware/%s", tmp1); + system(command); + } + + /* FPGA state check */ + if (binfile != NULL) { + if (!fpga_state()) { + printf("Time taken to load BIN is %f Milli Seconds\n\r", time); + printf("BIN FILE loaded through FPGA manager successfully\n\r"); + } else { + printf("BIN FILE loading through FPGA manager failed\n\r"); + } + } + } else if (flow == FPGA_SYSFS) { + if (argc < 3) { + printf("%s: For more information run %s -h\n", strerror(22), basename(argv[0])); + return 1; + } + snprintf(command, sizeof(command), "cp %s /lib/firmware", binfile); + system(command); + snprintf(command, sizeof(command), "echo %x > /sys/class/fpga_manager/fpga0/flags", flags); + system(command); + if (ENCRYPTION_USERKEY_EN & flags) { + snprintf(command, sizeof(command), "echo %s > /sys/class/fpga_manager/fpga0/key", AesKey); + system(command); + } + tmp = strdup(binfile); + while((token = strsep(&tmp, "/"))) { + tmp1 = token; + } + snprintf(command, sizeof(command), "echo %s > /sys/class/fpga_manager/fpga0/firmware", tmp1); + gettimeofday(&t0, NULL); + system(command); + gettimeofday(&t1, NULL); + time = gettime(t0, t1); + + /* Delete Bin file and DTBO file*/ + snprintf(command, sizeof(command), "rm /lib/firmware/%s", tmp1); + system(command); + + /* FPGA state check */ + if (!fpga_state()) { + printf("Time taken to load BIN is %f Milli Seconds\n\r", time); + printf("BIN FILE loaded through FPGA manager successfully\n\r"); + } else { + printf("BIN FILE loading through FPGA manager failed\n\r"); + } + } else if (flow == READBACK) { + if (readback_type > 1) { + printf("Invalid arugments :%s\n", strerror(1)); + printf("For more information run %s -h\n", basename(argv[0])); + return -EINVAL; + } + snprintf(command, sizeof(command), "echo %x > /sys/module/zynqmp_fpga/parameters/readback_type", readback_type); + system(command); + snprintf(command, sizeof(command), "cat /sys/kernel/debug/fpga/fpga0/image >> %s.bin", filename); + system(command); + printf("Readback contents are stored in the file %s.bin\n\r", filename); + } + + return 0; +} diff --git a/meta-xilinx-core/recipes-bsp/fpga-manager-script/fpga-manager-script_1.0.bb b/meta-xilinx-core/recipes-bsp/fpga-manager-script/fpga-manager-script_1.0.bb new file mode 100644 index 00000000..d22c995c --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/fpga-manager-script/fpga-manager-script_1.0.bb @@ -0,0 +1,23 @@ +SUMMARY = "Install user script to support fpga-manager" +DESCRIPTION = "Install user script that loads and unloads overlays using kernel fpga-manager" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://${WORKDIR}/fpgautil.c;beginline=1;endline=24;md5=0c02eabf57dba52842c5df9b96bccfae" + +SRC_URI = "\ + file://fpgautil.c \ + " +S = "${WORKDIR}" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +do_compile() { + ${CC} ${LDFLAGS} fpgautil.c -o fpgautil +} + +do_install() { + install -Dm 0755 ${S}/fpgautil ${D}${bindir}/fpgautil +} + +FILES:${PN} = "\ + ${bindir}/fpgautil \ + " diff --git a/meta-xilinx-core/recipes-bsp/initramdisk/initramdisk-xilinx.bb b/meta-xilinx-core/recipes-bsp/initramdisk/initramdisk-xilinx.bb new file mode 100644 index 00000000..2114eafd --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/initramdisk/initramdisk-xilinx.bb @@ -0,0 +1,37 @@ +INITRAMFS_IMAGE ??= "" + +# Adjust our name to be explicit to what we're going to produce +PN = "initramdisk-${INITRAMFS_IMAGE}" + +DESCRIPTION = "Provide the initramdisk available via a package, installed in /boot" + +DEPENDS = "${INITRAMFS_IMAGE}" + +LICENSE = "MIT" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install[vardepsexclude] += "DEPLOY_DIR_IMAGE" +do_install[depends] += "${INITRAMFS_IMAGE}:do_image_complete" +do_install[cleandirs] = "${D}" +do_install() { + if [ -e ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.rootfs.cpio.gz.u-boot ]; then + install -d ${D}/boot/ + install -m 0644 ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.rootfs.cpio.gz.u-boot ${D}/boot/. + else + bbfatal "Unable to find expected initramfs: ${INITRAMFS_IMAGE}-${MACHINE}.rootfs.cpio.gz.u-boot" + fi +} + +PACKAGES = "${PACKAGE_BEFORE_PN} ${PN}" + +RPROVIDES:${PN} = "initramdisk" +FILES:${PN} = "/boot/${INITRAMFS_IMAGE}-${MACHINE}.rootfs.cpio.gz.u-boot" + +python() { + if not d.getVar('INITRAMFS_IMAGE'): + bb.parse.SkipRecipe("No init ramdisk enabled. This package requires INITRAMFS_IMAGE to be defined.") +} diff --git a/meta-xilinx-core/recipes-bsp/libdfx/libdfx_1.0.bb b/meta-xilinx-core/recipes-bsp/libdfx/libdfx_1.0.bb new file mode 100644 index 00000000..2c180561 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/libdfx/libdfx_1.0.bb @@ -0,0 +1,23 @@ +SUMMARY = "Xilinx libdfx library" +DESCRIPTION = "Xilinx libdfx Library and headers" + +LICENSE = "MIT & GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=94aba86aec117f003b958a52f019f1a7" + +BRANCH ?= "xlnx_rel_v2022.2" +REPO ?= "git://github.com/Xilinx/libdfx.git;protocol=https" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" +SRCREV = "f2b7bbca9d6936141024becfb92266600eeefc2b" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" + +S = "${WORKDIR}/git" + +inherit cmake + +# Due to an update where the soname/version was defined, we need to use an RREPLACES +# so updates will work properly. +RREPLACES:${PN} = "libdfx" diff --git a/meta-xilinx-core/recipes-bsp/libdfx/libdfx_2023.1.bb b/meta-xilinx-core/recipes-bsp/libdfx/libdfx_2023.1.bb new file mode 100644 index 00000000..287246c2 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/libdfx/libdfx_2023.1.bb @@ -0,0 +1,23 @@ +SUMMARY = "Xilinx libdfx library" +DESCRIPTION = "Xilinx libdfx Library and headers" + +LICENSE = "MIT & GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=94aba86aec117f003b958a52f019f1a7" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/libdfx.git;protocol=https" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" +SRCREV = "52c1d83c72a2b2e85d256411a199ed1baed12ae1" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" + +S = "${WORKDIR}/git" + +inherit cmake + +# Due to an update where the soname/version was defined, we need to use an RREPLACES +# so updates will work properly. +RREPLACES:${PN} = "libdfx" diff --git a/meta-xilinx-core/recipes-bsp/libdfx/libdfx_2023.2.bb b/meta-xilinx-core/recipes-bsp/libdfx/libdfx_2023.2.bb new file mode 100644 index 00000000..b3ccb884 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/libdfx/libdfx_2023.2.bb @@ -0,0 +1,23 @@ +SUMMARY = "Xilinx libdfx library" +DESCRIPTION = "Xilinx libdfx Library and headers" + +LICENSE = "MIT & GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=94aba86aec117f003b958a52f019f1a7" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/libdfx.git;protocol=https" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" +SRCREV = "52c1d83c72a2b2e85d256411a199ed1baed12ae1" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" + +S = "${WORKDIR}/git" + +inherit cmake + +# Due to an update where the soname/version was defined, we need to use an RREPLACES +# so updates will work properly. +RREPLACES:${PN} = "libdfx" diff --git a/meta-xilinx-bsp/recipes-bsp/platform-init/platform-init.bb b/meta-xilinx-core/recipes-bsp/platform-init/platform-init.bb index 32509b07..75c83ee8 100644 --- a/meta-xilinx-bsp/recipes-bsp/platform-init/platform-init.bb +++ b/meta-xilinx-core/recipes-bsp/platform-init/platform-init.bb @@ -10,9 +10,8 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" inherit xilinx-platform-init COMPATIBLE_MACHINE = "$^" -COMPATIBLE_MACHINE_picozed-zynq7 = "picozed-zynq7" -LICENSE = "GPLv2+" +LICENSE = "GPL-2.0-or-later" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" PROVIDES += "virtual/xilinx-platform-init" @@ -34,5 +33,5 @@ do_install() { done } -FILES_${PN} += "${PLATFORM_INIT_DIR}/*" +FILES:${PN} += "${PLATFORM_INIT_DIR}/*" diff --git a/meta-xilinx-core/recipes-bsp/pmu-firmware/pmu-rom-native.bb b/meta-xilinx-core/recipes-bsp/pmu-firmware/pmu-rom-native.bb new file mode 100644 index 00000000..44ad9368 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/pmu-firmware/pmu-rom-native.bb @@ -0,0 +1,27 @@ +SUMMARY = "PMU ROM for QEMU" +DESCRIPTION = "The ZynqMP PMU ROM for QEMU emulation" +HOMEPAGE = "http://www.xilinx.com" +SECTION = "bsp" + +LICENSE = "Proprietary" +LICENSE_FLAGS = "xilinx" +LIC_FILES_CHKSUM = "file://PMU_ROM-LICENSE.txt;md5=d43d49bc1eb1c907fc6f4ea75abafdfc" + +SRC_URI = "https://www.xilinx.com/bin/public/openDownload?filename=PMU_ROM.tar.gz" +SRC_URI[sha256sum] = "f9a450ef960979463ea0a87a35fafb4a5b62d3a741de30cbcef04c8edc22a7cf" + +S = "${WORKDIR}/PMU_ROM" + +inherit deploy native + +INHIBIT_DEFAULT_DEPS = "1" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" +do_install[noexec] = "1" + +do_deploy () { + install -D ${S}/pmu-rom.elf ${DEPLOYDIR}/pmu-rom.elf +} + +addtask deploy before do_build after do_install diff --git a/meta-xilinx-core/recipes-bsp/u-boot/files/0001-Remove-redundant-YYLOC-global-declaration.patch b/meta-xilinx-core/recipes-bsp/u-boot/files/0001-Remove-redundant-YYLOC-global-declaration.patch new file mode 100644 index 00000000..7091098c --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/files/0001-Remove-redundant-YYLOC-global-declaration.patch @@ -0,0 +1,28 @@ +From 8127b19aa42ccfb3faae1173a12b3eb0cebf8941 Mon Sep 17 00:00:00 2001 +From: Peter Robinson <pbrobinson@gmail.com> +Date: Thu, 30 Jan 2020 09:37:15 +0000 +Subject: [PATCH] Remove redundant YYLOC global declaration + +Same as the upstream fix for building dtc with gcc 10. + +Signed-off-by: Peter Robinson <pbrobinson@gmail.com> +State: upstream (e33a814e772cdc36436c8c188d8c42d019fda639) +--- + scripts/dtc/dtc-lexer.l | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index fd825ebba6..24af549977 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n + #include "srcpos.h" + #include "dtc-parser.tab.h" + +-YYLTYPE yylloc; + extern bool treesource_error; + + /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ +-- +2.29.2 + diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc index 50eae1f1..6638c9e5 100644 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc @@ -3,8 +3,8 @@ inherit xilinx-platform-init FORCE_PLATFORM_INIT[doc] = "This variable is used to force the overriding of all platform init files in u-boot source." PLATFORM_BOARD_DIR ?= "" -PLATFORM_BOARD_DIR_zynq = "board/xilinx/zynq" -PLATFORM_BOARD_DIR_zynqmp = "board/xilinx/zynqmp" +PLATFORM_BOARD_DIR:zynq = "board/xilinx/zynq" +PLATFORM_BOARD_DIR:zynqmp = "board/xilinx/zynqmp" do_zynq_platform_init() { for f in ${PLATFORM_INIT_FILES}; do @@ -47,8 +47,8 @@ python () { if (currentconfig not in hasconfigs) or (d.getVar("FORCE_PLATFORM_INIT") == "1"): # force the dependency on a recipe that provides the platform init files d.appendVar("DEPENDS", " virtual/xilinx-platform-init") - # setup task to modify platform init after unpack and before configure - bb.build.addtask("do_zynq_platform_init", "do_configure", "do_prepare_recipe_sysroot", d) + # setup task to modify platform init after unpack and prepare_recipe_sysroot, and before configure + bb.build.addtask("do_zynq_platform_init", "do_configure", "do_unpack do_prepare_recipe_sysroot", d) if "boot.bin" not in d.getVar("SPL_BINARY"): # not deploying the boot.bin, just building SPL @@ -64,11 +64,7 @@ python () { d.setVar("SPL_BINARY", "") if providesbin and d.getVar("SOC_FAMILY") in ["zynqmp"]: - # depend on the pmu-firmware build - d.appendVar("DEPENDS", " virtual/pmu-firmware") - # determine the path relative to the source tree - relpath = os.path.relpath(d.expand("${DEPLOY_DIR_IMAGE}/pmu-${MACHINE}.bin"), d.getVar("S")) # setup PMU Firmware path via MAKEFLAGS - d.appendVar("EXTRA_OEMAKE", " CONFIG_PMUFW_INIT_FILE=\"{0}\"".format(relpath)) + d.appendVar("EXTRA_OEMAKE", " CONFIG_PMUFW_INIT_FILE=\"{0}\"".format("${PMU_FIRMWARE_DEPLOY_DIR}/${PMU_FIRMWARE_IMAGE_NAME}.bin")) } diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools%.bbappend b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools%.bbappend new file mode 100644 index 00000000..65b6ad9d --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools%.bbappend @@ -0,0 +1,23 @@ +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for libmetal. This avoids network access required by +# the use of AUTOREV SRCREVs, which may be the default for some recipes. +python () { + if bb.data.inherits_class('native', d): + if (not d.getVar("PREFERRED_PROVIDER_u-boot-tools-native") and "u-boot-tools-native" != d.getVar("PN")) or \ + (d.getVar("PREFERRED_PROVIDER_u-boot-tools-native") and d.getVar("PREFERRED_PROVIDER_u-boot-tools-native") != d.getVar("PN")): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_u-boot-tools-native to %s to enable it" % (d.getVar("PN"))) + + elif bb.data.inherits_class('nativesdk', d): + if (not d.getVar("PREFERRED_PROVIDER_nativesdk-u-boot-tools") and "nativesdk-u-boot-tools" != d.getVar("PN")) or \ + (d.getVar("PREFERRED_PROVIDER_nativesdk-u-boot-tools") and d.getVar("PREFERRED_PROVIDER_nativesdk-u-boot-tools") != d.getVar("PN")): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_nativesdk-u-boot-tools to %s to enable it" % (d.getVar("PN"))) + + else: + if (not d.getVar("PREFERRED_PROVIDER_u-boot-tools") and "u-boot-tools" != d.getVar("PN")) or \ + (d.getVar("PREFERRED_PROVIDER_u-boot-tools") and d.getVar("PREFERRED_PROVIDER_u-boot-tools") != d.getVar("PN")): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_u-boot-tools to %s to enable it" % (d.getVar("PN"))) +} + diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx.inc new file mode 100644 index 00000000..83368af6 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx.inc @@ -0,0 +1,13 @@ +require recipes-bsp/u-boot/u-boot-common.inc +require recipes-bsp/u-boot/u-boot-tools.inc + +require u-boot-xlnx-common.inc + +PROVIDES:append = " u-boot-tools" +RPROVIDES:${PN} += "u-boot-tools" +RPROVIDES:${PN}-dbg += "u-boot-tools-dbg" +RPROVIDES:${PN}-dev += "u-boot-tools-dev" +RPROVIDES:${PN}-lic += "u-boot-tools-lic" +RPROVIDES:${PN}-src += "u-boot-tools-src" +RPROVIDES:${PN}-mkenvimage += "u-boot-tools-mkenvimage" +RPROVIDES:${PN}-mkimage += "u-boot-tools-mkimage" diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2022.1.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2022.1.bb new file mode 100644 index 00000000..eaf8d4ce --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2022.1.bb @@ -0,0 +1,21 @@ +require u-boot-tools-xlnx.inc +require u-boot-xlnx-2022.1.inc + +# MUST clear CONFIG_VIDEO to avoid a compilation failure trying to construct +# bmp_logo.h +SED_CONFIG_EFI:append = ' -e "s/CONFIG_VIDEO=.*/# CONFIG_VIDEO is not set/"' + +# Default do_compile fails with: +# | error: object directory ../downloads/git2/github.com.Xilinx.u-boot-xlnx.git/objects does not exist; check .git/objects/info/alternates. +# The regular workaround of calling 'git diff' seems to be problematic. +do_compile () { + oe_runmake -C ${S} tools-only_defconfig O=${B} + + # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and + # generating it requires bin2header tool, which for target build + # is built with target tools and thus cannot be executed on host. + sed -i -e "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" ${SED_CONFIG_EFI} ${B}/.config + + oe_runmake -C ${S} cross_tools NO_SDL=1 O=${B} +} + diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2022.2.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2022.2.bb new file mode 100644 index 00000000..44636872 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2022.2.bb @@ -0,0 +1,21 @@ +require u-boot-tools-xlnx.inc +require u-boot-xlnx-2022.2.inc + +# MUST clear CONFIG_VIDEO to avoid a compilation failure trying to construct +# bmp_logo.h +SED_CONFIG_EFI:append = ' -e "s/CONFIG_VIDEO=.*/# CONFIG_VIDEO is not set/"' + +# Default do_compile fails with: +# | error: object directory ../downloads/git2/github.com.Xilinx.u-boot-xlnx.git/objects does not exist; check .git/objects/info/alternates. +# The regular workaround of calling 'git diff' seems to be problematic. +do_compile () { + oe_runmake -C ${S} tools-only_defconfig O=${B} + + # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and + # generating it requires bin2header tool, which for target build + # is built with target tools and thus cannot be executed on host. + sed -i -e "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" ${SED_CONFIG_EFI} ${B}/.config + + oe_runmake -C ${S} cross_tools NO_SDL=1 O=${B} +} + diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2023.1.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2023.1.bb new file mode 100644 index 00000000..fe5ecf79 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2023.1.bb @@ -0,0 +1,21 @@ +require u-boot-tools-xlnx.inc +require u-boot-xlnx-2023.1.inc + +# MUST clear CONFIG_VIDEO to avoid a compilation failure trying to construct +# bmp_logo.h +SED_CONFIG_EFI:append = ' -e "s/CONFIG_VIDEO=.*/# CONFIG_VIDEO is not set/"' + +# Default do_compile fails with: +# | error: object directory ../downloads/git2/github.com.Xilinx.u-boot-xlnx.git/objects does not exist; check .git/objects/info/alternates. +# The regular workaround of calling 'git diff' seems to be problematic. +do_compile () { + oe_runmake -C ${S} tools-only_defconfig O=${B} + + # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and + # generating it requires bin2header tool, which for target build + # is built with target tools and thus cannot be executed on host. + sed -i -e "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" ${SED_CONFIG_EFI} ${B}/.config + + oe_runmake -C ${S} cross_tools NO_SDL=1 O=${B} +} + diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2023.2.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2023.2.bb new file mode 100644 index 00000000..43fec635 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-tools-xlnx_2023.2.bb @@ -0,0 +1,21 @@ +require u-boot-tools-xlnx.inc +require u-boot-xlnx-2023.2.inc + +# MUST clear CONFIG_VIDEO to avoid a compilation failure trying to construct +# bmp_logo.h +SED_CONFIG_EFI:append = ' -e "s/CONFIG_VIDEO=.*/# CONFIG_VIDEO is not set/"' + +# Default do_compile fails with: +# | error: object directory ../downloads/git2/github.com.Xilinx.u-boot-xlnx.git/objects does not exist; check .git/objects/info/alternates. +# The regular workaround of calling 'git diff' seems to be problematic. +do_compile () { + oe_runmake -C ${S} tools-only_defconfig O=${B} + + # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and + # generating it requires bin2header tool, which for target build + # is built with target tools and thus cannot be executed on host. + sed -i -e "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" ${SED_CONFIG_EFI} ${B}/.config + + oe_runmake -C ${S} cross_tools NO_SDL=1 O=${B} +} + diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2021.01/microblaze-generic-top.h b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2021.01/microblaze-generic-top.h new file mode 100644 index 00000000..08c1c16c --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2021.01/microblaze-generic-top.h @@ -0,0 +1,10 @@ +/* + * This file is use for addition u-boot configurations for microblaze. + */ +#include <configs/microblaze-generic.h> + +/* Core microblaze boot configurations */ +#define XILINX_USE_DCACHE 1 +#define CONFIG_CMD_IRQ +#define CONFIG_DCACHE +#define CONFIG_ICACHE
\ No newline at end of file diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2021.01/microblaze-generic.cfg b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2021.01/microblaze-generic.cfg new file mode 100644 index 00000000..0f784f73 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2021.01/microblaze-generic.cfg @@ -0,0 +1,81 @@ +# SPDX-License-Identifier: MIT + +#........................................................................ +# WARNING +# +# This file is a u-boot configuration fragment, and not a full u-boot +# configuration file. The final u-boot configuration is made up of +# an assembly of processed fragments, each of which is designed to +# capture a specific part of the final configuration (e.g. platform +# configuration, feature configuration, and board specific hardware +# configuration). For more information on u-boot configuration, please +# refer the product documentation. +# +#....................................................................... + +# +# Definitions for Generic Microbalze machine. +# +CONFIG_BOOTDELAY=4 +CONFIG_SYS_TEXT_BASE=0x80100000 +CONFIG_SYS_PROMPT="U-Boot>" +CONFIG_SYS_CONFIG_NAME="microblaze-generic-top" +CONFIG_BOOT_SCRIPT_OFFSET=0x1F00000 +# CONFIG_SYS_NS16550 is not set +# CONFIG_SYS_FLASH_USE_BUFFER_WRITE is not set +# CONFIG_SYS_FLASH_CFI is not set +# CONFIG_FLASH_CFI_DRIVER is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_MTD_NOR_FLASH is not set +# CONFIG_MTD_DEVICE is not set +# CONFIG_SYS_FLASH_PROTECTION is not set +# CONFIG_SPI_FLASH_SST is not set +# CONFIG_XILINX_EMACLITE is not set +# CONFIG_PHY_VITESSE is not set +# CONFIG_CMD_EXT2 is not set +# CONFIG_CMD_EXT4 is not set +# CONFIG_CMD_EXT4_WRITE is not set +# CONFIG_CMD_FAT is not set +# CONFIG_DOS_PARTITION is not set +# CONFIG_FAT_WRITE is not set +CONFIG_DM=y +CONFIG_SYS_MALLOC_F=y +CONFIG_XILINX_UARTLITE=y +CONFIG_XILINX_AXIEMAC=y +CONFIG_PHY_XILINX=y +CONFIG_PHY_TI=y +CONFIG_NET=y +CONFIG_PHY_GIGE=y +CONFIG_NETDEVICES=y +CONFIG_CMD_NET=y +CONFIG_DM_ETH=y +CONFIG_CMD_PING=y +CONFIG_CMD_DHCP=y +CONFIG_PHYLIB=y +CONFIG_CMD_TFTPPUT=y +CONFIG_CMD_NFS=y +CONFIG_CMD_MII=y +CONFIG_PHY_MARVELL=y +CONFIG_PHY_REALTEK=y +CONFIG_PHY_NATSEMI=y +CONFIG_XILINX_SPI=y +CONFIG_CMD_SPI=y +CONFIG_CMD_SF=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_DM_SPI_FLASH=y +CONFIG_DM_SPI=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI=y +CONFIG_SPI_FLASH_ISSI=y +# CONFIG_BOOTARGS is not set +# CONFIG_USE_BOOTARGS is not set +# CONFIG_SPL is not set +# CONFIG_I2C_EEPROM is not set +# CONFIG_CMD_EEPROM is not set +# CONFIG_SYS_I2C_EEPROM_ADDR is not set +# CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW is not set diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/microblaze-generic-top.h b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/microblaze-generic-top.h new file mode 100644 index 00000000..be823421 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/microblaze-generic-top.h @@ -0,0 +1,8 @@ +/* + * This file is use for addition u-boot configurations for microblaze. + */ +#include <configs/microblaze-generic.h> + +/* Core microblaze boot configurations */ +#define XILINX_USE_ICACHE 1 +#define XILINX_USE_DCACHE 1 diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/microblaze-generic.cfg b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/microblaze-generic.cfg new file mode 100644 index 00000000..3c911a06 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-v2023.01/microblaze-generic.cfg @@ -0,0 +1,83 @@ +# SPDX-License-Identifier: MIT + +#........................................................................ +# WARNING +# +# This file is a u-boot configuration fragment, and not a full u-boot +# configuration file. The final u-boot configuration is made up of +# an assembly of processed fragments, each of which is designed to +# capture a specific part of the final configuration (e.g. platform +# configuration, feature configuration, and board specific hardware +# configuration). For more information on u-boot configuration, please +# refer the product documentation. +# +#....................................................................... + +# +# Definitions for Generic Microbalze machine. +# +CONFIG_BOOTDELAY=4 +CONFIG_TEXT_BASE=0x80100000 +CONFIG_SYS_PROMPT="U-Boot>" +CONFIG_SYS_CONFIG_NAME="microblaze-generic-top" +CONFIG_BOOT_SCRIPT_OFFSET=0x1F00000 +# CONFIG_SYS_NS16550 is not set +# CONFIG_SYS_FLASH_USE_BUFFER_WRITE is not set +# CONFIG_SYS_FLASH_CFI is not set +# CONFIG_FLASH_CFI_DRIVER is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_MTD_NOR_FLASH is not set +# CONFIG_MTD_DEVICE is not set +# CONFIG_SYS_FLASH_PROTECTION is not set +# CONFIG_SPI_FLASH_SST is not set +# CONFIG_XILINX_EMACLITE is not set +# CONFIG_PHY_VITESSE is not set +# CONFIG_CMD_EXT2 is not set +# CONFIG_CMD_EXT4 is not set +# CONFIG_CMD_EXT4_WRITE is not set +# CONFIG_CMD_FAT is not set +# CONFIG_DOS_PARTITION is not set +# CONFIG_FAT_WRITE is not set +CONFIG_DM=y +CONFIG_SYS_MALLOC_F=y +CONFIG_XILINX_UARTLITE=y +CONFIG_XILINX_AXIEMAC=y +CONFIG_PHY_XILINX=y +CONFIG_PHY_TI=y +CONFIG_NET=y +CONFIG_PHY_GIGE=y +CONFIG_NETDEVICES=y +CONFIG_CMD_NET=y +CONFIG_DM_ETH=y +CONFIG_CMD_PING=y +CONFIG_CMD_DHCP=y +CONFIG_PHYLIB=y +CONFIG_CMD_TFTPPUT=y +CONFIG_CMD_NFS=y +CONFIG_CMD_MII=y +CONFIG_PHY_MARVELL=y +CONFIG_PHY_REALTEK=y +CONFIG_PHY_NATSEMI=y +CONFIG_XILINX_SPI=y +CONFIG_CMD_SPI=y +CONFIG_CMD_SF=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_DM_SPI_FLASH=y +CONFIG_DM_SPI=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI=y +CONFIG_SPI_FLASH_ISSI=y +# CONFIG_BOOTARGS is not set +# CONFIG_USE_BOOTARGS is not set +# CONFIG_SPL is not set +# CONFIG_I2C_EEPROM is not set +# CONFIG_CMD_EEPROM is not set +# CONFIG_SYS_I2C_EEPROM_ADDR is not set +# CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW is not set +CONFIG_DCACHE=y +CONFIG_ICACHE=y diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2022.1.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2022.1.inc new file mode 100644 index 00000000..a0c0b50d --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2022.1.inc @@ -0,0 +1,17 @@ +UBOOT_VERSION = "v2021.01" + +UBRANCH ?= "xlnx_rebase_v2022.01_2022.1_update" + +SRCREV = "91ad7924e7f59584d597353e1bb86794341e0a7e" + +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://README;beginline=1;endline=4;md5=744e7e3bb0c94b4b9f6b3db3bf893897" + +# u-boot-xlnx has support for these +HAS_PLATFORM_INIT ?= " \ + xilinx_zynqmp_virt_config \ + xilinx_zynq_virt_defconfig \ + xilinx_versal_vc_p_a2197_revA_x_prc_01_revA \ + " + +DEPENDS += "bc-native dtc-native python3-setuptools-native gnutls-native" diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2022.2.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2022.2.inc new file mode 100644 index 00000000..6415861d --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2022.2.inc @@ -0,0 +1,17 @@ +UBOOT_VERSION = "v2021.01" + +UBRANCH ?= "xlnx_rebase_v2022.01" + +SRCREV = "b31476685debf5512ed0d4e8000fa5167a22f530" + +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://README;beginline=1;endline=4;md5=744e7e3bb0c94b4b9f6b3db3bf893897" + +# u-boot-xlnx has support for these +HAS_PLATFORM_INIT ?= " \ + xilinx_zynqmp_virt_config \ + xilinx_zynq_virt_defconfig \ + xilinx_versal_vc_p_a2197_revA_x_prc_01_revA \ + " + +DEPENDS += "bc-native dtc-native python3-setuptools-native gnutls-native" diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.1.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.1.inc new file mode 100644 index 00000000..72f43f71 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.1.inc @@ -0,0 +1,17 @@ +UBOOT_VERSION = "v2023.01" + +UBRANCH = "xlnx_rebase_v2023.01_update" + +SRCREV = "1689570b68dd3827e527a520805aa0bb7f58ee09" + +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://README;beginline=1;endline=4;md5=744e7e3bb0c94b4b9f6b3db3bf893897" + +# u-boot-xlnx has support for these +HAS_PLATFORM_INIT ?= " \ + xilinx_zynqmp_virt_config \ + xilinx_zynq_virt_defconfig \ + xilinx_versal_vc_p_a2197_revA_x_prc_01_revA \ + " + +DEPENDS += "bc-native dtc-native python3-setuptools-native gnutls-native" diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.2.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.2.inc new file mode 100644 index 00000000..0cfbd846 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-2023.2.inc @@ -0,0 +1,17 @@ +UBOOT_VERSION = "v2023.01" + +UBRANCH = "xlnx_rebase_v2023.01" + +SRCREV = "0fc19cad5a07a09958443e7a5b6f11e420ef195c" + +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://README;beginline=1;endline=4;md5=744e7e3bb0c94b4b9f6b3db3bf893897" + +# u-boot-xlnx has support for these +HAS_PLATFORM_INIT ?= " \ + xilinx_zynqmp_virt_config \ + xilinx_zynq_virt_defconfig \ + xilinx_versal_vc_p_a2197_revA_x_prc_01_revA \ + " + +DEPENDS += "bc-native dtc-native python3-setuptools-native gnutls-native" diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-blob.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-blob.inc new file mode 100644 index 00000000..bbf4125f --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-blob.inc @@ -0,0 +1,176 @@ +# U-boot fitimage/blob generator + +UBOOT_IMAGE_BLOB_DEFAULT = "" +UBOOT_IMAGE_BLOB ?= "${UBOOT_IMAGE_BLOB_DEFAULT}" +DT_BLOB_DIR ?= "${B}/arch/arm/dts/dt-blob" +UBOOT_BLOB_NAME ?= "${MACHINE}-fit-dtb${IMAGE_VERSION_SUFFIX}.blob" + +IMPORT_CC_DTBS ?= "" +CC_DTBS_DUP ?= "" +IMPORT_CC_UBOOT_DTBS ?= "" + +DEPENDS:append:eval-brd-sc-zynqmp = " uboot-device-tree" +MKIMAGE_DTBLOB_OPTS ?= "-E -B 0x8" + +# Everything is swtiched on with UBOOT_IMAGE_BLOB = '1' +inherit ${@'image-artifact-names' if d.getVar('UBOOT_IMAGE_BLOB') == "1" else ''} + +python() { + if d.getVar('UBOOT_IMAGE_BLOB') == "1": + d.appendVarFlag('do_compile', 'postfuncs', ' do_blob_generate') + d.appendVarFlag('do_compile', 'cleandirs', ' ${DT_BLOB_DIR}') + d.appendVar('PROVIDES', ' u-boot-xlnx-fit-blob') + d.appendVar('DEPENDS', ' u-boot-mkimage-native') +} + +dtblob_emit_its_section() { + case $2 in + header) + cat << EOF > $1 +/dts-v1/; + +/ { + description = "DT Blob Creation"; +EOF + ;; + imagestart) + cat << EOF >> $1 + + images { +EOF + ;; + confstart) + cat << EOF >> $1 + + configurations { +EOF + ;; + sectend) + cat << EOF >> $1 + }; +EOF + ;; + fitend) + cat << EOF >> $1 +}; +EOF + ;; + esac +} + +dtblob_emit_dtb () { + dtb_csum="md5" + cat << EOF >> $1 + fdt-$2 { + description = "$(basename $3 .dtb)"; + data = /incbin/("$3"); + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + hash-1 { + algo = "$dtb_csum"; + }; + }; +EOF +} + +#1.file name +#2.config node +#3.config node description +#4.DTB count +dtblob_emit_config () { + default_dtb=1 + if [ $4 -eq $default_dtb ]; then + cat << EOF >> $1 + default = "config_$4"; +EOF + fi + cat << EOF >> $1 + config_$4 { + description = "$3"; + fdt = "fdt-$2"; + }; +EOF +} + +do_blob_generate () { + oe_runmake -C ${S} O=${B} dtbs + install -d ${DT_BLOB_DIR} + for CC_DTB in ${IMPORT_CC_DTBS}; do + DTBO=$(echo $CC_DTB | cut -d: -f1) + BASE_DTB=$(echo $CC_DTB | cut -d: -f2) + OUTPUT_DTB=$(echo $CC_DTB | cut -d: -f3) + if [ "${SYSTEM_DTB_BLOB}" = "1" ]; then + BASE_SYS_DTB="${RECIPE_SYSROOT}/${DTB_PATH}/${DTB_FILE_NAME}" + else + BASE_SYS_DTB="${B}/arch/arm/dts/${BASE_DTB}" + fi + bbnote "fdtoverlay -o ${DT_BLOB_DIR}/${OUTPUT_DTB} -i ${BASE_SYS_DTB} ${B}/arch/arm/dts/${DTBO}" + if [ -f ${B}/arch/arm/dts/${DTBO} ]; then + fdtoverlay -o ${DT_BLOB_DIR}/${OUTPUT_DTB} -i ${BASE_SYS_DTB} ${B}/arch/arm/dts/${DTBO} + fi + done + + for CC_DTB in ${IMPORT_CC_UBOOT_DTBS}; do + DTBO=$(echo $CC_DTB | cut -d: -f1) + OUTPUT_DTB=$(echo $CC_DTB | cut -d: -f3) + BASE_SYS_DTB="${RECIPE_SYSROOT}/${DTB_PATH}/${PACKAGE_UBOOT_DTB_NAME}" + if [ -f ${B}/arch/arm/dts/${DTBO} ] && [ -f ${BASE_SYS_DTB} ]; then + bbnote "fdtoverlay -o ${DT_BLOB_DIR}/${OUTPUT_DTB} -i ${BASE_SYS_DTB} ${B}/arch/arm/dts/${DTBO}" + fdtoverlay -o ${DT_BLOB_DIR}/${OUTPUT_DTB} -i ${BASE_SYS_DTB} ${B}/arch/arm/dts/${DTBO} + fi + done + + cd ${DT_BLOB_DIR} + its_filename="dtblob.its" + dtblob_emit_its_section "${its_filename}" "header" + dtblob_emit_its_section "${its_filename}" "imagestart" + for dtb in ${RECIPE_SYSROOT}/${DTB_PATH}/${DTB_FILE_NAME} $(find ${DT_BLOB_DIR} -name '*.dtb' | sort); do + dtblob_emit_dtb "${its_filename}" "$(basename $dtb .dtb)" "$dtb" + done + dtblob_emit_its_section "${its_filename}" "sectend" + dtblob_emit_its_section "${its_filename}" "confstart" + dtbcount=1 + for dtb in ${RECIPE_SYSROOT}/${DTB_PATH}/${DTB_FILE_NAME} $(find ${DT_BLOB_DIR} -name '*.dtb' | sort); do + dtblob_emit_config "${its_filename}" "$(basename $dtb .dtb)" "$(basename $dtb .dtb)" "$dtbcount" + dtbcount=`expr $dtbcount + 1` + done + + for CC_DTB_DUP in ${CC_DTBS_DUP}; do + DTB=$(echo $CC_DTB_DUP | cut -d: -f1) + DUP_DTB=$(echo $CC_DTB_DUP | cut -d: -f2) + if [ -f ${DT_BLOB_DIR}/${DTB}.dtb ]; then + bbnote "Node ${DT_BLOB_DIR}/${DTB} with ${DT_BLOB_DIR}/${DUP_DTB}" + dtblob_emit_config "${its_filename}" "$DTB" "$DUP_DTB" "$dtbcount" + dtbcount=`expr $dtbcount + 1` + else + bberror "CC_DTBS_DUP file not found ${DT_BLOB_DIR}/${DTB}.dtb" + fi + done + + dtblob_emit_its_section "${its_filename}" "sectend" + dtblob_emit_its_section "${its_filename}" "fitend" + + mkimage ${MKIMAGE_DTBLOB_OPTS} -f "${its_filename}" "${UBOOT_BLOB_NAME}" +} + +do_install:append() { + ( + cd ${B} + + if [ -e "${DT_BLOB_DIR}/${UBOOT_BLOB_NAME}" ]; then + install -d ${D}/boot + install -m 0644 ${DT_BLOB_DIR}/${UBOOT_BLOB_NAME} ${D}/boot + ln -sf `basename ${UBOOT_BLOB_NAME}` ${D}/boot/fit-dtb.blob + fi + ) +} + +do_deploy:prepend() { + cd ${B} + + if [ -e "${DT_BLOB_DIR}/${UBOOT_BLOB_NAME}" ]; then + install -m 0644 ${DT_BLOB_DIR}/${UBOOT_BLOB_NAME} ${DEPLOYDIR}/ + ln -sf `basename ${UBOOT_BLOB_NAME}` ${DEPLOYDIR}/fit-dtb.blob + fi +} diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-common.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-common.inc new file mode 100644 index 00000000..b447c92a --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-common.inc @@ -0,0 +1,19 @@ +# Use the name of the .bb for the extension +UBOOT_VERSION_EXTENSION ?= "-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}" +PV = "${UBOOT_VERSION}${UBOOT_VERSION_EXTENSION}+git${SRCPV}" + +UBOOTURI ?= "git://github.com/Xilinx/u-boot-xlnx.git;protocol=https" +UBRANCH ?= "" +UBRANCHARG = "${@['nobranch=1', 'branch=${UBRANCH}'][d.getVar('UBRANCH', True) != '']}" + +SRC_URI = "${UBOOTURI};${UBRANCHARG}" + +S = "${WORKDIR}/git" +B = "${WORKDIR}/build" + +FILESEXTRAPATHS:prepend := "${THISDIR}/u-boot-${UBOOT_VERSION}:" + +UBOOT_MB_INC = "" +UBOOT_MB_INC:microblaze = "u-boot-xlnx-microblaze.inc" +require ${UBOOT_MB_INC} + diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx-dev.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-dev.bb index 3e40bfa1..c0005bc5 100644 --- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-xlnx-dev.bb +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-dev.bb @@ -9,7 +9,7 @@ UBRANCH ?= "master" include u-boot-xlnx.inc include u-boot-spl-zynq-init.inc -LICENSE = "GPLv2+" +LICENSE = "GPL-2.0-or-later" LIC_FILES_CHKSUM = "file://README;beginline=1;endline=6;md5=157ab8408beab40cd8ce1dc69f702a6c" SRCREV_DEFAULT = "aebea9d20a5aa32857f320c07ca8f9fd1b3dec1f" @@ -17,12 +17,3 @@ SRCREV ?= "${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/bootloader", "u-b PV = "${UBRANCH}-xilinx-dev+git${SRCPV}" -# Newer versions of u-boot have support for these -HAS_PLATFORM_INIT ?= " \ - zynq_microzed_config \ - zynq_zed_config \ - zynq_zc702_config \ - zynq_zc706_config \ - zynq_zybo_config \ - " - diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-microblaze.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-microblaze.inc new file mode 100644 index 00000000..2ef7b9cf --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-microblaze.inc @@ -0,0 +1,11 @@ +SRC_URI += " \ + file://microblaze-generic.cfg \ + file://microblaze-generic-top.h \ + " + +do_configure:prepend () { + install ${WORKDIR}/microblaze-generic-top.h ${S}/include/configs/ +} + +# Disable buildpaths QA check warnings for u-boot-xlnx.elf. +INSANE_SKIP:${PN}-elf += "buildpaths" diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr.bb new file mode 100644 index 00000000..6410fc25 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr.bb @@ -0,0 +1,282 @@ +SUMMARY = "U-boot boot scripts for Xilinx devices" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +DEPENDS = "u-boot-mkimage-native" + +inherit deploy image-wic-utils + +INHIBIT_DEFAULT_DEPS = "1" + +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:zynq = "zynq" +COMPATIBLE_MACHINE:versal = "versal" +COMPATIBLE_MACHINE:microblaze = "microblaze" + +KERNELDT = "${@os.path.basename(d.getVar('KERNEL_DEVICETREE').split(' ')[0]) if d.getVar('KERNEL_DEVICETREE') else ''}" +DEVICE_TREE_NAME ?= "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 'device-tree', 'system.dtb', d.getVar('KERNELDT'), d)}" +#Need to copy a rootfs.cpio.gz.u-boot into boot partition +RAMDISK_IMAGE ?= "rootfs.cpio.gz.u-boot" +RAMDISK_IMAGE1 ?= "ramdisk.cpio.gz.u-boot" + +PXERAMDISK_IMAGE ?= "${@'${RAMDISK_IMAGE1}' if d.getVar('INITRAMFS_IMAGE') and d.getVar('INITRAMFS_IMAGE').find('initramfs') > 0 else '${RAMDISK_IMAGE}'}" + +KERNEL_BOOTCMD:zynqmp ?= "booti" +KERNEL_BOOTCMD:zynq ?= "bootm" +KERNEL_BOOTCMD:versal ?= "booti" +KERNEL_BOOTCMD:microblaze ?= "bootm" + +BOOTMODE ??= "generic" +BOOTFILE_EXT ?= "" + +#Make this value to "1" to skip appending base address to ddr offsets. +SKIP_APPEND_BASEADDR ?= "0" + +DDR_BASEADDR ?= "0x0" +DDR_BASEADDR:microblaze ?= "0x80000000" +PRE_BOOTENV ?= "" + +SRC_URI = " \ + file://boot.cmd.sd.zynq \ + file://boot.cmd.sd.zynqmp \ + file://boot.cmd.sd.versal \ + file://boot.cmd.qspi.versal \ + file://boot.cmd.generic \ + file://boot.cmd.generic.root \ + file://boot.cmd.ubifs \ + file://pxeboot.pxe \ + " + +# Even thought we don't create a package, make sure this is unique to the machine +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit image-artifact-names +UENV_TEXTFILE ?= "uEnv.txt" +UENV_MMC_OFFSET:zynqmp ??= "0x200000" +UENV_MMC_OFFSET:zynq ??= "0x2080000" +UENV_MMC_OFFSET:versal ??= "0x200000" +UENV_MMC_OFFSET:microblaze ??= "0x0" + +UENV_MMC_LOAD_ADDRESS ?= "${@append_baseaddr(d,d.getVar('UENV_MMC_OFFSET'))}" + +UBOOTSCR_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}${IMAGE_VERSION_SUFFIX}" +UBOOTPXE_CONFIG ?= "pxelinux.cfg" +UBOOTPXE_CONFIG_NAME = "${UBOOTPXE_CONFIG}${IMAGE_VERSION_SUFFIX}" + +DEVICETREE_ADDRESS ?= "${@append_baseaddr(d,d.getVar('DEVICETREE_OFFSET'))}" + +DEVICETREE_OFFSET:microblaze ??= "0x1e00000" +DEVICETREE_OFFSET:zynqmp ??= "0x100000" +DEVICETREE_OFFSET:zynq ??= "0x100000" +DEVICETREE_OFFSET:versal ??= "0x1000" + +DEVICETREE_OVERLAY_OFFSET:microblaze ??= "0x1e00000" +DEVICETREE_OVERLAY_OFFSET:zynqmp ??= "0x100000" +DEVICETREE_OVERLAY_OFFSET:zynq ??= "0x100000" +DEVICETREE_OVERLAY_OFFSET:versal ??= "0x1000" +DEVICETREE_OVERLAY_PADSIZE ??= "0xf00000" + +DEVICETREE_OVERLAY_ADDRESS ?= "${@hex(int(append_baseaddr(d,d.getVar('DEVICETREE_OVERLAY_OFFSET')),16) \ + + int(d.getVar('DEVICETREE_OVERLAY_PADSIZE'),16))}" + +KERNEL_LOAD_ADDRESS ?= "${@append_baseaddr(d,d.getVar('KERNEL_OFFSET'))}" + +KERNEL_OFFSET:microblaze ??= "0x0" +KERNEL_OFFSET:zynqmp ??= "0x200000" +KERNEL_OFFSET:zynq ??= "0x200000" +KERNEL_OFFSET:versal ??= "0x200000" + +KERNEL_IMAGE ?= "${KERNEL_IMAGETYPE}" + +RAMDISK_IMAGE_ADDRESS ?= "${@append_baseaddr(d,d.getVar('RAMDISK_OFFSET'))}" + +RAMDISK_OFFSET:microblaze ??= "0x2e00000" +RAMDISK_OFFSET:zynq ??= "0x4000000" +RAMDISK_OFFSET:zynqmp ??= "0x4000000" +RAMDISK_OFFSET:versal ??= "0x4000000" + +FIT_IMAGE_LOAD_ADDRESS ?= "${@append_baseaddr(d,d.getVar('FIT_IMAGE_OFFSET'))}" +FIT_IMAGE_OFFSET ??= "0x10000000" +FIT_IMAGE ?= "image.ub" + +## Below offsets and sizes are based on 32MB QSPI Memory for zynq +## For MB +## Load boot.scr at 0xFC0000 -> 15MB of QSPI/NAND Memory +QSPI_KERNEL_OFFSET:microblaze ??= "0xBC0000" +QSPI_KERNEL_SIZE:microblaze ??= "0x500000" +QSPI_RAMDISK_SIZE:microblaze ??= "0xA00000" +QSPI_RAMDISK_SIZE:microblaze ??= "0x4000000" + +## For zynq +## Load boot.scr at 0xFC0000 -> 15MB of QSPI/NAND Memory +QSPI_KERNEL_OFFSET:zynq ??= "0xA00000" +QSPI_RAMDISK_OFFSET:zynq ??= "0x1000000" + +NAND_KERNEL_OFFSET:zynq ??= "0x1000000" +NAND_RAMDISK_OFFSET:zynq ??= "0x4600000" + +QSPI_KERNEL_SIZE:zynq ??= "0x600000" +QSPI_RAMDISK_SIZE:zynq ??= "0xF80000" + +NAND_KERNEL_SIZE ??= "0x3200000" +NAND_RAMDISK_SIZE ??= "0x3200000" + +## Below offsets and sizes are based on 128MB QSPI Memory for zynqmp/versal +## For zynqMP +## Load boot.scr at 0x3E80000 -> 62MB of QSPI/NAND Memory +QSPI_KERNEL_OFFSET ??= "0xF00000" +QSPI_KERNEL_OFFSET:zynqmpdr ??= "0x3F00000" +QSPI_RAMDISK_OFFSET ??= "0x4000000" +QSPI_RAMDISK_OFFSET:zynqmpdr ??= "0x5D00000" + +NAND_KERNEL_OFFSET:zynqmp ??= "0x4100000" +NAND_RAMDISK_OFFSET:zynqmp ??= "0x7800000" + +QSPI_KERNEL_SIZE:zynqmp ??= "0x1D00000" +QSPI_RAMDISK_SIZE ??= "0x4000000" +QSPI_RAMDISK_SIZE:zynqmpdr ??= "0x1D00000" + +## For versal +## Load boot.scr at 0x7F80000 -> 127MB of QSPI/NAND Memory +QSPI_KERNEL_OFFSET:versal ??= "0xF00000" +QSPI_RAMDISK_OFFSET:versal ??= "0x2E00000" + +NAND_KERNEL_OFFSET:versal ??= "0x4100000" +NAND_RAMDISK_OFFSET:versal ??= "0x8200000" + +QSPI_KERNEL_SIZE:versal ??= "0x1D00000" +QSPI_RAMDISK_SIZE:versal ??= "0x4000000" + +QSPI_KERNEL_IMAGE:microblaze ?= "image.ub" +QSPI_KERNEL_IMAGE:zynq ?= "image.ub" +QSPI_KERNEL_IMAGE:zynqmp ?= "image.ub" +QSPI_KERNEL_IMAGE:versal ?= "image.ub" + +NAND_KERNEL_IMAGE ?= "image.ub" + +QSPI_FIT_IMAGE_OFFSET ??= "0xF40000" +QSPI_FIT_IMAGE_OFFSET:zynqmpdr ??= "0x3F80000" +QSPI_FIT_IMAGE_OFFSET:zynq ??= "0xA80000" +QSPI_FIT_IMAGE_OFFSET:microblaze ??= "0xC00000" + +QSPI_FIT_IMAGE_SIZE ??= "0x6400000" +QSPI_FIT_IMAGE_SIZE:zynqmpdr ??= "0x3F00000" +QSPI_FIT_IMAGE_SIZE:zynq ??= "0x1500000" +QSPI_FIT_IMAGE_SIZE:microblaze ??= "0xF00000" + +NAND_FIT_IMAGE_OFFSET ??= "0x4180000" +NAND_FIT_IMAGE_OFFSET:zynq ??= "0x1080000" +NAND_FIT_IMAGE_SIZE ??= "0x6400000" + +# Add variables as addendum. +SCRIPT_SED_ADDENDUM = "" + +# Default to booting with the rootfs device being partition 2 for SD/eMMC +PARTNUM ?= "2" + +# Set Kernel root filesystem parameter for SD/eMMC boot +# Bootdev will automatically be set to 'sda' or 'mmcblkXp' +KERNEL_ROOT_SD ?= "root=/dev/\${bootdev}${PARTNUM} ro rootwait" + +# Set Kernel root filesystem parameter for JTAG/QSPI/OSPI/NAND(using RAMDISK) boot +KERNEL_ROOT_RAMDISK ?= "root=/dev/ram0 rw" + +# Append the kernel command line +KERNEL_COMMAND_APPEND ?= "" + +BITSTREAM_LOAD_ADDRESS ?= "0x100000" + +do_configure[noexec] = "1" + +def append_baseaddr(d,offset): + skip_append = d.getVar('SKIP_APPEND_BASEADDR') or "" + if skip_append == "1": + return offset + if offset.startswith('$'): + # If offset startswith '$' Assuming as uboot env variable. + return offset + import subprocess + baseaddr = d.getVar('DDR_BASEADDR') or "0x0" + subcmd = "$((%s+%s));" % (baseaddr,offset) + cmd = "printf '0x%08x' " + str(subcmd) + output = subprocess.check_output(cmd, shell=True).decode("utf-8") + return output + +def get_bitstream_load_type(d): + if boot_files_bitstream(d)[1] : + return "loadb" + else: + return "load" + +do_compile() { + sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \ + -e 's/@@KERNEL_LOAD_ADDRESS@@/${KERNEL_LOAD_ADDRESS}/' \ + -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \ + -e 's/@@DEVICETREE_ADDRESS@@/${DEVICETREE_ADDRESS}/' \ + -e 's/@@DEVICETREE_OVERLAY_ADDRESS@@/${DEVICETREE_OVERLAY_ADDRESS}/' \ + -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \ + -e 's/@@RAMDISK_IMAGE_ADDRESS@@/${RAMDISK_IMAGE_ADDRESS}/' \ + -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \ + -e 's/@@SDBOOTDEV@@/${SDBOOTDEV}/' \ + -e 's/@@BITSTREAM@@/${@boot_files_bitstream(d)[0]}/g' \ + -e 's/@@BITSTREAM_LOAD_ADDRESS@@/${BITSTREAM_LOAD_ADDRESS}/g' \ + -e 's/@@BITSTREAM_IMAGE@@/${@boot_files_bitstream(d)[0]}/g' \ + -e 's/@@BITSTREAM_LOAD_TYPE@@/${@get_bitstream_load_type(d)}/g' \ + -e 's/@@QSPI_KERNEL_OFFSET@@/${QSPI_KERNEL_OFFSET}/' \ + -e 's/@@NAND_KERNEL_OFFSET@@/${NAND_KERNEL_OFFSET}/' \ + -e 's/@@QSPI_KERNEL_SIZE@@/${QSPI_KERNEL_SIZE}/' \ + -e 's/@@NAND_KERNEL_SIZE@@/${NAND_KERNEL_SIZE}/' \ + -e 's/@@QSPI_RAMDISK_OFFSET@@/${QSPI_RAMDISK_OFFSET}/' \ + -e 's/@@NAND_RAMDISK_OFFSET@@/${NAND_RAMDISK_OFFSET}/' \ + -e 's/@@QSPI_RAMDISK_SIZE@@/${QSPI_RAMDISK_SIZE}/' \ + -e 's/@@NAND_RAMDISK_SIZE@@/${NAND_RAMDISK_SIZE}/' \ + -e 's/@@KERNEL_IMAGE@@/${KERNEL_IMAGE}/' \ + -e 's/@@QSPI_KERNEL_IMAGE@@/${QSPI_KERNEL_IMAGE}/' \ + -e 's/@@NAND_KERNEL_IMAGE@@/${NAND_KERNEL_IMAGE}/' \ + -e 's/@@FIT_IMAGE_LOAD_ADDRESS@@/${FIT_IMAGE_LOAD_ADDRESS}/' \ + -e 's/@@QSPI_FIT_IMAGE_OFFSET@@/${QSPI_FIT_IMAGE_OFFSET}/' \ + -e 's/@@QSPI_FIT_IMAGE_SIZE@@/${QSPI_FIT_IMAGE_SIZE}/' \ + -e 's/@@NAND_FIT_IMAGE_OFFSET@@/${NAND_FIT_IMAGE_OFFSET}/' \ + -e 's/@@NAND_FIT_IMAGE_SIZE@@/${NAND_FIT_IMAGE_SIZE}/' \ + -e 's/@@FIT_IMAGE@@/${FIT_IMAGE}/' \ + -e 's/@@PRE_BOOTENV@@/${PRE_BOOTENV}/' \ + -e 's/@@UENV_MMC_LOAD_ADDRESS@@/${UENV_MMC_LOAD_ADDRESS}/' \ + -e 's/@@UENV_TEXTFILE@@/${UENV_TEXTFILE}/' \ + -e 's/@@RAMDISK_IMAGE1@@/${RAMDISK_IMAGE1}/' \ + -e 's/@@PARTNUM@@/${PARTNUM}/' \ + -e 's:@@KERNEL_ROOT_SD@@:${KERNEL_ROOT_SD}:' \ + -e 's:@@KERNEL_ROOT_RAMDISK@@:${KERNEL_ROOT_RAMDISK}:' \ + -e 's:@@KERNEL_COMMAND_APPEND@@:${KERNEL_COMMAND_APPEND}:' \ + ${SCRIPT_SED_ADDENDUM} \ + "${WORKDIR}/boot.cmd.${BOOTMODE}${BOOTFILE_EXT}" > "${WORKDIR}/boot.cmd" + + mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr + + sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \ + -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \ + -e 's/@@RAMDISK_IMAGE@@/${PXERAMDISK_IMAGE}/' \ + "${WORKDIR}/pxeboot.pxe" > "pxeboot.pxe" +} + +do_install() { + install -d ${D}/boot + install -m 0644 boot.scr ${D}/boot/${UBOOTSCR_BASE_NAME}.scr + ln -sf ${UBOOTSCR_BASE_NAME}.scr ${D}/boot/boot.scr + install -d ${D}/boot/pxeboot/${UBOOTPXE_CONFIG_NAME} + install -m 0644 pxeboot.pxe ${D}/boot/pxeboot/${UBOOTPXE_CONFIG_NAME}/default + ln -sf pxeboot/${UBOOTPXE_CONFIG_NAME} ${D}/boot/${UBOOTPXE_CONFIG} +} + +FILES:${PN} = "/boot/*" + +do_deploy() { + install -d ${DEPLOYDIR} + install -m 0644 boot.scr ${DEPLOYDIR}/${UBOOTSCR_BASE_NAME}.scr + ln -sf ${UBOOTSCR_BASE_NAME}.scr ${DEPLOYDIR}/boot.scr + install -d ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME} + install -m 0644 pxeboot.pxe ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME}/default + ln -sf pxeboot/${UBOOTPXE_CONFIG_NAME} ${DEPLOYDIR}/${UBOOTPXE_CONFIG} +} + +addtask do_deploy after do_compile before do_build diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic new file mode 100644 index 00000000..d99932ed --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic @@ -0,0 +1,86 @@ +# This is a boot script for U-Boot +# Generate boot.scr: +# mkimage -c none -A arm -T script -d boot.cmd.default boot.scr +# +################ +fitimage_name=@@FIT_IMAGE@@ +kernel_name=@@KERNEL_IMAGE@@ +ramdisk_name=@@RAMDISK_IMAGE1@@ +rootfs_name=@@RAMDISK_IMAGE@@ +@@PRE_BOOTENV@@ + + +setenv get_bootargs 'fdt addr $fdtcontroladdr;fdt get value bootargs /chosen bootargs;' +setenv update_bootargs 'if test -n ${launch_ramdisk_init} && test ${bootargs} = "";then if run get_bootargs;then setenv bootargs "\$bootargs launch_ramdisk_init=${launch_ramdisk_init} $extrabootargs";fi;fi' + + +for boot_target in ${boot_targets}; +do + echo "Trying to load boot images from ${boot_target}" + if test "${boot_target}" = "jtag" ; then + run update_bootargs + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ + fi + if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" || test "${boot_target}" = "usb0" || test "${boot_target}" = "usb1"; then + if test -e ${devtype} ${devnum}:${distro_bootpart} /@@UENV_TEXTFILE@@; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@UENV_MMC_LOAD_ADDRESS@@ @@UENV_TEXTFILE@@; + echo "Importing environment(@@UENV_TEXTFILE@@) from ${boot_target}..." + env import -t @@UENV_MMC_LOAD_ADDRESS@@ $filesize + if test -n $uenvcmd; then + echo "Running uenvcmd ..."; + run uenvcmd; + fi + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /${fitimage_name}; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@FIT_IMAGE_LOAD_ADDRESS@@ ${fitimage_name}; + bootm @@FIT_IMAGE_LOAD_ADDRESS@@; + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /${kernel_name}; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@KERNEL_LOAD_ADDRESS@@ ${kernel_name}; + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_ADDRESS@@ system.dtb; + setenv fdtcontroladdr @@DEVICETREE_ADDRESS@@ + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /devicetree/openamp.dtbo; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt resize 8192 + fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ + fi + run update_bootargs + if test -e ${devtype} ${devnum}:${distro_bootpart} /${ramdisk_name} && test "${skip_tinyramdisk}" != "yes"; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${ramdisk_name}; + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /${rootfs_name} && test "${skip_ramdisk}" != "yes"; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${rootfs_name}; + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ + fi + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ + fi + if test "${boot_target}" = "xspi0" || test "${boot_target}" = "xspi1" || test "${boot_target}" = "qspi" || test "${boot_target}" = "qspi0"; then + sf probe 0 0 0; + sf read @@FIT_IMAGE_LOAD_ADDRESS@@ @@QSPI_FIT_IMAGE_OFFSET@@ @@QSPI_FIT_IMAGE_SIZE@@ + bootm @@FIT_IMAGE_LOAD_ADDRESS@@; + echo "Booting using Fit image failed" + + sf read @@KERNEL_LOAD_ADDRESS@@ @@QSPI_KERNEL_OFFSET@@ @@QSPI_KERNEL_SIZE@@ + sf read @@RAMDISK_IMAGE_ADDRESS@@ @@QSPI_RAMDISK_OFFSET@@ @@QSPI_RAMDISK_SIZE@@ + run update_bootargs + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@; + echo "Booting using Separate images failed" + fi + if test "${boot_target}" = "nand" || test "${boot_target}" = "nand0"; then + nand info; + nand read @@FIT_IMAGE_LOAD_ADDRESS@@ @@NAND_FIT_IMAGE_OFFSET@@ @@NAND_FIT_IMAGE_SIZE@@ + bootm @@FIT_IMAGE_LOAD_ADDRESS@@; + echo "Booting using Fit image failed" + + nand read @@KERNEL_LOAD_ADDRESS@@ @@NAND_KERNEL_OFFSET@@ @@NAND_KERNEL_SIZE@@ + nand read @@RAMDISK_IMAGE_ADDRESS@@ @@NAND_RAMDISK_OFFSET@@ @@NAND_RAMDISK_SIZE@@ + run update_bootargs + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@; + echo "Booting using Separate images failed" + fi +done diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic.root b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic.root new file mode 100644 index 00000000..ed12f941 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic.root @@ -0,0 +1,115 @@ +# This is a boot script for U-Boot with generic root parameters used by yocto machine configuration file. +# Generate boot.scr: +# mkimage -c none -A arm -T script -d boot.cmd.default boot.scr +# +################ +fitimage_name=@@FIT_IMAGE@@ +kernel_name=@@KERNEL_IMAGE@@ +ramdisk_name=@@RAMDISK_IMAGE1@@ +rootfs_name=@@RAMDISK_IMAGE@@ +@@PRE_BOOTENV@@ + +for boot_target in ${boot_targets}; +do + echo "Trying to load boot images from ${boot_target}" + if test "${boot_target}" = "jtag" ; then + fdt addr @@DEVICETREE_ADDRESS@@ + fdt get value bootargs /chosen bootargs + setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ + fi + if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" || test "${boot_target}" = "usb0" || test "${boot_target}" = "usb1"; then + if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1"; then + setenv bootdev mmcblk${devnum}p + fi + if test "${boot_target}" = "usb0" || test "${boot_target}" = "usb1"; then + setenv bootdev sda + fi + + if test -e ${devtype} ${devnum}:${distro_bootpart} /@@UENV_TEXTFILE@@; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@UENV_MMC_LOAD_ADDRESS@@ @@UENV_TEXTFILE@@; + echo "Importing environment(@@UENV_TEXTFILE@@) from ${boot_target}..." + env import -t @@UENV_MMC_LOAD_ADDRESS@@ $filesize + if test -n $uenvcmd; then + echo "Running uenvcmd ..."; + run uenvcmd; + fi + fi + echo "Checking for /${fitimage_name}" + if test -e ${devtype} ${devnum}:${distro_bootpart} /${fitimage_name}; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@FIT_IMAGE_LOAD_ADDRESS@@ ${fitimage_name}; + echo "Kernel root filesystem parameter needs to be set for FITIMAGE boot if not defined in DTB" + bootm @@FIT_IMAGE_LOAD_ADDRESS@@; + fi + echo "Checking for /${kernel_name}" + if test -e ${devtype} ${devnum}:${distro_bootpart} /${kernel_name}; then + echo "Loading ${kernel_name}"; + fatload ${devtype} ${devnum}:${distro_bootpart} @@KERNEL_LOAD_ADDRESS@@ ${kernel_name}; + fi + echo "Checking for /system.dtb" + if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then + echo "Loading system.dtb"; + fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_ADDRESS@@ system.dtb; + fi + echo "Checking for /devicetree/openamp.dtbo" + if test -e ${devtype} ${devnum}:${distro_bootpart} /devicetree/openamp.dtbo; then + echo "Loading and merging openamp.dtbo into device tree"; + fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt resize 8192 + fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ + fi + echo "Checking for /${ramdisk_name}" + if test -e ${devtype} ${devnum}:${distro_bootpart} /${ramdisk_name} && test "${skip_tinyramdisk}" != "yes"; then + echo "Loading ${ramdisk_name}"; + fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${ramdisk_name}; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt get value bootargs /chosen bootargs + setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ + fi + echo "Checking for /${rootfs_name}" + if test -e ${devtype} ${devnum}:${distro_bootpart} /${rootfs_name} && test "${skip_ramdisk}" != "yes"; then + echo "Loading ${rootfs_name}"; + fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${rootfs_name}; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt get value bootargs /chosen bootargs + setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ + fi + fdt addr @@DEVICETREE_ADDRESS@@ + fdt get value bootargs /chosen bootargs + setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_SD@@ + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ + fi + if test "${boot_target}" = "xspi0" || test "${boot_target}" = "qspi" || test "${boot_target}" = "qspi0"; then + sf probe 0 0 0; + sf read @@FIT_IMAGE_LOAD_ADDRESS@@ @@QSPI_FIT_IMAGE_OFFSET@@ @@QSPI_FIT_IMAGE_SIZE@@ + echo "Kernel root filesystem parameter needs to be set for FITIMAGE boot if not defined in DTB" + bootm @@FIT_IMAGE_LOAD_ADDRESS@@; + echo "Booting using Fit image failed" + + sf read @@KERNEL_LOAD_ADDRESS@@ @@QSPI_KERNEL_OFFSET@@ @@QSPI_KERNEL_SIZE@@ + sf read @@RAMDISK_IMAGE_ADDRESS@@ @@QSPI_RAMDISK_OFFSET@@ @@QSPI_RAMDISK_SIZE@@ + fdt addr @@DEVICETREE_ADDRESS@@ + fdt get value bootargs /chosen bootargs + setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@; + echo "Booting using Separate images failed" + fi + if test "${boot_target}" = "nand" || test "${boot_target}" = "nand0"; then + nand info; + nand read @@FIT_IMAGE_LOAD_ADDRESS@@ @@NAND_FIT_IMAGE_OFFSET@@ @@NAND_FIT_IMAGE_SIZE@@ + echo "Kernel root filesystem parameter needs to be set for FITIMAGE boot if not defined in DTB" + bootm @@FIT_IMAGE_LOAD_ADDRESS@@; + echo "Booting using Fit image failed" + + nand read @@KERNEL_LOAD_ADDRESS@@ @@NAND_KERNEL_OFFSET@@ @@NAND_KERNEL_SIZE@@ + nand read @@RAMDISK_IMAGE_ADDRESS@@ @@NAND_RAMDISK_OFFSET@@ @@NAND_RAMDISK_SIZE@@ + fdt addr @@DEVICETREE_ADDRESS@@ + fdt get value bootargs /chosen bootargs + setenv bootargs $bootargs @@KERNEL_COMMAND_APPEND@@ @@KERNEL_ROOT_RAMDISK@@ + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@; + echo "Booting using Separate images failed" + fi +done diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.qspi.versal b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.qspi.versal new file mode 100644 index 00000000..b9e2f3ec --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.qspi.versal @@ -0,0 +1,3 @@ +@@PRE_BOOTENV@@ + +@@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.versal b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.versal new file mode 100644 index 00000000..d726187a --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.versal @@ -0,0 +1,7 @@ +@@PRE_BOOTENV@@ + +setenv sdbootdev @@SDBOOTDEV@@ +setenv bootargs $bootargs root=/dev/mmcblk${sdbootdev}p2 rw rootwait earlycon clk_ignore_unused +fatload mmc $sdbootdev @@DEVICETREE_ADDRESS@@ @@DEVICE_TREE_NAME@@ +fatload mmc $sdbootdev:$partid @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@ +@@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.zynq b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.zynq new file mode 100644 index 00000000..abc5ae00 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.zynq @@ -0,0 +1,9 @@ +@@PRE_BOOTENV@@ + +if test -n "@@BITSTREAM@@"; then + fatload mmc $sdbootdev @@BITSTREAM_LOAD_ADDRESS@@ @@BITSTREAM_IMAGE@@ && fpga @@BITSTREAM_LOAD_TYPE@@ 0 @@BITSTREAM_LOAD_ADDRESS@@ ${filesize} +fi +fatload mmc 0 @@DEVICETREE_ADDRESS@@ @@DEVICE_TREE_NAME@@ +fatload mmc 0 @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@ +fatload mmc 0 @@RAMDISK_IMAGE_ADDRESS@@ @@RAMDISK_IMAGE@@ +@@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.zynqmp b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.zynqmp new file mode 100644 index 00000000..bddab5d0 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.sd.zynqmp @@ -0,0 +1,10 @@ +@@PRE_BOOTENV@@ + +setenv sdbootdev @@SDBOOTDEV@@ +setenv bootargs $bootargs root=/dev/mmcblk${sdbootdev}p2 rw rootwait earlycon clk_ignore_unused +if test -n "@@BITSTREAM@@"; then + fatload mmc $sdbootdev @@BITSTREAM_LOAD_ADDRESS@@ @@BITSTREAM_IMAGE@@ && fpga @@BITSTREAM_LOAD_TYPE@@ 0 @@BITSTREAM_LOAD_ADDRESS@@ ${filesize} +fi +fatload mmc $sdbootdev @@DEVICETREE_ADDRESS@@ @@DEVICE_TREE_NAME@@ +fatload mmc $sdbootdev:$partid @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@ +@@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.ubifs b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.ubifs new file mode 100644 index 00000000..dca974ab --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.ubifs @@ -0,0 +1,67 @@ +# This is a boot script for U-Boot +# Generate boot.scr: +# mkimage -c none -A arm -T script -d boot.cmd.default boot.scr +# +################ +@@PRE_BOOTENV@@ + +for boot_target in ${boot_targets}; +do + if test "${boot_target}" = "xspi0" || test "${boot_target}" = "qspi" || test "${boot_target}" = "qspi0"; then + ubifsls @@FIT_IMAGE@@ + if test $? = 0; then + ubifsload @@FIT_IMAGE_LOAD_ADDRESS@@ @@FIT_IMAGE@@; + bootm @@FIT_IMAGE_LOAD_ADDRESS@@; + fi + ubifsls @@KERNEL_IMAGE@@ + if test $? = 0; then + ubifsload @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGE@@; + fi + ubifsls system.dtb + if test $? = 0; then + ubifsload @@DEVICETREE_ADDRESS@@ system.dtb + fi + ubifsls devicetree/openamp.dtbo + if test $? = 0; then + ubifsload @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt resize 8192 + fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ + fi + ubifsls @@RAMDISK_IMAGE@@ + if test $? = 0; then + ubifsload @@RAMDISK_IMAGE_ADDRESS@@ @@RAMDISK_IMAGE@@ + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ + exit; + fi + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ + exit; + fi + if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" ; then + run bootcmd_${boot_target}; + if test -e ${devtype} ${devnum}:${distro_bootpart} /@@FIT_IMAGE@@; then + ext4load ${devtype} ${devnum}:${distro_bootpart} @@FIT_IMAGE_LOAD_ADDRESS@@ @@FIT_IMAGE@@; + bootm @@FIT_IMAGE_LOAD_ADDRESS@@; + exit; + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /@@KERNEL_IMAGE@@; then + ext4load ${devtype} ${devnum}:${distro_bootpart} @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGE@@; + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then + ext4load ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_ADDRESS@@ system.dtb; + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /devicetree/openamp.dtbo; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt resize 8192 + fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ + fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /@@RAMDISK_IMAGE@@; then + ext4load ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ @@RAMDISK_IMAGE@@; + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ + exit; + fi + @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@ + exit; + fi +done diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/pxeboot.pxe b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/pxeboot.pxe new file mode 100644 index 00000000..40796545 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/pxeboot.pxe @@ -0,0 +1,4 @@ +LABEL Linux +KERNEL @@KERNEL_IMAGETYPE@@ +FDT @@DEVICE_TREE_NAME@@ +INITRD @@RAMDISK_IMAGE@@ diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-uenv.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-uenv.bb new file mode 100644 index 00000000..228396eb --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-uenv.bb @@ -0,0 +1,111 @@ +SUMMARY = "U-Boot uEnv.txt SD boot environment generation for Zynq targets" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +INHIBIT_DEFAULT_DEPS = "1" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynq = ".*" +COMPATIBLE_MACHINE:zynqmp = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit deploy image-wic-utils + +def remove_task_from_depends(d): + extra_imagedepends = d.getVar('EXTRA_IMAGEDEPENDS') or '' + uenv_depends = '' + for imagedepend in extra_imagedepends.split(): + if imagedepend == d.getVar("BPN"): + continue + elif ':' in imagedepend: + uenv_depends += ' %s' % imagedepend.split(':')[0] + else: + uenv_depends += ' %s' % imagedepend + return uenv_depends + +def uboot_boot_cmd(d): + if d.getVar("KERNEL_IMAGETYPE") in ["uImage", "fitImage"]: + return "bootm" + if d.getVar("KERNEL_IMAGETYPE") in ["zImage"]: + return "bootz" + if d.getVar("KERNEL_IMAGETYPE") in ["Image"]: + return "booti" + raise bb.parse.SkipRecipe("Unsupport kernel image type") + +def get_sdbootdev(d): + if d.getVar("SOC_FAMILY") in ["zynqmp"]: + return "${devnum}" + else: + return "0" + +def uenv_populate(d): + # populate the environment values + env = {} + + env["machine_name"] = d.getVar("MACHINE") + + env["kernel_image"] = d.getVar("KERNEL_IMAGETYPE") + env["kernel_load_address"] = d.getVar("KERNEL_LOAD_ADDRESS") + + env["devicetree_image"] = boot_files_dtb_filepath(d) + env["devicetree_load_address"] = d.getVar("DEVICETREE_LOAD_ADDRESS") + env["devicetree_overlay_load_address" ] = d.getVar("DEVICETREE_OVERLAY_LOAD_ADDRESS") + + env["bootargs"] = d.getVar("KERNEL_BOOTARGS") + + env["loadkernel"] = "fatload mmc " + get_sdbootdev(d) + " ${kernel_load_address} ${kernel_image}" + env["loaddtb"] = "fatload mmc " + get_sdbootdev(d) + " ${devicetree_load_address} ${devicetree_image}" + env["loaddtbo"] = "if test -e mmc " + get_sdbootdev(d) + " /devicetree/openamp.dtbo; then fatload mmc " + get_sdbootdev(d) + " ${devicetree_overlay_load_address} /devicetree/openamp.dtbo ; fdt addr ${devicetree_load_address} ; fdt resize 8192 ; fdt apply ${devicetree_overlay_load_address} ; fi" + env["bootkernel"] = "run loadkernel && run loaddtb && run loaddtbo && " + uboot_boot_cmd(d) + " ${kernel_load_address} - ${devicetree_load_address}" + + if d.getVar("SOC_FAMILY") in ["zynqmp"]: + env["bootkernel"] = "setenv bootargs " + d.getVar("KERNEL_BOOTARGS") + " ; " + env["bootkernel"] + + # default uenvcmd does not load bitstream + env["uenvcmd"] = "run bootkernel" + + bitstream, bitstreamtype = boot_files_bitstream(d) + if bitstream: + env["bitstream_image"] = bitstream + env["bitstream_load_address"] = "0x100000" + + # if bitstream is "bit" format use loadb, otherwise use load + env["bitstream_type"] = "loadb" if bitstreamtype else "load" + + # load bitstream first with loadfpa + env["loadfpga"] = "fatload mmc " + get_sdbootdev(d) + " ${bitstream_load_address} ${bitstream_image} && fpga ${bitstream_type} 0 ${bitstream_load_address} ${filesize}" + env["uenvcmd"] = "run loadfpga && run bootkernel" + + return env + +DEPENDS:append := " virtual/kernel ${@remove_task_from_depends(d)}" + +# bootargs, default to booting with the rootfs device being partition 2 +KERNEL_BOOTARGS:zynq = "earlyprintk console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait" +KERNEL_BOOTARGS:zynqmp = "earlycon clk_ignore_unused root=/dev/mmcblk${devnum}p2 rw rootwait" + +KERNEL_LOAD_ADDRESS:zynq = "0x2080000" +KERNEL_LOAD_ADDRESS:zynqmp = "0x200000" +DEVICETREE_LOAD_ADDRESS:zynq = "0x2000000" +DEVICETREE_LOAD_ADDRESS:zynqmp = "0x4000000" +DEVICETREE_OVERLAY_LOAD_ADDRESS = "${@hex(int(d.getVar("DEVICETREE_LOAD_ADDRESS"),16) + 0xf00000)}" + +python do_compile() { + env = uenv_populate(d) + with open(d.expand("${WORKDIR}/uEnv.txt"), "w") as f: + for k, v in env.items(): + f.write("{0}={1}\n".format(k, v)) +} + +FILES:${PN} += "/boot/uEnv.txt" + +do_install() { + install -Dm 0644 ${WORKDIR}/uEnv.txt ${D}/boot/uEnv.txt +} + +do_deploy() { + install -Dm 0644 ${WORKDIR}/uEnv.txt ${DEPLOYDIR}/uEnv.txt +} +addtask do_deploy after do_compile before do_build + diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx.inc b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx.inc new file mode 100644 index 00000000..4c7ea934 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx.inc @@ -0,0 +1,83 @@ +require recipes-bsp/u-boot/u-boot-common.inc +require recipes-bsp/u-boot/u-boot.inc + +DEPENDS += "bc-native dtc-native python3-setuptools-native bison-native xxd-native" + +require u-boot-xlnx-common.inc + +SYSROOT_DIRS += "/boot" + +BASE_DTS ?= "${@os.path.basename(d.getVar('CONFIG_DTFILE') or '').rstrip('.dtb').rstrip('.dts') or 'system-top'}" +DTB_PATH ?= "boot/devicetree/" +DTB_FILE_NAME ?= "" + +# This vairable is used for U-boot user specified dts from u-boot repo path +# u-boot-xlnx/arch/arm/dts/versal-vck190-revA-x-ebm-01-revA.dts. +# Note: .dts extension is not required for this variable settings. +# Example: UBOOT_USER_SPECIFIED_DTS = "versal-vck190-revA-x-ebm-01-revA" +UBOOT_USER_SPECIFIED_DTS ?= "" + +EXTRA_OEMAKE += "${@'EXT_DTB=${RECIPE_SYSROOT}/${DTB_PATH}/${DTB_FILE_NAME}' if (d.getVar('DTB_FILE_NAME') != '' and d.getVar('UBOOT_USER_SPECIFIED_DTS') == '') else '' }" +EXTRA_OEMAKE += "${@'DEVICE_TREE=${UBOOT_USER_SPECIFIED_DTS}' if (d.getVar('UBOOT_USER_SPECIFIED_DTS') != '') else '' }" + +python __anonymous () { + #check if there are any dtb providers + providerdtb = d.getVar("PREFERRED_PROVIDER_virtual/dtb") + if providerdtb: + d.appendVarFlag('do_configure', 'depends', ' virtual/dtb:do_populate_sysroot') + if d.getVar("DTB_FILE_NAME") is not None: + d.setVar('DTB_FILE_NAME', d.getVar('BASE_DTS')+ '.dtb') +} + +do_configure:prepend () { + if [ -n "${UBOOT_USER_SPECIFIED_DTS}" && ! -f ${S}/arch/arm/dts/${UBOOT_USER_SPECIFIED_DTS}.dts ]; then + bbfatal "Uboot user specified dts (${UBOOT_USER_SPECIFIED_DTS}.dts) is not found in \ +the${S}/arch/arm/dts directory, you need to patch dts file to u-boot source and use this configuration. \ +For more details refer https://u-boot.readthedocs.io/en/latest/develop/devicetree/control.html#configuration " + fi +} + +# Split u-boot into .bin and .elf packages +# If the user just installs u-boot they get both +PACKAGES =+ "${PN}-bin ${PN}-elf" +RDEPENDS:${PN} = "${PN}-bin ${PN}-elf" +ALLOW_EMPTY:${PN} = "1" + +SUMMARY:${PN}-bin = "${SUMMARY} - files in .bin format" +FILES:${PN}-bin = "/boot/u-boot*.bin" + +SUMMARY:${PN}-elf = "${SUMMARY} - files in .elf format" +FILES:${PN}-elf = "/boot/u-boot*.elf" + +require u-boot-xlnx-blob.inc + +UBOOTELF_NODTB_IMAGE ?= "u-boot-nodtb.elf" +UBOOTELF_NODTB_BINARY ?= "u-boot" +do_deploy:prepend() { + cd ${B} + + if [ -f "${UBOOTELF_NODTB_BINARY}" ]; then + install ${UBOOTELF_NODTB_BINARY} ${DEPLOYDIR}/${UBOOTELF_NODTB_IMAGE} + fi + + #following lines are from uboot-sign.bbclass, vars are defined there + if [ -e "${UBOOT_DTB_BINARY}" ]; then + if [ "${UBOOT_SIGN_ENABLE}" = "0" ]; then + install ${UBOOT_DTB_BINARY} ${DEPLOYDIR}/${UBOOT_DTB_IMAGE} + fi + ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY} + ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK} + fi + if [ -f "${UBOOT_NODTB_BINARY}" ]; then + install ${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE} + ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_SYMLINK} + ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_BINARY} + fi + + # In ZynqMP u-boot.dtb is generated by default but not for versal, Hence manually deploy. + if [ "${SOC_FAMILY}" == "versal" ]; then + if [ -f ${B}/arch/arm/dts/${UBOOT_USER_SPECIFIED_DTS}.dtb ]; then + install -Dm 0644 ${B}/arch/arm/dts/${UBOOT_USER_SPECIFIED_DTS}.dtb ${DEPLOYDIR}/u-boot.dtb + fi + fi +} diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2022.1.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2022.1.bb new file mode 100644 index 00000000..c1c45e56 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2022.1.bb @@ -0,0 +1,4 @@ + +require u-boot-xlnx.inc +require u-boot-spl-zynq-init.inc +require u-boot-xlnx-2022.1.inc diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2022.2.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2022.2.bb new file mode 100644 index 00000000..b10f321b --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2022.2.bb @@ -0,0 +1,4 @@ + +require u-boot-xlnx.inc +require u-boot-spl-zynq-init.inc +require u-boot-xlnx-2022.2.inc diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2023.1.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2023.1.bb new file mode 100644 index 00000000..fd76bc51 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2023.1.bb @@ -0,0 +1,4 @@ + +require u-boot-xlnx.inc +require u-boot-spl-zynq-init.inc +require u-boot-xlnx-2023.1.inc diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2023.2.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2023.2.bb new file mode 100644 index 00000000..22075424 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx_2023.2.bb @@ -0,0 +1,4 @@ + +require u-boot-xlnx.inc +require u-boot-spl-zynq-init.inc +require u-boot-xlnx-2023.2.inc diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot_%.bbappend b/meta-xilinx-core/recipes-bsp/u-boot/u-boot_%.bbappend new file mode 100644 index 00000000..56083ce3 --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot_%.bbappend @@ -0,0 +1,2 @@ +include u-boot-spl-zynq-init.inc + diff --git a/meta-xilinx-core/recipes-connectivity/iproute2/iproute2.inc b/meta-xilinx-core/recipes-connectivity/iproute2/iproute2.inc new file mode 100644 index 00000000..b1bcc143 --- /dev/null +++ b/meta-xilinx-core/recipes-connectivity/iproute2/iproute2.inc @@ -0,0 +1,91 @@ +SUMMARY = "TCP / IP networking and traffic control utilities" +DESCRIPTION = "Iproute2 is a collection of utilities for controlling \ +TCP / IP networking and traffic control in Linux. Of the utilities ip \ +and tc are the most important. ip controls IPv4 and IPv6 \ +configuration and tc stands for traffic control." +HOMEPAGE = "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2" +SECTION = "base" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \ + file://ip/ip.c;beginline=3;endline=8;md5=689d691d0410a4b64d3899f8d6e31817" + +DEPENDS = "flex-native bison-native iptables libcap" + +inherit update-alternatives bash-completion pkgconfig + +CLEANBROKEN = "1" + +PACKAGECONFIG ??= "tipc elf devlink" +PACKAGECONFIG[tipc] = ",,libmnl," +PACKAGECONFIG[elf] = ",,elfutils," +PACKAGECONFIG[devlink] = ",,libmnl," +PACKAGECONFIG[rdma] = ",,libmnl," + +IPROUTE2_MAKE_SUBDIRS = "lib tc ip bridge misc genl ${@bb.utils.filter('PACKAGECONFIG', 'devlink tipc rdma', d)}" + +EXTRA_OEMAKE = "\ + CC='${CC}' \ + KERNEL_INCLUDE=${STAGING_INCDIR} \ + DOCDIR=${docdir}/iproute2 \ + SUBDIRS='${IPROUTE2_MAKE_SUBDIRS}' \ + SBINDIR='${base_sbindir}' \ + LIBDIR='${libdir}' \ +" + +do_configure:append () { + sh configure ${STAGING_INCDIR} + # Explicitly disable ATM support + sed -i -e '/TC_CONFIG_ATM/d' config.mk +} + +do_install () { + oe_runmake DESTDIR=${D} install + mv ${D}${base_sbindir}/ip ${D}${base_sbindir}/ip.iproute2 + install -d ${D}${datadir} + mv ${D}/share/* ${D}${datadir}/ || true + rm ${D}/share -rf || true +} + +# The .so files in iproute2-tc are modules, not traditional libraries +INSANE_SKIP:${PN}-tc = "dev-so" + +IPROUTE2_PACKAGES =+ "\ + ${PN}-devlink \ + ${PN}-genl \ + ${PN}-ifstat \ + ${PN}-ip \ + ${PN}-lnstat \ + ${PN}-nstat \ + ${PN}-rtacct \ + ${PN}-ss \ + ${PN}-tc \ + ${PN}-tipc \ + ${PN}-rdma \ +" + +PACKAGE_BEFORE_PN = "${IPROUTE2_PACKAGES}" +RDEPENDS:${PN} += "${PN}-ip" + +FILES:${PN}-tc = "${base_sbindir}/tc* \ + ${libdir}/tc/*.so" +FILES:${PN}-lnstat = "${base_sbindir}/lnstat \ + ${base_sbindir}/ctstat \ + ${base_sbindir}/rtstat" +FILES:${PN}-ifstat = "${base_sbindir}/ifstat" +FILES:${PN}-ip = "${base_sbindir}/ip.${PN} ${sysconfdir}/iproute2" +FILES:${PN}-genl = "${base_sbindir}/genl" +FILES:${PN}-rtacct = "${base_sbindir}/rtacct" +FILES:${PN}-nstat = "${base_sbindir}/nstat" +FILES:${PN}-ss = "${base_sbindir}/ss" +FILES:${PN}-tipc = "${base_sbindir}/tipc" +FILES:${PN}-devlink = "${base_sbindir}/devlink" +FILES:${PN}-rdma = "${base_sbindir}/rdma" + +ALTERNATIVE:${PN}-ip = "ip" +ALTERNATIVE_TARGET[ip] = "${base_sbindir}/ip.${BPN}" +ALTERNATIVE_LINK_NAME[ip] = "${base_sbindir}/ip" +ALTERNATIVE_PRIORITY = "100" + +ALTERNATIVE:${PN}-tc = "tc" +ALTERNATIVE_LINK_NAME[tc] = "${base_sbindir}/tc" +ALTERNATIVE_PRIORITY_${PN}-tc = "100" diff --git a/meta-xilinx-core/recipes-connectivity/iproute2/iproute2/0001-libc-compat.h-add-musl-workaround.patch b/meta-xilinx-core/recipes-connectivity/iproute2/iproute2/0001-libc-compat.h-add-musl-workaround.patch new file mode 100644 index 00000000..74e3de1c --- /dev/null +++ b/meta-xilinx-core/recipes-connectivity/iproute2/iproute2/0001-libc-compat.h-add-musl-workaround.patch @@ -0,0 +1,39 @@ +From c25f8d1f7a6203dfeb10b39f80ffd314bb84a58d Mon Sep 17 00:00:00 2001 +From: Baruch Siach <baruch@tkos.co.il> +Date: Thu, 22 Dec 2016 15:26:30 +0200 +Subject: [PATCH] libc-compat.h: add musl workaround + +The libc-compat.h kernel header uses glibc specific macros (__GLIBC__ and +__USE_MISC) to solve conflicts with libc provided headers. This patch makes +libc-compat.h work for musl libc as well. + +Upstream-Status: Pending + +Taken From: +https://git.buildroot.net/buildroot/tree/package/iproute2/0001-Add-the-musl-workaround-to-the-libc-compat.h-copy.patch + +Signed-off-by: Baruch Siach <baruch@tkos.co.il> +Signed-off-by: Maxin B. John <maxin.john@intel.com> + +--- + include/uapi/linux/libc-compat.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h +index a159991..22198fa 100644 +--- a/include/uapi/linux/libc-compat.h ++++ b/include/uapi/linux/libc-compat.h +@@ -50,10 +50,12 @@ + #define _LIBC_COMPAT_H + + /* We have included glibc headers... */ +-#if defined(__GLIBC__) ++#if 1 ++#define __USE_MISC + + /* Coordinate with glibc net/if.h header. */ + #if defined(_NET_IF_H) && defined(__USE_MISC) ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0 + + /* GLIBC headers included first so don't define anything + * that would already be defined. */ diff --git a/meta-xilinx-core/recipes-connectivity/iproute2/iproute2_5.15.0.bb b/meta-xilinx-core/recipes-connectivity/iproute2/iproute2_5.15.0.bb new file mode 100644 index 00000000..99a74339 --- /dev/null +++ b/meta-xilinx-core/recipes-connectivity/iproute2/iproute2_5.15.0.bb @@ -0,0 +1,11 @@ +require iproute2.inc + +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/net/${BPN}/${BP}.tar.xz \ + file://0001-libc-compat.h-add-musl-workaround.patch \ + " + +SRC_URI[sha256sum] = "38e3e4a5f9a7f5575c015027a10df097c149111eeb739993128e5b2b35b291ff" + +# CFLAGS are computed in Makefile and reference CCOPTS +# +EXTRA_OEMAKE:append = " CCOPTS='${CFLAGS}'" diff --git a/meta-xilinx-core/recipes-core/glibc/glibc-locale_%.bbappend b/meta-xilinx-core/recipes-core/glibc/glibc-locale_%.bbappend new file mode 100644 index 00000000..1702b75d --- /dev/null +++ b/meta-xilinx-core/recipes-core/glibc/glibc-locale_%.bbappend @@ -0,0 +1,4 @@ +do_install:append() { + # Remove the libdir if it is empty when gconv is not copied + find ${D}${libdir} -type d -empty -delete +} diff --git a/meta-xilinx-core/recipes-core/images/core-image-ptest-all.bbappend b/meta-xilinx-core/recipes-core/images/core-image-ptest-all.bbappend new file mode 100644 index 00000000..fd3a3c11 --- /dev/null +++ b/meta-xilinx-core/recipes-core/images/core-image-ptest-all.bbappend @@ -0,0 +1,5 @@ +# Minimum board memory required for each type +QB_MEM:microblaze = "-m 2G" +QB_MEM:zynq = "-m 1G" +QB_MEM:zynqmp = "-m 4G" +QB_MEM:versal = "-m 16G" diff --git a/meta-xilinx-core/recipes-core/images/core-image-ptest-all.bbppend b/meta-xilinx-core/recipes-core/images/core-image-ptest-all.bbppend new file mode 100644 index 00000000..fd3a3c11 --- /dev/null +++ b/meta-xilinx-core/recipes-core/images/core-image-ptest-all.bbppend @@ -0,0 +1,5 @@ +# Minimum board memory required for each type +QB_MEM:microblaze = "-m 2G" +QB_MEM:zynq = "-m 1G" +QB_MEM:zynqmp = "-m 4G" +QB_MEM:versal = "-m 16G" diff --git a/meta-xilinx-core/recipes-core/images/core-image-ptest-fast.bbappend b/meta-xilinx-core/recipes-core/images/core-image-ptest-fast.bbappend new file mode 100644 index 00000000..e748c9e4 --- /dev/null +++ b/meta-xilinx-core/recipes-core/images/core-image-ptest-fast.bbappend @@ -0,0 +1,15 @@ +# Minimum board memory required for each type +QB_MEM:microblaze = "-m 2G" +QB_MEM:zynq = "-m 1G" +QB_MEM:zynqmp = "-m 4G" +QB_MEM:versal = "-m 16G" + +# Zynq can't build qemu-xilinx or it's ptests +PTESTS_FAST:remove:zynq = "qemu-ptest" +PTESTS_PROBLEMS:append:zynq = " qemu-ptest" + +# Microblaze has some limitations +# graphics is the primary one, bluez5 requires graphics support by default +PTESTS_FAST:remove:microblaze = "pango-ptest wayland-ptest qemu-ptest bluez5-ptest python3-bcrypt qemu" +PTESTS_PROBLEMS:append:microblaze = " pango-ptest wayland-ptest qemu-ptest bluez5-ptest python3-bcrypt qemu" + diff --git a/meta-xilinx-core/recipes-core/images/core-image-ptest.bbappend b/meta-xilinx-core/recipes-core/images/core-image-ptest.bbappend new file mode 100644 index 00000000..fd3a3c11 --- /dev/null +++ b/meta-xilinx-core/recipes-core/images/core-image-ptest.bbappend @@ -0,0 +1,5 @@ +# Minimum board memory required for each type +QB_MEM:microblaze = "-m 2G" +QB_MEM:zynq = "-m 1G" +QB_MEM:zynqmp = "-m 4G" +QB_MEM:versal = "-m 16G" diff --git a/meta-xilinx-core/recipes-devtools/python/python3-anytree_2.8.0.bb b/meta-xilinx-core/recipes-devtools/python/python3-anytree_2.8.0.bb new file mode 100644 index 00000000..8bd6e6bc --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/python/python3-anytree_2.8.0.bb @@ -0,0 +1,22 @@ +SUMMARY = "Powerful and Lightweight Python Tree Data Structure" + +HOMEPAGE = "https://github.com/c0fec0de/anytree" +LICENSE = "Apache-2.0" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" + +DEPENDS += "python3-six" + +SRC_URI = "git://github.com/c0fec0de/anytree.git;branch=2.x.x;protocol=https" +SRCREV = "75c0198636f8997967ba00df5077cd21350f68ce" + +S = "${WORKDIR}/git" + +inherit setuptools3 + +do_install:append() { + rm -f ${D}/${datadir}/LICENSE ${D}/${prefix}/LICENSE + rmdir ${D}/${datadir} || : +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/qemu/files/flash_stripe.c b/meta-xilinx-core/recipes-devtools/qemu/files/flash_stripe.c new file mode 100644 index 00000000..a9a6e76a --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/files/flash_stripe.c @@ -0,0 +1,176 @@ +/* + * Stripe a flash image across multiple files. + * + * Copyright (C) 2019 Xilinx, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> + +/* N way (num) in place bit striper. Lay out row wise bits column wise + * (from element 0 to N-1). num is the length of x, and dir reverses the + * direction of the transform. be determines the bit endianess scheme. + * false to lay out bits LSB to MSB (little endian) and true for big endian. + * + * Best illustrated by examples: + * Each digit in the below array is a single bit (num == 3, be == false): + * + * {{ 76543210, } ----- stripe (dir == false) -----> {{ FCheb630, } + * { hgfedcba, } { GDAfc741, } + * { HGFEDCBA, }} <---- upstripe (dir == true) ----- { HEBgda52, }} + * + * Same but with be == true: + * + * {{ 76543210, } ----- stripe (dir == false) -----> {{ 741gdaFC, } + * { hgfedcba, } { 630fcHEB, } + * { HGFEDCBA, }} <---- upstripe (dir == true) ----- { 52hebGDA, }} + */ + +static inline void stripe8(uint8_t *x, int num, bool dir, bool be) +{ + uint8_t r[num]; + memset(r, 0, sizeof(uint8_t) * num); + int idx[2] = {0, 0}; + int bit[2] = {0, be ? 7 : 0}; + int d = dir; + + for (idx[0] = 0; idx[0] < num; ++idx[0]) { + for (bit[0] = be ? 7 : 0; bit[0] != (be ? -1 : 8); bit[0] += be ? -1 : 1) { + r[idx[!d]] |= x[idx[d]] & 1 << bit[d] ? 1 << bit[!d] : 0; + idx[1] = (idx[1] + 1) % num; + if (!idx[1]) { + bit[1] += be ? -1 : 1; + } + } + } + memcpy(x, r, sizeof(uint8_t) * num); +} + +int main (int argc, char *argv []) { +#ifdef UNSTRIPE + bool unstripe = true; +#else + bool unstripe = false; +#endif + +#ifdef FLASH_STRIPE_BE + bool be = true; +#else + bool be = false; +#endif + + int i; + + const char *exe_name = argv[0]; + argc--; + argv++; + + if (argc < 2) { + fprintf(stderr, "ERROR: %s requires at least two args\n", exe_name); + return 1; + } + + const char *single_f = argv[0]; + int single; + + if (unstripe) { + single = creat(single_f, 0644); + } else { + single = open(single_f, 0); + } + if (single == -1) { + perror(argv[0]); + return 1; + } + + argv++; + argc--; + + int multiple[argc]; + + for (i = 0; i < argc; ++i) { + if (unstripe) { + multiple[i] = open(argv[i], 0); + } else { + multiple[i] = creat(argv[i], 0644); + } + if (multiple[i] == -1) { + perror(argv[i]); + return 1; + } + } + + while (true) { + uint8_t buf[argc]; + for (i = 0; i < argc; ++i) { + switch (read(!unstripe ? single : multiple[ +#if defined(FLASH_STRIPE_BW) && defined (FLASH_STRIPE_BE) + argc - 1 - +#endif + i], &buf[i], 1)) { + case 0: + if (i == 0) { + goto done; + } else if (!unstripe) { + fprintf(stderr, "WARNING:input file %s is not multiple of " + "%d bytes, padding with garbage byte\n", single_f, + argc); + } + break; + case -1: + perror(unstripe ? argv[i] : single_f); + return 1; + } + } + +#ifndef FLASH_STRIPE_BW + stripe8(buf, argc, unstripe, be); +#endif + + for (i = 0; i < argc; ++i) { + switch (write(unstripe ? single : multiple[ +#if defined(FLASH_STRIPE_BW) && defined (FLASH_STRIPE_BE) + argc - 1 - +#endif + i], &buf[i], 1)) { + case -1: + perror(unstripe ? single_f : argv[i]); + return 1; + case 0: + i--; /* try again */ + } + } + } + +done: + close(single); + for (i = 0; i < argc; ++i) { + close(multiple[argc]); + } + return 0; +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch b/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch new file mode 100644 index 00000000..370e694b --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 + +# Xilinx QEMU wrapper to launch both PMU and APU instances (multiarch) +import os +import subprocess +import sys +import tempfile +import shutil + +binpath = os.path.dirname(os.path.abspath(__file__)) +mach_path = tempfile.mkdtemp() + + +# Separate PMU and APU arguments +APU_args = sys.argv[1:] +mbtype='' + +if '-pmu-args' in APU_args: + MB_args = APU_args[APU_args.index('-pmu-args')+1] + APU_args.remove('-pmu-args') + APU_args.remove(MB_args) + MB_args = MB_args.split() + PMU_rom = MB_args[MB_args.index('-kernel')+1] + mbtype='PMU' +elif '-plm-args' in APU_args: + MB_args = APU_args[APU_args.index('-plm-args')+1] + APU_args.remove('-plm-args') + APU_args.remove(MB_args) + MB_args = MB_args.split() + mbtype='PLM' +elif '--help' in APU_args: + mbtype='help' +else: + error_msg = '\nMultiarch not setup properly.' + sys.exit(error_msg) + +error_msg = None +if (mbtype == 'PMU' and os.path.exists(PMU_rom)) or mbtype == 'PLM': + + # We need to switch tcp serial arguments (if they exist, e.g. qemurunner) to get the output correctly + tcp_serial_ports = [i for i, s in enumerate(APU_args) if 'tcp:127.0.0.1:' in s] + + #NEED TO FIX for next yocto release (dont need to switch ports anymore, they will be provided correctly upstream + # We can only switch these if there are exactly two, otherwise we can't assume what is being executed so we leave it as is + if len(tcp_serial_ports) == 2: + APU_args[tcp_serial_ports[0]],APU_args[tcp_serial_ports[1]] = APU_args[tcp_serial_ports[1]],APU_args[tcp_serial_ports[0]] + + mb_cmd = binpath + '/qemu-system-microblazeel ' + ' '.join(MB_args) + ' -machine-path ' + mach_path + apu_cmd = binpath + '/qemu-system-aarch64 ' + ' '.join(APU_args) + ' -machine-path ' + mach_path + + # Debug prints + print('\n%s instance cmd: %s\n' % (mbtype, mb_cmd)) + print('APU instance cmd: %s\n' % apu_cmd) + + + # Invoke QEMU pmu instance + process_pmu = subprocess.Popen(mb_cmd, shell=True, stderr=subprocess.PIPE) + + # Invoke QEMU APU instance + process_apu = subprocess.Popen(apu_cmd, shell=True, stderr=subprocess.PIPE) + if process_apu.wait(): + error_msg = '\nQEMU APU instance failed:\n%s' % process_apu.stderr.read().decode() + +else: + if mbtype == 'PMU': + error_msg = '\nError: Missing PMU ROM: %s' % PMU_rom + error_msg += '\nSee "meta-xilinx/README.qemu.md" for more information on accquiring the PMU ROM.\n' + +shutil.rmtree(mach_path) +sys.exit(error_msg) diff --git a/meta-xilinx-core/recipes-devtools/qemu/flashstrip_1.0.bb b/meta-xilinx-core/recipes-devtools/qemu/flashstrip_1.0.bb new file mode 100644 index 00000000..e1dcc5ae --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/flashstrip_1.0.bb @@ -0,0 +1,27 @@ +SUMMARY = "Building and installing flash strip utility" +DESCRIPTION = "Building and installing flash strip utility" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://../flash_stripe.c;beginline=1;endline=23;md5=abb859d98b7c4eede655e1b71824125a" + +B = "${WORKDIR}/build" + +SRC_URI += "file://flash_stripe.c" + +TARGET_CC_ARCH += "${LDFLAGS}" + +do_compile() { + ${CC} ${WORKDIR}/flash_stripe.c -o flash_strip + ${CC} ${WORKDIR}/flash_stripe.c -o flash_unstrip + ${CC} ${WORKDIR}/flash_stripe.c -o flash_strip_bw -DFLASH_STRIPE_BW + ${CC} ${WORKDIR}/flash_stripe.c -o flash_unstrip_bw -DUNSTRIP -DFLASH_STRIPE_BW +} + +do_install() { + install -d ${D}${bindir} + install -Dm 0755 ${B}/* ${D}${bindir}/ +} + +FILES:${PN} = "${bindir}/*" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-alt.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-alt.inc new file mode 100644 index 00000000..c18a5326 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-alt.inc @@ -0,0 +1,53 @@ +PROVIDES += "qemu" + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for qemu-syste-native. This avoids network access required by +# the use of AUTOREV SRCREVs, which may be the default for some recipes. +python () { + if bb.data.inherits_class('nativesdk', d): + if (not d.getVar("PREFERRED_PROVIDER_nativesdk-qemu") and "nativesdk-qemu" != d.getVar("PN")) or \ + (d.getVar("PREFERRED_PROVIDER_nativesdk-qemu") and d.getVar("PREFERRED_PROVIDER_nativesdk-qemu") != d.getVar("PN")): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_nativesdk-qemu to %s to enable it" % (d.getVar("PN"))) + elif (not d.getVar("PREFERRED_PROVIDER_qemu") and "qemu" != d.getVar("PN")) or \ + (d.getVar("PREFERRED_PROVIDER_qemu") and d.getVar("PREFERRED_PROVIDER_qemu") != d.getVar("PN")): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_qemu to %s to enable it" % (d.getVar("PN"))) + + if (d.getVar('BPN') != 'qemu'): + for pkg in d.getVar('PACKAGES').split(): + d.appendVar('RPROVIDES:%s' % pkg, ' ' + pkg.replace(d.getVar('PN'), 'qemu')) + + for pkg in d.getVar('PACKAGES_DYNAMIC').split(): + d.appendVar('PACKAGES_DYNAMIC', ' ' + pkg.replace(d.getVar('PN'), 'qemu')) +} + +# From Poky qemu.inc +# Modified to add compatibility RPROVIDES +python split_qemu_packages () { + archdir = d.expand('${bindir}/') + syspackages = do_split_packages(d, archdir, r'^qemu-system-(.*)$', '${PN}-system-%s', 'QEMU full system emulation binaries(%s)' , prepend=True) + if syspackages: + d.setVar('RDEPENDS:' + d.getVar('PN') + '-system-all', ' '.join(syspackages)) + + if (d.getVar('BPN') != 'qemu'): + for pkg in syspackages: + d.appendVar('RPROVIDES:%s' % pkg, ' ' + pkg.replace(d.getVar('PN'), 'qemu')) + + userpackages = do_split_packages(d, archdir, r'^qemu-((?!system|edid|ga|img|io|nbd|pr-helper|storage-daemon).*)$', '${PN}-user-%s', 'QEMU full user emulation binaries(%s)' , prepend=True) + if userpackages: + d.setVar('RDEPENDS:' + d.getVar('PN') + '-user-all', ' '.join(userpackages)) + + if (d.getVar('BPN') != 'qemu'): + for pkg in userpackages: + d.appendVar('RPROVIDES:%s' % pkg, ' ' + pkg.replace(d.getVar('PN'), 'qemu')) + + mipspackage = d.getVar('PN') + "-user-mips" + if mipspackage in ' '.join(userpackages): + d.appendVar('RDEPENDS:' + mipspackage, ' ' + d.getVar("MLPREFIX") + 'bash') + + if (d.getVar('BPN') != 'qemu'): + for pkg in mipspackage: + d.appendVar('RPROVIDES:%s' % pkg, ' ' + pkg.replace(d.getVar('PN'), 'qemu')) +} + diff --git a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-devicetrees.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees.inc index d4044ed7..b08b414f 100644 --- a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-devicetrees.inc +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees.inc @@ -1,15 +1,14 @@ SUMMARY = "Xilinx's hardware device trees required for QEMU" HOMEPAGE = "https://github.com/xilinx/qemu-devicetrees/" -LICENSE = "BSD" +LICENSE = "BSD-3-Clause" DEPENDS += "dtc-native" inherit deploy LIC_FILES_CHKSUM = "file://Makefile;beginline=1;endline=27;md5=7348b6cbcae69912cb1dee68d6c68d99" -PV = "xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}" +PV = "xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" -BRANCH ?= "" REPO ?= "git://github.com/Xilinx/qemu-devicetrees.git;protocol=https" BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees/0001-Makefile-Use-python3-instead-of-python.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees/0001-Makefile-Use-python3-instead-of-python.patch new file mode 100644 index 00000000..425145d0 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees/0001-Makefile-Use-python3-instead-of-python.patch @@ -0,0 +1,37 @@ +From e80324e3497e5768c9fdbde3c0660a03d0dcc3ee Mon Sep 17 00:00:00 2001 +From: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> +Date: Mon, 8 Feb 2021 16:32:34 -0800 +Subject: [PATCH] Makefile:Use python3 instead of python + +Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> +--- + Makefile | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/Makefile b/Makefile +index a110483..fd8868c 100644 +--- a/Makefile ++++ b/Makefile +@@ -91,13 +91,13 @@ $(LQSPI_XIP_OUTDIR)/%.dts: %.dts $(DTSI_FILES) $(HEADER_FILES) + # TODO: Add support for auto-generated dependency list + versal-pmc-npi.dtsi: versal-pmc-npi-nxx.dtsi versal-h10-pmc-npi-nxx.dtsi + versal-pmc-npi-nxx.dtsi: Makefile +- @python -c 'for a in range(0, 54): print("\tGEN_NMU(" + str(a) + ")")' > $@ +- @python -c 'for a in range(0, 50): print("\tGEN_NSU(" + str(a) + ")")' >> $@ +- @python -c 'for a in range(0, 146): print("\tGEN_NPS(" + str(a) + ")")' >> $@ ++ @python3 -c 'for a in range(0, 54): print("\tGEN_NMU(" + str(a) + ")")' > $@ ++ @python3 -c 'for a in range(0, 50): print("\tGEN_NSU(" + str(a) + ")")' >> $@ ++ @python3 -c 'for a in range(0, 146): print("\tGEN_NPS(" + str(a) + ")")' >> $@ + versal-h10-pmc-npi-nxx.dtsi: Makefile +- @python -c 'for a in range(0, 37): print("\tGEN_NMU(" + str(a) + ")")' > $@ +- @python -c 'for a in range(0, 33): print("\tGEN_NSU(" + str(a) + ")")' >> $@ +- @python -c 'for a in range(0, 135): print("\tGEN_NPS(" + str(a) + ")")' >> $@ ++ @python3 -c 'for a in range(0, 37): print("\tGEN_NMU(" + str(a) + ")")' > $@ ++ @python3 -c 'for a in range(0, 33): print("\tGEN_NSU(" + str(a) + ")")' >> $@ ++ @python3 -c 'for a in range(0, 135): print("\tGEN_NPS(" + str(a) + ")")' >> $@ + + clean: + $(RM) versal-pmc-npi-nxx.dtsi +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb new file mode 100644 index 00000000..7c734cd6 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.1.bb @@ -0,0 +1,8 @@ + +require qemu-devicetrees.inc + +BRANCH ?= "xlnx_rel_v2022.1" +SRCREV ?= "0499324af1178057c3730b0989c8fb5c5bbc4cf8" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +SRC_URI:append = " file://0001-Makefile-Use-python3-instead-of-python.patch" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.2.bb new file mode 100644 index 00000000..6675ba3e --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2022.2.bb @@ -0,0 +1,6 @@ + +require qemu-devicetrees.inc + +BRANCH ?= "xlnx_rel_v2022.2" +SRCREV ?= "cf5d357e16c13ac447861f908e83951ffb7b4301" + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.1.bb new file mode 100644 index 00000000..dc1feda4 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.1.bb @@ -0,0 +1,6 @@ + +require qemu-devicetrees.inc + +BRANCH ?= "xlnx_rel_v2023.1" +SRCREV ?= "56538937584f527fb408347c3b430142e74723e8" + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.2.bb new file mode 100644 index 00000000..d41743c1 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-devicetrees_2023.2.bb @@ -0,0 +1,6 @@ + +require qemu-devicetrees.inc + +BRANCH ?= "xlnx_rel_v2023.2" +SRCREV ?= "d1013382d9a5ef816cd020e7840813b7a2d65c51" + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-native-alt.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-native-alt.inc new file mode 100644 index 00000000..60c79542 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-native-alt.inc @@ -0,0 +1,12 @@ +PROVIDES += "qemu-native" + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for qemu-syste-native. This avoids network access required by +# the use of AUTOREV SRCREVs, which may be the default for some recipes. +python () { + if (not d.getVar("PREFERRED_PROVIDER_qemu-native") and "qemu-native" != d.getVar("PN")) or \ + (d.getVar("PREFERRED_PROVIDER_qemu-native") and d.getVar("PREFERRED_PROVIDER_qemu-native") != d.getVar("PN")): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_qemu-native to %s to enable it" % (d.getVar("PN"))) +} + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-native_%.bbappend b/meta-xilinx-core/recipes-devtools/qemu/qemu-native_%.bbappend new file mode 100644 index 00000000..d34c04ee --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-native_%.bbappend @@ -0,0 +1 @@ +require qemu-native-alt.inc diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-system-native-alt.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-system-native-alt.inc new file mode 100644 index 00000000..42592c58 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-system-native-alt.inc @@ -0,0 +1,13 @@ +PROVIDES += "qemu-system-native" + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for qemu-syste-native. This avoids network access required by +# the use of AUTOREV SRCREVs, which may be the default for some recipes. +python () { + if (not d.getVar("PREFERRED_PROVIDER_qemu-system-native") and "qemu-system-native" != d.getVar("PN")) or \ + (d.getVar("PREFERRED_PROVIDER_qemu-system-native") and d.getVar("PREFERRED_PROVIDER_qemu-system-native") != d.getVar("PN")): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_qemu-system-native to %s to enable it" % (d.getVar("PN"))) +} + +RPROVIDES:${PN} += "qemu-system-native" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-system-native_%.bbappend b/meta-xilinx-core/recipes-devtools/qemu/qemu-system-native_%.bbappend new file mode 100644 index 00000000..4a7810bd --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-system-native_%.bbappend @@ -0,0 +1 @@ +require qemu-system-native-alt.inc diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.1.inc new file mode 100644 index 00000000..bb8fac70 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.1.inc @@ -0,0 +1,8 @@ +# Note this isn't really the 2022.1 or 2022.2 version of qemu-xilinx +# Instead it's the current master version, as qemu 6.1.0 doesn't +# work reliabily anymore. + +XILINX_QEMU_VERSION = "v7.1.0" +BRANCH = "master" +SRCREV = "21adc9f99e813fb24fb65421259b5b0614938376" + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.2.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.2.inc new file mode 100644 index 00000000..bb8fac70 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2022.2.inc @@ -0,0 +1,8 @@ +# Note this isn't really the 2022.1 or 2022.2 version of qemu-xilinx +# Instead it's the current master version, as qemu 6.1.0 doesn't +# work reliabily anymore. + +XILINX_QEMU_VERSION = "v7.1.0" +BRANCH = "master" +SRCREV = "21adc9f99e813fb24fb65421259b5b0614938376" + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.1.inc new file mode 100644 index 00000000..06ac05a1 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.1.inc @@ -0,0 +1,3 @@ +XILINX_QEMU_VERSION = "v7.1.0" +BRANCH = "xlnx_rel_v2023.1" +SRCREV = "21adc9f99e813fb24fb65421259b5b0614938376" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.2.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.2.inc new file mode 100644 index 00000000..db6e1528 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-2023.2.inc @@ -0,0 +1,3 @@ +XILINX_QEMU_VERSION = "v7.1.0" +BRANCH = "xlnx_rel_v2023.2" +SRCREV = "23b643ba1683a47ef49447a45643fe2172d6f8ca" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-net-tulip-Restrict-DMA-engine-to-memories.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-net-tulip-Restrict-DMA-engine-to-memories.patch new file mode 100644 index 00000000..6c85a77b --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-net-tulip-Restrict-DMA-engine-to-memories.patch @@ -0,0 +1,64 @@ +CVE: CVE-2022-2962 +Upstream-Status: Backport +Signed-off-by: Ross Burton <ross.burton@arm.com> + +From 5c5c50b0a73d78ffe18336c9996fef5eae9bbbb0 Mon Sep 17 00:00:00 2001 +From: Zheyu Ma <zheyuma97@gmail.com> +Date: Sun, 21 Aug 2022 20:43:43 +0800 +Subject: [PATCH] net: tulip: Restrict DMA engine to memories + +The DMA engine is started by I/O access and then itself accesses the +I/O registers, triggering a reentrancy bug. + +The following log can reveal it: +==5637==ERROR: AddressSanitizer: stack-overflow + #0 0x5595435f6078 in tulip_xmit_list_update qemu/hw/net/tulip.c:673 + #1 0x5595435f204a in tulip_write qemu/hw/net/tulip.c:805:13 + #2 0x559544637f86 in memory_region_write_accessor qemu/softmmu/memory.c:492:5 + #3 0x5595446379fa in access_with_adjusted_size qemu/softmmu/memory.c:554:18 + #4 0x5595446372fa in memory_region_dispatch_write qemu/softmmu/memory.c + #5 0x55954468b74c in flatview_write_continue qemu/softmmu/physmem.c:2825:23 + #6 0x559544683662 in flatview_write qemu/softmmu/physmem.c:2867:12 + #7 0x5595446833f3 in address_space_write qemu/softmmu/physmem.c:2963:18 + #8 0x5595435fb082 in dma_memory_rw_relaxed qemu/include/sysemu/dma.h:87:12 + #9 0x5595435fb082 in dma_memory_rw qemu/include/sysemu/dma.h:130:12 + #10 0x5595435fb082 in dma_memory_write qemu/include/sysemu/dma.h:171:12 + #11 0x5595435fb082 in stl_le_dma qemu/include/sysemu/dma.h:272:1 + #12 0x5595435fb082 in stl_le_pci_dma qemu/include/hw/pci/pci.h:910:1 + #13 0x5595435fb082 in tulip_desc_write qemu/hw/net/tulip.c:101:9 + #14 0x5595435f7e3d in tulip_xmit_list_update qemu/hw/net/tulip.c:706:9 + #15 0x5595435f204a in tulip_write qemu/hw/net/tulip.c:805:13 + +Fix this bug by restricting the DMA engine to memories regions. + +Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> +Signed-off-by: Jason Wang <jasowang@redhat.com> +--- + hw/net/tulip.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/net/tulip.c b/hw/net/tulip.c +index 097e905bec..b9e42c322a 100644 +--- a/hw/net/tulip.c ++++ b/hw/net/tulip.c +@@ -70,7 +70,7 @@ static const VMStateDescription vmstate_pci_tulip = { + static void tulip_desc_read(TULIPState *s, hwaddr p, + struct tulip_descriptor *desc) + { +- const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; ++ const MemTxAttrs attrs = { .memory = true }; + + if (s->csr[0] & CSR0_DBO) { + ldl_be_pci_dma(&s->dev, p, &desc->status, attrs); +@@ -88,7 +88,7 @@ static void tulip_desc_read(TULIPState *s, hwaddr p, + static void tulip_desc_write(TULIPState *s, hwaddr p, + struct tulip_descriptor *desc) + { +- const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; ++ const MemTxAttrs attrs = { .memory = true }; + + if (s->csr[0] & CSR0_DBO) { + stl_be_pci_dma(&s->dev, p, desc->status, attrs); +-- +2.34.1 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch new file mode 100644 index 00000000..6fb160e6 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch @@ -0,0 +1,36 @@ +From de64af82950a6908f9407dfc92b83c17e2af3eab Mon Sep 17 00:00:00 2001 +From: Jason Wessel <jason.wessel@windriver.com> +Date: Fri, 28 Mar 2014 17:42:43 +0800 +Subject: [PATCH 01/12] qemu: Add addition environment space to boot loader + qemu-system-mips + +Upstream-Status: Inappropriate - OE uses deep paths + +If you create a project with very long directory names like 128 characters +deep and use NFS, the kernel arguments will be truncated. The kernel will +accept longer strings such as 1024 bytes, but the qemu boot loader defaulted +to only 256 bytes. This patch expands the limit. + +Signed-off-by: Jason Wessel <jason.wessel@windriver.com> +Signed-off-by: Roy Li <rongqing.li@windriver.com> + +--- + hw/mips/malta.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/mips/malta.c b/hw/mips/malta.c +index 628851172..12d37f35d 100644 +--- a/hw/mips/malta.c ++++ b/hw/mips/malta.c +@@ -61,7 +61,7 @@ + #define ENVP_PADDR 0x2000 + #define ENVP_VADDR cpu_mips_phys_to_kseg0(NULL, ENVP_PADDR) + #define ENVP_NB_ENTRIES 16 +-#define ENVP_ENTRY_SIZE 256 ++#define ENVP_ENTRY_SIZE 1024 + + /* Hardware addresses */ + #define FLASH_ADDRESS 0x1e000000ULL +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0002-chardev-connect-socket-to-a-spawned-command.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0002-chardev-connect-socket-to-a-spawned-command.patch new file mode 100644 index 00000000..63a99c96 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0002-chardev-connect-socket-to-a-spawned-command.patch @@ -0,0 +1,246 @@ +From 14cd62607c9de232edf0a9b8503bd02783e03411 Mon Sep 17 00:00:00 2001 +From: Alistair Francis <alistair.francis@xilinx.com> +Date: Thu, 21 Dec 2017 11:35:16 -0800 +Subject: [PATCH 02/12] chardev: connect socket to a spawned command + +The command is started in a shell (sh -c) with stdin connect to QEMU +via a Unix domain stream socket. QEMU then exchanges data via its own +end of the socket, just like it normally does. + +"-chardev socket" supports some ways of connecting via protocols like +telnet, but that is only a subset of the functionality supported by +tools socat. To use socat instead, for example to connect via a socks +proxy, use: + + -chardev 'socket,id=socat,cmd=exec socat FD:0 SOCKS4A:socks-proxy.localdomain:example.com:9999,,socksuser=nobody' \ + -device usb-serial,chardev=socat + +Beware that commas in the command must be escaped as double commas. + +Or interactively in the console: + (qemu) chardev-add socket,id=cat,cmd=cat + (qemu) device_add usb-serial,chardev=cat + ^ac + # cat >/dev/ttyUSB0 + hello + hello + +Another usage is starting swtpm from inside QEMU. swtpm will +automatically shut down once it looses the connection to the parent +QEMU, so there is no risk of lingering processes: + + -chardev 'socket,id=chrtpm0,cmd=exec swtpm socket --terminate --ctrl type=unixio,,clientfd=0 --tpmstate dir=... --log file=swtpm.log' \ + -tpmdev emulator,id=tpm0,chardev=chrtpm0 \ + -device tpm-tis,tpmdev=tpm0 + +The patch was discussed upstream, but QEMU developers believe that the +code calling QEMU should be responsible for managing additional +processes. In OE-core, that would imply enhancing runqemu and +oeqa. This patch is a simpler solution. + +Because it is not going upstream, the patch was written so that it is +as simple as possible. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> + +--- + chardev/char-socket.c | 100 ++++++++++++++++++++++++++++++++++++++++++ + chardev/char.c | 3 ++ + qapi/char.json | 5 +++ + 3 files changed, 108 insertions(+) + +diff --git a/chardev/char-socket.c b/chardev/char-socket.c +index fab2d791d..c79641f24 100644 +--- a/chardev/char-socket.c ++++ b/chardev/char-socket.c +@@ -1315,6 +1315,67 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock, + return true; + } + ++#ifndef _WIN32 ++static void chardev_open_socket_cmd(Chardev *chr, ++ const char *cmd, ++ Error **errp) ++{ ++ int fds[2] = { -1, -1 }; ++ QIOChannelSocket *sioc = NULL; ++ pid_t pid = -1; ++ const char *argv[] = { "/bin/sh", "-c", cmd, NULL }; ++ ++ /* ++ * We need a Unix domain socket for commands like swtpm and a single ++ * connection, therefore we cannot use qio_channel_command_new_spawn() ++ * without patching it first. Duplicating the functionality is easier. ++ */ ++ if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds)) { ++ error_setg_errno(errp, errno, "Error creating socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC)"); ++ goto error; ++ } ++ ++ pid = qemu_fork(errp); ++ if (pid < 0) { ++ goto error; ++ } ++ ++ if (!pid) { ++ /* child */ ++ dup2(fds[1], STDIN_FILENO); ++ execv(argv[0], (char * const *)argv); ++ _exit(1); ++ } ++ ++ /* ++ * Hand over our end of the socket pair to the qio channel. ++ * ++ * We don't reap the child because it is expected to keep ++ * running. We also don't support the "reconnect" option for the ++ * same reason. ++ */ ++ sioc = qio_channel_socket_new_fd(fds[0], errp); ++ if (!sioc) { ++ goto error; ++ } ++ fds[0] = -1; ++ ++ g_free(chr->filename); ++ chr->filename = g_strdup_printf("cmd:%s", cmd); ++ tcp_chr_new_client(chr, sioc); ++ ++ error: ++ if (fds[0] >= 0) { ++ close(fds[0]); ++ } ++ if (fds[1] >= 0) { ++ close(fds[1]); ++ } ++ if (sioc) { ++ object_unref(OBJECT(sioc)); ++ } ++} ++#endif + + static void qmp_chardev_open_socket(Chardev *chr, + ChardevBackend *backend, +@@ -1323,6 +1384,9 @@ static void qmp_chardev_open_socket(Chardev *chr, + { + SocketChardev *s = SOCKET_CHARDEV(chr); + ChardevSocket *sock = backend->u.socket.data; ++#ifndef _WIN32 ++ const char *cmd = sock->cmd; ++#endif + bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; + bool is_listen = sock->has_server ? sock->server : true; + bool is_telnet = sock->has_telnet ? sock->telnet : false; +@@ -1393,6 +1457,14 @@ static void qmp_chardev_open_socket(Chardev *chr, + + update_disconnected_filename(s); + ++#ifndef _WIN32 ++ if (cmd) { ++ chardev_open_socket_cmd(chr, cmd, errp); ++ ++ /* everything ready (or failed permanently) before we return */ ++ *be_opened = true; ++ } else ++#endif + if (s->is_listen) { + if (qmp_chardev_open_socket_server(chr, is_telnet || is_tn3270, + is_waitconnect, errp) < 0) { +@@ -1412,6 +1484,9 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, + const char *host = qemu_opt_get(opts, "host"); + const char *port = qemu_opt_get(opts, "port"); + const char *fd = qemu_opt_get(opts, "fd"); ++#ifndef _WIN32 ++ const char *cmd = qemu_opt_get(opts, "cmd"); ++#endif + #ifdef CONFIG_LINUX + bool tight = qemu_opt_get_bool(opts, "tight", true); + bool abstract = qemu_opt_get_bool(opts, "abstract", false); +@@ -1419,6 +1494,20 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, + SocketAddressLegacy *addr; + ChardevSocket *sock; + ++#ifndef _WIN32 ++ if (cmd) { ++ /* ++ * Here we have to ensure that no options are set which are incompatible with ++ * spawning a command, otherwise unmodified code that doesn't know about ++ * command spawning (like socket_reconnect_timeout()) might get called. ++ */ ++ if (path || sock->server || sock->has_telnet || sock->has_tn3270 || sock->reconnect || host || port || sock->tls_creds) { ++ error_setg(errp, "chardev: socket: cmd does not support any additional options"); ++ return; ++ } ++ } else ++#endif ++ + if ((!!path + !!fd + !!host) > 1) { + error_setg(errp, + "None or one of 'path', 'fd' or 'host' option required."); +@@ -1469,13 +1558,24 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, + sock->tls_creds = g_strdup(qemu_opt_get(opts, "tls-creds")); + sock->has_tls_authz = qemu_opt_get(opts, "tls-authz"); + sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz")); ++#ifndef _WIN32 ++ sock->cmd = g_strdup(cmd); ++#endif + + addr = g_new0(SocketAddressLegacy, 1); ++#ifndef _WIN32 ++ if (path || cmd) { ++#else + if (path) { ++#endif + UnixSocketAddress *q_unix; + addr->type = SOCKET_ADDRESS_TYPE_UNIX; + q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); ++#ifndef _WIN32 ++ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); ++#else + q_unix->path = g_strdup(path); ++#endif + #ifdef CONFIG_LINUX + q_unix->has_tight = true; + q_unix->tight = tight; +diff --git a/chardev/char.c b/chardev/char.c +index 0169d8dde..ce9a21f41 100644 +--- a/chardev/char.c ++++ b/chardev/char.c +@@ -835,6 +835,9 @@ QemuOptsList qemu_chardev_opts = { + },{ + .name = "path", + .type = QEMU_OPT_STRING, ++ },{ ++ .name = "cmd", ++ .type = QEMU_OPT_STRING, + },{ + .name = "host", + .type = QEMU_OPT_STRING, +diff --git a/qapi/char.json b/qapi/char.json +index 7b4215157..37feabdac 100644 +--- a/qapi/char.json ++++ b/qapi/char.json +@@ -250,6 +250,10 @@ + # + # @addr: socket address to listen on (server=true) + # or connect to (server=false) ++# @cmd: command to run via "sh -c" with stdin as one end of ++# a AF_UNIX SOCK_DSTREAM socket pair. The other end ++# is used by the chardev. Either an addr or a cmd can ++# be specified, but not both. + # @tls-creds: the ID of the TLS credentials object (since 2.6) + # @tls-authz: the ID of the QAuthZ authorization object against which + # the client's x509 distinguished name will be validated. This +@@ -276,6 +280,7 @@ + ## + { 'struct': 'ChardevSocket', + 'data': { 'addr': 'SocketAddressLegacy', ++ '*cmd': 'str', + '*tls-creds': 'str', + '*tls-authz' : 'str', + '*server': 'bool', +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0003-apic-fixup-fallthrough-to-PIC.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0003-apic-fixup-fallthrough-to-PIC.patch new file mode 100644 index 00000000..f350ffce --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0003-apic-fixup-fallthrough-to-PIC.patch @@ -0,0 +1,47 @@ +From dc2a8ccd440ee3741b61606eafed3f7e092f4312 Mon Sep 17 00:00:00 2001 +From: Mark Asselstine <mark.asselstine@windriver.com> +Date: Tue, 26 Feb 2013 11:43:28 -0500 +Subject: [PATCH 03/12] apic: fixup fallthrough to PIC + +Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC +interrupts through the local APIC if the local APIC config says so.] +missed a check to ensure the local APIC is enabled. Since if the local +APIC is disabled it doesn't matter what the local APIC config says. + +If this check isn't done and the guest has disabled the local APIC the +guest will receive a general protection fault, similar to what is seen +here: + +https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html + +The GPF is caused by an attempt to service interrupt 0xffffffff. This +comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr() +(with the local APIC disabled apic_get_interrupt() returns -1). +apic_accept_pic_intr() returns 0 and thus the interrupt number which +is returned from cpu_get_pic_interrupt(), and which is attempted to be +serviced, is -1. + +Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html] +Signed-off-by: He Zhe <zhe.he@windriver.com> + +--- + hw/intc/apic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/intc/apic.c b/hw/intc/apic.c +index 3df11c34d..9506c88ce 100644 +--- a/hw/intc/apic.c ++++ b/hw/intc/apic.c +@@ -605,7 +605,7 @@ int apic_accept_pic_intr(DeviceState *dev) + APICCommonState *s = APIC(dev); + uint32_t lvt0; + +- if (!s) ++ if (!s || !(s->spurious_vec & APIC_SV_ENABLE)) + return -1; + + lvt0 = s->lvt[APIC_LVT_LINT0]; +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch new file mode 100644 index 00000000..6faebd4e --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch @@ -0,0 +1,32 @@ +From d8265abdce5dc2bf74b3fccdf2b7257b4f3894f0 Mon Sep 17 00:00:00 2001 +From: He Zhe <zhe.he@windriver.com> +Date: Wed, 28 Aug 2019 19:56:28 +0800 +Subject: [PATCH 04/12] configure: Add pkg-config handling for libgcrypt + +libgcrypt may also be controlled by pkg-config, this patch adds pkg-config +handling for libgcrypt. + +Upstream-Status: Denied [https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg06333.html] + +Signed-off-by: He Zhe <zhe.he@windriver.com> + +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 861de93c4..d45ff2d7c 100644 +--- a/meson.build ++++ b/meson.build +@@ -1063,7 +1063,7 @@ endif + if not gnutls_crypto.found() + if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled() + gcrypt = dependency('libgcrypt', version: '>=1.8', +- method: 'config-tool', ++ method: 'pkg-config', + required: get_option('gcrypt'), + kwargs: static_kwargs) + # Debian has removed -lgpg-error from libgcrypt-config +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0005-qemu-Do-not-include-file-if-not-exists.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0005-qemu-Do-not-include-file-if-not-exists.patch new file mode 100644 index 00000000..3f3c39f9 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0005-qemu-Do-not-include-file-if-not-exists.patch @@ -0,0 +1,35 @@ +From f39e7bfc5ed07b5ecaeb705c4eae4855ca120d47 Mon Sep 17 00:00:00 2001 +From: Oleksiy Obitotskyy <oobitots@cisco.com> +Date: Wed, 25 Mar 2020 21:21:35 +0200 +Subject: [PATCH 05/12] qemu: Do not include file if not exists + +Script configure checks for if_alg.h and check failed but +if_alg.h still included. + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg07188.html] +Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com> + +[update patch context] +Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> + +--- + linux-user/syscall.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index f65045efe..340e0c6f0 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -113,7 +113,9 @@ + #include <linux/blkpg.h> + #include <netpacket/packet.h> + #include <linux/netlink.h> ++#if defined(CONFIG_AF_ALG) + #include <linux/if_alg.h> ++#endif + #include <linux/rtc.h> + #include <sound/asound.h> + #ifdef HAVE_BTRFS_H +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch new file mode 100644 index 00000000..75c03693 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch @@ -0,0 +1,52 @@ +From 375cae3dd6151ef33cae8f243f6a2c2da6c0c356 Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Fri, 8 Jan 2021 17:27:06 +0000 +Subject: [PATCH 06/12] qemu: Add some user space mmap tweaks to address musl + 32 bit + +When using qemu-i386 to build qemux86 webkitgtk on musl, it sits in an +infinite loop of mremap calls of ever decreasing/increasing addresses. + +I suspect something in the musl memory allocation code loops indefinitely +if it only sees ENOMEM and only exits when it hits EFAULT. + +According to the docs, trying to mremap outside the address space +can/should return EFAULT and changing this allows the build to succeed. + +A better return value for the other cases of invalid addresses is EINVAL +rather than ENOMEM so adjust the other part of the test to this. + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01355.html] +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org + +--- + linux-user/mmap.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/linux-user/mmap.c b/linux-user/mmap.c +index c125031b9..e651834a5 100644 +--- a/linux-user/mmap.c ++++ b/linux-user/mmap.c +@@ -749,12 +749,16 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, + int prot; + void *host_addr; + +- if (!guest_range_valid_untagged(old_addr, old_size) || +- ((flags & MREMAP_FIXED) && ++ if (!guest_range_valid_untagged(old_addr, old_size)) { ++ errno = EFAULT; ++ return -1; ++ } ++ ++ if (((flags & MREMAP_FIXED) && + !guest_range_valid_untagged(new_addr, new_size)) || + ((flags & MREMAP_MAYMOVE) == 0 && + !guest_range_valid_untagged(old_addr, new_size))) { +- errno = ENOMEM; ++ errno = EINVAL; + return -1; + } + +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0007-qemu-Determinism-fixes.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0007-qemu-Determinism-fixes.patch new file mode 100644 index 00000000..0d7dae36 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0007-qemu-Determinism-fixes.patch @@ -0,0 +1,34 @@ +From 50bab5c2605b609ea7ea154f57a9be96d656725a Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Mon, 1 Mar 2021 13:00:47 +0000 +Subject: [PATCH 07/12] qemu: Determinism fixes + +When sources are included within debug information, a couple of areas of the +qemu build are not reproducible due to either full buildpaths or timestamps. + +Replace the full paths with relative ones. I couldn't figure out how to get +meson to pass relative paths but we can fix that in the script. + +Upstream-Status: Pending [some version of all/part of this may be accepted] +RP 2021/3/1 + +--- + scripts/decodetree.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/decodetree.py b/scripts/decodetree.py +index a03dc6b5e..4ea24c1f3 100644 +--- a/scripts/decodetree.py ++++ b/scripts/decodetree.py +@@ -1328,7 +1328,7 @@ def main(): + toppat = ExcMultiPattern(0) + + for filename in args: +- input_file = filename ++ input_file = os.path.relpath(filename) + f = open(filename, 'rt', encoding='utf-8') + parse_file(f, toppat) + f.close() +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch new file mode 100644 index 00000000..43d3c7cf --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch @@ -0,0 +1,38 @@ +From 2bf9388b801d4389e2d57e95a7897bfc1c42786e Mon Sep 17 00:00:00 2001 +From: Changqing Li <changqing.li@windriver.com> +Date: Thu, 14 Jan 2021 06:33:04 +0000 +Subject: [PATCH 08/12] tests/meson.build: use relative path to refer to files + +Fix error like: +Fatal error: can't create tests/ptimer-test.p/..._qemu-5.2.0_hw_core_ptimer.c.o: File name too long + +when build path is too long, use meson.source_root() will make this +filename too long. Fixed by using relative path to refer to files + +Upstream-Status: Submitted [send to qemu-devel] + +Signed-off-by: Changqing Li <changqing.li@windriver.com> + +--- + tests/unit/meson.build | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/unit/meson.build b/tests/unit/meson.build +index 96b295263..e4c3246dc 100644 +--- a/tests/unit/meson.build ++++ b/tests/unit/meson.build +@@ -44,9 +44,9 @@ tests = { + 'test-keyval': [testqapi], + 'test-logging': [], + 'test-uuid': [], +- 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], ++ 'ptimer-test': ['ptimer-test-stubs.c', '../../hw/core/ptimer.c'], + 'test-qapi-util': [], +- 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], ++ 'test-smp-parse': [qom, '../../hw/core/machine-smp.c'], + } + + if have_system or have_tools +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch new file mode 100644 index 00000000..23d0a698 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch @@ -0,0 +1,49 @@ +From ebf4bb2f51da83af0c61480414cfa156f7308b34 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 21 Mar 2022 10:09:38 -0700 +Subject: [PATCH 09/12] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux + systems + +linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures +which include asm-generic/mman.h and mips/powerpc are not including this +file in linux/mman.h, therefore these should be defined for such +architectures on Linux as well. This fixes build on mips/musl/linux + +Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2022-03/msg05298.html] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Cc: Zhang Yi <yi.z.zhang@linux.intel.com> +Cc: Michael S. Tsirkin <mst@redhat.com> + +--- + util/mmap-alloc.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c +index 893d86435..86d3cda24 100644 +--- a/util/mmap-alloc.c ++++ b/util/mmap-alloc.c +@@ -10,14 +10,18 @@ + * later. See the COPYING file in the top-level directory. + */ + ++#include "qemu/osdep.h" + #ifdef CONFIG_LINUX + #include <linux/mman.h> +-#else /* !CONFIG_LINUX */ ++#endif /* CONFIG_LINUX */ ++ ++#ifndef MAP_SYNC + #define MAP_SYNC 0x0 ++#endif /* MAP_SYNC */ ++#ifndef MAP_SHARED_VALIDATE + #define MAP_SHARED_VALIDATE 0x0 +-#endif /* CONFIG_LINUX */ ++#endif /* MAP_SHARED_VALIDATE */ + +-#include "qemu/osdep.h" + #include "qemu/mmap-alloc.h" + #include "qemu/host-utils.h" + #include "qemu/cutils.h" +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch new file mode 100644 index 00000000..810c74fa --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch @@ -0,0 +1,43 @@ +CVE: CVE-2022-1050 +Upstream-Status: Submitted [https://lore.kernel.org/qemu-devel/20220403095234.2210-1-yuval.shaia.ml@gmail.com/] +Signed-off-by: Ross Burton <ross.burton@arm.com> + +From dbdef95c272e8f3ec037c3db4197c66002e30995 Mon Sep 17 00:00:00 2001 +From: Yuval Shaia <yuval.shaia.ml@gmail.com> +Date: Sun, 3 Apr 2022 12:52:34 +0300 +Subject: [PATCH] hw/pvrdma: Protect against buggy or malicious guest driver + +Guest driver might execute HW commands when shared buffers are not yet +allocated. +This could happen on purpose (malicious guest) or because of some other +guest/host address mapping error. +We need to protect againts such case. + +Fixes: CVE-2022-1050 + +Reported-by: Raven <wxhusst@gmail.com> +Signed-off-by: Yuval Shaia <yuval.shaia.ml@gmail.com> +--- + hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c +index da7ddfa548..89db963c46 100644 +--- a/hw/rdma/vmw/pvrdma_cmd.c ++++ b/hw/rdma/vmw/pvrdma_cmd.c +@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev) + + dsr_info = &dev->dsr_info; + ++ if (!dsr_info->dsr) { ++ /* Buggy or malicious guest driver */ ++ rdma_error_report("Exec command without dsr, req or rsp buffers"); ++ goto out; ++ } ++ + if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) / + sizeof(struct cmd_handler)) { + rdma_error_report("Unsupported command"); +-- +2.34.1 + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/CVE-2022-3165.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/CVE-2022-3165.patch new file mode 100644 index 00000000..3b4a6694 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/CVE-2022-3165.patch @@ -0,0 +1,59 @@ +CVE: CVE-2022-3165 +Upstream-Status: Backport +Signed-off-by: Ross Burton <ross.burton@arm.com> + +From d307040b18bfcb1393b910f1bae753d5c12a4dc7 Mon Sep 17 00:00:00 2001 +From: Mauro Matteo Cascella <mcascell@redhat.com> +Date: Sun, 25 Sep 2022 22:45:11 +0200 +Subject: [PATCH] ui/vnc-clipboard: fix integer underflow in + vnc_client_cut_text_ext + +Extended ClientCutText messages start with a 4-byte header. If len < 4, +an integer underflow occurs in vnc_client_cut_text_ext. The result is +used to decompress data in a while loop in inflate_buffer, leading to +CPU consumption and denial of service. Prevent this by checking dlen in +protocol_client_msg. + +Fixes: CVE-2022-3165 +Fixes: 0bf41cab93e5 ("ui/vnc: clipboard support") +Reported-by: TangPeng <tangpeng@qianxin.com> +Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com> +Message-Id: <20220925204511.1103214-1-mcascell@redhat.com> +Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> +--- + ui/vnc.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/ui/vnc.c b/ui/vnc.c +index 6a05d06147..acb3629cd8 100644 +--- a/ui/vnc.c ++++ b/ui/vnc.c +@@ -2442,8 +2442,8 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) + if (len == 1) { + return 8; + } ++ uint32_t dlen = abs(read_s32(data, 4)); + if (len == 8) { +- uint32_t dlen = abs(read_s32(data, 4)); + if (dlen > (1 << 20)) { + error_report("vnc: client_cut_text msg payload has %u bytes" + " which exceeds our limit of 1MB.", dlen); +@@ -2456,8 +2456,13 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) + } + + if (read_s32(data, 4) < 0) { +- vnc_client_cut_text_ext(vs, abs(read_s32(data, 4)), +- read_u32(data, 8), data + 12); ++ if (dlen < 4) { ++ error_report("vnc: malformed payload (header less than 4 bytes)" ++ " in extended clipboard pseudo-encoding."); ++ vnc_client_error(vs); ++ break; ++ } ++ vnc_client_cut_text_ext(vs, dlen, read_u32(data, 8), data + 12); + break; + } + vnc_client_cut_text(vs, read_u32(data, 4), data + 8); +-- +GitLab + diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/arm-cpreg-fix.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/arm-cpreg-fix.patch new file mode 100644 index 00000000..071691f8 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/arm-cpreg-fix.patch @@ -0,0 +1,27 @@ +target/arm: mark SP_EL1 with ARM_CP_EL3_NO_EL2_KEEP + +SP_EL1 must be kept when EL3 is present but EL2 is not. Therefore mark +it with ARM_CP_EL3_NO_EL2_KEEP. + +Fixes: 696ba3771894 ("target/arm: Handle cpreg registration for missing EL") +Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2022-09/msg04515.html] + +--- + target/arm/helper.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: qemu-7.1.0/target/arm/helper.c +=================================================================== +--- qemu-7.1.0.orig/target/arm/helper.c ++++ qemu-7.1.0/target/arm/helper.c +@@ -4971,7 +4971,7 @@ static const ARMCPRegInfo v8_cp_reginfo[ + .fieldoffset = offsetof(CPUARMState, sp_el[0]) }, + { .name = "SP_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 1, .opc2 = 0, +- .access = PL2_RW, .type = ARM_CP_ALIAS, ++ .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_KEEP, + .fieldoffset = offsetof(CPUARMState, sp_el[1]) }, + { .name = "SPSel", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0, diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/cross.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/cross.patch new file mode 100644 index 00000000..ca2ad361 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/cross.patch @@ -0,0 +1,38 @@ +From 76c3fc4c87231bed32974ebbbdb5079cff45a6b7 Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Tue, 5 Jan 2021 23:00:14 +0000 +Subject: [PATCH 12/12] qemu: Upgrade 5.1.0->5.2.0 + +We need to be able to trigger configure's cross code but we don't want +to set cross_prefix as it does other things we don't want. Patch things +so we can do what we need in the target config case. + +Upstream-Status: Inappropriate [may be rewritten in a way upstream may accept?] +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> + +--- + configure | 4 ---- + 1 file changed, 4 deletions(-) + +Index: qemu-7.1.0/configure +=================================================================== +--- qemu-7.1.0.orig/configure ++++ qemu-7.1.0/configure +@@ -2710,7 +2710,6 @@ if test "$skip_meson" = no; then + echo "strip = [$(meson_quote $strip)]" >> $cross + echo "widl = [$(meson_quote $widl)]" >> $cross + echo "windres = [$(meson_quote $windres)]" >> $cross +- if test "$cross_compile" = "yes"; then + cross_arg="--cross-file config-meson.cross" + echo "[host_machine]" >> $cross + echo "system = '$targetos'" >> $cross +@@ -2728,9 +2727,6 @@ if test "$skip_meson" = no; then + else + echo "endian = 'little'" >> $cross + fi +- else +- cross_arg="--native-file config-meson.cross" +- fi + mv $cross config-meson.cross + + rm -rf meson-private meson-info meson-logs diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/powerpc_rom.bin b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/powerpc_rom.bin Binary files differnew file mode 100644 index 00000000..c4044296 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/powerpc_rom.bin diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/qemu-7.0.0-glibc-2.36.patch b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/qemu-7.0.0-glibc-2.36.patch new file mode 100644 index 00000000..abad1cfe --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/qemu-7.0.0-glibc-2.36.patch @@ -0,0 +1,46 @@ +Avoid conflicts between sys/mount.h and linux/mount.h that are seen +with glibc 2.36 + +Source: https://github.com/archlinux/svntogit-packages/blob/packages/qemu/trunk/qemu-7.0.0-glibc-2.36.patch + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -95,7 +95,25 @@ + #include <linux/soundcard.h> + #include <linux/kd.h> + #include <linux/mtio.h> ++ ++#ifdef HAVE_SYS_MOUNT_FSCONFIG ++/* ++ * glibc >= 2.36 linux/mount.h conflicts with sys/mount.h, ++ * which in turn prevents use of linux/fs.h. So we have to ++ * define the constants ourselves for now. ++ */ ++#define FS_IOC_GETFLAGS _IOR('f', 1, long) ++#define FS_IOC_SETFLAGS _IOW('f', 2, long) ++#define FS_IOC_GETVERSION _IOR('v', 1, long) ++#define FS_IOC_SETVERSION _IOW('v', 2, long) ++#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) ++#define FS_IOC32_GETFLAGS _IOR('f', 1, int) ++#define FS_IOC32_SETFLAGS _IOW('f', 2, int) ++#define FS_IOC32_GETVERSION _IOR('v', 1, int) ++#define FS_IOC32_SETVERSION _IOW('v', 2, int) ++#else + #include <linux/fs.h> ++#endif + #include <linux/fd.h> + #if defined(CONFIG_FIEMAP) + #include <linux/fiemap.h> +--- a/meson.build ++++ b/meson.build +@@ -1686,6 +1686,8 @@ config_host_data.set('HAVE_OPTRESET', + cc.has_header_symbol('getopt.h', 'optreset')) + config_host_data.set('HAVE_IPPROTO_MPTCP', + cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP')) ++config_host_data.set('HAVE_SYS_MOUNT_FSCONFIG', ++ cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG')) + + # has_member + config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID', diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/run-ptest b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/run-ptest new file mode 100644 index 00000000..f9a4e8fb --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.0/run-ptest @@ -0,0 +1,13 @@ +#!/bin/sh +# +#This script is used to run qemu test suites +# + +ptestdir=$(dirname "$(readlink -f "$0")") +export SRC_PATH=$ptestdir + +cd $ptestdir/tests +tests=$(find . -name "test-*" ! -name "*.p") +for f in $tests; do + $f | sed '/^ok/ s/ok/PASS:/g' +done diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.inc new file mode 100644 index 00000000..4b0aceb8 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-7.1.inc @@ -0,0 +1,65 @@ +SUMMARY = "Xilinx's fork of a fast open source processor emulator" +HOMEPAGE = "https://github.com/xilinx/qemu/" + +# This qemu fork is NOT compatible with running on a 32-bit system +# See: https://github.com/Xilinx/qemu/issues/35 +COMPATIBLE_HOST:arm = "null" + +# x86_64 is needed to build nativesdks +QEMU_TARGETS = "aarch64 arm microblaze microblazeel x86_64" + +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ + file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f \ + " +DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native meson-native" + +FILESEXTRAPATHS:prepend := "${THISDIR}/qemu-xilinx-7.1.0:" + +PV = "${XILINX_QEMU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" +REPO ?= "gitsm://github.com/Xilinx/qemu.git;protocol=https" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +FILESEXTRAPATHS:append := ":${COREBASE}/meta/recipes-devtools/qemu/qemu" + +SRC_URI += "\ + file://powerpc_rom.bin \ + file://run-ptest \ + file://0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ + file://0002-chardev-connect-socket-to-a-spawned-command.patch \ + file://0003-apic-fixup-fallthrough-to-PIC.patch \ + file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0005-qemu-Do-not-include-file-if-not-exists.patch \ + file://0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch \ + file://0007-qemu-Determinism-fixes.patch \ + file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \ + file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ + file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ + file://0001-net-tulip-Restrict-DMA-engine-to-memories.patch \ + file://arm-cpreg-fix.patch \ + file://CVE-2022-3165.patch \ + file://qemu-guest-agent.init \ + file://qemu-guest-agent.udev \ + " + +# Workaround for 8.2 patch that doesn't apply +SRC_URI:remove = "file://0011-linux-user-workaround-for-missing-MAP_FIXED_NOREPLAC.patch" +SRC_URI:remove = "file://0012-linux-user-workaround-for-missing-MAP_SHARED_VALIDAT.patch" + +S = "${WORKDIR}/git" + +PACKAGECONFIG ??= " \ + fdt sdl kvm gcrypt pie slirp \ + ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ +" +PACKAGECONFIG:class-nativesdk ??= "fdt sdl kvm gcrypt pie slirp" + +# Disable this +PACKAGECONFIG[debuginfo] = "" +PACKAGECONFIG[pipewire] = "" +PACKAGECONFIG[sndio] = "" + +DISABLE_STATIC:pn-${PN} = "" diff --git a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb index a9b11c6c..1eec0163 100644 --- a/meta-xilinx-bsp/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-multiarch-helper-native_1.0.bb @@ -1,11 +1,11 @@ SUMMARY = "Helper scripts for executing a multi-arch instance of Xilinx QEMU" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -RDEPENDS_${PN} = "qemu-xilinx-native" +RDEPENDS:${PN} = "qemu-xilinx-native" inherit native -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRC_URI = "file://qemu-system-aarch64-multiarch" @@ -15,6 +15,6 @@ do_compile[noexec] = "1" SYSROOT_DIRS += "${bindir}/qemu-xilinx" do_install() { - install -Dm 0755 ${WORKDIR}/qemu-system-aarch64-multiarch ${D}${bindir}/qemu-xilinx/qemu-system-aarch64-multiarch + install -Dm 0755 ${WORKDIR}/qemu-system-aarch64-multiarch ${D}${bindir}/qemu-system-aarch64-multiarch } diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native-7.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native-7.1.inc new file mode 100644 index 00000000..e664a580 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native-7.1.inc @@ -0,0 +1,4 @@ +require recipes-devtools/qemu/qemu-native.inc +require qemu-xilinx-7.1.inc + +DEPENDS = "glib-2.0-native zlib-native ninja-native meson-native" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb new file mode 100644 index 00000000..bfdb916d --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.1.bb @@ -0,0 +1,21 @@ +require qemu-xilinx-2022.1.inc +require qemu-xilinx-native-7.1.inc +require qemu-native-alt.inc + +BPN = "qemu-xilinx" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" + +PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.2.bb new file mode 100644 index 00000000..f91eb891 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2022.2.bb @@ -0,0 +1,21 @@ +require qemu-xilinx-2022.2.inc +require qemu-xilinx-native-7.1.inc +require qemu-native-alt.inc + +BPN = "qemu-xilinx" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" + +PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.1.bb new file mode 100644 index 00000000..a19b2cc3 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.1.bb @@ -0,0 +1,21 @@ +require qemu-xilinx-2023.1.inc +require qemu-xilinx-native-7.1.inc +require qemu-native-alt.inc + +BPN = "qemu-xilinx" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" + +PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.2.bb new file mode 100644 index 00000000..78ffedca --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-native_2023.2.bb @@ -0,0 +1,21 @@ +require qemu-xilinx-2023.2.inc +require qemu-xilinx-native-7.1.inc +require qemu-native-alt.inc + +BPN = "qemu-xilinx" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" + +PACKAGECONFIG ??= "pie" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_%.bbappend b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_%.bbappend new file mode 100644 index 00000000..7c152d60 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_%.bbappend @@ -0,0 +1,5 @@ +# Automatically enable pmu-rom-native for ZynqMP support +PMU_ROM_DEP[vardepsexclude] = "LICENSE_FLAGS_ACCEPTED" +PMU_ROM_DEP = "${@bb.utils.contains("LICENSE_FLAGS_ACCEPTED", "xilinx", " pmu-rom-native", "", d)}" + +DEPENDS .= "${PMU_ROM_DEP}" diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb new file mode 100644 index 00000000..ba733ede --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.1.bb @@ -0,0 +1,38 @@ +require qemu-system-native-alt.inc +require qemu-xilinx-2022.1.inc +require qemu-xilinx-native-7.1.inc + +PROVIDES = "qemu-system-native" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" + +PACKAGECONFIG ??= "fdt alsa kvm gcrypt pie slirp" + +PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" + +DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" +DEPENDS += "qemu-xilinx-multiarch-helper-native" + +do_install:append() { + # The following is also installed by qemu-native + rm -f ${D}${datadir}/qemu/trace-events-all + rm -rf ${D}${datadir}/qemu/keymaps + rm -rf ${D}${datadir}/icons + rm -rf ${D}${includedir}/qemu-plugin.h + + # Install qmp.py to be used with testimage + install -d ${D}${libdir}/qemu-python/qmp/ + install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.2.bb new file mode 100644 index 00000000..17386afe --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2022.2.bb @@ -0,0 +1,38 @@ +require qemu-system-native-alt.inc +require qemu-xilinx-2022.2.inc +require qemu-xilinx-native-7.1.inc + +PROVIDES = "qemu-system-native" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" + +PACKAGECONFIG ??= "fdt alsa kvm gcrypt pie slirp" + +PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" + +DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" +DEPENDS += "qemu-xilinx-multiarch-helper-native" + +do_install:append() { + # The following is also installed by qemu-native + rm -f ${D}${datadir}/qemu/trace-events-all + rm -rf ${D}${datadir}/qemu/keymaps + rm -rf ${D}${datadir}/icons + rm -rf ${D}${includedir}/qemu-plugin.h + + # Install qmp.py to be used with testimage + install -d ${D}${libdir}/qemu-python/qmp/ + install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.1.bb new file mode 100644 index 00000000..3264c260 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.1.bb @@ -0,0 +1,38 @@ +require qemu-system-native-alt.inc +require qemu-xilinx-2023.1.inc +require qemu-xilinx-native-7.1.inc + +PROVIDES = "qemu-system-native" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" + +PACKAGECONFIG ??= "fdt alsa kvm gcrypt pie slirp" + +PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" + +DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" +DEPENDS += "qemu-xilinx-multiarch-helper-native" + +do_install:append() { + # The following is also installed by qemu-native + rm -f ${D}${datadir}/qemu/trace-events-all + rm -rf ${D}${datadir}/qemu/keymaps + rm -rf ${D}${datadir}/icons + rm -rf ${D}${includedir}/qemu-plugin.h + + # Install qmp.py to be used with testimage + install -d ${D}${libdir}/qemu-python/qmp/ + install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.2.bb new file mode 100644 index 00000000..fdf3be2e --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx-system-native_2023.2.bb @@ -0,0 +1,38 @@ +require qemu-system-native-alt.inc +require qemu-xilinx-2023.2.inc +require qemu-xilinx-native-7.1.inc + +PROVIDES = "qemu-system-native" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" + +PACKAGECONFIG ??= "fdt alsa kvm gcrypt pie slirp" + +PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" + +DEPENDS += "pixman-native qemu-xilinx-native bison-native ninja-native meson-native" +DEPENDS += "qemu-xilinx-multiarch-helper-native" + +do_install:append() { + # The following is also installed by qemu-native + rm -f ${D}${datadir}/qemu/trace-events-all + rm -rf ${D}${datadir}/qemu/keymaps + rm -rf ${D}${datadir}/icons + rm -rf ${D}${includedir}/qemu-plugin.h + + # Install qmp.py to be used with testimage + install -d ${D}${libdir}/qemu-python/qmp/ + install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb new file mode 100644 index 00000000..96b26101 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.1.bb @@ -0,0 +1,38 @@ +require qemu-xilinx-2022.1.inc +require recipes-devtools/qemu/qemu.inc +require qemu-xilinx-7.1.inc +require qemu-alt.inc + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" + +BBCLASSEXTEND = "nativesdk" + +RDEPENDS:${PN}:class-target += "bash" + +PROVIDES:class-nativesdk = "nativesdk-qemu" +RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" + +do_install:append:class-nativesdk() { + ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.2.bb new file mode 100644 index 00000000..c6e91fdd --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2022.2.bb @@ -0,0 +1,36 @@ +require qemu-xilinx-2022.2.inc +require recipes-devtools/qemu/qemu.inc +require qemu-xilinx-7.1.inc +require qemu-alt.inc + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" + +BBCLASSEXTEND = "nativesdk" + +RDEPENDS:${PN}:class-target += "bash" + +PROVIDES:class-nativesdk = "nativesdk-qemu" +RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" + +do_install:append:class-nativesdk() { + ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.1.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.1.bb new file mode 100644 index 00000000..fca09883 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.1.bb @@ -0,0 +1,38 @@ +require qemu-xilinx-2023.1.inc +require recipes-devtools/qemu/qemu.inc +require qemu-xilinx-7.1.inc +require qemu-alt.inc + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" + +BBCLASSEXTEND = "nativesdk" + +RDEPENDS:${PN}:class-target += "bash" + +PROVIDES:class-nativesdk = "nativesdk-qemu" +RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" + +do_install:append:class-nativesdk() { + ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.2.bb b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.2.bb new file mode 100644 index 00000000..070ae65f --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-xilinx_2023.2.bb @@ -0,0 +1,38 @@ +require qemu-xilinx-2023.2.inc +require recipes-devtools/qemu/qemu.inc +require qemu-xilinx-7.1.inc +require qemu-alt.inc + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" + +BBCLASSEXTEND = "nativesdk" + +RDEPENDS:${PN}:class-target += "bash" + +PROVIDES:class-nativesdk = "nativesdk-qemu" +RPROVIDES:${PN}:class-nativesdk = "nativesdk-qemu" + +# Latest poky has changed the defaults, restore them to something compatible +# with this QEMU. When we update to QEMU 8.x this won't be necessary. +EXTRA_OECONF:remove = "--disable-download" +EXTRA_OECONF:remove = "--disable-docs" +EXTRA_OECONF:remove = "--disable-af-xdp" + +EXTRA_OECONF:append = "\ + --with-git=/bin/false \ + --with-git-submodules=ignore \ + --meson=meson \ +" + +EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" + +do_install:append:class-nativesdk() { + ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} +} diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu_%.bbappend b/meta-xilinx-core/recipes-devtools/qemu/qemu_%.bbappend new file mode 100644 index 00000000..04c89b83 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu_%.bbappend @@ -0,0 +1,8 @@ +require qemu-alt.inc + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH:class-target = "${@bb.utils.contains_any('DEPENDS', 'libepoxy virglrenderer', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" diff --git a/meta-xilinx-core/recipes-devtools/run-postinsts/run-postinsts_%.bbappend b/meta-xilinx-core/recipes-devtools/run-postinsts/run-postinsts_%.bbappend new file mode 100644 index 00000000..cb5a912b --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/run-postinsts/run-postinsts_%.bbappend @@ -0,0 +1,7 @@ +# Update-alternatives is not able to find stdout when using JTAG boot mode on +# our devices, exits ungracefully without performing the required work (symbolic +# linking), pass kmsg to it as output to achieve proper behavior. + +do_install:append(){ + sed -i "s/sh -c \$i \$append_log/sh -c \$i > \/dev\/kmsg/" ${D}${sbindir}/run-postinsts +} diff --git a/meta-xilinx-core/recipes-gnome/gtk+/gtk+3_%.bbappend b/meta-xilinx-core/recipes-gnome/gtk+/gtk+3_%.bbappend new file mode 100644 index 00000000..03823f6e --- /dev/null +++ b/meta-xilinx-core/recipes-gnome/gtk+/gtk+3_%.bbappend @@ -0,0 +1,6 @@ +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" diff --git a/meta-xilinx-core/recipes-graphics/libepoxy/libepoxy_%.bbappend b/meta-xilinx-core/recipes-graphics/libepoxy/libepoxy_%.bbappend new file mode 100644 index 00000000..03823f6e --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libepoxy/libepoxy_%.bbappend @@ -0,0 +1,6 @@ +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/egl.pc b/meta-xilinx-core/recipes-graphics/libgles/files/egl.pc new file mode 100644 index 00000000..65c4c1f3 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/egl.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=/usr/lib +includedir=/usr/include + +Name: egl +Description: MALI EGL library +Requires.private: +Version: 17.3 +Libs: -L${libdir} -lEGL +Libs.private: -lm -lpthread -ldl +Cflags: -I${includedir} diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/gbm.pc b/meta-xilinx-core/recipes-graphics/libgles/files/gbm.pc new file mode 100644 index 00000000..c40b5f4f --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/gbm.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=/usr/lib +includedir=/usr/include + +Name: gbm +Description: MALI gbm library +Requires.private: +Version: 17.3 +Libs: -L${libdir} -lgbm +Libs.private: -lm -lpthread -ldl +Cflags: -I${includedir} diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/glesv1.pc b/meta-xilinx-core/recipes-graphics/libgles/files/glesv1.pc new file mode 100644 index 00000000..39467f33 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/glesv1.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=/usr/lib +includedir=/usr/include + +Name: glesv1 +Description: MALI OpenGL ES 1.1 library +Requires.private: +Version: 17.3 +Libs: -L${libdir} -lGLESv1_CM +Libs.private: -lm -lpthread -ldl +Cflags: -I${includedir} diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/glesv1_cm.pc b/meta-xilinx-core/recipes-graphics/libgles/files/glesv1_cm.pc new file mode 100644 index 00000000..1547b4c8 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/glesv1_cm.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=/usr/lib +includedir=/usr/include + +Name: gles_cm +Description: Mali OpenGL ES 1.1 CM library +Requires.private: +Version: 17.3 +Libs: -L${libdir} -lGLESv1_CM +Libs.private: -lm -lpthread -ldl +Cflags: -I${includedir} diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/glesv2.pc b/meta-xilinx-core/recipes-graphics/libgles/files/glesv2.pc new file mode 100644 index 00000000..a0a84f23 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/glesv2.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=/usr/lib +includedir=/usr/include + +Name: glesv2 +Description: MALI OpenGL ES 2.0 library +Requires.private: +Version: 17.3 +Libs: -L${libdir} -lGLESv2 +Libs.private: -lm -lpthread -ldl +Cflags: -I${includedir} diff --git a/meta-xilinx-core/recipes-graphics/libgles/libmali-xlnx.bb b/meta-xilinx-core/recipes-graphics/libgles/libmali-xlnx.bb new file mode 100644 index 00000000..db99c4d7 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/libmali-xlnx.bb @@ -0,0 +1,200 @@ +DESCRIPTION = "libGLES for ZynqMP with Mali 400" + +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://EULA;md5=82e466d0ed92c5a15f568dbe6b31089c" + +inherit features_check update-alternatives + +ANY_OF_DISTRO_FEATURES = "x11 fbdev wayland" +REQUIRED_MACHINE_FEATURES = "mali400" + +PROVIDES += "virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +REPO ?= "git://github.com/Xilinx/mali-userspace-binaries.git;protocol=https" +BRANCH ?= "xlnx_rel_v2023.2" +SRCREV ?= "b3a772aad859cdadc8513b11c3e995546c20e75e" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" + +PV = "r9p0-01rel0" +SRC_URI = " \ + ${REPO};${BRANCHARG} \ + file://egl.pc \ + file://glesv1_cm.pc \ + file://glesv1.pc \ + file://glesv2.pc \ + file://gbm.pc \ + " + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/git" + +# If were switching at runtime, we would need all RDEPENDS needed for all backends available +X11RDEPENDS = "libxdamage libxext libx11 libdrm libxfixes" +X11DEPENDS = "libxdamage libxext virtual/libx11 libdrm libxfixes" + +# Don't install runtime dependencies for other backends unless the DISTRO supports it +RDEPENDS:${PN} = " \ + kernel-module-mali \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11RDEPENDS}', '', d)} \ +" + +# We dont build anything but we want to avoid QA warning build-deps +DEPENDS = "\ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland libdrm', '', d)} \ +" + + +# x11 is default, set to "fbdev" , "wayland", or "headless" if required +MALI_BACKEND_DEFAULT ?= "x11" + +USE_X11 = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "yes", "no", d)}" +USE_FB = "${@bb.utils.contains("DISTRO_FEATURES", "fbdev", "yes", "no", d)}" +USE_WL = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "yes", "no", d)}" + +MONOLITHIC_LIBMALI = "libMali.so.9.0" + +do_install() { + #Identify the ARCH type + ${TARGET_PREFIX}gcc --version > ARCH_PLATFORM + if grep -q aarch64 "ARCH_PLATFORM"; then + ARCH_PLATFORM_DIR=aarch64-linux-gnu + else + ARCH_PLATFORM_DIR=arm-linux-gnueabihf + fi + + # install headers + install -d -m 0655 ${D}${includedir}/EGL + install -m 0644 ${S}/${PV}/glesHeaders/EGL/*.h ${D}${includedir}/EGL/ + install -d -m 0655 ${D}${includedir}/GLES + install -m 0644 ${S}/${PV}/glesHeaders/GLES/*.h ${D}${includedir}/GLES/ + install -d -m 0655 ${D}${includedir}/GLES2 + install -m 0644 ${S}/${PV}/glesHeaders/GLES2/*.h ${D}${includedir}/GLES2/ + install -d -m 0655 ${D}${includedir}/KHR + install -m 0644 ${S}/${PV}/glesHeaders/KHR/*.h ${D}${includedir}/KHR/ + + install -d ${D}${libdir}/pkgconfig + install -m 0644 ${WORKDIR}/egl.pc ${D}${libdir}/pkgconfig/egl.pc + install -m 0644 ${WORKDIR}/glesv2.pc ${D}${libdir}/pkgconfig/glesv2.pc + install -m 0644 ${WORKDIR}/glesv1.pc ${D}${libdir}/pkgconfig/glesv1.pc + install -m 0644 ${WORKDIR}/glesv1_cm.pc ${D}${libdir}/pkgconfig/glesv1_cm.pc + + install -d ${D}${libdir} + install -d ${D}${includedir} + + cp -a --no-preserve=ownership ${S}/${PV}/${ARCH_PLATFORM_DIR}/common/*.so* ${D}${libdir} + + install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/headless/${MONOLITHIC_LIBMALI} ${D}${libdir}/headless/${MONOLITHIC_LIBMALI} + ln -snf headless/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} + + if [ "${USE_FB}" = "yes" ]; then + install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/fbdev/${MONOLITHIC_LIBMALI} ${D}${libdir}/fbdev/${MONOLITHIC_LIBMALI} + if [ "${MALI_BACKEND_DEFAULT}" = "fbdev" ]; then + ln -snf fbdev/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} + fi + fi + if [ "${USE_X11}" = "yes" ]; then + install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/x11/${MONOLITHIC_LIBMALI} ${D}${libdir}/x11/${MONOLITHIC_LIBMALI} + if [ "${MALI_BACKEND_DEFAULT}" = "x11" ]; then + ln -snf x11/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} + fi + else + # We cant rely on the fact that all apps will use pkgconfig correctly + sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if (1)/' ${D}${includedir}/EGL/eglplatform.h + fi + if [ "${USE_WL}" = "yes" ]; then + install -m 0644 ${S}/${PV}/glesHeaders/GBM/gbm.h ${D}${includedir}/ + install -m 0644 ${WORKDIR}/gbm.pc ${D}${libdir}/pkgconfig/gbm.pc + install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/wayland/${MONOLITHIC_LIBMALI} ${D}${libdir}/wayland/${MONOLITHIC_LIBMALI} + if [ "${MALI_BACKEND_DEFAULT}" = "wayland" ]; then + ln -snf wayland/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} + fi + fi +} + + +# We need separate packages to provide multiple alternatives, at this point we install +# everything on the default one but that can be split if necessary +PACKAGES += "${@bb.utils.contains("DISTRO_FEATURES", "x11", "${PN}-x11", "", d)}" +PACKAGES += "${@bb.utils.contains("DISTRO_FEATURES", "fbdev", "${PN}-fbdev", "", d)}" +PACKAGES += "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "${PN}-wayland", "", d)}" +PACKAGES += "${PN}-headless" + +# This is default/common for all alternatives +ALTERNATIVE_LINK_NAME[libmali-xlnx] = "${libdir}/${MONOLITHIC_LIBMALI}" + + +# Declare alternatives and corresponding library location +ALTERNATIVE:${PN}-x11 = "libmali-xlnx" +ALTERNATIVE_TARGET_libmali-xlnx-x11[libmali-xlnx] = "${libdir}/x11/${MONOLITHIC_LIBMALI}" + +ALTERNATIVE:${PN}-fbdev = "libmali-xlnx" +ALTERNATIVE_TARGET_libmali-xlnx-fbdev[libmali-xlnx] = "${libdir}/fbdev/${MONOLITHIC_LIBMALI}" + +ALTERNATIVE:${PN}-wayland = "libmali-xlnx" +ALTERNATIVE_TARGET_libmali-xlnx-wayland[libmali-xlnx] = "${libdir}/wayland/${MONOLITHIC_LIBMALI}" + +ALTERNATIVE:${PN}-headless = "libmali-xlnx" +ALTERNATIVE_TARGET_libmali-xlnx-headless[libmali-xlnx] = "${libdir}/headless/${MONOLITHIC_LIBMALI}" + +# Set priorities according to what we prveiously defined +ALTERNATIVE_PRIORITY_libmali-xlnx-x11[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "x11", "20", "10", d)}" +ALTERNATIVE_PRIORITY_libmali-xlnx-fbdev[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "fbdev", "20", "10", d)}" +ALTERNATIVE_PRIORITY_libmali-xlnx-wayland[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "wayland", "20", "10", d)}" + +# If misconfigured, fallback to headless +ALTERNATIVE_PRIORITY_libmali-xlnx-headless[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "headless", "20", "15", d)}" + + +# Package gets renamed on the debian class, but we want to keep -xlnx +DEBIAN_NOAUTONAME:libmali-xlnx = "1" + +# Update alternatives will actually have separate postinst scripts (one for each package) +# This wont work for us, so we create a common postinst script and we pass that as the general +# libmali-xlnx postinst script, but we defer execution to run on first boot (pkg_postinst_ontarget). +# This will avoid ldconfig removing the symbolic links when creating the root filesystem. +python populate_packages_updatealternatives:append () { + # We need to remove the 'fake' libmali-xlnx before creating any links + libdir = d.getVar('libdir') + common_postinst = "#!/bin/sh\nrm " + libdir + "/${MONOLITHIC_LIBMALI}\n" + for pkg in (d.getVar('PACKAGES') or "").split(): + # Not all packages provide an alternative (e.g. ${PN}-lic) + postinst = d.getVar('pkg_postinst:%s' % pkg) + if postinst: + old_postinst = postinst + new_postinst = postinst.replace('#!/bin/sh','') + common_postinst += new_postinst + d.setVar('pkg_postinst_ontarget:%s' % 'libmali-xlnx', common_postinst) +} + + +# Inhibit warnings about files being stripped +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" +INHIBIT_SYSROOT_STRIP = "1" + +RREPLACES:${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2 libgbm" +RPROVIDES:${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2 libgbm" +RCONFLICTS:${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2 libgbm" + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. +EXCLUDE_FROM_WORLD = "1" +FILES:${PN} += "${libdir}/*" + +do_package:append() { + + shlibswork_dir = d.getVar('SHLIBSWORKDIR') + pkg_filename = d.getVar('PN') + ".list" + shlibs_file = os.path.join(shlibswork_dir, pkg_filename) + lines = "" + with open(shlibs_file, "r") as f: + lines = f.readlines() + with open(shlibs_file, "w") as f: + for line in lines: + if d.getVar('MALI_BACKEND_DEFAULT') in line.strip("\n"): + f.write(line) +} diff --git a/meta-xilinx-core/recipes-graphics/libglu/libglu_%.bbappend b/meta-xilinx-core/recipes-graphics/libglu/libglu_%.bbappend new file mode 100644 index 00000000..e824a179 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libglu/libglu_%.bbappend @@ -0,0 +1,11 @@ +# OpenGL comes from libmali, adjust parameters +MALI_DEPENDS = "${@bb.utils.contains('DISTRO_FEATURES', 'libmali', ' virtual/libgles2', '', d)}" +DEPENDS:append = "${@bb.utils.contains('MACHINE_FEATURES', 'mali400', ' ${MALI_DEPENDS}', '', d)}" + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" + diff --git a/meta-xilinx-core/recipes-graphics/libsdl2/libsdl2_%.bbappend b/meta-xilinx-core/recipes-graphics/libsdl2/libsdl2_%.bbappend new file mode 100644 index 00000000..03823f6e --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libsdl2/libsdl2_%.bbappend @@ -0,0 +1,6 @@ +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb new file mode 100644 index 00000000..268759c2 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali.bb @@ -0,0 +1,57 @@ +SUMMARY = "A Mali 400 Linux Kernel module" +SECTION = "kernel/modules" + +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = " \ + file://linux/license/gpl/mali_kernel_license.h;md5=f5af2d61f4c1eb262cb6a557aaa1070a \ + " + +PV = "r9p0-01rel0" + +SRC_URI = " \ + https://developer.arm.com/-/media/Files/downloads/mali-drivers/kernel/mali-utgard-gpu/DX910-SW-99002-${PV}.tgz \ + file://0001-Change-Makefile-to-be-compatible-with-Yocto.patch \ + file://0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch \ + file://0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch \ + file://0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch \ + file://0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch \ + file://0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch \ + file://0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch \ + file://0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch\ + file://0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch\ + file://0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch\ + file://0014-linux-mali_-timer-Get-rid-of-init_timer.patch\ + file://0015-fix-driver-failed-to-check-map-error.patch \ + file://0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch \ + file://0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch \ + file://0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch \ + file://0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch \ + file://0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch \ + file://0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch \ + file://0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch \ + file://0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch \ + file://0024-Use-community-device-tree-names.patch \ + file://0025-Import-DMA_BUF-module-and-update-register_shrinker-f.patch \ + file://0026-Fix-gpu-driver-probe-failure.patch \ + file://0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch \ + " +SRC_URI[md5sum] = "85ea110dd6675c70b7d01af87ec9633c" +SRC_URI[sha256sum] = "7a67127341d17640c1fff5dad80258fb2a37c8a2121b81525fe2327e4532ce2b" + +inherit features_check module + +PARALLEL_MAKE = "-j 1" + +S = "${WORKDIR}/DX910-SW-99002-${PV}/driver/src/devicedrv/mali" + +REQUIRED_MACHINE_FEATURES = "mali400" + +EXTRA_OEMAKE = 'KDIR="${STAGING_KERNEL_DIR}" \ + ARCH="${ARCH}" \ + BUILD=release \ + MALI_PLATFORM="arm" \ + USING_DT=1 \ + MALI_SHARED_INTERRUPTS=1 \ + CROSS_COMPILE="${TARGET_PREFIX}" \ + MALI_QUIET=1 \ + ' diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch index 0314734e..3c82f602 100644 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0001-Change-Makefile-to-be-compatible-with-Yocto.patch @@ -1,38 +1,36 @@ -From d9a4441c31faef60b7f39692df6913d58ec69d1b Mon Sep 17 00:00:00 2001 -From: Hyun Kwon <hyun.kwon@xilinx.com> -Date: Thu, 8 Sep 2016 09:56:40 -0700 -Subject: [PATCH 1/6] Change Makefile to be compatible with Yocto +From 6d283b9aa3f7fb761da4cb076b47a62275fc4caa Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurki@xilinx.com> +Date: Tue, 21 Nov 2017 03:57:25 -0800 +Subject: [PATCH 1/9] Change Makefile to be compatible with Yocto Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> -Upstream Status: Pending +Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> +Upstream Status: Inappropriate [Xilinx specific] --- - driver/src/devicedrv/mali/Makefile | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) + driver/src/devicedrv/mali/Makefile | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/driver/src/devicedrv/mali/Makefile b/driver/src/devicedrv/mali/Makefile -index f39ae4d..9ef9713 100755 +index 5a259fe..a6dd94c 100644 --- Makefile +++ b/Makefile -@@ -88,7 +88,11 @@ endif +@@ -89,7 +89,11 @@ endif # Define host system directory KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build -include $(KDIR)/.config +ifeq ($(O),) -+ include $(KDIR)/.config ++ -include $(KDIR)/.config +else -+ include $(O)/.config ++ -include $(O)/.config +endif ifeq ($(ARCH), arm) # when compiling for ARM we're cross compiling -@@ -193,10 +197,15 @@ ifeq ($(MALI_MEM_SWAP_TRACKING),1) - EXTRA_DEFINES += -DMALI_MEM_SWAP_TRACKING=1 +@@ -204,9 +208,12 @@ EXTRA_DEFINES += -DMALI_MEM_SWAP_TRACKING=1 endif -+EXTRA_DEFINES += -Wno-error=date-time -+ all: $(UMP_SYMVERS_FILE) - $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules + $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) O=$(O) modules diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch index 363153ee..0a7b6736 100644 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r7p0-00rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0002-staging-mali-r8p0-01rel0-Add-the-ZYNQ-ZYNQMP-platfor.patch @@ -1,19 +1,19 @@ -From 65a8f9eb32322538396607805dcbc28aa0aadcb7 Mon Sep 17 00:00:00 2001 +From f27aab2b0e4d5dea9b5a0e4648c142257940c428 Mon Sep 17 00:00:00 2001 From: Hyun Kwon <hyun.kwon@xilinx.com> Date: Thu, 25 Jun 2015 17:14:42 -0700 -Subject: [PATCH 2/6] staging: mali: r7p0-00rel0: Add the ZYNQ/ZYNQMP platform +Subject: [PATCH 2/9] staging: mali: r8p0-01rel0: Add the ZYNQ/ZYNQMP platform Add the number of PP cores that is required for Zynq/ZynqMP configuration. Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> -Upstream Status: Pending +Upstream Status: Inappropriate [Xilinx specific] --- driver/src/devicedrv/mali/platform/arm/arm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c -index a7ff1b2..0682842 100755 +index 4e09aca..fac99bc 100644 --- platform/arm/arm.c +++ b/platform/arm/arm.c @@ -261,6 +261,10 @@ static struct mali_gpu_device_data mali_gpu_data = { diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r7p0-00rel0-Remove-unused-trace-macros.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch index fc0dc6e6..98aa6ac9 100644 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r7p0-00rel0-Remove-unused-trace-macros.patch +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0003-staging-mali-r8p0-01rel0-Remove-unused-trace-macros.patch @@ -1,21 +1,22 @@ -From c86d22f1133647518a68f9f1cbe73e1797e68fa8 Mon Sep 17 00:00:00 2001 -From: Hyun Kwon <hyun.kwon@xilinx.com> -Date: Tue, 3 May 2016 08:11:38 -0700 -Subject: [PATCH 3/6] staging: mali: r7p0-00rel0: Remove unused trace macros +From d6e44bbf8d1377f78481f611dec237e8d24baf74 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurki@xilinx.com> +Date: Tue, 21 Nov 2017 04:00:27 -0800 +Subject: [PATCH 3/9] staging: mali: r8p0-01rel0: Remove unused trace macros TRACE_SYSTEM_STRING is not need in each trace file anymore. Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> +Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> Upstream Status: Pending --- driver/src/devicedrv/mali/linux/mali_linux_trace.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/driver/src/devicedrv/mali/linux/mali_linux_trace.h b/driver/src/devicedrv/mali/linux/mali_linux_trace.h -index 2c91ddc..d4e45ab 100755 +index 7f0b19d..33cb1ca 100644 --- linux/mali_linux_trace.h +++ b/linux/mali_linux_trace.h -@@ -13,12 +13,10 @@ +@@ -13,13 +13,11 @@ #include <linux/types.h> @@ -24,8 +25,9 @@ index 2c91ddc..d4e45ab 100755 #undef TRACE_SYSTEM #define TRACE_SYSTEM mali + #ifndef TRACEPOINTS_ENABLED -#define TRACE_SYSTEM_STRING __stringfy(TRACE_SYSTEM) - + #endif #define TRACE_INCLUDE_PATH . #define TRACE_INCLUDE_FILE mali_linux_trace -- diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r7p0-00rel0-Don-t-include-mali_read_phy.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch index ce3bea0a..c5c49679 100644 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r7p0-00rel0-Don-t-include-mali_read_phy.patch +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0004-staging-mali-r8p0-01rel0-Don-t-include-mali_read_phy.patch @@ -1,19 +1,19 @@ -From 3e6fb4697bddc4cfbb82e6a0b2f9f28d5c1d0a04 Mon Sep 17 00:00:00 2001 +From 2f5e8944357f43fbde4cb642c6ee4a699c88efb5 Mon Sep 17 00:00:00 2001 From: Hyun Kwon <hyun.kwon@xilinx.com> Date: Wed, 29 Jun 2016 09:14:37 -0700 -Subject: [PATCH 4/6] staging: mali: r7p0-00rel0: Don't include +Subject: [PATCH 4/9] staging: mali: r8p0-01rel0: Don't include mali_read_phys() for zynq/zynqmp mali_read_phys() is not used with CONFIG_ARCH_ZYNQ and CONFIG_ARCH_ZYNQMP. Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com> -Upstream Status: Pending +Upstream Status: Inappropriate [Xilinx specific] --- driver/src/devicedrv/mali/platform/arm/arm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c -index 0682842..c6f58d8 100755 +index fac99bc..62f9be6 100644 --- platform/arm/arm.c +++ b/platform/arm/arm.c @@ -38,7 +38,9 @@ diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0009-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch index 34cbccf4..3d784604 100644 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0009-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch @@ -1,20 +1,20 @@ -From ba8c94302a1c606315109a9d1cee342213fdbf98 Mon Sep 17 00:00:00 2001 +From e67e20ec6ff0c9720d87844270421453c738066a Mon Sep 17 00:00:00 2001 From: Madhurkiran Harikrishnan <madhurki@xilinx.com> Date: Thu, 16 Feb 2017 12:15:58 -0800 -Subject: [PATCH] linux/mali_kernel_linux.c: Handle clock when probed and +Subject: [PATCH 5/9] linux/mali_kernel_linux.c: Handle clock when probed and removed This patch will handle the clock through clock specifier for GPU PP0 and PP1. Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> -Upstream-Status: Inappropriate [Specific to Xilinx ZynqMP] +Upstream Status: Inappropriate [Xilinx specific] --- .../src/devicedrv/mali/linux/mali_kernel_linux.c | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/driver/src/devicedrv/mali/linux/mali_kernel_linux.c b/driver/src/devicedrv/mali/linux/mali_kernel_linux.c -index 9bfa2bd..cfde20f 100755 +index d7893a3..f15fb56 100644 --- linux/mali_kernel_linux.c +++ b/linux/mali_kernel_linux.c @@ -45,6 +45,14 @@ diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0008-arm.c-dma_ops-will-be-modified-by-the-driver-only-ti.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch index c11b60a8..3e1745fd 100644 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0008-arm.c-dma_ops-will-be-modified-by-the-driver-only-ti.patch +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0006-arm.c-global-variable-dma_ops-is-removed-from-the-ke.patch @@ -1,12 +1,13 @@ -From 4bb78550d818b9e6491fa2d3b9706bb217a1597b Mon Sep 17 00:00:00 2001 +From ed7242238151c12029c566d1974058c579d8ae3d Mon Sep 17 00:00:00 2001 From: Madhurkiran Harikrishnan <madhurki@xilinx.com> Date: Wed, 25 Jan 2017 10:00:33 -0800 -Subject: [PATCH 2/2] arm.c: dma_ops will be modified by the driver only till - Kernel v4.7 +Subject: [PATCH 6/9] arm.c: global variable dma_ops is removed from the kernel + 4.7 -From v4.8(Platform specific) Kernel the arch_setup_dma_ops will -not give a dummy_dma_ops if acpi is disabled rather pass a valid -dma_ops. +Refer kernel commit 1dccb598df549d892b6450c261da54cdd7af44b4, the global +dma_ops variable and the special-casing for ACPI is removed , and just +returns the dma ops that got set for the device, or the dummy_dma_ops +if none were present. Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> Upstream Status: Pending @@ -15,7 +16,7 @@ Upstream Status: Pending 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/driver/src/devicedrv/mali/platform/arm/arm.c b/driver/src/devicedrv/mali/platform/arm/arm.c -index c6f58d8..36965fe 100755 +index 62f9be6..57ca989 100644 --- platform/arm/arm.c +++ b/platform/arm/arm.c @@ -529,8 +529,9 @@ int mali_platform_device_init(struct platform_device *device) diff --git a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch index ad159ba6..98a86c88 100644 --- a/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0010-common-mali_pm.c-Add-PM-runtime-barrier-after-removi.patch @@ -1,4 +1,4 @@ -From 572d234259158bf9f046c2393a65e2800bec1062 Mon Sep 17 00:00:00 2001 +From 58e2c55176f1a146781430b2a570c8ce5f80d426 Mon Sep 17 00:00:00 2001 From: Madhurkiran Harikrishnan <madhurki@xilinx.com> Date: Mon, 28 Aug 2017 09:40:37 -0700 Subject: [PATCH] common/mali_pm.c: Add PM runtime barrier after removing @@ -15,7 +15,7 @@ Upstream-Status: Pending 1 file changed, 1 insertion(+) diff --git a/driver/src/devicedrv/mali/common/mali_pm.c b/driver/src/devicedrv/mali/common/mali_pm.c -index 1ef03a6..0343ad3 100755 +index 858c689..62a1e5f 100644 --- common/mali_pm.c +++ b/common/mali_pm.c @@ -301,6 +301,7 @@ void mali_pm_init_end(void) diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch new file mode 100644 index 00000000..38ab4042 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0011-linux-mali_kernel_linux.c-Enable-disable-clock-for-r.patch @@ -0,0 +1,153 @@ +From aeff13ad9e9ef73172a9325f669aefd3c0403dbb Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurki@xilinx.com> +Date: Wed, 21 Feb 2018 16:52:15 -0800 +Subject: [PATCH] linux/mali_kernel_linux.c: Enable/disable clock for runtime + resume/suspend + +Enable/Disable the clock for GP,PP0 and PP1 during runtime +resume/suspend. + +Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com> +Reviewed-by: Hyun Kwon <hyunk@xilinx.com> +Upstream Status: Inappropriate [Xilinx specific] +--- + .../src/devicedrv/mali/linux/mali_kernel_linux.c | 65 ++++++++++++++++++---- + 1 file changed, 54 insertions(+), 11 deletions(-) + +diff --git a/driver/src/devicedrv/mali/linux/mali_kernel_linux.c b/driver/src/devicedrv/mali/linux/mali_kernel_linux.c +index f15fb56..e61f33b 100644 +--- linux/mali_kernel_linux.c ++++ b/linux/mali_kernel_linux.c +@@ -51,6 +51,7 @@ + struct clk *clk_gpu; + struct clk *clk_gpu_pp0; + struct clk *clk_gpu_pp1; ++mali_bool clk_enabled; + #endif + + #if defined(CONFIG_MALI400_PROFILING) && defined(CONFIG_MALI_DVFS) +@@ -281,6 +282,46 @@ struct file_operations mali_fops = { + .mmap = mali_mmap + }; + ++static int mali_enable_clk(void) ++{ ++#if defined(CONFIG_ARCH_ZYNQMP) ++ int err = 0; ++ ++ if (clk_enabled) ++ return 0; ++ ++ clk_enabled = MALI_TRUE; ++ err = clk_prepare_enable(clk_gpu); ++ if (err) { ++ MALI_PRINT_ERROR(("Could not enable clock for GP\n\r")); ++ return err; ++ } ++ err = clk_prepare_enable(clk_gpu_pp0); ++ if (err) { ++ MALI_PRINT_ERROR(("Could not enable clock for PP0\n\r")); ++ return err; ++ } ++ err = clk_prepare_enable(clk_gpu_pp1); ++ if (err) { ++ MALI_PRINT_ERROR(("Could not enable clock for PP1\n\r")); ++ return err; ++ } ++#endif ++ return 0; ++} ++ ++static void mali_disable_clk(void) ++{ ++#if defined(CONFIG_ARCH_ZYNQMP) ++ if (clk_enabled) { ++ clk_enabled = MALI_FALSE; ++ clk_disable_unprepare(clk_gpu); ++ clk_disable_unprepare(clk_gpu_pp0); ++ clk_disable_unprepare(clk_gpu_pp1); ++ } ++#endif ++} ++ + #if MALI_ENABLE_CPU_CYCLES + void mali_init_cpu_time_counters(int reset, int enable_divide_by_64) + { +@@ -593,18 +634,19 @@ static int mali_probe(struct platform_device *pdev) + clk_gpu = devm_clk_get(&pdev->dev, "gpu"); + if (IS_ERR(clk_gpu)) + return PTR_ERR(clk_gpu); +- clk_prepare_enable(clk_gpu); + + clk_gpu_pp0 = devm_clk_get(&pdev->dev, "gpu_pp0"); + if (IS_ERR(clk_gpu_pp0)) + return PTR_ERR(clk_gpu_pp0); +- clk_prepare_enable(clk_gpu_pp0); + + clk_gpu_pp1 = devm_clk_get(&pdev->dev, "gpu_pp1"); + if (IS_ERR(clk_gpu_pp1)) + return PTR_ERR(clk_gpu_pp1); +- clk_prepare_enable(clk_gpu_pp1); + #endif ++ ++ err = mali_enable_clk(); ++ if (err) ++ return err; + if (_MALI_OSK_ERR_OK == _mali_osk_wq_init()) { + /* Initialize the Mali GPU HW specified by pdev */ + if (_MALI_OSK_ERR_OK == mali_initialize_subsystems()) { +@@ -632,11 +674,6 @@ static int mali_probe(struct platform_device *pdev) + _mali_osk_wq_term(); + } + +-#if defined(CONFIG_ARCH_ZYNQMP) +- clk_disable_unprepare(clk_gpu); +- clk_disable_unprepare(clk_gpu_pp0); +- clk_disable_unprepare(clk_gpu_pp1); +-#endif + + #ifdef CONFIG_MALI_DEVFREQ + mali_devfreq_term(mdev); +@@ -644,6 +681,7 @@ devfreq_init_failed: + mali_pm_metrics_term(mdev); + pm_metrics_init_failed: + clk_disable_unprepare(mdev->clock); ++ mali_disable_clk(); + clock_prepare_failed: + clk_put(mdev->clock); + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && defined(CONFIG_OF) \ +@@ -706,9 +744,7 @@ static int mali_remove(struct platform_device *pdev) + + #if defined(CONFIG_ARCH_ZYNQMP) + /* Remove clock */ +- clk_disable_unprepare(clk_gpu); +- clk_disable_unprepare(clk_gpu_pp0); +- clk_disable_unprepare(clk_gpu_pp1); ++ mali_disable_clk(); + #endif + + return 0; +@@ -816,6 +852,8 @@ static int mali_driver_runtime_suspend(struct device *dev) + devfreq_suspend_device(mdev->devfreq); + #endif + ++ mali_disable_clk(); ++ + return 0; + } else { + return -EBUSY; +@@ -824,6 +862,11 @@ static int mali_driver_runtime_suspend(struct device *dev) + + static int mali_driver_runtime_resume(struct device *dev) + { ++ int err ; ++ ++ err = mali_enable_clk(); ++ if (err) ++ return err; + #ifdef CONFIG_MALI_DEVFREQ + struct mali_device *mdev = dev_get_drvdata(dev); + if (!mdev) +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch new file mode 100644 index 00000000..24f0a22c --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0012-linux-mali_memory_os_alloc-Remove-__GFP_COLD.patch @@ -0,0 +1,33 @@ +From 779b1883d56804ecd08fe7f57d6c01e3db4e893b Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Wed, 5 Dec 2018 18:07:29 -0800 +Subject: [PATCH 1/3] linux: mali_memory_os_alloc: Remove __GFP_COLD + +The support for Cache hot and cold pages are removed from the kernel. +For more information refer kernel commit 453f85d43fa9ee243f0fc3ac4e1be45615301e3f + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> +Upstream Status: Pending +--- + driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c +index 1602371..830e8c6 100644 +--- linux/mali_memory_os_alloc.c ++++ b/linux/mali_memory_os_alloc.c +@@ -202,7 +202,9 @@ int mali_mem_os_alloc_pages(mali_mem_os_mem *os_mem, u32 size) + /* Allocate new pages, if needed. */ + for (i = 0; i < remaining; i++) { + dma_addr_t dma_addr; +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ gfp_t flags = __GFP_ZERO | __GFP_RETRY_MAYFAIL | __GFP_NOWARN; ++#elif LINUX_VERSION_CODE == KERNEL_VERSION(4, 14, 0) + gfp_t flags = __GFP_ZERO | __GFP_RETRY_MAYFAIL | __GFP_NOWARN | __GFP_COLD; + #else + gfp_t flags = __GFP_ZERO | __GFP_REPEAT | __GFP_NOWARN | __GFP_COLD; +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch new file mode 100644 index 00000000..c28a83f4 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0013-linux-mali_memory_secure-Add-header-file-dma-direct..patch @@ -0,0 +1,34 @@ +From d20b6eb3e48e56558488dbdda98875b1aed0c29f Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Wed, 5 Dec 2018 18:13:28 -0800 +Subject: [PATCH 2/3] linux: mali_memory_secure: Add header file dma-direct.h + +Add dma-direct.h header, as API dma_to_phys is defined here. +refer kernel commit ea8c64ace86647260ec4255f483e5844d62af2df + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> +Upstream Status: Pending +--- + driver/src/devicedrv/mali/linux/mali_memory_secure.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/driver/src/devicedrv/mali/linux/mali_memory_secure.c b/driver/src/devicedrv/mali/linux/mali_memory_secure.c +index 2836b1b..4f55fa5 100644 +--- linux/mali_memory_secure.c ++++ b/linux/mali_memory_secure.c +@@ -13,7 +13,11 @@ + #include "mali_memory_secure.h" + #include "mali_osk.h" + #include <linux/mutex.h> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) ++#include <linux/dma-direct.h> ++#else + #include <linux/dma-mapping.h> ++#endif + #include <linux/dma-buf.h> + + _mali_osk_errcode_t mali_mem_secure_attach_dma_buf(mali_mem_secure *secure_mem, u32 size, int mem_fd) +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch new file mode 100644 index 00000000..a7c1d5cc --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0014-linux-mali_-timer-Get-rid-of-init_timer.patch @@ -0,0 +1,156 @@ +From b6936450484b5aa9dd2438367a907af020341d1d Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Thu, 6 Dec 2018 13:30:44 -0800 +Subject: [PATCH 3/3] linux: mali_*timer: Get rid of init_timer + +kernel 4.19 got rid of ancient init_timer. Hence, replace it with +timer_setup API. For more information refer kernel commit +7eeb6b893bd28c68b6d664de1d3120e49b855cdb + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com> +Upstream Status: Pending +--- + driver/src/devicedrv/mali/common/mali_control_timer.c | 6 ++++++ + driver/src/devicedrv/mali/common/mali_group.c | 6 ++++++ + driver/src/devicedrv/mali/common/mali_osk.h | 15 ++++++++++++++- + driver/src/devicedrv/mali/linux/mali_osk_timers.c | 15 ++++++++++++++- + 4 files changed, 40 insertions(+), 2 deletions(-) + +diff --git a/driver/src/devicedrv/mali/common/mali_control_timer.c b/driver/src/devicedrv/mali/common/mali_control_timer.c +index 1296ffe..d24b934 100644 +--- common/mali_control_timer.c ++++ b/common/mali_control_timer.c +@@ -65,11 +65,17 @@ _mali_osk_errcode_t mali_control_timer_init(void) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ mali_control_timer = _mali_osk_timer_init(mali_control_timer_callback); ++#else + mali_control_timer = _mali_osk_timer_init(); ++#endif + if (NULL == mali_control_timer) { + return _MALI_OSK_ERR_FAULT; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + _mali_osk_timer_setcallback(mali_control_timer, mali_control_timer_callback, NULL); ++#endif + + return _MALI_OSK_ERR_OK; + } +diff --git a/driver/src/devicedrv/mali/common/mali_group.c b/driver/src/devicedrv/mali/common/mali_group.c +index 5c7b3f4..1702e9a 100644 +--- common/mali_group.c ++++ b/common/mali_group.c +@@ -65,9 +65,15 @@ struct mali_group *mali_group_create(struct mali_l2_cache_core *core, + + group = _mali_osk_calloc(1, sizeof(struct mali_group)); + if (NULL != group) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ group->timeout_timer = _mali_osk_timer_init(mali_group_timeout); ++#else + group->timeout_timer = _mali_osk_timer_init(); ++#endif + if (NULL != group->timeout_timer) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + _mali_osk_timer_setcallback(group->timeout_timer, mali_group_timeout, (void *)group); ++#endif + + group->l2_cache_core[0] = core; + _mali_osk_list_init(&group->group_list); +diff --git a/driver/src/devicedrv/mali/common/mali_osk.h b/driver/src/devicedrv/mali/common/mali_osk.h +index a501778..fe93d79 100644 +--- common/mali_osk.h ++++ b/common/mali_osk.h +@@ -947,7 +947,17 @@ _mali_osk_errcode_t _mali_osk_notification_queue_dequeue(_mali_osk_notification_ + * asked for. + * + * @{ */ +- ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++/** @brief Initialize a timer ++ * ++ * Allocates resources for a new timer, and initializes them. This does not ++ * start the timer. ++ * ++ * @param callback Function to call when timer expires ++ * @return a pointer to the allocated timer object, or NULL on failure. ++ */ ++_mali_osk_timer_t *_mali_osk_timer_init(_mali_osk_timer_callback_t callback); ++#else + /** @brief Initialize a timer + * + * Allocates resources for a new timer, and initializes them. This does not +@@ -956,6 +966,7 @@ _mali_osk_errcode_t _mali_osk_notification_queue_dequeue(_mali_osk_notification_ + * @return a pointer to the allocated timer object, or NULL on failure. + */ + _mali_osk_timer_t *_mali_osk_timer_init(void); ++#endif + + /** @brief Start a timer + * +@@ -1034,6 +1045,7 @@ void _mali_osk_timer_del_async(_mali_osk_timer_t *tim); + */ + mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + /** @brief Set a timer's callback parameters. + * + * This must be called at least once before a timer is started/modified. +@@ -1047,6 +1059,7 @@ mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim); + * @param data Function-specific data to supply to the function on expiry. + */ + void _mali_osk_timer_setcallback(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback, void *data); ++#endif + + /** @brief Terminate a timer, and deallocate resources. + * +diff --git a/driver/src/devicedrv/mali/linux/mali_osk_timers.c b/driver/src/devicedrv/mali/linux/mali_osk_timers.c +index e5d7238..f9b5a86 100644 +--- linux/mali_osk_timers.c ++++ b/linux/mali_osk_timers.c +@@ -21,13 +21,24 @@ + struct _mali_osk_timer_t_struct { + struct timer_list timer; + }; +- ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++typedef void (*timer_timeout_function_t)(struct timer_list *); ++#else + typedef void (*timer_timeout_function_t)(unsigned long); ++#endif + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++_mali_osk_timer_t *_mali_osk_timer_init(_mali_osk_timer_callback_t callback) ++#else + _mali_osk_timer_t *_mali_osk_timer_init(void) ++#endif + { + _mali_osk_timer_t *t = (_mali_osk_timer_t *)kmalloc(sizeof(_mali_osk_timer_t), GFP_KERNEL); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ if (NULL != t) timer_setup(&t->timer, (timer_timeout_function_t)callback, 0); ++#else + if (NULL != t) init_timer(&t->timer); ++#endif + return t; + } + +@@ -62,12 +73,14 @@ mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim) + return 1 == timer_pending(&(tim->timer)); + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + void _mali_osk_timer_setcallback(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback, void *data) + { + MALI_DEBUG_ASSERT_POINTER(tim); + tim->timer.data = (unsigned long)data; + tim->timer.function = (timer_timeout_function_t)callback; + } ++#endif + + void _mali_osk_timer_term(_mali_osk_timer_t *tim) + { +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch new file mode 100644 index 00000000..5363c37e --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0015-fix-driver-failed-to-check-map-error.patch @@ -0,0 +1,17 @@ +Index: mali/linux/mali_memory_os_alloc.c +=================================================================== +--- mali.orig/linux/mali_memory_os_alloc.c ++++ mali/linux/mali_memory_os_alloc.c +@@ -239,8 +239,10 @@ int mali_mem_os_alloc_pages(mali_mem_os_ + /* Ensure page is flushed from CPU caches. */ + dma_addr = dma_map_page(&mali_platform_device->dev, new_page, + 0, _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); +- dma_unmap_page(&mali_platform_device->dev, dma_addr, +- _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); ++ err = dma_mapping_error(&mali_platform_device->dev, dma_addr); ++ if (likely(!err)) ++ dma_unmap_page(&mali_platform_device->dev, dma_addr, ++ _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); + dma_addr = dma_map_page(&mali_platform_device->dev, new_page, + 0, _MALI_OSK_MALI_PAGE_SIZE, DMA_BIDIRECTIONAL); + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch new file mode 100644 index 00000000..dc8bbebf --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0016-mali_memory_secure-Kernel-5.0-onwards-access_ok-API-.patch @@ -0,0 +1,47 @@ +From 8cf1dd43f3f25cb4afb84dfc3b0e7c02bc8f7f0c Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Mon, 24 Feb 2020 18:19:37 -0800 +Subject: [LINUX][rel-v2020.1][PATCH v1 1/3] mali_memory_secure: Kernel 5.0 + onwards 'access_ok' API does not take 'type' as input parameter + +'access_ok' no longer needs 'type' as input paramter from kernel 5.0 +onwards. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + driver/src/devicedrv/mali/linux/mali_ukk_mem.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/driver/src/devicedrv/mali/linux/mali_ukk_mem.c b/driver/src/devicedrv/mali/linux/mali_ukk_mem.c +index 4ec57dc..270bb6d 100644 +--- linux/mali_ukk_mem.c ++++ b/linux/mali_ukk_mem.c +@@ -207,8 +207,13 @@ int mem_write_safe_wrapper(struct mali_session_data *session_data, _mali_uk_mem_ + kargs.ctx = (uintptr_t)session_data; + + /* Check if we can access the buffers */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) ++ if (!access_ok((const void __user *)kargs.dest, kargs.size) ++ || !access_ok((const void __user *)kargs.src, kargs.size)) { ++#else + if (!access_ok(VERIFY_WRITE, kargs.dest, kargs.size) + || !access_ok(VERIFY_READ, kargs.src, kargs.size)) { ++#endif + return -EINVAL; + } + +@@ -266,7 +271,11 @@ int mem_dump_mmu_page_table_wrapper(struct mali_session_data *session_data, _mal + goto err_exit; + + user_buffer = (void __user *)(uintptr_t)kargs.buffer; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) ++ if (!access_ok(user_buffer, kargs.size)) ++#else + if (!access_ok(VERIFY_WRITE, user_buffer, kargs.size)) ++#endif + goto err_exit; + + /* allocate temporary buffer (kernel side) to store mmu page table info */ +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch new file mode 100644 index 00000000..9c4bbee9 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0017-Support-for-vm_insert_pfn-deprecated-from-kernel-4.2.patch @@ -0,0 +1,146 @@ +From 953cab73b8bc487da330aa454abd7f8c7466737e Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Mon, 24 Feb 2020 18:32:16 -0800 +Subject: [LINUX][rel-v2020.1][PATCH v1 2/3] Support for vm_insert_pfn + deprecated from kernel 4.20 + +From kernel 4.20 onwards, support for vm_insert_pfn is deprecated. +Hence, replace the same with vmf_insert_pfn. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + .../devicedrv/mali/linux/mali_memory_block_alloc.c | 6 +++++- + driver/src/devicedrv/mali/linux/mali_memory_cow.c | 14 ++++++++++++-- + .../src/devicedrv/mali/linux/mali_memory_os_alloc.c | 20 +++++++++++++++++--- + driver/src/devicedrv/mali/linux/mali_memory_secure.c | 7 ++++++- + 4 files changed, 40 insertions(+), 7 deletions(-) + +diff --git a/driver/src/devicedrv/mali/linux/mali_memory_block_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_block_alloc.c +index 0c5b6c3..e528699 100644 +--- linux/mali_memory_block_alloc.c ++++ b/linux/mali_memory_block_alloc.c +@@ -309,9 +309,13 @@ int mali_mem_block_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *v + + list_for_each_entry(m_page, &block_mem->pfns, list) { + MALI_DEBUG_ASSERT(m_page->type == MALI_PAGE_NODE_BLOCK); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page)); +- + if (unlikely(0 != ret)) { ++#endif + return -EFAULT; + } + addr += _MALI_OSK_MALI_PAGE_SIZE; +diff --git a/driver/src/devicedrv/mali/linux/mali_memory_cow.c b/driver/src/devicedrv/mali/linux/mali_memory_cow.c +index f1d44fe..1dae1d6 100644 +--- linux/mali_memory_cow.c ++++ b/linux/mali_memory_cow.c +@@ -532,9 +532,14 @@ int mali_mem_cow_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma + * flush which makes it way slower than remap_pfn_range or vm_insert_pfn.
+ ret = vm_insert_page(vma, addr, page);
+ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
+-
+ if (unlikely(0 != ret)) {
++#endif ++
+ return ret;
+ }
+ addr += _MALI_OSK_MALI_PAGE_SIZE;
+@@ -569,9 +574,14 @@ _mali_osk_errcode_t mali_mem_cow_cpu_map_pages_locked(mali_mem_backend *mem_bken +
+ list_for_each_entry(m_page, &cow->pages, list) {
+ if ((count >= offset) && (count < offset + num)) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page));
++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page));
+-
+ if (unlikely(0 != ret)) {
++#endif ++
+ if (count == offset) {
+ return _MALI_OSK_ERR_FAULT;
+ } else {
+diff --git a/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c b/driver/src/devicedrv/mali/linux/mali_memory_os_alloc.c +index 3fb6f05..7de3920 100644 +--- linux/mali_memory_os_alloc.c ++++ b/linux/mali_memory_os_alloc.c +@@ -378,9 +378,14 @@ int mali_mem_os_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma) + ret = vm_insert_page(vma, addr, page); + */ + page = m_page->page; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, addr, page_to_pfn(page)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, addr, page_to_pfn(page)); +- + if (unlikely(0 != ret)) { ++#endif ++ + return -EFAULT; + } + addr += _MALI_OSK_MALI_PAGE_SIZE; +@@ -416,9 +421,13 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken + + vm_end -= _MALI_OSK_MALI_PAGE_SIZE; + if (mapping_page_num > 0) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, vm_end, page_to_pfn(m_page->page)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, vm_end, page_to_pfn(m_page->page)); +- + if (unlikely(0 != ret)) { ++#endif + /*will return -EBUSY If the page has already been mapped into table, but it's OK*/ + if (-EBUSY == ret) { + break; +@@ -439,9 +448,14 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken + list_for_each_entry(m_page, &os_mem->pages, list) { + if (count >= offset) { + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, vstart, page_to_pfn(m_page->page)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, vstart, page_to_pfn(m_page->page)); +- + if (unlikely(0 != ret)) { ++#endif ++ + /*will return -EBUSY If the page has already been mapped into table, but it's OK*/ + if (-EBUSY == ret) { + break; +diff --git a/driver/src/devicedrv/mali/linux/mali_memory_secure.c b/driver/src/devicedrv/mali/linux/mali_memory_secure.c +index 5546304..cebd1c8 100644 +--- linux/mali_memory_secure.c ++++ b/linux/mali_memory_secure.c +@@ -132,9 +132,14 @@ int mali_mem_secure_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct * + MALI_DEBUG_ASSERT(0 == size % _MALI_OSK_MALI_PAGE_SIZE); + + for (j = 0; j < size / _MALI_OSK_MALI_PAGE_SIZE; j++) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ ret = vmf_insert_pfn(vma, addr, PFN_DOWN(phys)); ++ if (unlikely(VM_FAULT_ERROR & ret)) { ++#else + ret = vm_insert_pfn(vma, addr, PFN_DOWN(phys)); +- + if (unlikely(0 != ret)) { ++#endif ++ + return -EFAULT; + } + addr += _MALI_OSK_MALI_PAGE_SIZE; +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch new file mode 100644 index 00000000..9797db62 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0018-Change-return-type-to-vm_fault_t-for-fault-handler.patch @@ -0,0 +1,32 @@ +From ad5c569f0cc40698699fc2f2c1db3ceb9f8b8f35 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Tue, 25 Feb 2020 11:36:01 -0800 +Subject: [LINUX][rel-v2020.1][PATCH v1 3/3] Change return type to vm_fault_t + for fault handler + +From kernel 4.17 onwards the return type of fault handler for +vm_operations is of type 'vm_fault_t'. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + driver/src/devicedrv/mali/linux/mali_memory.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/driver/src/devicedrv/mali/linux/mali_memory.c b/driver/src/devicedrv/mali/linux/mali_memory.c +index c0f0982..2b2b209 100644 +--- linux/mali_memory.c ++++ b/linux/mali_memory.c +@@ -70,7 +70,9 @@ static void mali_mem_vma_close(struct vm_area_struct *vma) + } + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) ++static vm_fault_t mali_mem_vma_fault(struct vm_fault *vmf) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + static int mali_mem_vma_fault(struct vm_fault *vmf) + #else + static int mali_mem_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch new file mode 100644 index 00000000..154bb673 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0019-get_monotonic_boottime-ts-deprecated-from-kernel-4.2.patch @@ -0,0 +1,36 @@ +From c6a6b39cea3fdfd91cae7f2a4ef6f36d2c55fdd6 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Tue, 25 Feb 2020 15:17:17 -0800 +Subject: [LINUX][rel-v2020.1][PATCH v1] "get_monotonic_boottime(&ts)" + deprecated from kernel 4.20 onwards + +As "get_monotonic_boottime(&ts)" is deprecated, replace the same with +"ktime_get_boottime_ts64(&ts)". Refer kernel commit ID +976516404ff3fab2a8caa8bd6f5efc1437fed0b8 + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +--- + driver/src/devicedrv/mali/linux/mali_osk_time.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/driver/src/devicedrv/mali/linux/mali_osk_time.c b/driver/src/devicedrv/mali/linux/mali_osk_time.c +index 03046a5..bfcbf7f 100644 +--- linux/mali_osk_time.c ++++ b/linux/mali_osk_time.c +@@ -53,7 +53,13 @@ u64 _mali_osk_time_get_ns(void) + + u64 _mali_osk_boot_time_get_ns(void) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) ++ struct timespec64 tsval; ++ ktime_get_boottime_ts64(&tsval); ++ return (u64)timespec64_to_ns(&tsval); ++#else + struct timespec tsval; + get_monotonic_boottime(&tsval); + return (u64)timespec_to_ns(&tsval); ++#endif + } +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch new file mode 100644 index 00000000..ff86091f --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0020-Fix-ioremap_nocache-deprecation-in-kernel-5.6.patch @@ -0,0 +1,92 @@ +From cbc2351e8acf7ed38f6d965e5ea21620e45eda30 Mon Sep 17 00:00:00 2001 +From: Dylan Yip <dylan.yip@xilinx.com> +Date: Tue, 9 Feb 2021 10:05:41 -0800 +Subject: [PATCH 20/23] Fix ioremap_nocache() deprecation in kernel 5.6 + +As of commit 4bdc0d676a643140 ("remove ioremap_nocache and +devm_ioremap_nocache") from kernel 5.6, ioremap_nocache has been +removed because ioremap is already non-cached by default. So replace all +calls with ioremap. + +Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> +--- + linux/mali_memory_cow.c | 4 ++++ + linux/mali_osk_low_level_mem.c | 4 ++++ + platform/arm/arm.c | 12 ++++++++++++ + 3 files changed, 20 insertions(+) + +diff --git a/linux/mali_memory_cow.c b/linux/mali_memory_cow.c +index 1dae1d6..6fadd42 100644 +--- a/linux/mali_memory_cow.c ++++ b/linux/mali_memory_cow.c +@@ -693,7 +693,11 @@ void _mali_mem_cow_copy_page(mali_page_node *src_node, mali_page_node *dst_node) + /*
+ * use ioremap to map src for BLOCK memory
+ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++ src = ioremap(_mali_page_node_get_dma_addr(src_node), _MALI_OSK_MALI_PAGE_SIZE);
++#else
+ src = ioremap_nocache(_mali_page_node_get_dma_addr(src_node), _MALI_OSK_MALI_PAGE_SIZE);
++#endif
+ memcpy(dst, src , _MALI_OSK_MALI_PAGE_SIZE);
+ iounmap(src);
+ }
+diff --git a/linux/mali_osk_low_level_mem.c b/linux/mali_osk_low_level_mem.c +index 84f93d9..5a0a725 100644 +--- a/linux/mali_osk_low_level_mem.c ++++ b/linux/mali_osk_low_level_mem.c +@@ -33,7 +33,11 @@ void _mali_osk_write_mem_barrier(void) + + mali_io_address _mali_osk_mem_mapioregion(uintptr_t phys, u32 size, const char *description) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) ++ return (mali_io_address)ioremap(phys, size); ++#else + return (mali_io_address)ioremap_nocache(phys, size); ++#endif + } + + void _mali_osk_mem_unmapioregion(uintptr_t phys, u32 size, mali_io_address virt) +diff --git a/platform/arm/arm.c b/platform/arm/arm.c +index b2fb746..e468263 100644 +--- a/platform/arm/arm.c ++++ b/platform/arm/arm.c +@@ -98,7 +98,11 @@ static int mali_secure_mode_init_juno(void) + + MALI_DEBUG_ASSERT(NULL == secure_mode_mapped_addr); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) ++ secure_mode_mapped_addr = ioremap(phys_addr_page, map_size); ++#else + secure_mode_mapped_addr = ioremap_nocache(phys_addr_page, map_size); ++#endif + if (NULL != secure_mode_mapped_addr) { + return mali_gpu_reset_and_secure_mode_disable_juno(); + } +@@ -588,7 +592,11 @@ static u32 mali_read_phys(u32 phys_addr) + u32 phys_offset = phys_addr & 0x00001FFF; + u32 map_size = phys_offset + sizeof(u32); + u32 ret = 0xDEADBEEF; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) ++ void *mem_mapped = ioremap(phys_addr_page, map_size); ++#else + void *mem_mapped = ioremap_nocache(phys_addr_page, map_size); ++#endif + if (NULL != mem_mapped) { + ret = (u32)ioread32(((u8 *)mem_mapped) + phys_offset); + iounmap(mem_mapped); +@@ -604,7 +612,11 @@ static void mali_write_phys(u32 phys_addr, u32 value) + u32 phys_addr_page = phys_addr & 0xFFFFE000; + u32 phys_offset = phys_addr & 0x00001FFF; + u32 map_size = phys_offset + sizeof(u32); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) ++ void *mem_mapped = ioremap(phys_addr_page, map_size); ++#else + void *mem_mapped = ioremap_nocache(phys_addr_page, map_size); ++#endif + if (NULL != mem_mapped) { + iowrite32(value, ((u8 *)mem_mapped) + phys_offset); + iounmap(mem_mapped); +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch new file mode 100644 index 00000000..adef8e18 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0021-Use-updated-timekeeping-functions-in-kernel-5.6.patch @@ -0,0 +1,37 @@ +From bc0f85271681532c7e394229f0155366d1de8779 Mon Sep 17 00:00:00 2001 +From: Dylan Yip <dylan.yip@xilinx.com> +Date: Mon, 8 Feb 2021 23:47:01 -0800 +Subject: [PATCH 21/23] Use updated timekeeping functions in kernel 5.6 + +As of commit 412c53a680a9 ("y2038: remove unused time32 interfaces"), 32 +bit timekeeping functions like getnstimeofday() have been removed. So +use the 64 bit replacements. + +Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> +--- + linux/mali_osk_time.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/linux/mali_osk_time.c b/linux/mali_osk_time.c +index bfcbf7f..583d82b 100644 +--- a/linux/mali_osk_time.c ++++ b/linux/mali_osk_time.c +@@ -46,9 +46,15 @@ void _mali_osk_time_ubusydelay(u32 usecs) + + u64 _mali_osk_time_get_ns(void) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) ++ struct timespec64 tsval; ++ ktime_get_real_ts64(&tsval); ++ return (u64)timespec64_to_ns(&tsval); ++#else + struct timespec tsval; + getnstimeofday(&tsval); + return (u64)timespec_to_ns(&tsval); ++#endif + } + + u64 _mali_osk_boot_time_get_ns(void) +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch new file mode 100644 index 00000000..181df7b7 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0022-Set-HAVE_UNLOCKED_IOCTL-default-to-true.patch @@ -0,0 +1,38 @@ +From d17933b6909cc29103befc2ef4e6cf413d9e8fb6 Mon Sep 17 00:00:00 2001 +From: Dylan Yip <dylan.yip@xilinx.com> +Date: Tue, 9 Feb 2021 08:58:44 -0800 +Subject: [PATCH 22/23] Set HAVE_UNLOCKED_IOCTL default to true + +As of commit b19dd42faf41 ("bkl: Remove locked .ioctl file operation") +of kernel 2.6, the ioctl operation has been replaced with +unlocked_ioctl. Since this change has been around for almost 10 years, +go ahead and set the default HAVE_UNLOCKED_IOCTL to be true. + +Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> +--- + Kbuild | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Kbuild b/Kbuild +index 02c3f3d..8c6e6e0 100644 +--- a/Kbuild ++++ b/Kbuild +@@ -21,6 +21,7 @@ MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0 + MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0 + MALI_UPPER_HALF_SCHEDULING ?= 1 + MALI_ENABLE_CPU_CYCLES ?= 0 ++HAVE_UNLOCKED_IOCTL ?= 1 + + # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases: + # The ARM proprietary product will only include the license/proprietary directory +@@ -179,6 +180,7 @@ ccflags-y += -DMALI_STATE_TRACKING=1 + ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB) + ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION) + ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES) ++ccflags-y += -DHAVE_UNLOCKED_IOCTL=$(HAVE_UNLOCKED_IOCTL) + + ifeq ($(MALI_UPPER_HALF_SCHEDULING),1) + ccflags-y += -DMALI_UPPER_HALF_SCHEDULING +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch new file mode 100644 index 00000000..bab2bd37 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0023-Use-PTR_ERR_OR_ZERO-instead-of-PTR_RET.patch @@ -0,0 +1,33 @@ +From e2b52e358e0e030d3881ef80ef09de3662b41210 Mon Sep 17 00:00:00 2001 +From: Dylan Yip <dylan.yip@xilinx.com> +Date: Tue, 9 Feb 2021 09:48:01 -0800 +Subject: [PATCH 23/23] Use PTR_ERR_OR_ZERO instead of PTR_RET + +As of commit fad7c9020948 ("err.h: remove deprecated PTR_RET for good") +in kernel 5.7, PTR_RET has been removed and replaced with +PTR_ERR_OR_ZERO. So use this API instead. + +Signed-off-by: Dylan Yip <dylan.yip@xilinx.com> +--- + linux/mali_memory_dma_buf.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/linux/mali_memory_dma_buf.c b/linux/mali_memory_dma_buf.c +index 905cd8b..fcdcaac 100644 +--- a/linux/mali_memory_dma_buf.c ++++ b/linux/mali_memory_dma_buf.c +@@ -281,7 +281,11 @@ int mali_dma_buf_get_size(struct mali_session_data *session, _mali_uk_dma_buf_ge + buf = dma_buf_get(fd); + if (IS_ERR_OR_NULL(buf)) { + MALI_DEBUG_PRINT_ERROR(("Failed to get dma-buf from fd: %d\n", fd)); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) ++ return PTR_ERR_OR_ZERO(buf); ++#else + return PTR_RET(buf); ++#endif + } + + if (0 != put_user(buf->size, &user_arg->size)) { +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0024-Use-community-device-tree-names.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0024-Use-community-device-tree-names.patch new file mode 100644 index 00000000..5b3eeedc --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0024-Use-community-device-tree-names.patch @@ -0,0 +1,91 @@ +Use the community device-tree names + +The community LIMA driver uses a series of names that are different then +the legacy Xilinx names. Moves from the legacy names to the more standard +names. + +This will allow us to have a single device tree that works with both the +mali driver, as well as the lima driver. + +Interrupt-names: + IRQGP -> gp + IRQGPMMU -> gpmmu + IRQPP0 -> pp0 + IRQPPMMU0 -> ppmmu0 + IRQPP1 -> pp1 + IRQPPMMU1 -> ppmmu1 + ... + +Clock-names: + gpu_pp0 -> core + gpu_pp1 -> bus + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +diff -ur a/linux/mali_kernel_linux.c b/linux/mali_kernel_linux.c +--- a/linux/mali_kernel_linux.c 2018-09-17 04:04:48.000000000 -0700 ++++ b/linux/mali_kernel_linux.c 2022-10-24 14:01:54.614376177 -0700 +@@ -635,11 +635,11 @@ + if (IS_ERR(clk_gpu)) + return PTR_ERR(clk_gpu); + +- clk_gpu_pp0 = devm_clk_get(&pdev->dev, "gpu_pp0"); ++ clk_gpu_pp0 = devm_clk_get(&pdev->dev, "core"); + if (IS_ERR(clk_gpu_pp0)) + return PTR_ERR(clk_gpu_pp0); + +- clk_gpu_pp1 = devm_clk_get(&pdev->dev, "gpu_pp1"); ++ clk_gpu_pp1 = devm_clk_get(&pdev->dev, "bus"); + if (IS_ERR(clk_gpu_pp1)) + return PTR_ERR(clk_gpu_pp1); + #endif +diff -ur a/linux/mali_osk_mali.c b/linux/mali_osk_mali.c +--- a/linux/mali_osk_mali.c 2018-09-12 23:52:20.000000000 -0700 ++++ b/linux/mali_osk_mali.c 2022-10-24 14:00:28.470380512 -0700 +@@ -72,26 +72,26 @@ + #define MALI_OSK_RESOURCE_DMA_LOCATION 26 + + static _mali_osk_resource_t mali_osk_resource_bank[MALI_OSK_MAX_RESOURCE_NUMBER] = { +- {.description = "Mali_GP", .base = MALI_OFFSET_GP, .irq_name = "IRQGP",}, +- {.description = "Mali_GP_MMU", .base = MALI_OFFSET_GP_MMU, .irq_name = "IRQGPMMU",}, +- {.description = "Mali_PP0", .base = MALI_OFFSET_PP0, .irq_name = "IRQPP0",}, +- {.description = "Mali_PP0_MMU", .base = MALI_OFFSET_PP0_MMU, .irq_name = "IRQPPMMU0",}, +- {.description = "Mali_PP1", .base = MALI_OFFSET_PP1, .irq_name = "IRQPP1",}, +- {.description = "Mali_PP1_MMU", .base = MALI_OFFSET_PP1_MMU, .irq_name = "IRQPPMMU1",}, +- {.description = "Mali_PP2", .base = MALI_OFFSET_PP2, .irq_name = "IRQPP2",}, +- {.description = "Mali_PP2_MMU", .base = MALI_OFFSET_PP2_MMU, .irq_name = "IRQPPMMU2",}, +- {.description = "Mali_PP3", .base = MALI_OFFSET_PP3, .irq_name = "IRQPP3",}, +- {.description = "Mali_PP3_MMU", .base = MALI_OFFSET_PP3_MMU, .irq_name = "IRQPPMMU3",}, +- {.description = "Mali_PP4", .base = MALI_OFFSET_PP4, .irq_name = "IRQPP4",}, +- {.description = "Mali_PP4_MMU", .base = MALI_OFFSET_PP4_MMU, .irq_name = "IRQPPMMU4",}, +- {.description = "Mali_PP5", .base = MALI_OFFSET_PP5, .irq_name = "IRQPP5",}, +- {.description = "Mali_PP5_MMU", .base = MALI_OFFSET_PP5_MMU, .irq_name = "IRQPPMMU5",}, +- {.description = "Mali_PP6", .base = MALI_OFFSET_PP6, .irq_name = "IRQPP6",}, +- {.description = "Mali_PP6_MMU", .base = MALI_OFFSET_PP6_MMU, .irq_name = "IRQPPMMU6",}, +- {.description = "Mali_PP7", .base = MALI_OFFSET_PP7, .irq_name = "IRQPP7",}, +- {.description = "Mali_PP7_MMU", .base = MALI_OFFSET_PP7_MMU, .irq_name = "IRQPPMMU",}, +- {.description = "Mali_PP_Broadcast", .base = MALI_OFFSET_PP_BCAST, .irq_name = "IRQPP",}, +- {.description = "Mali_PMU", .base = MALI_OFFSET_PMU, .irq_name = "IRQPMU",}, ++ {.description = "Mali_GP", .base = MALI_OFFSET_GP, .irq_name = "gp",}, ++ {.description = "Mali_GP_MMU", .base = MALI_OFFSET_GP_MMU, .irq_name = "gpmmu",}, ++ {.description = "Mali_PP0", .base = MALI_OFFSET_PP0, .irq_name = "pp0",}, ++ {.description = "Mali_PP0_MMU", .base = MALI_OFFSET_PP0_MMU, .irq_name = "ppmmu0",}, ++ {.description = "Mali_PP1", .base = MALI_OFFSET_PP1, .irq_name = "pp1",}, ++ {.description = "Mali_PP1_MMU", .base = MALI_OFFSET_PP1_MMU, .irq_name = "ppmmu1",}, ++ {.description = "Mali_PP2", .base = MALI_OFFSET_PP2, .irq_name = "pp2",}, ++ {.description = "Mali_PP2_MMU", .base = MALI_OFFSET_PP2_MMU, .irq_name = "ppmmu2",}, ++ {.description = "Mali_PP3", .base = MALI_OFFSET_PP3, .irq_name = "pp3",}, ++ {.description = "Mali_PP3_MMU", .base = MALI_OFFSET_PP3_MMU, .irq_name = "ppmmu3",}, ++ {.description = "Mali_PP4", .base = MALI_OFFSET_PP4, .irq_name = "pp4",}, ++ {.description = "Mali_PP4_MMU", .base = MALI_OFFSET_PP4_MMU, .irq_name = "ppmmu4",}, ++ {.description = "Mali_PP5", .base = MALI_OFFSET_PP5, .irq_name = "pp5",}, ++ {.description = "Mali_PP5_MMU", .base = MALI_OFFSET_PP5_MMU, .irq_name = "ppmmu5",}, ++ {.description = "Mali_PP6", .base = MALI_OFFSET_PP6, .irq_name = "pp6",}, ++ {.description = "Mali_PP6_MMU", .base = MALI_OFFSET_PP6_MMU, .irq_name = "ppmmu6",}, ++ {.description = "Mali_PP7", .base = MALI_OFFSET_PP7, .irq_name = "pp7",}, ++ {.description = "Mali_PP7_MMU", .base = MALI_OFFSET_PP7_MMU, .irq_name = "ppmmu",}, ++ {.description = "Mali_PP_Broadcast", .base = MALI_OFFSET_PP_BCAST, .irq_name = "pp",}, ++ {.description = "Mali_PMU", .base = MALI_OFFSET_PMU, .irq_name = "pmu",}, + {.description = "Mali_L2", .base = MALI_OFFSET_L2_RESOURCE0,}, + {.description = "Mali_L2", .base = MALI_OFFSET_L2_RESOURCE1,}, + {.description = "Mali_L2", .base = MALI_OFFSET_L2_RESOURCE2,}, diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0025-Import-DMA_BUF-module-and-update-register_shrinker-f.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0025-Import-DMA_BUF-module-and-update-register_shrinker-f.patch new file mode 100644 index 00000000..f3bcd4f1 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0025-Import-DMA_BUF-module-and-update-register_shrinker-f.patch @@ -0,0 +1,67 @@ +From d4fcb32f8dc85d01c6e0dc8e5d85c7ed43f0866c Mon Sep 17 00:00:00 2001 +From: Yash Ladani <yash.ladani@amd.com> +Date: Tue, 6 Dec 2022 00:52:53 -0800 +Subject: [PATCH] Import DMA_BUF module and update register_shrinker function + for kernel 5.16 or higher + +Added MODULE_IMPORT_NS(DMA_BUF) for kernel version 5.16 or higher. +register_shrinker function call now requires two arguments +for kernel 5.16 or higher updated this function call. + +Signed-off-by: Yash Ladani <yash.ladani@amd.com> +--- + linux/mali_memory_dma_buf.c | 4 ++++ + linux/mali_memory_os_alloc.c | 5 ++++- + linux/mali_memory_secure.c | 4 ++++ + 3 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/linux/mali_memory_dma_buf.c b/linux/mali_memory_dma_buf.c +index fcdcaac..72e28a8 100644 +--- a/linux/mali_memory_dma_buf.c ++++ b/linux/mali_memory_dma_buf.c +@@ -34,6 +34,10 @@ + #include "mali_memory_virtual.h" + #include "mali_pp_job.h" + ++#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 15, 0) ++MODULE_IMPORT_NS(DMA_BUF); ++#endif ++ + /* + * Map DMA buf attachment \a mem into \a session at virtual address \a virt. + */ +diff --git a/linux/mali_memory_os_alloc.c b/linux/mali_memory_os_alloc.c +index 7de3920..5bf08f8 100644 +--- a/linux/mali_memory_os_alloc.c ++++ b/linux/mali_memory_os_alloc.c +@@ -801,8 +801,11 @@ _mali_osk_errcode_t mali_mem_os_init(void) + dma_set_attr(DMA_ATTR_WRITE_COMBINE, &dma_attrs_wc); + #endif + ++#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 15, 0) ++ register_shrinker(&mali_mem_os_allocator.shrinker, "mali"); ++#else + register_shrinker(&mali_mem_os_allocator.shrinker); +- ++#endif + return _MALI_OSK_ERR_OK; + } + +diff --git a/linux/mali_memory_secure.c b/linux/mali_memory_secure.c +index cebd1c8..a9d932f 100644 +--- a/linux/mali_memory_secure.c ++++ b/linux/mali_memory_secure.c +@@ -20,6 +20,10 @@ + #endif + #include <linux/dma-buf.h> + ++#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 15, 0) ++MODULE_IMPORT_NS(DMA_BUF); ++#endif ++ + _mali_osk_errcode_t mali_mem_secure_attach_dma_buf(mali_mem_secure *secure_mem, u32 size, int mem_fd) + { + struct dma_buf *buf; +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0026-Fix-gpu-driver-probe-failure.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0026-Fix-gpu-driver-probe-failure.patch new file mode 100644 index 00000000..247c92ff --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0026-Fix-gpu-driver-probe-failure.patch @@ -0,0 +1,46 @@ +From d7a56b7bdf1ea34194fe86639cc318d7a33b9abb Mon Sep 17 00:00:00 2001 +From: Parth Gajjar <parth.gajjar@xilinx.com> +Date: Thu, 12 Jan 2023 06:00:20 -0800 +Subject: [PATCH] Fix gpu driver probe failure + +In patch a1a2b7125e1079cfcc13a116aa3af3df2f9e002b +(Drop static setup of IRQ resource from DT core) platform_get_resource() +stopped from returning the IRQ, as all drivers were supposed to have +switched to platform_get_irq(). +Using platform_get_irq_optional() to avoid printing error messages +for interrupts not found. + +Signed-off-by: Parth Gajjar <parth.gajjar@xilinx.com> +--- + linux/mali_osk_mali.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/linux/mali_osk_mali.c b/linux/mali_osk_mali.c +index c22758d..3f66132 100644 +--- a/linux/mali_osk_mali.c ++++ b/linux/mali_osk_mali.c +@@ -113,7 +113,7 @@ static int _mali_osk_get_compatible_name(const char **out_string) + _mali_osk_errcode_t _mali_osk_resource_initialize(void) + { + mali_bool mali_is_450 = MALI_FALSE, mali_is_470 = MALI_FALSE; +- int i, pp_core_num = 0, l2_core_num = 0; ++ int i, pp_core_num = 0, l2_core_num = 0, irq = 0; + struct resource *res; + const char *compatible_name = NULL; + +@@ -128,9 +128,9 @@ _mali_osk_errcode_t _mali_osk_resource_initialize(void) + } + + for (i = 0; i < MALI_OSK_RESOURCE_WITH_IRQ_NUMBER; i++) { +- res = platform_get_resource_byname(mali_platform_device, IORESOURCE_IRQ, mali_osk_resource_bank[i].irq_name); +- if (res) { +- mali_osk_resource_bank[i].irq = res->start; ++ irq = platform_get_irq_byname_optional(mali_platform_device, mali_osk_resource_bank[i].irq_name); ++ if (irq > 0) { ++ mali_osk_resource_bank[i].irq = irq; + } else { + mali_osk_resource_bank[i].base = MALI_OSK_INVALID_RESOURCE_ADDRESS; + } +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch new file mode 100644 index 00000000..18081dc3 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mali/kernel-module-mali/0027-Updated-clock-name-and-structure-to-match-LIMA-drive.patch @@ -0,0 +1,95 @@ +From a64707b7fea40d326c5b18636a41a5994f60048d Mon Sep 17 00:00:00 2001 +From: Parth Gajjar <parth.gajjar@amd.com> +Date: Fri, 24 Feb 2023 05:11:38 -0800 +Subject: [PATCH] Updated clock name and structure to match LIMA driver + +Clock-names: + gpu -> bus + gpu_pp0,gpu_pp1 -> core + +This will allow us to have a single device tree that works with both the +mali driver, as well as the lima driver. + +Signed-off-by: Parth Gajjar <parth.gajjar@amd.com> +--- + linux/mali_kernel_linux.c | 37 +++++++------------ + 1 file changed, 13 insertions(+), 24 deletions(-) + +diff --git a/linux/mali_kernel_linux.c b/linux/mali_kernel_linux.c +index ad450b4..050af67 100644 +--- a/linux/mali_kernel_linux.c ++++ b/linux/mali_kernel_linux.c +@@ -48,9 +48,8 @@ + + #if defined(CONFIG_ARCH_ZYNQMP) + /* Initialize variables for clocks */ +-struct clk *clk_gpu; +-struct clk *clk_gpu_pp0; +-struct clk *clk_gpu_pp1; ++struct clk *clk_bus; ++struct clk *clk_core; + mali_bool clk_enabled; + #endif + +@@ -291,19 +290,14 @@ static int mali_enable_clk(void) + return 0; + + clk_enabled = MALI_TRUE; +- err = clk_prepare_enable(clk_gpu); ++ err = clk_prepare_enable(clk_bus); + if (err) { + MALI_PRINT_ERROR(("Could not enable clock for GP\n\r")); + return err; + } +- err = clk_prepare_enable(clk_gpu_pp0); ++ err = clk_prepare_enable(clk_core); + if (err) { +- MALI_PRINT_ERROR(("Could not enable clock for PP0\n\r")); +- return err; +- } +- err = clk_prepare_enable(clk_gpu_pp1); +- if (err) { +- MALI_PRINT_ERROR(("Could not enable clock for PP1\n\r")); ++ MALI_PRINT_ERROR(("Could not enable clock for PP\n\r")); + return err; + } + #endif +@@ -315,9 +309,8 @@ static void mali_disable_clk(void) + #if defined(CONFIG_ARCH_ZYNQMP) + if (clk_enabled) { + clk_enabled = MALI_FALSE; +- clk_disable_unprepare(clk_gpu); +- clk_disable_unprepare(clk_gpu_pp0); +- clk_disable_unprepare(clk_gpu_pp1); ++ clk_disable_unprepare(clk_bus); ++ clk_disable_unprepare(clk_core); + } + #endif + } +@@ -631,17 +624,13 @@ static int mali_probe(struct platform_device *pdev) + + #if defined(CONFIG_ARCH_ZYNQMP) + /* Initialize clocks for GPU and PP */ +- clk_gpu = devm_clk_get(&pdev->dev, "gpu"); +- if (IS_ERR(clk_gpu)) +- return PTR_ERR(clk_gpu); +- +- clk_gpu_pp0 = devm_clk_get(&pdev->dev, "core"); +- if (IS_ERR(clk_gpu_pp0)) +- return PTR_ERR(clk_gpu_pp0); ++ clk_bus = devm_clk_get(&pdev->dev, "bus"); ++ if (IS_ERR(clk_bus)) ++ return PTR_ERR(clk_bus); + +- clk_gpu_pp1 = devm_clk_get(&pdev->dev, "bus"); +- if (IS_ERR(clk_gpu_pp1)) +- return PTR_ERR(clk_gpu_pp1); ++ clk_core = devm_clk_get(&pdev->dev, "core"); ++ if (IS_ERR(clk_core)) ++ return PTR_ERR(clk_core); + #endif + + err = mali_enable_clk(); +-- +2.25.1 + diff --git a/meta-xilinx-core/recipes-graphics/mesa/files/0001-DRI_Add_xlnx_dri.patch b/meta-xilinx-core/recipes-graphics/mesa/files/0001-DRI_Add_xlnx_dri.patch new file mode 100644 index 00000000..f77f1939 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/files/0001-DRI_Add_xlnx_dri.patch @@ -0,0 +1,32 @@ +DRI: Add xlnx dri + +Add the Xilinx dri target + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +Index: mesa-24.0.1/src/gallium/targets/dri/meson.build +=================================================================== +--- mesa-24.0.1.orig/src/gallium/targets/dri/meson.build ++++ mesa-24.0.1/src/gallium/targets/dri/meson.build +@@ -101,6 +101,7 @@ foreach d : [[with_gallium_kmsro, [ + 'stm_dri.so', + 'sun4i-drm_dri.so', + 'udl_dri.so', ++ 'xlnx_dri.so', + ]], + [with_gallium_radeonsi, 'radeonsi_dri.so'], + [with_gallium_nouveau, 'nouveau_dri.so'], +Index: mesa-24.0.1/src/gallium/targets/dri/target.c +=================================================================== +--- mesa-24.0.1.orig/src/gallium/targets/dri/target.c ++++ mesa-24.0.1/src/gallium/targets/dri/target.c +@@ -129,6 +129,7 @@ DEFINE_LOADER_DRM_ENTRYPOINT(sti) + DEFINE_LOADER_DRM_ENTRYPOINT(stm) + DEFINE_LOADER_DRM_ENTRYPOINT(sun4i_drm) + DEFINE_LOADER_DRM_ENTRYPOINT(udl) ++DEFINE_LOADER_DRM_ENTRYPOINT(xlnx) + #endif + + #if defined(GALLIUM_LIMA) diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch new file mode 100644 index 00000000..fdb30564 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch @@ -0,0 +1,44 @@ +From 9470d00850e8b622d963d4d9c61ad1e59972310a Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Tue, 28 Jan 2020 16:10:54 -0800 +Subject: [PATCH 1/2] src: egl: eglinfo: Align EXT_platform_device extension + macros with khronos + +Although the macro definitions are consistent, using the macros name +defined under khronos makes it backward compatible with older eglext.h + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Upstream-Status: Inappropriate [Xilinx specific] +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/egl/opengl/eglinfo.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c +index 72fe45a..e8a0225 100644 +--- a/src/egl/opengl/eglinfo.c ++++ b/src/egl/opengl/eglinfo.c +@@ -305,17 +305,17 @@ main(int argc, char *argv[]) + NULL), "Android platform"); + if (strstr(clientext, "EGL_MESA_platform_gbm") || + strstr(clientext, "EGL_KHR_platform_gbm")) +- ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_GBM_MESA, ++ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_GBM_KHR, + EGL_DEFAULT_DISPLAY, + NULL), "GBM platform"); + if (strstr(clientext, "EGL_EXT_platform_wayland") || + strstr(clientext, "EGL_KHR_platform_wayland")) +- ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, ++ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, + EGL_DEFAULT_DISPLAY, + NULL), "Wayland platform"); + if (strstr(clientext, "EGL_EXT_platform_x11") || + strstr(clientext, "EGL_KHR_platform_x11")) +- ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_X11_EXT, ++ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_X11_KHR, + EGL_DEFAULT_DISPLAY, + NULL), "X11 platform"); + if (strstr(clientext, "EGL_MESA_platform_surfaceless")) +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch new file mode 100644 index 00000000..7212ef27 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch @@ -0,0 +1,41 @@ +From 040b0b79a8e73a3348ab2e95f817636a7d479f18 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Tue, 28 Jan 2020 16:17:46 -0800 +Subject: [PATCH 2/2] src: egl: eglinfo: Use EGL_PLATFORM_DEVICE_EXT only if + the EGL provider supports it + +Compiling against the other EGL provider like mali fails, as they dont +support this macro as one of thier supported platforms + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Upstream-Status: Inappropriate [Xilinx specific] +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + src/egl/opengl/eglinfo.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c +index e8a0225..bc0e869 100644 +--- a/src/egl/opengl/eglinfo.c ++++ b/src/egl/opengl/eglinfo.c +@@ -243,6 +243,7 @@ doOneDisplay(EGLDisplay d, const char *name) + static int + doOneDevice(EGLDeviceEXT d, int i) + { ++#ifdef EGL_PLATFORM_DEVICE_EXT + PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay = + (PFNEGLGETPLATFORMDISPLAYEXTPROC) + eglGetProcAddress("eglGetPlatformDisplayEXT"); +@@ -253,6 +254,9 @@ doOneDevice(EGLDeviceEXT d, int i) + + return doOneDisplay(getPlatformDisplay(EGL_PLATFORM_DEVICE_EXT, d, NULL), + "Platform Device"); ++#else ++ return 0; ++#endif + } + + +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/libmali-egl-workaround.patch b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/libmali-egl-workaround.patch new file mode 100644 index 00000000..6cfecb38 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/libmali-egl-workaround.patch @@ -0,0 +1,69 @@ +Upstream-Status: Inappropriate [libmali specific] + +Index: mesa-demos-8.5.0/src/egl/opengl/eglinfo.c +=================================================================== +--- mesa-demos-8.5.0.orig/src/egl/opengl/eglinfo.c ++++ mesa-demos-8.5.0/src/egl/opengl/eglinfo.c +@@ -195,6 +195,7 @@ PrintDisplayExtensions(EGLDisplay d) + } + + ++#ifdef EGL_EXT_device_base + static const char * + PrintDeviceExtensions(EGLDeviceEXT d) + { +@@ -211,7 +212,7 @@ PrintDeviceExtensions(EGLDeviceEXT d) + + return PrintExtensions(extensions); + } +- ++#endif + + static int + doOneDisplay(EGLDisplay d, const char *name) +@@ -240,6 +241,7 @@ doOneDisplay(EGLDisplay d, const char *n + } + + ++#ifdef EGL_EXT_device_base + static int + doOneDevice(EGLDeviceEXT d, int i) + { +@@ -258,8 +260,9 @@ doOneDevice(EGLDeviceEXT d, int i) + return 0; + #endif + } ++#endif + +- ++#ifdef EGL_EXT_device_base + static int + doDevices(const char *name) + { +@@ -288,7 +291,7 @@ doDevices(const char *name) + + return ret; + } +- ++#endif + + int + main(int argc, char *argv[]) +@@ -322,13 +325,17 @@ main(int argc, char *argv[]) + ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_X11_KHR, + EGL_DEFAULT_DISPLAY, + NULL), "X11 platform"); ++#ifdef EGL_PLATFORM_SURFACELESS_MESA + if (strstr(clientext, "EGL_MESA_platform_surfaceless")) + ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, + EGL_DEFAULT_DISPLAY, + NULL), "Surfaceless platform"); ++#endif ++#ifdef EGL_EXT_device_base + if (strstr(clientext, "EGL_EXT_device_enumeration") && + strstr(clientext, "EGL_EXT_platform_device")) + ret += doDevices("Device platform"); ++#endif + } + else { + ret = doOneDisplay(eglGetDisplay(EGL_DEFAULT_DISPLAY), "Default display"); diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos_%.bbappend b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos_%.bbappend new file mode 100644 index 00000000..5c84f56e --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos_%.bbappend @@ -0,0 +1,16 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/mesa-demos:" + +SRC_URI += " \ + file://0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch \ + file://0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch \ + file://libmali-egl-workaround.patch \ +" + +DEPENDS += "wayland-protocols" + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-gl_%.bbappend b/meta-xilinx-core/recipes-graphics/mesa/mesa-gl_%.bbappend new file mode 100644 index 00000000..a8e18a57 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-gl_%.bbappend @@ -0,0 +1,18 @@ +PACKAGECONFIG:append = " dri3 gallium" + +# If we're using libmali-xlnx, then we need to bring it in for the KHR/khrplatform.h file +DEPENDS .= "${@' libmali-xlnx' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else ''}" +RDEPENDS:libgl-mesa-dev .= "${@' libmali-xlnx-dev' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else ''}" + +do_install:append () { + if ${@'true' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else 'false'} ; then + rm -rf ${D}${includedir}/KHR/* + fi +} + +# If we require libmali-xlnx, this becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${MACHINE_ARCH}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@'${MALI_PACKAGE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa_%.bbappend b/meta-xilinx-core/recipes-graphics/mesa/mesa_%.bbappend new file mode 100644 index 00000000..86183f54 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa_%.bbappend @@ -0,0 +1,15 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +SRC_URI:append:class-target = " file://0001-DRI_Add_xlnx_dri.patch" + +# This is not compatible with the mali400 driver, use mesa-gl instead +CONFLICT_DISTRO_FEATURES:class-target = "${@bb.utils.contains('MACHINE_FEATURES', 'mali400', bb.utils.contains('DISTRO_FEATURES', 'libmali', 'libmali', '', d), '', d)}" + +# Enable lima if not using libmali +PACKAGECONFIG_MALI = "${@bb.utils.contains('DISTRO_FEATURES', 'libmali', '', 'lima', d)}" +PACKAGECONFIG:append:class-target = "${@bb.utils.contains('MACHINE_FEATURES', 'mali400', '${PACKAGECONFIG_MALI}', '', d)}" + +PACKAGE_ARCH_DEFAULT := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${MACHINE_ARCH}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains('MACHINE_FEATURES', 'mali400', '${MALI_PACKAGE_ARCH}', '${PACKAGE_ARCH_DEFAULT}', d)}" diff --git a/meta-xilinx-core/recipes-graphics/virglrenderer/virglrenderer_%.bbappend b/meta-xilinx-core/recipes-graphics/virglrenderer/virglrenderer_%.bbappend new file mode 100644 index 00000000..03823f6e --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/virglrenderer/virglrenderer_%.bbappend @@ -0,0 +1,6 @@ +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" diff --git a/meta-xilinx-core/recipes-graphics/wayland/files/0001-libweston-Remove-substitute-format-for-ARGB8888.patch b/meta-xilinx-core/recipes-graphics/wayland/files/0001-libweston-Remove-substitute-format-for-ARGB8888.patch new file mode 100644 index 00000000..de1f3719 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/files/0001-libweston-Remove-substitute-format-for-ARGB8888.patch @@ -0,0 +1,30 @@ +From 3fbb596e53524e78703b76c4fdc33cd6ac62f777 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Fri, 11 Dec 2020 16:21:38 -0800 +Subject: [PATCH] libweston: Remove substitute format for ARGB8888 + +Xilinx DP gfx layer does not support XRGB8888. Hence, remove the same +as opaque substitute. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Upstream-Status: Inappropriate [Xilinx specific] + +Reworked the patch for the newer weston + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + libweston/pixel-formats.c | 1 - + 1 file changed, 1 deletion(-) + +Index: weston-13.0.0/libweston/pixel-formats.c +=================================================================== +--- weston-13.0.0.orig/libweston/pixel-formats.c ++++ weston-13.0.0/libweston/pixel-formats.c +@@ -251,7 +251,6 @@ static const struct pixel_format_info pi + { + DRM_FORMAT(ARGB8888), + BITS_RGBA_FIXED(8, 8, 8, 8), +- .opaque_substitute = DRM_FORMAT_XRGB8888, + .addfb_legacy_depth = 32, + .bpp = 32, + GL_INTERNALFORMAT(GL_RGBA8), diff --git a/meta-xilinx-core/recipes-graphics/wayland/files/9.0.0/0001-libweston-Remove-substitute-format-for-ARGB8888.patch b/meta-xilinx-core/recipes-graphics/wayland/files/9.0.0/0001-libweston-Remove-substitute-format-for-ARGB8888.patch new file mode 100644 index 00000000..6b5f53b0 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/files/9.0.0/0001-libweston-Remove-substitute-format-for-ARGB8888.patch @@ -0,0 +1,29 @@ +From 3fbb596e53524e78703b76c4fdc33cd6ac62f777 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Date: Fri, 11 Dec 2020 16:21:38 -0800 +Subject: [PATCH] libweston: Remove substitute format for ARGB8888 + +Xilinx DP gfx layer does not support XRGB8888. Hence, remove the same +as opaque substitute. + +Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> +Upstream-Status: Inappropriate [Xilinx specific] +--- + libweston/pixel-formats.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/libweston/pixel-formats.c b/libweston/pixel-formats.c +index 79dc709..ec2d3b7 100644 +--- a/libweston/pixel-formats.c ++++ b/libweston/pixel-formats.c +@@ -193,7 +193,6 @@ static const struct pixel_format_info pixel_format_table[] = { + { + DRM_FORMAT(ARGB8888), + BITS_RGBA_FIXED(8, 8, 8, 8), +- .opaque_substitute = DRM_FORMAT_XRGB8888, + .depth = 32, + .bpp = 32, + GL_FORMAT(GL_BGRA_EXT), +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/wayland/files/init b/meta-xilinx-core/recipes-graphics/wayland/files/init new file mode 100644 index 00000000..f74ac8b1 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/files/init @@ -0,0 +1,54 @@ +#!/bin/sh +# +### BEGIN INIT INFO +# Provides: weston +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO + +if test -e /etc/default/weston ; then + . /etc/default/weston +fi + +killproc() { + pid=`/bin/pidof $1` + [ "$pid" != "" ] && kill $pid +} + +read CMDLINE < /proc/cmdline +for x in $CMDLINE; do + case $x in + weston=false) + echo "Weston disabled" + exit 0; + ;; + esac +done + +case "$1" in + start) + . /etc/profile + export HOME=ROOTHOME + + weston-start -- --continue-without-input $OPTARGS + ;; + + stop) + echo "Stopping Weston" + killproc weston + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + *) + echo "usage: $0 { start | stop | restart }" + ;; +esac + +exit 0 diff --git a/meta-xilinx-core/recipes-graphics/wayland/files/weston.service b/meta-xilinx-core/recipes-graphics/wayland/files/weston.service new file mode 100644 index 00000000..c7583e92 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/files/weston.service @@ -0,0 +1,71 @@ +# This is a system unit for launching Weston with auto-login as the +# user configured here. +# +# Weston must be built with systemd support, and your weston.ini must load +# the plugin systemd-notify.so. +[Unit] +Description=Weston, a Wayland compositor, as a system service +Documentation=man:weston(1) man:weston.ini(5) +Documentation=http://wayland.freedesktop.org/ + +# Make sure we are started after logins are permitted. +Requires=systemd-user-sessions.service +After=systemd-user-sessions.service + +# If Plymouth is used, we want to start when it is on its way out. +After=plymouth-quit-wait.service + +# D-Bus is necessary for contacting logind. Logind is required. +Wants=dbus.socket +After=dbus.socket + +# Ensure the socket is present +Requires=weston.socket + +# Since we are part of the graphical session, make sure we are started before +# it is complete. +Before=graphical.target + +# Prevent starting on systems without virtual consoles, Weston requires one +# for now. +ConditionPathExists=/dev/tty0 + +[Service] +# Requires systemd-notify.so Weston plugin. +Type=notify +EnvironmentFile=/etc/default/weston +ExecStart=/usr/bin/weston --continue-without-input --modules=systemd-notify.so + +# Optional watchdog setup +TimeoutStartSec=60 +WatchdogSec=20 + +# The user to run Weston as. +User=weston +Group=weston + +# Make sure the working directory is the users home directory +WorkingDirectory=/home/weston + +# Set up a full user session for the user, required by Weston. +PAMName=weston-autologin + +# A virtual terminal is needed. +TTYPath=/dev/tty7 +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes + +# Fail to start if not controlling the tty. +StandardInput=tty-fail +StandardOutput=journal +StandardError=journal + +# Log this user with utmp, letting it show up with commands 'w' and 'who'. +UtmpIdentifier=tty7 +UtmpMode=user + +[Install] +# Note: If you only want weston to start on-demand, remove this line with a +# service drop file +WantedBy=graphical.target diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston-init.bbappend b/meta-xilinx-core/recipes-graphics/wayland/weston-init.bbappend new file mode 100644 index 00000000..f0d64e27 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston-init.bbappend @@ -0,0 +1,5 @@ +PACKAGECONFIG += "no-idle-timeout" + +do_install:append:zynqmp() { + sed -i -e "/^\[core\]/a gbm-format=rgb565" ${D}${sysconfdir}/xdg/weston/weston.ini +} diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston.inc b/meta-xilinx-core/recipes-graphics/wayland/weston.inc new file mode 100644 index 00000000..fadc9486 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston.inc @@ -0,0 +1,15 @@ +SRC_URI:append:zynqmp = " file://0001-libweston-Remove-substitute-format-for-ARGB8888.patch" + +# Due to the SRC_URI zynqmp specific change, this needs to be SOC_FAMILY_ARCH specific +SOC_FAMILY_ARCH ??= "${TUNE_PKGARCH}" +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +DEFAULT_PACKAGE_ARCH:zynqmp = "${SOC_FAMILY_ARCH}" +PACKAGE_ARCH = "${DEFAULT_PACKAGE_ARCH}" + + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch b/meta-xilinx-core/recipes-graphics/wayland/weston/0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch new file mode 100644 index 00000000..f8f75894 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch @@ -0,0 +1,50 @@ +From c8bfa1f8d576cdc6d515dbbac36c48c6166be0d5 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Thu, 1 Apr 2021 00:12:00 +0300 +Subject: [PATCH] libweston/backend-drm: Re-order gbm destruction at DRM-backend tear down + +Tearing down the drm-backend when there are no input devices, would call +for the gbm device destruction before compositor shutdown. The latter +would call into the renderer detroy function and assume that the +EGLDisplay, which was created using the before-mentioned gbm device, is +still available. This patch re-orders the gbm destruction after the +compositor shutdown when no one would make use of it. + +Fixes: #314 + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +Suggested-by: Daniel Stone <daniel.stone@collabora.com> + +Upstream-Status: Backport [https://gitlab.freedesktop.org/wayland/weston/-/commit/d171c7b3ba346c4d0bd6494f45ebf0be3c3cc5fb] +--- + libweston/backend-drm/drm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 2780f3b..fbcfeca 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -3025,10 +3025,6 @@ err_drm_source: + err_udev_input: + udev_input_destroy(&b->input); + err_sprite: +-#ifdef BUILD_DRM_GBM +- if (b->gbm) +- gbm_device_destroy(b->gbm); +-#endif + destroy_sprites(b); + err_udev_dev: + udev_device_unref(drm_device); +@@ -3038,6 +3034,10 @@ err_launcher: + weston_launcher_destroy(compositor->launcher); + err_compositor: + weston_compositor_shutdown(compositor); ++#ifdef BUILD_DRM_GBM ++ if (b->gbm) ++ gbm_device_destroy(b->gbm); ++#endif + free(b); + return NULL; + } +-- +2.33.0 diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/0001-meson.build-fix-incorrect-header.patch b/meta-xilinx-core/recipes-graphics/wayland/weston/0001-meson.build-fix-incorrect-header.patch new file mode 100644 index 00000000..06e0f7ba --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/0001-meson.build-fix-incorrect-header.patch @@ -0,0 +1,32 @@ +From a2ba4714a6872e547621d29d9ddcb0f374b88cf6 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 20 Apr 2021 20:42:18 -0700 +Subject: [PATCH] meson.build: fix incorrect header + +The wayland.c actually include 'xdg-shell-client-protocol.h' instead of +the server one, so fix it. Otherwise, it's possible to get build failure +due to race condition. + +Upstream-Status: Pending + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + libweston/backend-wayland/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libweston/backend-wayland/meson.build b/libweston/backend-wayland/meson.build +index 7e82513..29270b5 100644 +--- a/libweston/backend-wayland/meson.build ++++ b/libweston/backend-wayland/meson.build +@@ -10,7 +10,7 @@ srcs_wlwl = [ + fullscreen_shell_unstable_v1_protocol_c, + presentation_time_protocol_c, + presentation_time_server_protocol_h, +- xdg_shell_server_protocol_h, ++ xdg_shell_client_protocol_h, + xdg_shell_protocol_c, + ] + +-- +2.30.2 + diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/0001-tests-include-fcntl.h-for-open-O_RDWR-O_CLOEXEC-and-.patch b/meta-xilinx-core/recipes-graphics/wayland/weston/0001-tests-include-fcntl.h-for-open-O_RDWR-O_CLOEXEC-and-.patch new file mode 100644 index 00000000..6fe86ff3 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/0001-tests-include-fcntl.h-for-open-O_RDWR-O_CLOEXEC-and-.patch @@ -0,0 +1,47 @@ +From 58760e09eed662a72da939ff4802d605489cff8e Mon Sep 17 00:00:00 2001 +From: Denys Dmytriyenko <denys@ti.com> +Date: Tue, 8 Sep 2020 19:37:42 -0400 +Subject: [PATCH] tests: include fcntl.h for open(), O_RDWR, O_CLOEXEC and + O_CREAT + +musl libc (unlike glibc) requires explicitly incuding fcntl.h to define open(), +O_RDWR, O_CLOEXEC and O_CREAT. Otherwise the build fails with the errors: + +| ../weston-9.0.0/tests/weston-test-fixture-compositor.c: In function 'wait_for_lock': +| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:7: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration] +| 135 | fd = open(lock_path, O_RDWR | O_CLOEXEC | O_CREAT, 00700); +| | ^~~~ +| | popen +| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:23: error: 'O_RDWR' undeclared (first use in this function) +| 135 | fd = open(lock_path, O_RDWR | O_CLOEXEC | O_CREAT, 00700); +| | ^~~~~~ +| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:23: note: each undeclared identifier is reported only once for each function it appears in +| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:32: error: 'O_CLOEXEC' undeclared (first use in this function) +| 135 | fd = open(lock_path, O_RDWR | O_CLOEXEC | O_CREAT, 00700); +| | ^~~~~~~~~ +| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:44: error: 'O_CREAT' undeclared (first use in this function) +| 135 | fd = open(lock_path, O_RDWR | O_CLOEXEC | O_CREAT, 00700); +| | ^~~~~~~ + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/493/diffs?commit_id=b10c0e843dcb8148bbe869bb15261955b94ac98c] + +Signed-off-by: Denys Dmytriyenko <denys@ti.com> +--- + tests/weston-test-fixture-compositor.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/weston-test-fixture-compositor.c b/tests/weston-test-fixture-compositor.c +index 0c9855f..e0e32c9 100644 +--- a/tests/weston-test-fixture-compositor.c ++++ b/tests/weston-test-fixture-compositor.c +@@ -31,6 +31,7 @@ + #include <unistd.h> + #include <sys/file.h> + #include <errno.h> ++#include <fcntl.h> + + #include "shared/helpers.h" + #include "weston-test-fixture-compositor.h" +-- +2.7.4 + diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch b/meta-xilinx-core/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch new file mode 100644 index 00000000..f6ebfd8f --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch @@ -0,0 +1,199 @@ +From a1548c742bf2dedbb47282d8a00407b60bbab669 Mon Sep 17 00:00:00 2001 +From: Tom Hochstein <tom.hochstein@nxp.com> +Date: Wed, 22 Feb 2017 15:53:30 +0200 +Subject: [PATCH] weston-launch: Provide a default version that doesn't require + + PAM + +weston-launch requires PAM for starting weston as a non-root user. + +Since starting weston as root is a valid use case by itself, if +PAM is not available, provide a default version of weston-launch +without non-root-user support. + +Upstream-Status: Denied [https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/725] + +Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com> +Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> +Signed-off-by: Denys Dmytriyenko <denys@ti.com> +Signed-off-by: Ming Liu <ming.liu@toradex.com> + +--- + libweston/meson.build | 16 ++++++++++++---- + libweston/weston-launch.c | 21 +++++++++++++++++++++ + meson_options.txt | 7 +++++++ + 3 files changed, 40 insertions(+), 4 deletions(-) + +diff --git a/libweston/meson.build b/libweston/meson.build +index 08d23ec..cb9fd3f 100644 +--- a/libweston/meson.build ++++ b/libweston/meson.build +@@ -216,16 +216,24 @@ dep_vertex_clipping = declare_dependency( + ) + + if get_option('weston-launch') +- dep_pam = cc.find_library('pam') ++ deps_weston_launch = [systemd_dep, dep_libdrm] + +- if not cc.has_function('pam_open_session', dependencies: dep_pam) +- error('pam_open_session not found for weston-launch') ++ if get_option('pam') ++ dep_pam = cc.find_library('pam') ++ if not cc.has_function('pam_open_session', dependencies: dep_pam) ++ error('pam_open_session not found for weston-launch') ++ endif ++ ++ if dep_pam.found() ++ deps_weston_launch += dep_pam ++ config_h.set('HAVE_PAM', '1') ++ endif + endif + + executable( + 'weston-launch', + 'weston-launch.c', +- dependencies: [dep_pam, systemd_dep, dep_libdrm], ++ dependencies: deps_weston_launch, + include_directories: common_inc, + install: true + ) +diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c +index 521cb2c..2d42d33 100644 +--- a/libweston/weston-launch.c ++++ b/libweston/weston-launch.c +@@ -51,7 +51,9 @@ + + #include <pwd.h> + #include <grp.h> ++#ifdef HAVE_PAM + #include <security/pam_appl.h> ++#endif + + #ifdef HAVE_SYSTEMD_LOGIN + #include <systemd/sd-login.h> +@@ -100,8 +102,10 @@ drmSetMaster(int drm_fd) + #endif + + struct weston_launch { ++#ifdef HAVE_PAM + struct pam_conv pc; + pam_handle_t *ph; ++#endif + int tty; + int ttynr; + int sock[2]; +@@ -192,6 +196,7 @@ weston_launch_allowed(struct weston_launch *wl) + return false; + } + ++#ifdef HAVE_PAM + static int + pam_conversation_fn(int msg_count, + const struct pam_message **messages, +@@ -232,6 +237,7 @@ setup_pam(struct weston_launch *wl) + + return 0; + } ++#endif + + static int + setup_launcher_socket(struct weston_launch *wl) +@@ -466,6 +472,7 @@ quit(struct weston_launch *wl, int status) + close(wl->signalfd); + close(wl->sock[0]); + ++#ifdef HAVE_PAM + if (wl->new_user) { + err = pam_close_session(wl->ph, 0); + if (err) +@@ -473,6 +480,7 @@ quit(struct weston_launch *wl, int status) + err, pam_strerror(wl->ph, err)); + pam_end(wl->ph, err); + } ++#endif + + /* + * Get a fresh handle to the tty as the previous one is in +@@ -710,6 +718,7 @@ setup_session(struct weston_launch *wl, char **child_argv) + setenv("HOME", wl->pw->pw_dir, 1); + setenv("SHELL", wl->pw->pw_shell, 1); + ++#ifdef HAVE_PAM + env = pam_getenvlist(wl->ph); + if (env) { + for (i = 0; env[i]; ++i) { +@@ -718,6 +727,7 @@ setup_session(struct weston_launch *wl, char **child_argv) + } + free(env); + } ++#endif + + /* + * We open a new session, so it makes sense +@@ -789,8 +799,10 @@ static void + help(const char *name) + { + fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name); ++#ifdef HAVE_PAM + fprintf(stderr, " -u, --user Start session as specified username,\n" + " e.g. -u joe, requires root.\n"); ++#endif + fprintf(stderr, " -t, --tty Start session on alternative tty,\n" + " e.g. -t /dev/tty4, requires -u option.\n"); + fprintf(stderr, " -v, --verbose Be verbose\n"); +@@ -804,7 +816,9 @@ main(int argc, char *argv[]) + int i, c; + char *tty = NULL; + struct option opts[] = { ++#ifdef HAVE_PAM + { "user", required_argument, NULL, 'u' }, ++#endif + { "tty", required_argument, NULL, 't' }, + { "verbose", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 'h' }, +@@ -816,11 +830,16 @@ main(int argc, char *argv[]) + while ((c = getopt_long(argc, argv, "u:t:vh", opts, &i)) != -1) { + switch (c) { + case 'u': ++#ifdef HAVE_PAM + wl.new_user = optarg; + if (getuid() != 0) { + fprintf(stderr, "weston: Permission denied. -u allowed for root only\n"); + exit(EXIT_FAILURE); + } ++#else ++ fprintf(stderr, "weston: -u is unsupported in this weston-launch build\n"); ++ exit(EXIT_FAILURE); ++#endif + break; + case 't': + tty = optarg; +@@ -872,8 +891,10 @@ main(int argc, char *argv[]) + if (setup_tty(&wl, tty) < 0) + exit(EXIT_FAILURE); + ++#ifdef HAVE_PAM + if (wl.new_user && setup_pam(&wl) < 0) + exit(EXIT_FAILURE); ++#endif + + if (setup_launcher_socket(&wl) < 0) + exit(EXIT_FAILURE); +diff --git a/meson_options.txt b/meson_options.txt +index 239bd2d..99e4ec3 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -73,6 +73,13 @@ option( + ) + + option( ++ 'pam', ++ type: 'boolean', ++ value: true, ++ description: 'Define if PAM is available' ++) ++ ++option( + 'xwayland', + type: 'boolean', + value: true, diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/dont-use-plane-add-prop.patch b/meta-xilinx-core/recipes-graphics/wayland/weston/dont-use-plane-add-prop.patch new file mode 100644 index 00000000..a4444e5d --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/dont-use-plane-add-prop.patch @@ -0,0 +1,23 @@ +Fix atomic modesetting with musl + +atomic modesetting seems to fail with drm weston backend and this patch fixes +it, below errors are seen before weston exits + +atomic: couldn't commit new state: Invalid argument + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/weston/-/issues/158] +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- a/libweston/backend-drm/kms.c ++++ b/libweston/backend-drm/kms.c +@@ -1168,8 +1168,8 @@ drm_pending_state_apply_atomic(struct dr + wl_list_for_each(plane, &b->plane_list, link) { + drm_debug(b, "\t\t[atomic] starting with plane %lu disabled\n", + (unsigned long) plane->plane_id); +- plane_add_prop(req, plane, WDRM_PLANE_CRTC_ID, 0); +- plane_add_prop(req, plane, WDRM_PLANE_FB_ID, 0); ++ //plane_add_prop(req, plane, WDRM_PLANE_CRTC_ID, 0); ++ //plane_add_prop(req, plane, WDRM_PLANE_FB_ID, 0); + } + + flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/systemd-notify.weston-start b/meta-xilinx-core/recipes-graphics/wayland/weston/systemd-notify.weston-start new file mode 100644 index 00000000..a97e7b38 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/systemd-notify.weston-start @@ -0,0 +1,9 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: Huawei Inc. +# SPDX-License-Identifier: Apache-2.0 + + +if [[ -x "/usr/lib/weston/systemd-notify.so" ]]; then + add_weston_module "systemd-notify.so" +fi diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/weston.desktop b/meta-xilinx-core/recipes-graphics/wayland/weston/weston.desktop new file mode 100644 index 00000000..1086ae8b --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/weston.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Name=Weston +Comment=Wayland Compostitor +Exec=weston +Icon=weston +Terminal=false +Categories=Utility; diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/weston.png b/meta-xilinx-core/recipes-graphics/wayland/weston/weston.png Binary files differnew file mode 100644 index 00000000..ea8b7e0e --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/weston.png diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston/xwayland.weston-start b/meta-xilinx-core/recipes-graphics/wayland/weston/xwayland.weston-start new file mode 100644 index 00000000..db384b1a --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston/xwayland.weston-start @@ -0,0 +1,5 @@ +#!/bin/sh + +if type Xwayland >/dev/null 2>/dev/null; then + mkdir -p /tmp/.X11-unix +fi diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston_13.%.bbappend b/meta-xilinx-core/recipes-graphics/wayland/weston_13.%.bbappend new file mode 100644 index 00000000..3ee9cafa --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston_13.%.bbappend @@ -0,0 +1,12 @@ +FILESEXTRAPATHS:prepend:zynqmp := "${THISDIR}/files:" + +require weston.inc + +ZYNQMP_WARN_DEFAULT = "0" +ZYNQMP_WARN_DEFAULT:zynqmp = "${@bb.utils.contains('DISTRO_FEATURES', 'libmali', '1', '0', d)}" +ZYNQMP_WARN = "${@bb.utils.contains('MACHINE_FEATURES', 'mali400', '${ZYNQMP_WARN_DEFAULT}', '0', d)}" + +python() { + if d.getVar('ZYNQMP_WARN') == "1": + raise bb.parse.SkipRecipe("Weston %s requires GLES 3 interfaces which are not available when libmali enabled. Use Weston 9.0.0.0 instead." % (d.getVar('PV'))) +} diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston_9.0.0.bb b/meta-xilinx-core/recipes-graphics/wayland/weston_9.0.0.bb new file mode 100644 index 00000000..a534b1b7 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston_9.0.0.bb @@ -0,0 +1,148 @@ +SUMMARY = "Weston, a Wayland compositor" +DESCRIPTION = "Weston is the reference implementation of a Wayland compositor" +HOMEPAGE = "http://wayland.freedesktop.org" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \ + file://libweston/compositor.c;endline=27;md5=6c53bbbd99273f4f7c4affa855c33c0a" + +# We want this version to be "newer" then 10, only if libmali and mali400 are both enabled +ORIG_PE := "${PE}" +MALI_PE = "${@bb.utils.contains('DISTRO_FEATURES', 'libmali', '1', '${ORIG_PE}', d)}" +PE = "${@bb.utils.contains('MACHINE_FEATURES', 'mali400', '${MALI_PE}', '${ORIG_PE}', d)}" + +SRC_URI = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \ + file://weston.png \ + file://weston.desktop \ + file://xwayland.weston-start \ + file://systemd-notify.weston-start \ + file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \ + file://0001-tests-include-fcntl.h-for-open-O_RDWR-O_CLOEXEC-and-.patch \ + file://0001-meson.build-fix-incorrect-header.patch \ + file://0001-libweston-backend-drm-Re-order-gbm-destruction-at-DR.patch \ +" + +SRC_URI:append:libc-musl = " file://dont-use-plane-add-prop.patch " + +SRC_URI[sha256sum] = "5cf5d6ce192e0eb15c1fc861a436bf21b5bb3b91dbdabbdebe83e1f83aa098fe" + +UPSTREAM_CHECK_URI = "https://wayland.freedesktop.org/releases.html" + +inherit meson pkgconfig useradd features_check +# depends on virtual/egl +# weston-init requires pam enabled if started via systemd +REQUIRED_DISTRO_FEATURES = "opengl ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', 'pam', '', d)}" + +DEPENDS = "libxkbcommon gdk-pixbuf pixman cairo glib-2.0" +DEPENDS += "wayland wayland-protocols libinput virtual/egl pango wayland-native" + +LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'lto', '-Wl,-z,undefs', '', d)}" + +WESTON_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:1])}" + +EXTRA_OEMESON += "-Dbackend-default=auto -Dpipewire=false" + +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms fbdev wayland egl clients', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd x11', d)} \ + ${@bb.utils.contains_any('DISTRO_FEATURES', 'wayland x11', '', 'headless', d)} \ + launch \ + image-jpeg \ + screenshare \ + shell-desktop \ + shell-fullscreen \ + shell-ivi" + +# +# Compositor choices +# +# Weston on KMS +PACKAGECONFIG[kms] = "-Dbackend-drm=true,-Dbackend-drm=false,drm udev virtual/egl virtual/libgles2 virtual/libgbm mtdev" +# Weston on Wayland (nested Weston) +PACKAGECONFIG[wayland] = "-Dbackend-wayland=true,-Dbackend-wayland=false,virtual/egl virtual/libgles2" +# Weston on X11 +PACKAGECONFIG[x11] = "-Dbackend-x11=true,-Dbackend-x11=false,virtual/libx11 libxcb libxcb libxcursor cairo" +# Headless Weston +PACKAGECONFIG[headless] = "-Dbackend-headless=true,-Dbackend-headless=false" +# Weston on framebuffer +PACKAGECONFIG[fbdev] = "-Dbackend-fbdev=true,-Dbackend-fbdev=false,udev mtdev" +# Weston on RDP +PACKAGECONFIG[rdp] = "-Dbackend-rdp=true,-Dbackend-rdp=false,freerdp" +# weston-launch +PACKAGECONFIG[launch] = "-Dweston-launch=true,-Dweston-launch=false,drm" +# VA-API desktop recorder +PACKAGECONFIG[vaapi] = "-Dbackend-drm-screencast-vaapi=true,-Dbackend-drm-screencast-vaapi=false,libva" +# Weston with EGL support +PACKAGECONFIG[egl] = "-Drenderer-gl=true,-Drenderer-gl=false,virtual/egl" +# Weston with lcms support +PACKAGECONFIG[lcms] = "-Dcolor-management-lcms=true,-Dcolor-management-lcms=false,lcms" +# Weston with webp support +PACKAGECONFIG[webp] = "-Dimage-webp=true,-Dimage-webp=false,libwebp" +# Weston with systemd-login support +PACKAGECONFIG[systemd] = "-Dsystemd=true -Dlauncher-logind=true,-Dsystemd=false -Dlauncher-logind=false,systemd dbus" +# Weston with Xwayland support (requires X11 and Wayland) +PACKAGECONFIG[xwayland] = "-Dxwayland=true,-Dxwayland=false" +# colord CMS support +PACKAGECONFIG[colord] = "-Dcolor-management-colord=true,-Dcolor-management-colord=false,colord" +# Clients support +PACKAGECONFIG[clients] = "-Dsimple-clients=all -Ddemo-clients=true,-Dsimple-clients= -Ddemo-clients=false" +# Virtual remote output with GStreamer on DRM backend +PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0 gstreamer1.0-plugins-base" +# Weston with PAM support +PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam" +# Weston with screen-share support +PACKAGECONFIG[screenshare] = "-Dscreenshare=true,-Dscreenshare=false" +# Traditional desktop shell +PACKAGECONFIG[shell-desktop] = "-Dshell-desktop=true,-Dshell-desktop=false" +# Fullscreen shell +PACKAGECONFIG[shell-fullscreen] = "-Dshell-fullscreen=true,-Dshell-fullscreen=false" +# In-Vehicle Infotainment (IVI) shell +PACKAGECONFIG[shell-ivi] = "-Dshell-ivi=true,-Dshell-ivi=false" +# JPEG image loading support +PACKAGECONFIG[image-jpeg] = "-Dimage-jpeg=true,-Dimage-jpeg=false, jpeg" + +do_install:append() { + # Weston doesn't need the .la files to load modules, so wipe them + rm -f ${D}/${libdir}/libweston-${WESTON_MAJOR_VERSION}/*.la + + # If X11, ship a desktop file to launch it + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then + install -d ${D}${datadir}/applications + install ${WORKDIR}/weston.desktop ${D}${datadir}/applications + + install -d ${D}${datadir}/icons/hicolor/48x48/apps + install ${WORKDIR}/weston.png ${D}${datadir}/icons/hicolor/48x48/apps + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then + install -Dm 644 ${WORKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'yes', 'no', d)}" = "yes" ]; then + install -Dm 644 ${WORKDIR}/systemd-notify.weston-start ${D}${datadir}/weston-start/systemd-notify + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'launch', 'yes', 'no', d)}" = "yes" ]; then + chmod u+s ${D}${bindir}/weston-launch + fi +} + +PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', '${PN}-xwayland', '', d)} \ + libweston-${WESTON_MAJOR_VERSION} ${PN}-examples" + +FILES:${PN}-dev += "${libdir}/${BPN}/libexec_weston.so" +FILES:${PN} = "${bindir}/weston ${bindir}/weston-terminal ${bindir}/weston-info ${bindir}/weston-launch ${bindir}/wcap-decode ${libexecdir} ${libdir}/${BPN}/*.so* ${datadir}" + +FILES:libweston-${WESTON_MAJOR_VERSION} = "${libdir}/lib*${SOLIBS} ${libdir}/libweston-${WESTON_MAJOR_VERSION}/*.so" +SUMMARY:libweston-${WESTON_MAJOR_VERSION} = "Helper library for implementing 'wayland window managers'." + +FILES:${PN}-examples = "${bindir}/*" + +FILES:${PN}-xwayland = "${libdir}/libweston-${WESTON_MAJOR_VERSION}/xwayland.so" +RDEPENDS:${PN}-xwayland += "xwayland" + +RDEPENDS:${PN} += "xkeyboard-config" +RRECOMMENDS:${PN} = "weston-init liberation-fonts" +RRECOMMENDS:${PN}-dev += "wayland-protocols" + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM:${PN} = "--system weston-launch" diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston_9.0.0.bbappend b/meta-xilinx-core/recipes-graphics/wayland/weston_9.0.0.bbappend new file mode 100644 index 00000000..80512ac3 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/weston_9.0.0.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS:prepend:zynqmp := "${THISDIR}/files/9.0.0:${THISDIR}/files:" + +require weston.inc diff --git a/meta-xilinx-core/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service.in b/meta-xilinx-core/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service.in new file mode 100644 index 00000000..5a4a6a05 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service.in @@ -0,0 +1,13 @@ +[Unit] +Description=Xserver startup without a display manager +StartLimitBurst=5 +StartLimitIntervalSec=100 + +[Service] +EnvironmentFile=/etc/default/xserver-nodm +User=@USER@ +ExecStart=/etc/xserver-nodm/Xserver +Restart=always + +[Install] +Alias=display-manager.service diff --git a/meta-xilinx-core/recipes-graphics/x11-common/xserver-nodm-init_%.bbappend b/meta-xilinx-core/recipes-graphics/x11-common/xserver-nodm-init_%.bbappend new file mode 100644 index 00000000..0a789a20 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/x11-common/xserver-nodm-init_%.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" diff --git a/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config/zynqmp/xorg.conf b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xf86-config/zynqmp/xorg.conf index 9ef39462..0e2988de 100644 --- a/meta-xilinx-bsp/recipes-graphics/xorg-xserver/xserver-xf86-config/zynqmp/xorg.conf +++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xf86-config/zynqmp/xorg.conf @@ -13,6 +13,7 @@ EndSection Section "Device" Identifier "ZynqMP" Driver "armsoc" + Option "BusId" "fd4a0000.display" Option "DRI2" "true" Option "DRI2_PAGE_FLIP" "false" Option "DRI2_WAIT_VSYNC" "true" diff --git a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend new file mode 100644 index 00000000..4fc41d05 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" diff --git a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/99-monitor-hotplug.rules b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/99-monitor-hotplug.rules new file mode 100644 index 00000000..eeb7d671 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/99-monitor-hotplug.rules @@ -0,0 +1 @@ +ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="/usr/bin/monitor-hotplug.sh" diff --git a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh new file mode 100755 index 00000000..bceb5607 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh @@ -0,0 +1,65 @@ +#! /bin/sh + +# Copyright (C) 2018 Xilinx, Inc. All rights reserved. +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Adapt this script to your needs. + +DEVICES=$(find /sys/class/drm/*/status) + +# inspired by /etc/acpd/lid.sh and the function it sources. + +# Read first X display number from the list. +displaynum=`ls /tmp/.X11-unix/* | sed s#/tmp/.X11-unix/X## | head -n 1` +displaynum=${displaynum%% *} + +display=":$displaynum.0" +export DISPLAY=":$displaynum.0" + +# from https://wiki.archlinux.org/index.php/Acpid#Laptop_Monitor_Power_Off + +# Clear XAUTHORITY by default in case X session is not using display manager. +unset XAUTHORITY + +# Detect X session command line started for the display $displaynum and extract +# -auth argument if any. +ps -eo args | grep -e "Xorg\W*:$displaynum" | grep -e -auth | while read -r line +do + if [[ "${line%% *}" == *Xorg ]]; then + export XAUTHORITY=`echo $line | sed -n 's/.*-auth //; s/ -[^ ].*//; p'` + break + fi +done + +for i in /sys/class/drm/*/*/status ; +do + status=$(cat $i); + connector=${i%/status*}; + connector=${connector#*-}; + if [ "$status" == "disconnected" ]; then + xset dpms force off + elif [ "$status" == "connected" ]; then + xset dpms force on + if [ "$(xrandr | grep '\*')" = "" ]; then + xrandr --output $connector --auto + fi + fi +done diff --git a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend new file mode 100644 index 00000000..460ff581 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend @@ -0,0 +1,23 @@ +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += " \ + file://monitor-hotplug.sh \ + file://99-monitor-hotplug.rules \ + " + +do_install:append() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/monitor-hotplug.sh ${D}${bindir} + + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-monitor-hotplug.rules ${D}${sysconfdir}/udev/rules.d/99-monitor-hotplug.rules +} + +FILES:${PN} += "${sysconfdir}/udev/rules.d/*" diff --git a/meta-xilinx-core/recipes-graphics/xwayland/xwayland_%.bbappend b/meta-xilinx-core/recipes-graphics/xwayland/xwayland_%.bbappend new file mode 100644 index 00000000..c1005f11 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/xwayland/xwayland_%.bbappend @@ -0,0 +1,7 @@ +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" + diff --git a/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2022.2.bb b/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2022.2.bb new file mode 100644 index 00000000..dda6ec31 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2022.2.bb @@ -0,0 +1,24 @@ +SUMMARY = "Xilinx DisplayPort Linux Kernel module" +DESCRIPTION = "Out-of-tree DisplayPort(DP) kernel modules provider for aarch64 devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XLNX_DP_VERSION = "5.10.0" +PV = "${XLNX_DP_VERSION}+xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2022.2" +REPO ?= "git://github.com/xilinx/dp-modules.git;protocol=https" +SRCREV ?= "c57b2ce95ee6c86f35caecbc7007644ff8f6d337" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit module + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" diff --git a/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2023.1.bb b/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2023.1.bb new file mode 100644 index 00000000..28770994 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2023.1.bb @@ -0,0 +1,24 @@ +SUMMARY = "Xilinx DisplayPort Linux Kernel module" +DESCRIPTION = "Out-of-tree DisplayPort(DP) kernel modules provider for aarch64 devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XLNX_DP_VERSION = "6.1.0" +PV = "${XLNX_DP_VERSION}+xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/xilinx/dp-modules.git;protocol=https" +SRCREV ?= "5b0969ac09f301c33bccc140c8f60e832f5cf222" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit module + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" diff --git a/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2023.2.bb b/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2023.2.bb new file mode 100644 index 00000000..d1c6bd3d --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/dp/kernel-module-dp_2023.2.bb @@ -0,0 +1,24 @@ +SUMMARY = "Xilinx DisplayPort Linux Kernel module" +DESCRIPTION = "Out-of-tree DisplayPort(DP) kernel modules provider for aarch64 devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XLNX_DP_VERSION = "6.1.0" +PV = "${XLNX_DP_VERSION}+xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/xilinx/dp-modules.git;protocol=https" +SRCREV ?= "5b0969ac09f301c33bccc140c8f60e832f5cf222" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit module + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" diff --git a/meta-xilinx-core/recipes-kernel/dtc/python3-dtc/0001-Revert-libfdt-overlay-make-overlay_get_target-public.patch b/meta-xilinx-core/recipes-kernel/dtc/python3-dtc/0001-Revert-libfdt-overlay-make-overlay_get_target-public.patch new file mode 100644 index 00000000..cf4739eb --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/dtc/python3-dtc/0001-Revert-libfdt-overlay-make-overlay_get_target-public.patch @@ -0,0 +1,129 @@ +From 4d4703e0199fb3556c37694e4d951785abca22fd Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Wed, 19 Jan 2022 12:46:42 -0500 +Subject: [PATCH] Revert "libfdt: overlay: make overlay_get_target() public" + +This reverts commit 45f3d1a095dd3440578d5c6313eba555a791f3fb. +--- + libfdt/fdt_overlay.c | 29 ++++++++++++++++++++++------- + libfdt/libfdt.h | 18 ------------------ + libfdt/version.lds | 1 - + 3 files changed, 22 insertions(+), 26 deletions(-) + +diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c +index 5c0c398..d217e79 100644 +--- a/libfdt/fdt_overlay.c ++++ b/libfdt/fdt_overlay.c +@@ -40,22 +40,37 @@ static uint32_t overlay_get_target_phandle(const void *fdto, int fragment) + return fdt32_to_cpu(*val); + } + +-int fdt_overlay_target_offset(const void *fdt, const void *fdto, +- int fragment_offset, char const **pathp) ++/** ++ * overlay_get_target - retrieves the offset of a fragment's target ++ * @fdt: Base device tree blob ++ * @fdto: Device tree overlay blob ++ * @fragment: node offset of the fragment in the overlay ++ * @pathp: pointer which receives the path of the target (or NULL) ++ * ++ * overlay_get_target() retrieves the target offset in the base ++ * device tree of a fragment, no matter how the actual targeting is ++ * done (through a phandle or a path) ++ * ++ * returns: ++ * the targeted node offset in the base device tree ++ * Negative error code on error ++ */ ++static int overlay_get_target(const void *fdt, const void *fdto, ++ int fragment, char const **pathp) + { + uint32_t phandle; + const char *path = NULL; + int path_len = 0, ret; + + /* Try first to do a phandle based lookup */ +- phandle = overlay_get_target_phandle(fdto, fragment_offset); ++ phandle = overlay_get_target_phandle(fdto, fragment); + if (phandle == (uint32_t)-1) + return -FDT_ERR_BADPHANDLE; + + /* no phandle, try path */ + if (!phandle) { + /* And then a path based lookup */ +- path = fdt_getprop(fdto, fragment_offset, "target-path", &path_len); ++ path = fdt_getprop(fdto, fragment, "target-path", &path_len); + if (path) + ret = fdt_path_offset(fdt, path); + else +@@ -621,7 +636,7 @@ static int overlay_merge(void *fdt, void *fdto) + if (overlay < 0) + return overlay; + +- target = fdt_overlay_target_offset(fdt, fdto, fragment, NULL); ++ target = overlay_get_target(fdt, fdto, fragment, NULL); + if (target < 0) + return target; + +@@ -764,7 +779,7 @@ static int overlay_symbol_update(void *fdt, void *fdto) + return -FDT_ERR_BADOVERLAY; + + /* get the target of the fragment */ +- ret = fdt_overlay_target_offset(fdt, fdto, fragment, &target_path); ++ ret = overlay_get_target(fdt, fdto, fragment, &target_path); + if (ret < 0) + return ret; + target = ret; +@@ -786,7 +801,7 @@ static int overlay_symbol_update(void *fdt, void *fdto) + + if (!target_path) { + /* again in case setprop_placeholder changed it */ +- ret = fdt_overlay_target_offset(fdt, fdto, fragment, &target_path); ++ ret = overlay_get_target(fdt, fdto, fragment, &target_path); + if (ret < 0) + return ret; + target = ret; +diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h +index a7f432c..7f117e8 100644 +--- a/libfdt/libfdt.h ++++ b/libfdt/libfdt.h +@@ -2116,24 +2116,6 @@ int fdt_del_node(void *fdt, int nodeoffset); + */ + int fdt_overlay_apply(void *fdt, void *fdto); + +-/** +- * fdt_overlay_target_offset - retrieves the offset of a fragment's target +- * @fdt: Base device tree blob +- * @fdto: Device tree overlay blob +- * @fragment_offset: node offset of the fragment in the overlay +- * @pathp: pointer which receives the path of the target (or NULL) +- * +- * fdt_overlay_target_offset() retrieves the target offset in the base +- * device tree of a fragment, no matter how the actual targeting is +- * done (through a phandle or a path) +- * +- * returns: +- * the targeted node offset in the base device tree +- * Negative error code on error +- */ +-int fdt_overlay_target_offset(const void *fdt, const void *fdto, +- int fragment_offset, char const **pathp); +- + /**********************************************************************/ + /* Debugging / informational functions */ + /**********************************************************************/ +diff --git a/libfdt/version.lds b/libfdt/version.lds +index cbce5d4..7ab85f1 100644 +--- a/libfdt/version.lds ++++ b/libfdt/version.lds +@@ -77,7 +77,6 @@ LIBFDT_1.2 { + fdt_appendprop_addrrange; + fdt_setprop_inplace_namelen_partial; + fdt_create_with_flags; +- fdt_overlay_target_offset; + local: + *; + }; +-- +2.19.1 + diff --git a/meta-xilinx-core/recipes-kernel/dtc/python3-dtc_1.6.1.bb b/meta-xilinx-core/recipes-kernel/dtc/python3-dtc_1.6.1.bb new file mode 100644 index 00000000..a868bd01 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/dtc/python3-dtc_1.6.1.bb @@ -0,0 +1,26 @@ +SUMMARY = "Python Library for the Device Tree Compiler" +HOMEPAGE = "https://devicetree.org/" +DESCRIPTION = "A python library for the Device Tree Compiler, a tool used to manipulate Device Tree files which contain a data structure for describing hardware." +SECTION = "bootloader" +LICENSE = "GPL-2.0-only | BSD-2-Clause" + +DEPENDS = "flex-native bison-native swig-native python3-setuptools-scm-native libyaml dtc" + +SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git;branch=master \ + file://0001-Revert-libfdt-overlay-make-overlay_get_target-public.patch \ + " + +UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" + +LIC_FILES_CHKSUM = "file://pylibfdt/libfdt.i;beginline=1;endline=6;md5=afda088c974174a29108c8d80b5dce90" + +SRCREV = "c001fc01a43e7a06447c06ea3d50bd60641322b8" + +PV = "1.6.1+git${SRCPV}" +S = "${WORKDIR}/git" + +PYPA_WHEEL = "${S}/dist/libfdt-1.6.2*.whl" + +inherit setuptools3 pkgconfig + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2022.2.bb b/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2022.2.bb new file mode 100644 index 00000000..c1f66013 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2022.2.bb @@ -0,0 +1,24 @@ +SUMMARY = "Xilinx HDMI Linux Kernel module" +DESCRIPTION = "Out-of-tree HDMI kernel modules provider for MPSoC EG/EV devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=b34277fe156508fd5a650609dc36d1fe" + +XLNX_HDMI_VERSION = "5.15.19" +PV = "${XLNX_HDMI_VERSION}+xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2022.2" +REPO ?= "git://github.com/Xilinx/hdmi-modules.git;protocol=https" +SRCREV = "25b6fe7a26a975be15c002b48cfd4c291486491e" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit module + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" diff --git a/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2023.1.bb b/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2023.1.bb new file mode 100644 index 00000000..20acb8b3 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2023.1.bb @@ -0,0 +1,24 @@ +SUMMARY = "Xilinx HDMI Linux Kernel module" +DESCRIPTION = "Out-of-tree HDMI kernel modules provider for MPSoC EG/EV devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=b34277fe156508fd5a650609dc36d1fe" + +XLNX_HDMI_VERSION = "6.1" +PV = "${XLNX_HDMI_VERSION}+xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/hdmi-modules.git;protocol=https" +SRCREV = "1c6330f02fea68992e22400fdbc8c0d0e63e2958" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit module + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" diff --git a/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2023.2.bb b/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2023.2.bb new file mode 100644 index 00000000..bc89f5f3 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/hdmi/kernel-module-hdmi_2023.2.bb @@ -0,0 +1,24 @@ +SUMMARY = "Xilinx HDMI Linux Kernel module" +DESCRIPTION = "Out-of-tree HDMI kernel modules provider for MPSoC EG/EV devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=b34277fe156508fd5a650609dc36d1fe" + +XLNX_HDMI_VERSION = "6.1" +PV = "${XLNX_HDMI_VERSION}+xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/hdmi-modules.git;protocol=https" +SRCREV = "82209b0021a7b5d7ef71a859eed4bafeb541ed08" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit module + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +COMPATIBLE_MACHINE:versal = "versal" diff --git a/meta-xilinx-core/recipes-kernel/linux-firmware/linux-firmware-ti-bt.bb b/meta-xilinx-core/recipes-kernel/linux-firmware/linux-firmware-ti-bt.bb new file mode 100644 index 00000000..97740671 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux-firmware/linux-firmware-ti-bt.bb @@ -0,0 +1,75 @@ +# TIInit_11.8.32.bts is required for bluetooth support but this particular +# version is not available in the linux-firmware repository. +# +SUMMARY = "TI Bluetooth firmware files for use with Linux kernel" +SECTION = "kernel" + +LICENSE = "Firmware-ti-bt" + +LIC_FILES_CHKSUM = "file://LICENSE.ti-bt;md5=f39eac9f4573be5b012e8313831e72a9" + +# No common license for this, so be sure to include it +NO_GENERIC_LICENSE[Firmware-ti-bt] = "LICENSE.ti-bt" + +SRC_URI = "git://git.ti.com/ti-bt/service-packs.git;protocol=https;branch=master" +SRCREV = "c290f8af9e388f37e509ecb111a1b64572b7c225" + +S = "${WORKDIR}/git" + +inherit allarch + +CLEANBROKEN = "1" + +do_unpack[postfuncs] += "rename_license" + +rename_license() { + mv ${S}/LICENSE ${S}/LICENSE.ti-bt +} + +do_compile() { + : +} + +do_install() { + oe_runmake 'DEST_DIR=${D}' 'BASE_LIB_DIR=${nonarch_base_libdir}' + + # Remove files we're not packaging... + rm -f ${D}${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_7.6.15.bts \ + ${D}${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_10.6.15.bts \ + ${D}${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_6.7.16_bt_spec_4.1.bts \ + ${D}${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_12.8.32.bts \ + ${D}${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_12.10.28.bts \ + ${D}${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_6.7.16_avpr_add-on.bts \ + ${D}${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_6.7.16_bt_spec_4.0.bts \ + ${D}${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_6.7.16_ble_add-on.bts + + for each in ${D}${nonarch_base_libdir}/firmware/ti-connectivity/* ; do + ln -s ti-connectivity/`basename $each` ${D}${nonarch_base_libdir}/firmware/`basename $each` + done + + cp LICENSE.ti-bt ${D}${nonarch_base_libdir}/firmware/License.ti-bt +} + +# 11.8.32 = WL180x, WL183x, WL185x PG2.1 or PG2.2, 8.32 ROM Version +PACKAGES =+ "${PN}-wl180x ${PN}-license" + +# Ensure if someone installs the main one, they get the specific named package +ALLOW_EMPTY:${PN} = "1" +RDEPENDS:${PN} += "${PN}-wl180x" + +FILES:${PN}-license = "\ + ${nonarch_base_libdir}/firmware/License.ti-bt \ + " + +FILES:${PN}-wl180x = "\ + ${nonarch_base_libdir}/firmware/TIInit_11.8.32.bts \ + ${nonarch_base_libdir}/firmware/ti-connectivity/TIInit_11.8.32.bts \ + " + +RDEPENDS:${PN}-wl180x = "\ + ${PN}-license linux-firmware-wl18xx \ + " + +LICENSE:${PN}-wl180x = "Firmware-ti-bt" + +INSANE_SKIP = "arch" diff --git a/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules.bb b/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules.bb new file mode 100644 index 00000000..611e2e91 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules.bb @@ -0,0 +1,35 @@ +SUMMARY = "Udev rules files for Linux drivers" +DESCRIPTION = "Generic udev rules recipe for Xilinx Linux in tree drivers" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "\ + file://99-aie-device.rules \ + file://99-mali-device.rules \ +" + +S = "${WORKDIR}" + +inherit useradd + +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynq = ".*" +COMPATIBLE_MACHINE:zynqmp = ".*" +COMPATIBLE_MACHINE:microblaze = ".*" +COMPATIBLE_MACHINE:versal = ".*" + +do_configure[noexec] = '1' +do_compile[noexec] = '1' + +do_install () { + install -d ${D}${sysconfdir}/udev/rules.d + for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do + install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/ + done +} + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM:${PN} += "-r aie;" + +FILES:${PN} += "${sysconfdir}/udev/rules.d/*" + diff --git a/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules/99-aie-device.rules b/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules/99-aie-device.rules new file mode 100644 index 00000000..fffcf6e6 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules/99-aie-device.rules @@ -0,0 +1,2 @@ +# Device rules for AIE drivers. +ACTION=="add", SUBSYSTEM=="aie", KERNEL=="aie[0-9]*", MODE="0660", GROUP="aie" diff --git a/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules/99-mali-device.rules b/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules/99-mali-device.rules new file mode 100644 index 00000000..89ec5f78 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux-xlnx-udev-rules/linux-xlnx-udev-rules/99-mali-device.rules @@ -0,0 +1,2 @@ +# Device rules for GPU MALI-400 drivers. +ACTION=="add", SUBSYSTEM=="misc", KERNEL=="mali", MODE="0660", GROUP="video", TAG+="uaccess" diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-microblaze.inc b/meta-xilinx-core/recipes-kernel/linux/linux-microblaze.inc new file mode 100644 index 00000000..a2f15adb --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-microblaze.inc @@ -0,0 +1,14 @@ +SRC_URI += " \ + file://microblaze_generic.cfg \ + " + +KERNEL_FEATURES:append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' features/microblaze-systemd/microblaze-systemd.scc', '', d)}" + +# MicroBlaze is a uImage target, but its not called 'uImage' instead it is called 'linux.bin.ub' +python () { + if d.getVar('KERNEL_IMAGETYPE', True).endswith('.ub'): + d.setVar('DEPENDS', "%s u-boot-mkimage-native" % d.getVar('DEPENDS', True)) +} + +# Disable buildpaths QA check warnings for linux-xlnx-scr +INSANE_SKIP:${PN}-src += "buildpaths" diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx-dev.bb b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx-dev.bb index acb9938f..197cb208 100644 --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx-dev.bb +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx-dev.bb @@ -11,7 +11,7 @@ SRCREV ?= '${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-x # skip version sanity, because the version moves with AUTOREV KERNEL_VERSION_SANITY_SKIP = "1" -LINUX_VERSION ?= "4.9+" +LINUX_VERSION ?= "5.15+" LINUX_VERSION_EXTENSION ?= "-xilinx-dev" include linux-xlnx.inc diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx.inc b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx.inc new file mode 100644 index 00000000..2355d090 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx.inc @@ -0,0 +1,67 @@ +# This version extension should match CONFIG_LOCALVERSION in defconfig +LINUX_VERSION_EXTENSION ?= "-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}" +PV = "${LINUX_VERSION}${LINUX_VERSION_EXTENSION}+git${SRCPV}" + +# Sources, by default allow for the use of SRCREV pointing to orphaned tags/commits +KBRANCH ?= "undefined" +SRCBRANCHARG = "${@['nobranch=1', 'branch=${KBRANCH}'][d.getVar('KBRANCH', True) != '']}" + +FILESOVERRIDES:append := ":${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}" +KERNELURI ?= "git://github.com/Xilinx/linux-xlnx.git;protocol=https;name=machine" +YOCTO_META ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=yocto-kmeta" +SRC_URI = "${KERNELURI};${SRCBRANCHARG} ${YOCTO_META}" +SRC_URI += "file://linux-xlnx-kmeta;type=kmeta;name=linux-xlnx-kmeta;destsuffix=linux-xlnx-kmeta" + +SRCREV_machine ?= "${SRCREV}" +SRCREV_meta ?= "eeb5d0c9dd5e2928835c633644426ee357fbce12" +SRCREV_FORMAT = "machine" + +require recipes-kernel/linux/linux-yocto.inc + +LINUX_MB_INC = "" +LINUX_MB_INC:microblaze = "linux-microblaze.inc" +require ${LINUX_MB_INC} + +DESCRIPTION = "Xilinx Kernel" +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + +EXTKERNELSRC = "${@'1' if d.getVar('EXTERNALSRC') else ''}" + +# Force the use of the KBUILD_DEFCONFIG even if some other defconfig was generated in the ${WORKDIR} +do_kernel_metadata:prepend () { + [ -n "${KBUILD_DEFCONFIG}" ] && [ -e ${WORKDIR}/defconfig ] && rm ${WORKDIR}/defconfig +} + +do_configure:prepend () { + if [ -n "${KBUILD_DEFCONFIG}" ] && [ -n "${EXTKERNELSRC}" ]; then + cp ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig + fi +} + +inherit kernel-simpleimage + +# Default to be only compatible with specific machines or soc families +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynq = ".*" +COMPATIBLE_MACHINE:zynqmp = ".*" +COMPATIBLE_MACHINE:microblaze = ".*" +COMPATIBLE_MACHINE:versal = ".*" + +# Use DEFCONFIGs for configuring linux-xlnx kernels +KCONFIG_MODE ?= "alldefconfig" +KBUILD_DEFCONFIG:zynqmp ?= "xilinx_defconfig" +KBUILD_DEFCONFIG:zynq ?= "xilinx_zynq_defconfig" +KBUILD_DEFCONFIG:microblaze ?= "mmu_defconfig" +KBUILD_DEFCONFIG:versal ?= "xilinx_defconfig" + +KERNEL_FEATURES:append:zynqmp = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' features/xen/xen.scc', '', d)}" + +KERNEL_FEATURES:append:zynqmp = "${@' features/xilinx/overlay_of/overlay_of.scc' if d.getVar('FPGA_MNGR_RECONFIG_ENABLE') == '1' else ''}" + +KERNEL_FEATURES:append:versal = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' features/xen/xen.scc', '', d)} features/xilinx/hdmi-module/hdmi-module.scc" + +KERNEL_FEATURES:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', ' features/ocicontainer/ocicontainer.scc', '', d)}" + +# Enable DRM_LIMA support if DISTRO_FEATURES != 'libmali' and MACHINE_FEATURES mali400 is enabled +MALI_FEATURE = "${@bb.utils.contains('DISTRO_FEATURES', 'libmali', '', 'features/drm-lima/drm-lima.scc', d)}" +KERNEL_FEATURES:append = "${@bb.utils.contains('MACHINE_FEATURES', 'mali400', ' ${MALI_FEATURE}', '', d)}" diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/0001-scripts-dtc-Remove-redundant-YYLOC-global-declaratio.patch b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/0001-scripts-dtc-Remove-redundant-YYLOC-global-declaratio.patch new file mode 100644 index 00000000..d5b96c2d --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/0001-scripts-dtc-Remove-redundant-YYLOC-global-declaratio.patch @@ -0,0 +1,51 @@ +From e33a814e772cdc36436c8c188d8c42d019fda639 Mon Sep 17 00:00:00 2001 +From: Dirk Mueller <dmueller@suse.com> +Date: Tue, 14 Jan 2020 18:53:41 +0100 +Subject: [PATCH] scripts/dtc: Remove redundant YYLOC global declaration + +gcc 10 will default to -fno-common, which causes this error at link +time: + + (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here + +This is because both dtc-lexer as well as dtc-parser define the same +global symbol yyloc. Before with -fcommon those were merged into one +defintion. The proper solution would be to to mark this as "extern", +however that leads to: + + dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls] + 26 | extern YYLTYPE yylloc; + | ^~~~~~ +In file included from dtc-lexer.l:24: +dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here + 127 | extern YYLTYPE yylloc; + | ^~~~~~ +cc1: all warnings being treated as errors + +which means the declaration is completely redundant and can just be +dropped. + +Signed-off-by: Dirk Mueller <dmueller@suse.com> +Signed-off-by: David Gibson <david@gibson.dropbear.id.au> +[robh: cherry-pick from upstream] +Cc: stable@vger.kernel.org +Signed-off-by: Rob Herring <robh@kernel.org> +--- + scripts/dtc/dtc-lexer.l | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index 5c6c3fd557d7..b3b7270300de 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -23,7 +23,6 @@ LINECOMMENT "//".*\n + #include "srcpos.h" + #include "dtc-parser.tab.h" + +-YYLTYPE yylloc; + extern bool treesource_error; + + /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ +-- +2.29.2 + diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/drm-lima/drm-lima.cfg b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/drm-lima/drm-lima.cfg new file mode 100644 index 00000000..79c268b3 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/drm-lima/drm-lima.cfg @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: MIT +CONFIG_DRM=y +CONFIG_DRM_LIMA=m +CONFIG_DRM_XLNX=y diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/drm-lima/drm-lima.scc b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/drm-lima/drm-lima.scc new file mode 100644 index 00000000..425cc233 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/drm-lima/drm-lima.scc @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: MIT +kconf hardware drm-lima.cfg + diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/microblaze-systemd/microblaze-systemd.cfg b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/microblaze-systemd/microblaze-systemd.cfg new file mode 100644 index 00000000..0aebbf91 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/microblaze-systemd/microblaze-systemd.cfg @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: MIT + +#........................................................................ +#WARNING +# +# This file is a kernel configuration fragment, and not a full kernel +# configuration file. The final kernel configuration is made up of +# an assembly of processed fragments, each of which is designed to +# capture a specific part of the final configuration (e.g. platform +# configuration, feature configuration, and board specific hardware +# configuration). For more information on kernel configuration, please +# refer the product documentation. +# +#........................................................................ + +# Based on the systemd README file kernel requirements +# Many of these are not enabled on microblaze by default to conserve +# memory. + +# Kernel Config Options +CONFIG_DEVTMPFS=y +CONFIG_CGROUPS=y +CONFIG_INOTIFY_USER=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EPOLL=y +CONFIG_UNIX=y +CONFIG_SYSFS=y +CONFIG_PROC_FS=y +CONFIG_FHANDLE=y + +# Kernel crypto/hash API +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_SHA256=y + +# udev will fail to work with the legacy sysfs layout: +# CONFIG_SYSFS_DEPRECATED is not set + +# Legacy hotplug slows down the system and confuses udev: +CONFIG_UEVENT_HELPER_PATH="" + +#Userspace firmware loading is not supported and should be disabled in +#the kernel: +# CONFIG_FW_LOADER_USER_HELPER is not set diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/microblaze-systemd/microblaze-systemd.scc b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/microblaze-systemd/microblaze-systemd.scc new file mode 100644 index 00000000..2a38f446 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/linux-xlnx-kmeta/features/microblaze-systemd/microblaze-systemd.scc @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT +define KFEATURE_DESCRIPTION "Enable systemd on microblaze systems" +define KFEATURE_COMPATIBILITY all + +kconf non-hardware microblaze-systemd.cfg + diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/mb-no-tree-loop-distribute-patterns.patch b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/mb-no-tree-loop-distribute-patterns.patch new file mode 100644 index 00000000..5a4d203d --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/mb-no-tree-loop-distribute-patterns.patch @@ -0,0 +1,47 @@ +Disable tree-loop-distribute-patterns CFLAG + +Issue: CR-1086247 + +GCC 10.2.0 added -ftree-loop-distribute-patterns by default with -O2. This +is causing a condition where the kernel will no longer boot. + +This is a temporary workaround until we can identify the true cause of +the boot failure. + +Symtoms: + +earlycon: uartlite_a0 at MMIO 0x40600000 (options '115200n8') +printk: bootconsole [uartlite_a0] enabled +cma: Reserved 16 MiB at 0xaec00000 +Linux version 5.10.0-xilinx-v2020.2 (oe-user@oe-host) (microblazeel-xilinx-linux-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.0.20200730) #1 Mon Mar 1 12:58:36 UTC 2021 +setup_memory: max_mapnr: 0x40000 +setup_memory: min_low_pfn: 0x80000 +setup_memory: max_low_pfn: 0xb0000 +setup_memory: max_pfn: 0xc0000 +Zone ranges: + DMA [mem 0x0000000080000000-0x00000000afffffff] + Normal empty + HighMem [mem 0x00000000b0000000-0x00000000bfffffff] +Movable zone start for each node +Early memory node ranges + node 0: [mem 0x0000000080000000-0x00000000bfffffff] +Initmem setup node 0 [mem 0x0000000080000000-0x00000000bfffffff] +<hang> + +Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> + +diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile +index bb980891816d..e368c35ad21c 100644 +--- a/arch/microblaze/Makefile ++++ b/arch/microblaze/Makefile +@@ -48,6 +48,10 @@ CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER)) + # r31 holds current when in kernel mode + KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-y) $(CPUFLAGS-1) $(CPUFLAGS-2) + ++# GCC 10.x now has -ftree-loop-distribute-patterns by default in -O2 ++# This causes a boot failure, so disable it ++KBUILD_CFLAGS += -fno-tree-loop-distribute-patterns ++ + head-y := arch/microblaze/kernel/head.o + libs-y += arch/microblaze/lib/ + core-y += arch/microblaze/kernel/ diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/microblaze_generic.cfg b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/microblaze_generic.cfg new file mode 100644 index 00000000..adbb7bc0 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx/microblaze_generic.cfg @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: MIT + +#........................................................................ +# WARNING +# +# This file is a kernel configuration fragment, and not a full kernel +# configuration file. The final kernel configuration is made up of +# an assembly of processed fragments, each of which is designed to +# capture a specific part of the final configuration (e.g. platform +# configuration, feature configuration, and board specific hardware +# configuration). For more information on kernel configuration, please +# refer the product documentation. +# +#........................................................................ + +# +# Definitions for MICROBLAZE +# +CONFIG_XILINX_MICROBLAZE0_FAMILY="kintexu" +CONFIG_XILINX_MICROBLAZE0_USE_FPU=1 +CONFIG_XILINX_MICROBLAZE0_HW_VER="11.0" +CONFIG_KERNEL_BASE_ADDR=0x80000000 + +# +# General Setup +# +CONFIG_BLK_DEV_INITRD=y + +# +# Boot options +# +CONFIG_CMDLINE="console=ttyUL0,115200 earlycon root=/dev/ram0 rw" +# CONFIG_CMDLINE_FORCE is not set + +# +# MTD support and Partition parsers +# +CONFIG_MTD_OF_PARTS=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_M25P80=y + +# +# Networking drivers +# +CONFIG_NET_CORE=y + +# +# Xilinx and TI DP83867 Gigabit PHY device drivers +# +CONFIG_XILINX_PHY=y +CONFIG_DP83867_PHY=y
\ No newline at end of file diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2022.1.bb b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2022.1.bb new file mode 100644 index 00000000..41c1ffe2 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2022.1.bb @@ -0,0 +1,9 @@ +LINUX_VERSION = "5.15.19" +KBRANCH="xlnx_rebase_v5.15_LTS_2022.1_update" +SRCREV = "75872fda9ad270b611ee6ae2433492da1e22b688" + +KCONF_AUDIT_LEVEL="0" + +include linux-xlnx.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2022.2.bb b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2022.2.bb new file mode 100644 index 00000000..260224b8 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2022.2.bb @@ -0,0 +1,9 @@ +LINUX_VERSION = "5.15.36" +KBRANCH="xlnx_rebase_v5.15_LTS" +SRCREV = "19984dd147fa7fbb7cb14b17400263ad0925c189" + +KCONF_AUDIT_LEVEL="0" + +include linux-xlnx.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2023.1.bb b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2023.1.bb new file mode 100644 index 00000000..d229f21c --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2023.1.bb @@ -0,0 +1,11 @@ +LINUX_VERSION = "6.1.30" +YOCTO_META ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.1;destsuffix=yocto-kmeta" +KBRANCH="xlnx_rebase_v6.1_LTS_2023.1_update" +SRCREV = "9299ac26ca514a0ccd9f6ae01f50e816d7e79dfa" +SRCREV_meta = "185bcfcbe480c742247d9117011794c69682914f" + +KCONF_AUDIT_LEVEL="0" + +include linux-xlnx.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2023.2.bb b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2023.2.bb new file mode 100644 index 00000000..ec5827e6 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-xlnx_2023.2.bb @@ -0,0 +1,11 @@ +LINUX_VERSION = "6.1.60" +YOCTO_META ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.1;destsuffix=yocto-kmeta" +KBRANCH="xlnx_rebase_v6.1_LTS" +SRCREV = "9c55be2d8a90a240912c9b85814ac962c86b382b" +SRCREV_meta = "185bcfcbe480c742247d9117011794c69682914f" + +KCONF_AUDIT_LEVEL="0" + +include linux-xlnx.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-yocto-dev.bbappend b/meta-xilinx-core/recipes-kernel/linux/linux-yocto-dev.bbappend new file mode 100644 index 00000000..05c39951 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -0,0 +1 @@ +require linux-yocto-xilinx.inc diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-yocto-tiny_%.bbappend b/meta-xilinx-core/recipes-kernel/linux/linux-yocto-tiny_%.bbappend new file mode 100644 index 00000000..05c39951 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-yocto-tiny_%.bbappend @@ -0,0 +1 @@ +require linux-yocto-xilinx.inc diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-yocto-xilinx.inc b/meta-xilinx-core/recipes-kernel/linux/linux-yocto-xilinx.inc new file mode 100644 index 00000000..5e33ffe5 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-yocto-xilinx.inc @@ -0,0 +1,17 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/linux-xlnx:" + +LINUX_MB_INC = "" +LINUX_MB_INC:microblaze = "linux-microblaze.inc" +require ${LINUX_MB_INC} + +# Zynq default generic KMACHINE +COMPATIBLE_MACHINE:zynq = "zynq" +KMACHINE:zynq = "zynq" + +# ZynqMP default generic KMACHINE +COMPATIBLE_MACHINE:zynqmp = "zynqmp" +KMACHINE:zynqmp = "zynqmp" + +# MicroBlaze default generic KMACHINE +KMACHINE:microblaze = "microblaze" +COMPATIBLE_MACHINE:microblaze = "microblaze" diff --git a/meta-xilinx-core/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-xilinx-core/recipes-kernel/linux/linux-yocto_%.bbappend new file mode 100644 index 00000000..05c39951 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/linux/linux-yocto_%.bbappend @@ -0,0 +1 @@ +require linux-yocto-xilinx.inc diff --git a/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops.bb b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops.bb new file mode 100644 index 00000000..2648c372 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops.bb @@ -0,0 +1,31 @@ +SUMMARY = "Device tree lopper - lops" +DESCRIPTION = "Xilinx specific lop files" +SECTION = "bootloader" +LICENSE = "BSD-3-Clause" + +RDEPENDS:${PN} += "lopper" + +SRC_URI = " \ + file://lop-microblaze-yocto.dts \ + file://lop-xilinx-id-cpus.dts \ + file://lop-machine-name.dts \ + " + +LIC_FILES_CHKSUM = "file://lop-microblaze-yocto.dts;endline=10;md5=27139f9b862dc6fe466c7157aba7ed9c" + +S = "${WORKDIR}" + +inherit python3-dir + +do_configure[noexec] = '1' +do_compile[noexec] = '1' + +do_install() { + mkdir -p ${D}/${PYTHON_SITEPACKAGES_DIR}/lopper/lops + cp ${S}/lop-microblaze-yocto.dts ${D}/${PYTHON_SITEPACKAGES_DIR}/lopper/lops/. + cp ${S}/lop-xilinx-id-cpus.dts ${D}/${PYTHON_SITEPACKAGES_DIR}/lopper/lops/. + cp ${S}/lop-machine-name.dts ${D}/${PYTHON_SITEPACKAGES_DIR}/lopper/lops/. +} + +FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}/lopper/lops" +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-machine-name.dts b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-machine-name.dts new file mode 100644 index 00000000..0fb5649a --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-machine-name.dts @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. + * + * Author: + * Mark Hatle <mark.hatle@amd.com> + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/dts-v1/; + +/ { + compatible = "system-device-tree-v1,lop"; + lops { + compatible = "system-device-tree-v1,lop"; + track_feature: track_feature { + compatible = "system-device-tree-v1,lop,code-v1"; + noexec; + code = " + # print( 'track: lopper library routine: %s' % node ) + try: + node.tunes[prop] = prop + except: + pass + "; + }; + lop_0_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/"; + lop_0_2 { + compatible = "system-device-tree-v1,lop,code-v1"; + inherit = "subsystem"; + code = " + for n in tree.__selected__: + mach_name = n['compatible'].value[0].replace(',','-').replace('.','-') + model = n['model'].value[0] + device_id = n['device_id'].value[0] + print( '%s %s %s' % (mach_name.lower(), device_id, model) ) + "; + }; + }; + }; +}; diff --git a/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-microblaze-yocto.dts b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-microblaze-yocto.dts new file mode 100644 index 00000000..5e5f7986 --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-microblaze-yocto.dts @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2020 Xilinx Inc. All rights reserved. + * Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. + * + * Author: + * Bruce Ashfield <bruce.ashfield@amd.com> + * Mark Hatle <mark.hatle@amd.com> + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/dts-v1/; + +/ { + compatible = "system-device-tree-v1,lop"; + lops { + compatible = "system-device-tree-v1,lop"; + track_feature: track_feature { + compatible = "system-device-tree-v1,lop,code-v1"; + noexec; + code = " + # print( 'track: lopper library routine: %s' % node ) + try: + node.tunes[prop] = prop + except: + pass + "; + }; + lop_0_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + lop_0_2 { + compatible = "system-device-tree-v1,lop,code-v1"; + inherit = "subsystem"; + code = " + for n in tree.__selected__: + val = n['compatible'].value[0] + if val == 'pmu-microblaze': + n.tunes = OrderedDict() + n.tunes['microblaze'] = 'microblaze' + n.tunes['version'] = 'v9.2' + n.tune_type = val.split('-')[0] + + elif val == 'pmc-microblaze' or val == 'psm-microblaze': + n.tunes = OrderedDict() + n.tunes['microblaze'] = 'microblaze' + n.tunes['version'] = 'v10.0' + n.tune_type = val.split('-')[0] + + else: + n.tune_type = re.split('@', n.name)[0] + "; + }; + }; + lop_1_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-barrel:1"; + lop_1_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['barrel-shift'] = 'barrel-shift' + "; + }; + }; + lop_2_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,endianness:!1"; + lop_2_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['bigendian'] = 'bigendian' + "; + }; + }; + lop_3_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,data-size:0x40"; + lop_3_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['64-bit'] = '64-bit' + "; + }; + }; + lop_4_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-pcmp-instr:1"; + lop_4_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['pattern-compare'] = 'pattern-compare' + "; + }; + }; + lop_5_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-reorder-instr:!0"; + lop_5_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['reorder'] = 'reorder' + "; + }; + }; + lop_6_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,area-optimized:2"; + lop_6_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['frequency-optimized'] = 'frequency-optimized' + "; + }; + }; + lop_7_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-hw-mul:1"; + lop_7_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['multiply-low'] = 'multiply-low' + "; + }; + }; + lop_8_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-hw-mul:2"; + lop_8_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['multiply-high'] = 'multiply-high' + "; + }; + }; + lop_9_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-div:1"; + lop_9_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['divide-hard'] = 'divide-hard' + "; + }; + }; + lop_10_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-fpu:!1"; + select_4 = ":xlnx,use-fpu:!2"; + lop_10_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['fpu-soft'] = 'fpu-soft' + "; + }; + }; + lop_11_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-fpu:1"; + lop_11_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['fpu-hard'] = 'fpu-hard' + "; + }; + }; + lop_12_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + select_3 = ":xlnx,use-fpu:2"; + lop_12_1_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + if __selected__: + for n in __selected__: + n.tunes['fpu-hard-extended'] = 'fpu-hard-extended' + "; + }; + }; + lop_output_tunes { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/cpus_microblaze.*/cpu*.*:compatible:.*microblaze"; + lop_output_code { + compatible = "system-device-tree-v1,lop,code-v1"; + code = " + cpu_addr = 0 + firmware_cpus = {} + for n in __selected__: + tname = 'microblaze-'+n.tune_type + if n.tune_type == 'cpu': + tname = tname + str(cpu_addr) + cpu_addr += 1 + print( '# %s\\n# compatible = \"%s\";' % (n, n['compatible'].value[0])) + print( 'AVAILTUNES += \"%s\"' % tname ) + print( 'TUNE_FEATURES:tune-%s = \"%s\"' % (tname, ' '.join(n.tunes.values()))) + print( 'PACKAGE_EXTRA_ARCHS:tune-%s = \"${TUNE_PKGARCH}\"\\n' % tname ) + "; + }; + }; + }; +}; diff --git a/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts new file mode 100644 index 00000000..1468801a --- /dev/null +++ b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2019,2020 Xilinx Inc. All rights reserved. + * + * Author: + * Bruce Ashfield <bruce.ashfield@xilinx.com> + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/dts-v1/; + +/ { + compatible = "system-device-tree-v1,lop"; + lops { + compatible = "system-device-tree-v1,lop"; + lop_0_1 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/.*:os,type:.*"; + lop_0_2 { + compatible = "system-device-tree-v1,lop,code-v1"; + inherit = "lopper_lib"; + code = " + for s in __selected__: + os_type = s['os,type'].value[0] + try: + domain_name = s.label + except: + domain_name = s.name + if not domain_name: + domain_name = s.name + try: + cpu = s['cpus'] + except: + print( '[ERROR]: os,type node, has no cpu reference' ) + try: + cpu_node = tree.pnode( cpu.value[0] ) + cpu_mask = cpu[1] + except: + print( '[ERROR]: os,type node, has invalid cpu reference' ) + + cpu_output = {} + cpus_refd, cpus_unrefd = lopper_lib.cpu_refs( tree, cpu ) + for c in cpus_refd: + cpu_type = c['compatible'].value[0] + cpu_output[cpu_type] = '{} {} {}'.format(cpu_type,domain_name,os_type) + + # print the summary lines + for o in cpu_output.values(): + print( '%s' % o ) + "; + }; + }; + lop_0_3 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/.*:compatible:openamp,domain-v1"; + select_3 = ":!os,type:"; + select_4 = ":compatible:!xilinx,subsystem-v1"; + lop_0_3_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + inherit = "lopper_lib"; + code = " + if __selected__: + print( '# global \\'all\\' domains' ) + # __selected__ are domains with no os,type specificiation + # we'll dump them to a global 'all' domain + for s in __selected__: + os_type = 'linux' + try: + domain_name = s.label + except: + domain_name = s.name + if not domain_name: + domain_name = s.name + try: + cpu = s['cpus'] + except: + print( '[ERROR]: os,type node, has no cpu reference' ) + try: + cpu_node = tree.pnode( cpu.value[0] ) + cpu_mask = cpu[1] + except: + print( '[ERROR]: os,type node, has invalid cpu reference' ) + + cpu_output = {} + cpus_refd, cpus_unrefd = lopper_lib.cpu_refs( tree, cpu ) + for c in cpus_refd: + cpu_type = c['compatible'].value[0] + cpu_output[cpu_type] = '{} {} {}'.format(cpu_type,domain_name,os_type) + + # print the summary lines + for o in cpu_output.values(): + print( '%s' % o ) + "; + }; + }; + lop_0_4 { + compatible = "system-device-tree-v1,lop,select-v1"; + select_1; + select_2 = "/.*:compatible:cpus,cluster"; + lop_0_3_1 { + compatible = "system-device-tree-v1,lop,code-v1"; + inherit = "lopper_lib"; + code = " + cpu_output = {} + symbol_node = node.tree['/__symbols__'] + prop_dict = symbol_node.__props__ + for c in __selected__: + num_cpu = 0 + for c_node in c.subnodes( children_only = True ): + try: + cpu_node = c_node['device_type'].value[0] + num_cpu = c_node['reg'].value[0] + num_cpu = num_cpu + 1 + except: + cpu_node = None + if cpu_node: + match = [label for label,node_abs in prop_dict.items() if re.match(node_abs[0], c_node.abs_path) and len(node_abs[0]) == len(c_node.abs_path)] + cpu_name = match[0] + if num_cpu != 0: + cpu_type = c_node['compatible'].value[0] + dict_key = cpu_name + str(num_cpu) + cpu_output[dict_key] = '{} {} {} {} {}'.format(cpu_type, num_cpu-1, 'None', cpu_name, 'None') + + if cpu_output: + print( '# global core_number no-domain cpu_name' ) + + for o in cpu_output.values(): + print( '%s' % o ) + "; + }; + }; + }; +}; diff --git a/meta-xilinx-core/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend b/meta-xilinx-core/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend new file mode 100644 index 00000000..03823f6e --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend @@ -0,0 +1,6 @@ +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH[vardepsexclude] = "MACHINE_ARCH" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH[vardepsexclude] = "MALI_PACKAGE_ARCH" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/files/0001-Current-gcc-requires-cstdint-for-C-types.patch b/meta-xilinx-core/recipes-multimedia/vcu/files/0001-Current-gcc-requires-cstdint-for-C-types.patch new file mode 100644 index 00000000..defe14dc --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/files/0001-Current-gcc-requires-cstdint-for-C-types.patch @@ -0,0 +1,55 @@ +From 2316632e8f3eefc21bc4f9cb97be4603b4c14719 Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Thu, 28 Sep 2023 12:24:04 -0600 +Subject: [PATCH] Current gcc requires cstdint for C types + +Add #include <cstdint> to resolve the issues similar to the following: + + module/module_structs.h:259:3: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'? + module/module_structs.h:260:3: error: 'uint16_t' does not name a type + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + exe_omx/encoder/EncCmdMngr.h | 1 + + module/module_structs.h | 1 + + utility/processor_fifo.h | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/exe_omx/encoder/EncCmdMngr.h b/exe_omx/encoder/EncCmdMngr.h +index 6dacd68..cd3d0a6 100644 +--- a/exe_omx/encoder/EncCmdMngr.h ++++ b/exe_omx/encoder/EncCmdMngr.h +@@ -7,6 +7,7 @@ + #include <iostream> + #include <string> + #include <vector> ++#include <cstdint> + + #include "ICommandsSender.h" + +diff --git a/module/module_structs.h b/module/module_structs.h +index 7151b86..37ff8ac 100644 +--- a/module/module_structs.h ++++ b/module/module_structs.h +@@ -6,6 +6,7 @@ + #include "module_enums.h" + #include <string> + #include <vector> ++#include <cstdint> + + template<typename T> + struct InputOutput +diff --git a/utility/processor_fifo.h b/utility/processor_fifo.h +index 1c62ba4..3c9cd86 100644 +--- a/utility/processor_fifo.h ++++ b/utility/processor_fifo.h +@@ -6,6 +6,7 @@ + #include <utility/locked_queue.h> + #include <thread> + #include <functional> ++#include <string> + + #if defined __linux__ + #include <sys/prctl.h> +-- +2.34.1 diff --git a/meta-xilinx-core/recipes-multimedia/vcu/files/0001-Support-updated-gcc-add-cstdint-where-necessary.patch b/meta-xilinx-core/recipes-multimedia/vcu/files/0001-Support-updated-gcc-add-cstdint-where-necessary.patch new file mode 100644 index 00000000..788edd03 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/files/0001-Support-updated-gcc-add-cstdint-where-necessary.patch @@ -0,0 +1,52 @@ +From b58c0a7dd0eeb16b2251edfad3b4763ce5653ea2 Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Thu, 28 Sep 2023 12:04:34 -0600 +Subject: [PATCH] Support updated gcc, add cstdint where necessary + +With the latest gcc, cstdint is now needs to be explicitly included, otherwise +errors similar to the following will occur: + + include/lib_app/Parser.h:413:36: error: 'uint32_t' has not been declared + 413 | static void resetFlag(T* bitfield, uint32_t uFlag) + | ^~~~~~~~ + include/lib_app/Parser.h: In function 'void resetFlag(T*, int)': + include/lib_app/Parser.h:415:20: error: 'uint32_t' was not declared in this scope + 415 | *bitfield = (T)((uint32_t)*bitfield & ~uFlag); + | ^~~~~~~~ + include/lib_app/Parser.h:18:1: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'? + 17 | #include <iomanip> + +++ |+#include <cstdint> + 18 | + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + exe_encoder/EncCmdMngr.h | 1 + + include/lib_app/Parser.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/exe_encoder/EncCmdMngr.h b/exe_encoder/EncCmdMngr.h +index 6dacd68..cd3d0a6 100644 +--- a/exe_encoder/EncCmdMngr.h ++++ b/exe_encoder/EncCmdMngr.h +@@ -7,6 +7,7 @@ + #include <iostream> + #include <string> + #include <vector> ++#include <cstdint> + + #include "ICommandsSender.h" + +diff --git a/include/lib_app/Parser.h b/include/lib_app/Parser.h +index efb7f94..66d5164 100644 +--- a/include/lib_app/Parser.h ++++ b/include/lib_app/Parser.h +@@ -15,6 +15,7 @@ + #include <sstream> + #include <vector> + #include <iomanip> ++#include <cstdint> + + std::deque<Token> toReversePolish(std::deque<Token>& tokens); + std::string parseString(std::deque<Token>& tokens); +-- +2.34.1 diff --git a/meta-xilinx-core/recipes-multimedia/vcu/files/99-vcu-enc-dec.rules b/meta-xilinx-core/recipes-multimedia/vcu/files/99-vcu-enc-dec.rules new file mode 100644 index 00000000..4643ad37 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/files/99-vcu-enc-dec.rules @@ -0,0 +1,7 @@ +# Allegro VCU Encode, Decoder module drivers +SUBSYSTEM=="allegro_encode_class", KERNEL=="allegroIP", MODE="0660", GROUP="video" +SUBSYSTEM=="allegro_decode_class", KERNEL=="allegroDecodeIP", MODE="0660", GROUP="video" + +# Xilinx Video DMA driver +SUBSYSTEM=="char", KERNEL=="dmaproxy", MODE="0660", GROUP="video" + diff --git a/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2022.1.bb b/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2022.1.bb new file mode 100644 index 00000000..7ef1d5fd --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2022.1.bb @@ -0,0 +1,39 @@ +SUMMARY = "Linux kernel module for Video Code Unit" +DESCRIPTION = "Out-of-tree VCU decoder, encoder and common kernel modules provider for MPSoC EV devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +BRANCH = "xlnx_rel_v2022.1" +REPO = "git://github.com/Xilinx/vcu-modules.git;protocol=https" +SRCREV = "9d2657550eccebccce08cacfcdd369367b9f6be4" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = " \ + ${REPO};${BRANCHARG} \ + file://99-vcu-enc-dec.rules \ + " + +inherit module features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" + +RDEPENDS:${PN} = "vcu-firmware" + +KERNEL_MODULE_AUTOLOAD += "dmaproxy" + +do_install:append() { + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-vcu-enc-dec.rules ${D}${sysconfdir}/udev/rules.d/ +} + +FILES:${PN} = "${sysconfdir}/udev/rules.d/*" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2022.2.bb b/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2022.2.bb new file mode 100644 index 00000000..b1c96d3c --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2022.2.bb @@ -0,0 +1,39 @@ +SUMMARY = "Linux kernel module for Video Code Unit" +DESCRIPTION = "Out-of-tree VCU decoder, encoder and common kernel modules provider for MPSoC EV devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +BRANCH = "xlnx_rel_v2022.2" +REPO = "git://github.com/Xilinx/vcu-modules.git;protocol=https" +SRCREV = "b131e220285e06658b6ab27f9e19b1c592a55f3a" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = " \ + ${REPO};${BRANCHARG} \ + file://99-vcu-enc-dec.rules \ + " + +inherit module features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" + +RDEPENDS:${PN} = "vcu-firmware" + +KERNEL_MODULE_AUTOLOAD += "dmaproxy" + +do_install:append() { + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-vcu-enc-dec.rules ${D}${sysconfdir}/udev/rules.d/ +} + +FILES:${PN} = "${sysconfdir}/udev/rules.d/*" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2023.1.bb b/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2023.1.bb new file mode 100644 index 00000000..9adfcade --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2023.1.bb @@ -0,0 +1,39 @@ +SUMMARY = "Linux kernel module for Video Code Unit" +DESCRIPTION = "Out-of-tree VCU decoder, encoder and common kernel modules provider for MPSoC EV devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +BRANCH = "xlnx_rel_v2023.1" +REPO = "git://github.com/Xilinx/vcu-modules.git;protocol=https" +SRCREV = "4afe0ab4eb3b7f2d17bcb823dee0caa0f03ab7a0" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = " \ + ${REPO};${BRANCHARG} \ + file://99-vcu-enc-dec.rules \ + " + +inherit module features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" + +RDEPENDS:${PN} = "vcu-firmware" + +KERNEL_MODULE_AUTOLOAD += "dmaproxy" + +do_install:append() { + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-vcu-enc-dec.rules ${D}${sysconfdir}/udev/rules.d/ +} + +FILES:${PN} = "${sysconfdir}/udev/rules.d/*" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2023.2.bb b/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2023.2.bb new file mode 100644 index 00000000..e8bd3397 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/kernel-module-vcu_2023.2.bb @@ -0,0 +1,39 @@ +SUMMARY = "Linux kernel module for Video Code Unit" +DESCRIPTION = "Out-of-tree VCU decoder, encoder and common kernel modules provider for MPSoC EV devices" +SECTION = "kernel/modules" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +BRANCH = "xlnx_rel_v2023.2" +REPO = "git://github.com/Xilinx/vcu-modules.git;protocol=https" +SRCREV = "689c8d823b383e2a8a5249be49de627f866cfaf2" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = " \ + ${REPO};${BRANCHARG} \ + file://99-vcu-enc-dec.rules \ + " + +inherit module features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" + +RDEPENDS:${PN} = "vcu-firmware" + +KERNEL_MODULE_AUTOLOAD += "dmaproxy" + +do_install:append() { + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-vcu-enc-dec.rules ${D}${sysconfdir}/udev/rules.d/ +} + +FILES:${PN} = "${sysconfdir}/udev/rules.d/*" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2022.1.bb b/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2022.1.bb new file mode 100644 index 00000000..47c521c4 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2022.1.bb @@ -0,0 +1,51 @@ +SUMMARY = "OpenMAX Integration layer for VCU" +DESCRIPTION = "OMX IL Libraries,test applications and headers for VCU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=03a7aef7e6f6a76a59fd9b8ba450b493" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2022.1" +REPO ?= "git://github.com/Xilinx/vcu-omx-il.git;protocol=https" +SRCREV = "b3308c608be7ed9250b9c6732f6e0a02b1a2e985" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +S = "${WORKDIR}/git" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +DEPENDS = "libvcu-xlnx" +RDEPENDS:${PN} = "kernel-module-vcu libvcu-xlnx" + +EXTERNAL_INCLUDE="${STAGING_INCDIR}/vcu-ctrl-sw/include" + +EXTRA_OEMAKE = " \ + CC='${CC}' CXX='${CXX} ${CXXFLAGS}' \ + EXTERNAL_INCLUDE='${EXTERNAL_INCLUDE}' \ + " + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir}/vcu-omx-il + + install -m 0644 ${S}/omx_header/*.h ${D}${includedir}/vcu-omx-il + + install -Dm 0755 ${S}/bin/omx_decoder ${D}/${bindir}/omx_decoder + install -Dm 0755 ${S}/bin/omx_encoder ${D}/${bindir}/omx_encoder + + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.core ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_decoder ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_encoder ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2022.2.bb b/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2022.2.bb new file mode 100644 index 00000000..c5b956bc --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2022.2.bb @@ -0,0 +1,50 @@ +SUMMARY = "OpenMAX Integration layer for VCU" +DESCRIPTION = "OMX IL Libraries,test applications and headers for VCU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=03a7aef7e6f6a76a59fd9b8ba450b493" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2022.2" +REPO ?= "git://github.com/Xilinx/vcu-omx-il.git;protocol=https" +SRCREV = "6752f5da88a8783f689ae762065295b89902d6d4" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +S = "${WORKDIR}/git" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:zynqmp = "zynqmp" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +DEPENDS = "libvcu-xlnx" +RDEPENDS:${PN} = "kernel-module-vcu libvcu-xlnx" + +EXTERNAL_INCLUDE="${STAGING_INCDIR}/vcu-ctrl-sw/include" + +EXTRA_OEMAKE = " \ + CC='${CC}' CXX='${CXX} ${CXXFLAGS}' \ + EXTERNAL_INCLUDE='${EXTERNAL_INCLUDE}' \ + " + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir}/vcu-omx-il + + install -m 0644 ${S}/omx_header/*.h ${D}${includedir}/vcu-omx-il + + install -Dm 0755 ${S}/bin/omx_decoder ${D}/${bindir}/omx_decoder + install -Dm 0755 ${S}/bin/omx_encoder ${D}/${bindir}/omx_encoder + + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.core ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_decoder ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_encoder ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2023.1.bb b/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2023.1.bb new file mode 100644 index 00000000..75a05fed --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2023.1.bb @@ -0,0 +1,53 @@ +SUMMARY = "OpenMAX Integration layer for VCU" +DESCRIPTION = "OMX IL Libraries,test applications and headers for VCU" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=5375796c5ae4ee85ea1f2c1603e58509" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/vcu-omx-il.git;protocol=https" +SRCREV = "4773b372b72b88ccbabc122b023f042fb22a019e" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +SRC_URI += "file://0001-Current-gcc-requires-cstdint-for-C-types.patch" + +S = "${WORKDIR}/git" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +DEPENDS = "libvcu-xlnx" +RDEPENDS:${PN} = "kernel-module-vcu libvcu-xlnx" + +EXTERNAL_INCLUDE="${STAGING_INCDIR}/vcu-ctrl-sw/include" + +EXTRA_OEMAKE = " \ + CC='${CC}' CXX='${CXX} ${CXXFLAGS}' \ + EXTERNAL_INCLUDE='${EXTERNAL_INCLUDE}' \ + " + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir}/vcu-omx-il + + install -m 0644 ${S}/omx_header/*.h ${D}${includedir}/vcu-omx-il + + install -Dm 0755 ${S}/bin/omx_decoder ${D}/${bindir}/omx_decoder + install -Dm 0755 ${S}/bin/omx_encoder ${D}/${bindir}/omx_encoder + + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.core ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_decoder ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_encoder ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2023.2.bb b/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2023.2.bb new file mode 100644 index 00000000..0c215605 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/libomxil-xlnx_2023.2.bb @@ -0,0 +1,52 @@ +SUMMARY = "OpenMAX Integration layer for VCU" +DESCRIPTION = "OMX IL Libraries,test applications and headers for VCU" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=ef69c2bb405668101824f0b644631e2e" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/vcu-omx-il.git;protocol=https" +SRCREV = "3a04b5adc661a0eced626c1373dbbfe699ae6fe0" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +SRC_URI += "file://0001-Current-gcc-requires-cstdint-for-C-types.patch" + +S = "${WORKDIR}/git" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +DEPENDS = "libvcu-xlnx" +RDEPENDS:${PN} = "kernel-module-vcu libvcu-xlnx" + +EXTERNAL_INCLUDE="${STAGING_INCDIR}/vcu-ctrl-sw/include" + +EXTRA_OEMAKE = " \ + CC='${CC}' CXX='${CXX} ${CXXFLAGS}' \ + EXTERNAL_INCLUDE='${EXTERNAL_INCLUDE}' \ + " + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir}/vcu-omx-il + + install -m 0644 ${S}/omx_header/*.h ${D}${includedir}/vcu-omx-il + + oe_runmake install INSTALL_PATH=${D}${bindir} + + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.core ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_decoder ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_encoder ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2022.1.bb b/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2022.1.bb new file mode 100644 index 00000000..71e6e572 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2022.1.bb @@ -0,0 +1,46 @@ +SUMMARY = "Control Software for VCU" +DESCRIPTION = "Control software libraries, test applications and headers provider for VCU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=03a7aef7e6f6a76a59fd9b8ba450b493" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2022.1" +REPO ?= "git://github.com/Xilinx/vcu-ctrl-sw.git;protocol=https" +SRCREV = "5bf158af204b181f00ac009c8745557642ecfe5f" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +S = "${WORKDIR}/git" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +RDEPENDS:${PN} = "kernel-module-vcu" + +EXTRA_OEMAKE = "CC='${CC}' CXX='${CXX} ${CXXFLAGS}'" + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir}/vcu-ctrl-sw/include + + install -Dm 0755 ${S}/bin/ctrlsw_encoder ${D}/${bindir}/ctrlsw_encoder + install -Dm 0755 ${S}/bin/ctrlsw_decoder ${D}/${bindir}/ctrlsw_decoder + + oe_runmake install_headers INSTALL_HDR_PATH=${D}${includedir}/vcu-ctrl-sw/include + oe_libinstall -C ${S}/bin/ -so liballegro_decode ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so liballegro_encode ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2022.2.bb b/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2022.2.bb new file mode 100644 index 00000000..130d79bc --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2022.2.bb @@ -0,0 +1,46 @@ +SUMMARY = "Control Software for VCU" +DESCRIPTION = "Control software libraries, test applications and headers provider for VCU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=03a7aef7e6f6a76a59fd9b8ba450b493" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2022.2" +REPO ?= "git://github.com/Xilinx/vcu-ctrl-sw.git;protocol=https" +SRCREV = "3c59dede1923a159a8db736ce0b4ab55633a2114" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +S = "${WORKDIR}/git" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +RDEPENDS:${PN} = "kernel-module-vcu" + +EXTRA_OEMAKE = "CC='${CC}' CXX='${CXX} ${CXXFLAGS}'" + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir}/vcu-ctrl-sw/include + + install -Dm 0755 ${S}/bin/ctrlsw_encoder ${D}/${bindir}/ctrlsw_encoder + install -Dm 0755 ${S}/bin/ctrlsw_decoder ${D}/${bindir}/ctrlsw_decoder + + oe_runmake install_headers INSTALL_HDR_PATH=${D}${includedir}/vcu-ctrl-sw/include + oe_libinstall -C ${S}/bin/ -so liballegro_decode ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so liballegro_encode ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2023.1.bb b/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2023.1.bb new file mode 100644 index 00000000..53a03f45 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2023.1.bb @@ -0,0 +1,46 @@ +SUMMARY = "Control Software for VCU" +DESCRIPTION = "Control software libraries, test applications and headers provider for VCU" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=5375796c5ae4ee85ea1f2c1603e58509" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/vcu-ctrl-sw.git;protocol=https" +SRCREV = "83aabb84c26667f7d6aee632654c63e504838061" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +SRC_URI += "file://0001-Support-updated-gcc-add-cstdint-where-necessary.patch" + +S = "${WORKDIR}/git" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +RDEPENDS:${PN} = "kernel-module-vcu" + +EXTRA_OEMAKE = "CC='${CC}' CXX='${CXX} ${CXXFLAGS}'" + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir}/vcu-ctrl-sw/include + + install -Dm 0755 ${S}/bin/ctrlsw_encoder ${D}/${bindir}/ctrlsw_encoder + install -Dm 0755 ${S}/bin/ctrlsw_decoder ${D}/${bindir}/ctrlsw_decoder + + oe_runmake install_headers INSTALL_HDR_PATH=${D}${includedir}/vcu-ctrl-sw/include + oe_libinstall -C ${S}/bin/ -so liballegro_decode ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so liballegro_encode ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2023.2.bb b/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2023.2.bb new file mode 100644 index 00000000..a2c7d98c --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/libvcu-xlnx_2023.2.bb @@ -0,0 +1,43 @@ +SUMMARY = "Control Software for VCU" +DESCRIPTION = "Control software libraries, test applications and headers provider for VCU" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=ef69c2bb405668101824f0b644631e2e" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/vcu-ctrl-sw.git;protocol=https" +SRCREV = "84b0856cad7844d69f57ac4d9447c20930875475" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +SRC_URI += "file://0001-Support-updated-gcc-add-cstdint-where-necessary.patch" + +S = "${WORKDIR}/git" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +RDEPENDS:${PN} = "kernel-module-vcu" + +EXTRA_OEMAKE = "CC='${CC}' CXX='${CXX} ${CXXFLAGS}'" + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir}/vcu-ctrl-sw/include + + oe_runmake install_headers INSTALL_HDR_PATH=${D}${includedir}/vcu-ctrl-sw/include INSTALL_PATH=${D}/${bindir} + oe_libinstall -C ${S}/bin/ -so liballegro_decode ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so liballegro_encode ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2022.1.bb b/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2022.1.bb new file mode 100644 index 00000000..c5c2b045 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2022.1.bb @@ -0,0 +1,40 @@ +SUMMARY = "Firmware for VCU" +DESCRIPTION = "Firmware binaries provider for VCU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=63b45903a9a50120df488435f03cf498" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2022.1" +REPO ?= "git://github.com/Xilinx/vcu-firmware.git;protocol=https" +SRCREV = "569f980527fd58f43baf16bd0b294bf8c7cdf963" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_install() { + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5d_b.fw ${D}/lib/firmware/al5d_b.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5d.fw ${D}/lib/firmware/al5d.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5e_b.fw ${D}/lib/firmware/al5e_b.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5e.fw ${D}/lib/firmware/al5e.fw +} + +# Inhibit warnings about files being stripped +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" +FILES:${PN} = "/lib/firmware/*" + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. +EXCLUDE_FROM_WORLD = "1" + +INSANE_SKIP:${PN} = "ldflags" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2022.2.bb b/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2022.2.bb new file mode 100644 index 00000000..594a94c3 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2022.2.bb @@ -0,0 +1,40 @@ +SUMMARY = "Firmware for VCU" +DESCRIPTION = "Firmware binaries provider for VCU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE;md5=63b45903a9a50120df488435f03cf498" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2022.2" +REPO ?= "git://github.com/Xilinx/vcu-firmware.git;protocol=https" +SRCREV = "3980c778d71fa51a15e89bf70fd8fb28d5cb12e0" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_install() { + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5d_b.fw ${D}/lib/firmware/al5d_b.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5d.fw ${D}/lib/firmware/al5d.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5e_b.fw ${D}/lib/firmware/al5e_b.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5e.fw ${D}/lib/firmware/al5e.fw +} + +# Inhibit warnings about files being stripped +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" +FILES:${PN} = "/lib/firmware/*" + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. +EXCLUDE_FROM_WORLD = "1" + +INSANE_SKIP:${PN} = "ldflags" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2023.1.bb b/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2023.1.bb new file mode 100644 index 00000000..a90d307f --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2023.1.bb @@ -0,0 +1,38 @@ +SUMMARY = "Firmware for VCU" +DESCRIPTION = "Firmware binaries provider for VCU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=6da65299754e921b31f03e9b11d77a74" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/vcu-firmware.git;protocol=https" +SRCREV = "c90288595ac9a12ff401de6dfa680b1f9adce5f6" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +do_install() { + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5d_b.fw ${D}${nonarch_base_libdir}/firmware/al5d_b.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5d.fw ${D}${nonarch_base_libdir}/firmware/al5d.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5e_b.fw ${D}${nonarch_base_libdir}/firmware/al5e_b.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5e.fw ${D}${nonarch_base_libdir}/firmware/al5e.fw +} + +# Inhibit warnings about files being stripped +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" +FILES:${PN} = "${nonarch_base_libdir}/firmware/*" + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. +EXCLUDE_FROM_WORLD = "1" + +INSANE_SKIP:${PN} = "ldflags" diff --git a/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2023.2.bb b/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2023.2.bb new file mode 100644 index 00000000..73fc2201 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vcu/vcu-firmware_2023.2.bb @@ -0,0 +1,38 @@ +SUMMARY = "Firmware for VCU" +DESCRIPTION = "Firmware binaries provider for VCU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=52eb1e8f27e0e189b175c7d75f028cc6" + +XILINX_VCU_VERSION = "1.0.0" +PV = "${XILINX_VCU_VERSION}-xilinx-v${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or ''}+git${SRCPV}" + +S = "${WORKDIR}/git" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/vcu-firmware.git;protocol=https" +SRCREV = "f4ab98d26aa3e244a487f518f5a76071137c8402" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vcu" + +do_install() { + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5d_b.fw ${D}${nonarch_base_libdir}/firmware/al5d_b.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5d.fw ${D}${nonarch_base_libdir}/firmware/al5d.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5e_b.fw ${D}${nonarch_base_libdir}/firmware/al5e_b.fw + install -Dm 0644 ${S}/${XILINX_VCU_VERSION}/lib/firmware/al5e.fw ${D}${nonarch_base_libdir}/firmware/al5e.fw +} + +# Inhibit warnings about files being stripped +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" +FILES:${PN} = "${nonarch_base_libdir}/firmware/*" + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. +EXCLUDE_FROM_WORLD = "1" + +INSANE_SKIP:${PN} = "ldflags" diff --git a/meta-xilinx-core/recipes-multimedia/vdu/files/0001-include-libapp-Parser.h-Add-cstdint.patch b/meta-xilinx-core/recipes-multimedia/vdu/files/0001-include-libapp-Parser.h-Add-cstdint.patch new file mode 100644 index 00000000..04d59c60 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/files/0001-include-libapp-Parser.h-Add-cstdint.patch @@ -0,0 +1,27 @@ +From 79eddc5c5474c9b61bf6b2e648eba8bca61469b9 Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Thu, 25 Jan 2024 12:30:24 -0700 +Subject: [PATCH] include/libapp/Parser.h: Add cstdint + +Resolves usages of unit32_t being undefined + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + include/lib_app/Parser.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/lib_app/Parser.h b/include/lib_app/Parser.h +index 976a835..6fa63ce 100644 +--- a/include/lib_app/Parser.h ++++ b/include/lib_app/Parser.h +@@ -35,6 +35,7 @@ + #include <sstream> + #include <vector> + #include <iomanip> ++#include <cstdint> + + std::deque<Token> toReversePolish(std::deque<Token>& tokens); + std::string parseString(std::deque<Token>& tokens); +-- +2.34.1 + diff --git a/meta-xilinx-core/recipes-multimedia/vdu/files/0001-libvdu-omxil-Fix-missing-definitions.patch b/meta-xilinx-core/recipes-multimedia/vdu/files/0001-libvdu-omxil-Fix-missing-definitions.patch new file mode 100644 index 00000000..db23ed00 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/files/0001-libvdu-omxil-Fix-missing-definitions.patch @@ -0,0 +1,54 @@ +From 7fc63cdd6642ea84b78db62fccafc460af0ff23e Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Thu, 25 Jan 2024 12:50:18 -0700 +Subject: [PATCH] Fix missing definitions + +Fix issues such as: +| module/module_structs.h:370:3: error: 'uint8_t' does not name a type +| 370 | uint8_t distributionMaxrgbPercentages[MAX_MAXRGB_PERCENTILES_ST2094_40]; +| | ^~~~~~~ +| module/module_structs.h:370:3: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'? +| module/module_structs.h:371:3: error: 'uint32_t' does not name a type +| 371 | uint32_t distributionMaxrgbPercentiles[MAX_MAXRGB_PERCENTILES_ST2094_40]; +| | ^~~~~~~~ +| module/module_structs.h:371:3: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'? + +and + +| ./utility/processor_fifo.h:80:15: error: field 'name_' has incomplete type 'std::string' {aka 'std::__cxx11::basic_string<char>'} +| 80 | std::string name_; +| | ^~~~~ + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + module/module_structs.h | 1 + + utility/processor_fifo.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/module/module_structs.h b/module/module_structs.h +index 75bdff6..594076f 100644 +--- a/module/module_structs.h ++++ b/module/module_structs.h +@@ -27,6 +27,7 @@ + #include "module_enums.h" + #include <string> + #include <vector> ++#include <cstdint> + + template<typename T> + struct InputOutput +diff --git a/utility/processor_fifo.h b/utility/processor_fifo.h +index e0dd47c..f047267 100644 +--- a/utility/processor_fifo.h ++++ b/utility/processor_fifo.h +@@ -27,6 +27,7 @@ + #include <utility/locked_queue.h> + #include <thread> + #include <functional> ++#include <string> + + #if defined __linux__ + #include <sys/prctl.h> +-- +2.34.1 + diff --git a/meta-xilinx-core/recipes-multimedia/vdu/files/99-vdu-enc-dec.rules b/meta-xilinx-core/recipes-multimedia/vdu/files/99-vdu-enc-dec.rules new file mode 100644 index 00000000..78bb54f4 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/files/99-vdu-enc-dec.rules @@ -0,0 +1,4 @@ +# Allegro VDU Encode, Decoder module drivers +SUBSYSTEM=="allegro_decode_class", KERNEL=="allegroDecodeIP[0-4]*", MODE="0660", GROUP="video", TAG+="uaccess" + + diff --git a/meta-xilinx-core/recipes-multimedia/vdu/kernel-module-vdu_2023.1.bb b/meta-xilinx-core/recipes-multimedia/vdu/kernel-module-vdu_2023.1.bb new file mode 100644 index 00000000..9b835490 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/kernel-module-vdu_2023.1.bb @@ -0,0 +1,42 @@ +SUMMARY = "Linux kernel module for Video Decode Unit" +DESCRIPTION = "Out-of-tree VDU decoder common kernel modules" +SECTION = "kernel/modules" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XILINX_VDU_VERSION = "1.0.0" +PV =. "${XILINX_VDU_VERSION}-xilinx-v" +PV .= "+git${SRCPV}" + +S = "${WORKDIR}/git" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/vdu-modules.git;protocol=https" +SRCREV ?= "82d06e395c93a1e941b83cccbb6f2e4e6d966f1c" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG} \ + file://99-vdu-enc-dec.rules \ +" + +inherit module features_check + +REQUIRED_MACHINE_FEATURES = "vdu" + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" + +RDEPENDS:${PN} = "vdu-firmware" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "versal-ai-edge" + +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" + +do_install:append() { + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-vdu-enc-dec.rules ${D}${sysconfdir}/udev/rules.d/ +} + +FILES:${PN} = "${sysconfdir}/udev/rules.d/*" diff --git a/meta-xilinx-core/recipes-multimedia/vdu/kernel-module-vdu_2023.2.bb b/meta-xilinx-core/recipes-multimedia/vdu/kernel-module-vdu_2023.2.bb new file mode 100644 index 00000000..1c9ba8ad --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/kernel-module-vdu_2023.2.bb @@ -0,0 +1,42 @@ +SUMMARY = "Linux kernel module for Video Decode Unit" +DESCRIPTION = "Out-of-tree VDU decoder common kernel modules" +SECTION = "kernel/modules" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a" + +XILINX_VDU_VERSION = "1.0.0" +PV =. "${XILINX_VDU_VERSION}-xilinx-v" +PV .= "+git${SRCPV}" + +S = "${WORKDIR}/git" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/vdu-modules.git;protocol=https" +SRCREV ?= "4d5134f54006f904f0b28f00e05dd3febd5fcfd3" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG} \ + file://99-vdu-enc-dec.rules \ +" + +inherit module features_check + +REQUIRED_MACHINE_FEATURES = "vdu" + +EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}" + +RDEPENDS:${PN} = "vdu-firmware" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "versal-ai-edge" + +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" + +do_install:append() { + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-vdu-enc-dec.rules ${D}${sysconfdir}/udev/rules.d/ +} + +FILES:${PN} = "${sysconfdir}/udev/rules.d/*" diff --git a/meta-xilinx-core/recipes-multimedia/vdu/libvdu-ctrlsw_2023.1.bb b/meta-xilinx-core/recipes-multimedia/vdu/libvdu-ctrlsw_2023.1.bb new file mode 100644 index 00000000..f9228678 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/libvdu-ctrlsw_2023.1.bb @@ -0,0 +1,47 @@ +SUMMARY = "Control Software for VDU" +DESCRIPTION = "Control software libraries, test applications and headers provider for VDU" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=aaf483d309243c4596f6373eb9c8325f" + +XILINX_VDU_VERSION = "1.0.0" +PV =. "${XILINX_VDU_VERSION}-xilinx-v" +PV .= "+git${SRCPV}" + +inherit autotools features_check + +REQUIRED_MACHINE_FEATURES = "vdu" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/vdu-ctrl-sw.git;protocol=https" +SRCREV ?= "06fc18b303b40d4fee7549ad162c22ee1bc31582" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG} \ + file://0001-include-libapp-Parser.h-Add-cstdint.patch \ + " + +S = "${WORKDIR}/git" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "versal-ai-edge" + +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" + +RDEPENDS:${PN} = "kernel-module-vdu" + +do_compile[dirs] = "${S}" +do_install[dirs] = "${S}" + +EXTRA_OEMAKE = "CC='${CC}' CXX='${CXX} ${CXXFLAGS}'" +EXTRA_OEMAKE +=" INSTALL_HDR_PATH=${D}${includedir}/vdu-ctrl-sw/include INSTALL_PATH=${D}${bindir}" + +do_install:append() { + + oe_libinstall -C ${S}/bin/ -so liballegro_decode ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-xilinx-core/recipes-multimedia/vdu/libvdu-ctrlsw_2023.2.bb b/meta-xilinx-core/recipes-multimedia/vdu/libvdu-ctrlsw_2023.2.bb new file mode 100644 index 00000000..f8b36a93 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/libvdu-ctrlsw_2023.2.bb @@ -0,0 +1,47 @@ +SUMMARY = "Control Software for VDU" +DESCRIPTION = "Control software libraries, test applications and headers provider for VDU" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=aaf483d309243c4596f6373eb9c8325f" + +XILINX_VDU_VERSION = "1.0.0" +PV =. "${XILINX_VDU_VERSION}-xilinx-v" +PV .= "+git${SRCPV}" + +inherit autotools features_check + +REQUIRED_MACHINE_FEATURES = "vdu" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/vdu-ctrl-sw.git;protocol=https" +SRCREV ?= "1beb8f247d01b1a728faea36ce8f7847c895482f" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG} \ + file://0001-include-libapp-Parser.h-Add-cstdint.patch \ + " + +S = "${WORKDIR}/git" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "versal-ai-edge" + +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" + +RDEPENDS:${PN} = "kernel-module-vdu" + +do_compile[dirs] = "${S}" +do_install[dirs] = "${S}" + +EXTRA_OEMAKE = "CC='${CC}' CXX='${CXX} ${CXXFLAGS}'" +EXTRA_OEMAKE +=" INSTALL_HDR_PATH=${D}${includedir}/vdu-ctrl-sw/include INSTALL_PATH=${D}${bindir}" + +do_install:append() { + + oe_libinstall -C ${S}/bin/ -so liballegro_decode ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-xilinx-core/recipes-multimedia/vdu/libvdu-omxil_2023.1.bb b/meta-xilinx-core/recipes-multimedia/vdu/libvdu-omxil_2023.1.bb new file mode 100644 index 00000000..b3c02ca2 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/libvdu-omxil_2023.1.bb @@ -0,0 +1,55 @@ +SUMMARY = "OpenMAX Integration layer for VDU" +DESCRIPTION = "OMX IL Libraries,test application and headers for VDU" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=aaf483d309243c4596f6373eb9c8325f" + +XILINX_VDU_VERSION = "1.0.0" +PV =. "${XILINX_VDU_VERSION}-xilinx-v" +PV .= "+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/vdu-omx-il.git;protocol=https" +SRCREV ?= "811eefac953fd5e098c69cada97a0dd35f5e9015" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG} \ + file://0001-libvdu-omxil-Fix-missing-definitions.patch \ + " +S = "${WORKDIR}/git" + +inherit autotools features_check + +REQUIRED_MACHINE_FEATURES = "vdu" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "versal-ai-edge" + +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" + +DEPENDS = "libvdu-ctrlsw" +RDEPENDS:${PN} = "kernel-module-vdu libvdu-ctrlsw" + +EXTERNAL_INCLUDE="${STAGING_INCDIR}/vdu-ctrl-sw/include" + +do_compile[dirs] = "${S}" +do_install[dirs] = "${S}" + +EXTRA_OEMAKE = " \ + CC='${CC}' CXX='${CXX} ${CXXFLAGS}' \ + EXTERNAL_INCLUDE='${EXTERNAL_INCLUDE}' \ + INSTALL_PATH=${D}${bindir} \ + INCLUDE_INST_PATH=${D}${includedir} \ + " + +do_install:append() { + install -d ${D}${libdir} + + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.core ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_decoder ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-xilinx-core/recipes-multimedia/vdu/libvdu-omxil_2023.2.bb b/meta-xilinx-core/recipes-multimedia/vdu/libvdu-omxil_2023.2.bb new file mode 100644 index 00000000..04860b79 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/libvdu-omxil_2023.2.bb @@ -0,0 +1,55 @@ +SUMMARY = "OpenMAX Integration layer for VDU" +DESCRIPTION = "OMX IL Libraries,test application and headers for VDU" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=aaf483d309243c4596f6373eb9c8325f" + +XILINX_VDU_VERSION = "1.0.0" +PV =. "${XILINX_VDU_VERSION}-xilinx-v" +PV .= "+git${SRCPV}" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/vdu-omx-il.git;protocol=https" +SRCREV ?= "811eefac953fd5e098c69cada97a0dd35f5e9015" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG} \ + file://0001-libvdu-omxil-Fix-missing-definitions.patch \ + " +S = "${WORKDIR}/git" + +inherit autotools features_check + +REQUIRED_MACHINE_FEATURES = "vdu" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "versal-ai-edge" + +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" + +DEPENDS = "libvdu-ctrlsw" +RDEPENDS:${PN} = "kernel-module-vdu libvdu-ctrlsw" + +EXTERNAL_INCLUDE="${STAGING_INCDIR}/vdu-ctrl-sw/include" + +do_compile[dirs] = "${S}" +do_install[dirs] = "${S}" + +EXTRA_OEMAKE = " \ + CC='${CC}' CXX='${CXX} ${CXXFLAGS}' \ + EXTERNAL_INCLUDE='${EXTERNAL_INCLUDE}' \ + INSTALL_PATH=${D}${bindir} \ + INCLUDE_INST_PATH=${D}${includedir} \ + " + +do_install:append() { + install -d ${D}${libdir} + + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.core ${D}/${libdir}/ + oe_libinstall -C ${S}/bin/ -so libOMX.allegro.video_decoder ${D}/${libdir}/ +} + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-xilinx-core/recipes-multimedia/vdu/vdu-firmware_2023.1.bb b/meta-xilinx-core/recipes-multimedia/vdu/vdu-firmware_2023.1.bb new file mode 100755 index 00000000..419dd681 --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/vdu-firmware_2023.1.bb @@ -0,0 +1,42 @@ +SUMMARY = "Firmware for VDU" +DESCRIPTION = "Firmware binaries provider for VDU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=c5784f63397086d836580d8785d1deb9" + +XILINX_VDU_VERSION = "1.0.0" +PV =. "${XILINX_VDU_VERSION}-xilinx-v" +PV .= "+git${SRCPV}" + +S = "${WORKDIR}/git" + +inherit autotools features_check + +REQUIRED_MACHINE_FEATURES = "vdu" + +BRANCH ?= "xlnx_rel_v2023.1" +REPO ?= "git://github.com/Xilinx/vdu-firmware.git;protocol=https" +SRCREV ?= "63fe2fce6e46d5bf03e33300a58a37d8568722ee" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "versal-ai-edge" + +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" +EXTRA_OEMAKE +="INSTALL_PATH=${D}/${nonarch_base_libdir}/firmware" + +do_compile[noexec] = "1" +do_install[dirs] = "${S}" + +# Inhibit warnings about files being stripped +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" +FILES:${PN} = "${nonarch_base_libdir}/firmware/*" + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. +EXCLUDE_FROM_WORLD = "1" + +INSANE_SKIP:${PN} = "ldflags" diff --git a/meta-xilinx-core/recipes-multimedia/vdu/vdu-firmware_2023.2.bb b/meta-xilinx-core/recipes-multimedia/vdu/vdu-firmware_2023.2.bb new file mode 100644 index 00000000..ade73a4e --- /dev/null +++ b/meta-xilinx-core/recipes-multimedia/vdu/vdu-firmware_2023.2.bb @@ -0,0 +1,42 @@ +SUMMARY = "Firmware for VDU" +DESCRIPTION = "Firmware binaries provider for VDU" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=c5784f63397086d836580d8785d1deb9" + +XILINX_VDU_VERSION = "1.0.0" +PV =. "${XILINX_VDU_VERSION}-xilinx-v" +PV .= "+git${SRCPV}" + +S = "${WORKDIR}/git" + +inherit autotools features_check + +REQUIRED_MACHINE_FEATURES = "vdu" + +BRANCH ?= "xlnx_rel_v2023.2" +REPO ?= "git://github.com/Xilinx/vdu-firmware.git;protocol=https" +SRCREV ?= "731897772730178f6a4e77eedeb4fb53faa1ab4d" + +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG}" + +COMPATIBLE_MACHINE = "^$" +COMPATIBLE_MACHINE:versal-ai-core = "versal-ai-core" +COMPATIBLE_MACHINE:versal-ai-edge = "versal-ai-edge" + +PACKAGE_ARCH = "${SOC_FAMILY_ARCH}" +EXTRA_OEMAKE +="INSTALL_PATH=${D}/${nonarch_base_libdir}/firmware" + +do_compile[noexec] = "1" +do_install[dirs] = "${S}" + +# Inhibit warnings about files being stripped +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" +FILES:${PN} = "${nonarch_base_libdir}/firmware/*" + +# These libraries shouldn't get installed in world builds unless something +# explicitly depends upon them. +EXCLUDE_FROM_WORLD = "1" + +INSANE_SKIP:${PN} = "ldflags" diff --git a/meta-xilinx-core/recipes-support/freeipmi/freeipmi/0001-Add-initial-support-for-Xilinx-OEM-FRU-records.patch b/meta-xilinx-core/recipes-support/freeipmi/freeipmi/0001-Add-initial-support-for-Xilinx-OEM-FRU-records.patch new file mode 100644 index 00000000..c7d4aefd --- /dev/null +++ b/meta-xilinx-core/recipes-support/freeipmi/freeipmi/0001-Add-initial-support-for-Xilinx-OEM-FRU-records.patch @@ -0,0 +1,370 @@ +From 1128691f6e2709b44eccafb0b303b07da55a814e Mon Sep 17 00:00:00 2001 +From: Christian Kohn <chris.kohn@amd.com> +Date: Mon, 17 Oct 2022 19:28:22 -0700 +Subject: [PATCH] Add initial support for Xilinx OEM FRU records + +The supported Xilinx OEM FRU records are MAC_ID and FREE_FORM. This FRU OEM +extension parses these records and prints them with proper formatting. + +To use this feature, run the ipmi-fru command as follows: +$ sudo ./ipmi-fru --fru-file=/sys/devices/platform/axi/ff030000.i2c/i2c-1/1-0051/eeprom \ + --interpret-oem-data + +Note: The EEPROM address can vary between different platforms. This is just an + example. + +This feature has been tested with the Xilinx Kria KV260 and KR260 Starter Kits. + +Signed-off-by: Christian Kohn <chris.kohn@amd.com> +--- + ipmi-fru/Makefile.am | 2 + + ipmi-fru/ipmi-fru-oem-xilinx.c | 171 ++++++++++++++++++ + ipmi-fru/ipmi-fru-oem-xilinx.h | 33 ++++ + ipmi-fru/ipmi-fru-output.c | 14 ++ + libfreeipmi/include/freeipmi/freeipmi.h.in | 1 + + .../oem/ipmi-fru-xilinx-oem-record-format.h | 45 +++++ + .../spec/ipmi-iana-enterprise-numbers-spec.h | 1 + + 7 files changed, 267 insertions(+) + create mode 100644 ipmi-fru/ipmi-fru-oem-xilinx.c + create mode 100644 ipmi-fru/ipmi-fru-oem-xilinx.h + create mode 100644 libfreeipmi/include/freeipmi/record-format/oem/ipmi-fru-xilinx-oem-record-format.h + +diff --git a/ipmi-fru/Makefile.am b/ipmi-fru/Makefile.am +index c92ba0e8c..c8545eede 100644 +--- a/ipmi-fru/Makefile.am ++++ b/ipmi-fru/Makefile.am +@@ -25,6 +25,8 @@ ipmi_fru_SOURCES = \ + ipmi-fru-argp.h \ + ipmi-fru-oem-wistron.c \ + ipmi-fru-oem-wistron.h \ ++ ipmi-fru-oem-xilinx.c \ ++ ipmi-fru-oem-xilinx.h \ + ipmi-fru-output.c \ + ipmi-fru-output.h + +diff --git a/ipmi-fru/ipmi-fru-oem-xilinx.c b/ipmi-fru/ipmi-fru-oem-xilinx.c +new file mode 100644 +index 000000000..87bb18f00 +--- /dev/null ++++ b/ipmi-fru/ipmi-fru-oem-xilinx.c +@@ -0,0 +1,171 @@ ++/* ++ * Copyright (C) 2022, Advanced Micro Devices, Inc. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#if HAVE_CONFIG_H ++#include "config.h" ++#endif /* HAVE_CONFIG_H */ ++ ++#include <stdio.h> ++#include <stdlib.h> ++#if STDC_HEADERS ++#include <string.h> ++#endif /* STDC_HEADERS */ ++#include <assert.h> ++ ++#include <freeipmi/freeipmi.h> ++ ++#include "ipmi-fru_.h" ++#include "ipmi-fru-oem-xilinx.h" ++ ++#include "freeipmi-portability.h" ++ ++static char * ++_version_str (uint8_t version) ++{ ++ switch (version) ++ { ++ case IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_BOARD: ++ return "Board"; ++ case IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_SYSCTL: ++ return "System Controller"; ++ case IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_MODULE: ++ return "Module"; ++ case IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_DUT_MAC: ++ return "DUT - MAC"; ++ case IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_DUT_ETHERCAT: ++ return "DUT - EtherCAT"; ++ default: ++ return ""; ++ } ++ ++ return (NULL); /* NOT REACHED */ ++} ++ ++int ++ipmi_fru_oem_xilinx_oem_record (ipmi_fru_state_data_t *state_data, ++ uint8_t record_type_id, ++ uint32_t manufacturer_id, ++ uint8_t *oem_data, ++ unsigned int oem_data_len) ++{ ++ assert (state_data); ++ assert (manufacturer_id == IPMI_IANA_ENTERPRISE_ID_XILINX); ++ assert (oem_data); ++ ++ /* The MAC_ID record type ID is 0xD2. The MAC ID record consists of a 1 byte ++ * version ID followed by one or more 6-byte MAC addresses. If the MAC ID ++ * version is set to "DUT - EtherCAT", a 4-byte EtherCAT ID is used instead of ++ * a 6-byte MAC address. ++ */ ++ if (record_type_id == IPMI_FRU_OEM_XILINX_MAC_ID && oem_data_len) ++ { ++ uint8_t version = oem_data[0]; ++ unsigned int len = oem_data_len - 1; ++ ++ pstdout_printf (state_data->pstate, ++ " FRU OEM MAC Version: %s (%xh)\n", ++ _version_str(version), ++ version); ++ ++ /* The MAC_ID record can hold multiple MAC addresses that are 6 bytes long ++ * each if version is set to 0x31. ++ */ ++ if ((version == IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_BOARD || ++ version == IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_SYSCTL || ++ version == IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_MODULE || ++ version == IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_DUT_MAC ) && ++ (len % 6) == 0) ++ { ++ unsigned int i, j, start, stop; ++ unsigned int mac_cnt = len / 6; ++ ++ for (j = 0; j < mac_cnt; j++) ++ { ++ pstdout_printf (state_data->pstate, " FRU OEM MAC ID %d: ", j); ++ ++ start = j*6 + 1; ++ stop = start + 5; ++ ++ for (i = start; i < stop; i++) ++ { ++ pstdout_printf (state_data->pstate, "%02x:", oem_data[i]); ++ } ++ ++ pstdout_printf (state_data->pstate, "%02x\n", oem_data[i]); ++ } ++ ++ return (1); ++ } ++ ++ /* The MAC_ID record holds one EtherCAT ID that is 4 bytes long if version ++ * is set to 0x32. The assigned EtherCAT ID for Xilinx is 0x0000056F. ++ */ ++ if (version == IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_DUT_ETHERCAT && ++ len == 4) ++ { ++ pstdout_printf (state_data->pstate, " FRU OEM EtherCAT ID: 0x"); ++ ++ for (unsigned int i = 1; i < len+1; i++) ++ { ++ pstdout_printf (state_data->pstate, "%02X", oem_data[i]); ++ } ++ ++ pstdout_printf (state_data->pstate, "\n"); ++ ++ return (1); ++ } ++ } ++ ++ /* The free form data record type ID is 0xD3. It consists of one or more ++ * fields where each field is split into N byte identifier and M byte data ++ * followed by a 0x00 end of field delimiter. The below code parses the free ++ * form record and prints each field on a new line prefixed with 'FRU OEM '. ++ */ ++ if (record_type_id == IPMI_FRU_OEM_XILINX_FREE_FORM && oem_data_len) ++ { ++ unsigned int i; ++ unsigned int new_field = 1; ++ ++ for (i = 0; i < oem_data_len; i++) ++ { ++ /* 0x00 marks the end of the field */ ++ if (oem_data[i] == 0) ++ { ++ if (new_field == 0) ++ { ++ pstdout_printf (state_data->pstate, "\n"); ++ } ++ new_field = 1; ++ continue; ++ } ++ ++ /* Start of a new field */ ++ if (new_field == 1) ++ { ++ new_field = 0; ++ pstdout_printf (state_data->pstate, " FRU OEM "); ++ } ++ ++ pstdout_printf (state_data->pstate, "%c", oem_data[i]); ++ } ++ ++ return (1); ++ } ++ ++ return (0); ++} +diff --git a/ipmi-fru/ipmi-fru-oem-xilinx.h b/ipmi-fru/ipmi-fru-oem-xilinx.h +new file mode 100644 +index 000000000..2484cd515 +--- /dev/null ++++ b/ipmi-fru/ipmi-fru-oem-xilinx.h +@@ -0,0 +1,33 @@ ++/* ++ * Copyright (C) 2022, Advanced Micro Devices, Inc. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#ifndef IPMI_FRU_OEM_XILINX_H ++#define IPMI_FRU_OEM_XILINX_H ++ ++#include <freeipmi/freeipmi.h> ++ ++#include "ipmi-fru_.h" ++ ++/* Returns 1 on interpretation, 0 if not, -1 on error */ ++int ipmi_fru_oem_xilinx_oem_record (ipmi_fru_state_data_t *state_data, ++ uint8_t record_type_id, ++ uint32_t manufacturer_id, ++ uint8_t *oem_data, ++ unsigned int oem_data_len); ++ ++#endif /* IPMI_FRU_OEM_XILINX_H */ +diff --git a/ipmi-fru/ipmi-fru-output.c b/ipmi-fru/ipmi-fru-output.c +index 845971018..d29c4470e 100644 +--- a/ipmi-fru/ipmi-fru-output.c ++++ b/ipmi-fru/ipmi-fru-output.c +@@ -51,6 +51,7 @@ + #include "ipmi-fru_.h" + #include "ipmi-fru-output.h" + #include "ipmi-fru-oem-wistron.h" ++#include "ipmi-fru-oem-xilinx.h" + #include "tool-util-common.h" + + #include "freeipmi-portability.h" +@@ -1201,6 +1202,19 @@ ipmi_fru_output_oem_record (ipmi_fru_state_data_t *state_data, + if (ret) + return (0); + } ++ ++ if (manufacturer_id == IPMI_IANA_ENTERPRISE_ID_XILINX) ++ { ++ if ((ret = ipmi_fru_oem_xilinx_oem_record (state_data, ++ record_type_id, ++ manufacturer_id, ++ oem_data, ++ oem_data_len)) < 0) ++ return (-1); ++ ++ if (ret) ++ return (0); ++ } + } + + if (oem_data_len) +diff --git a/libfreeipmi/include/freeipmi/freeipmi.h.in b/libfreeipmi/include/freeipmi/freeipmi.h.in +index a03178e97..fbd6749e9 100644 +--- a/libfreeipmi/include/freeipmi/freeipmi.h.in ++++ b/libfreeipmi/include/freeipmi/freeipmi.h.in +@@ -82,6 +82,7 @@ extern "C" { + #include <freeipmi/record-format/ipmi-sdr-record-format.h> + #include <freeipmi/record-format/ipmi-sel-record-format.h> + #include <freeipmi/record-format/oem/ipmi-fru-wistron-oem-record-format.h> ++#include <freeipmi/record-format/oem/ipmi-fru-xilinx-oem-record-format.h> + #include <freeipmi/record-format/oem/ipmi-sdr-oem-intel-node-manager-record-format.h> + #include <freeipmi/record-format/oem/ipmi-sdr-oem-intel-record-format.h> + #include <freeipmi/record-format/oem/ipmi-sel-oem-intel-record-format.h> +diff --git a/libfreeipmi/include/freeipmi/record-format/oem/ipmi-fru-xilinx-oem-record-format.h b/libfreeipmi/include/freeipmi/record-format/oem/ipmi-fru-xilinx-oem-record-format.h +new file mode 100644 +index 000000000..434e2031a +--- /dev/null ++++ b/libfreeipmi/include/freeipmi/record-format/oem/ipmi-fru-xilinx-oem-record-format.h +@@ -0,0 +1,45 @@ ++/* ++ * Copyright (C) 2022, Advanced Micro Devices, Inc. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ * ++ */ ++ ++#ifndef IPMI_FRU_OEM_XILINX_RECORD_FORMAT_H ++#define IPMI_FRU_OEM_XILINX_RECORD_FORMAT_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include <freeipmi/fiid/fiid.h> ++ ++/* OEM multi-record IDs used by Xilinx */ ++#define IPMI_FRU_OEM_XILINX_THERMAL 0xD0 ++#define IPMI_FRU_OEM_XILINX_POWER 0xD1 ++#define IPMI_FRU_OEM_XILINX_MAC_ID 0xD2 ++#define IPMI_FRU_OEM_XILINX_FREE_FORM 0xD3 ++ ++/* OEM MAC ID versions used by Xilinx */ ++#define IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_BOARD 0x01 ++#define IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_SYSCTL 0x11 ++#define IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_MODULE 0x21 ++#define IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_DUT_MAC 0x31 ++#define IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_DUT_ETHERCAT 0x32 ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* IPMI_FRU_OEM_XILINX_RECORD_FORMAT_H */ +diff --git a/libfreeipmi/include/freeipmi/spec/ipmi-iana-enterprise-numbers-spec.h b/libfreeipmi/include/freeipmi/spec/ipmi-iana-enterprise-numbers-spec.h +index d286f33a4..4c24b5259 100644 +--- a/libfreeipmi/include/freeipmi/spec/ipmi-iana-enterprise-numbers-spec.h ++++ b/libfreeipmi/include/freeipmi/spec/ipmi-iana-enterprise-numbers-spec.h +@@ -29,6 +29,7 @@ extern "C" { + #define IPMI_IANA_ENTERPRISE_ID_SUN_MICROSYSTEMS 42 + #define IPMI_IANA_ENTERPRISE_ID_INTEL 343 + #define IPMI_IANA_ENTERPRISE_ID_DELL 674 ++#define IPMI_IANA_ENTERPRISE_ID_XILINX 4314 + #define IPMI_IANA_ENTERPRISE_ID_MAGNUM_TECHNOLOGIES 5593 + #define IPMI_IANA_ENTERPRISE_ID_QUANTA 7244 + #define IPMI_IANA_ENTERPRISE_ID_FUJITSU 10368 +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-support/freeipmi/freeipmi/0002-ipmi-fru-fix-compilation-for-non-C99-compilation.patch b/meta-xilinx-core/recipes-support/freeipmi/freeipmi/0002-ipmi-fru-fix-compilation-for-non-C99-compilation.patch new file mode 100644 index 00000000..c0f36405 --- /dev/null +++ b/meta-xilinx-core/recipes-support/freeipmi/freeipmi/0002-ipmi-fru-fix-compilation-for-non-C99-compilation.patch @@ -0,0 +1,29 @@ +From c578c999b7d9aabbd6e54b0310a609b8f96ae962 Mon Sep 17 00:00:00 2001 +From: Albert Chu <chu11@llnl.gov> +Date: Tue, 8 Nov 2022 16:33:39 -0800 +Subject: [PATCH] ipmi-fru: fix compilation for non C99 compilation + +--- + ipmi-fru/ipmi-fru-oem-xilinx.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/ipmi-fru/ipmi-fru-oem-xilinx.c b/ipmi-fru/ipmi-fru-oem-xilinx.c +index 87bb18f00..937aa7614 100644 +--- a/ipmi-fru/ipmi-fru-oem-xilinx.c ++++ b/ipmi-fru/ipmi-fru-oem-xilinx.c +@@ -118,9 +118,11 @@ ipmi_fru_oem_xilinx_oem_record (ipmi_fru_state_data_t *state_data, + if (version == IPMI_FRU_OEM_XILINX_MAC_ID_VERSION_DUT_ETHERCAT && + len == 4) + { ++ unsigned int i; ++ + pstdout_printf (state_data->pstate, " FRU OEM EtherCAT ID: 0x"); + +- for (unsigned int i = 1; i < len+1; i++) ++ for (i = 1; i < len+1; i++) + { + pstdout_printf (state_data->pstate, "%02X", oem_data[i]); + } +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-support/freeipmi/freeipmi_1.6.10.bb b/meta-xilinx-core/recipes-support/freeipmi/freeipmi_1.6.10.bb new file mode 100644 index 00000000..a9d60465 --- /dev/null +++ b/meta-xilinx-core/recipes-support/freeipmi/freeipmi_1.6.10.bb @@ -0,0 +1,56 @@ +SUMMARY = "Tools and libraries for IPMI" +DESCRIPTION = " \ + FreeIPMI provides in-band and out-of-band IPMI software based on the IPMI \ + v1.5/2.0 specification. The IPMI specification defines a set of interfaces \ + for platform management and is implemented by a number vendors for system \ + management. The features of IPMI that most users will be interested in are \ + sensor monitoring, system event monitoring, power control, and \ + serial-over-LAN (SOL). The FreeIPMI tools and libraries listed below should \ + provide users with the ability to access and utilize these and many other \ + features. A number of useful features for large HPC or cluster environments \ + have also been implemented into FreeIPMI. \ +" +HOMEPAGE = "https://www.gnu.org/software/freeipmi/" + +LICENSE = "GPL-3.0-only & BSD-3-Clause" +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.ZRESEARCH;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.bmc-watchdog;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.ipmi-dcmi;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.ipmi-fru;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.ipmiconsole;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.ipmidetect;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.ipmimonitoring;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.ipmipower;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.ipmiseld;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.pstdout;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.sunbmc;md5=c03f21cd76ff5caba6b890d1213cbfbb \ + " + +BRANCH ?= "freeipmi-1-6-0-stable" +SRC_URI = " \ + git://git.savannah.gnu.org/freeipmi.git;iprotocol=https;branch=${BRANCH} \ + file://0001-Add-initial-support-for-Xilinx-OEM-FRU-records.patch \ + file://0002-ipmi-fru-fix-compilation-for-non-C99-compilation.patch \ + " +SRCREV ?= "1f7eea294c2967802019100b07cf1e44b3160a2b" + +S = "${WORKDIR}/git" + +inherit autotools-brokensep pkgconfig systemd + +PACKAGECONFIG ??= "" +PACKAGECONFIG[libgcrypt] = "--with-encryption,--without-encryption,libgcrypt," + +EXTRA_OECONF = " \ + --without-random-device \ + --with-systemdsystemunitdir=${systemd_system_unitdir} \ + " + +SYSTEMD_SERVICE:${PN} = " \ + bmc-watchdog.service \ + ipmidetectd.service \ + ipmiseld.service \ + " +SYSTEMD_AUTO_ENABLE = "disable" diff --git a/meta-xilinx-core/recipes-support/libgpg-error/files/lock-obj-pub.microblazeel-unknown-linux-gnu.h b/meta-xilinx-core/recipes-support/libgpg-error/files/lock-obj-pub.microblazeel-unknown-linux-gnu.h new file mode 100644 index 00000000..9843f4d9 --- /dev/null +++ b/meta-xilinx-core/recipes-support/libgpg-error/files/lock-obj-pub.microblazeel-unknown-linux-gnu.h @@ -0,0 +1,23 @@ +## lock-obj-pub.microblazeel-xilinx-linux-gnu.h +## File created by gen-posix-lock-obj - DO NOT EDIT +## To be included by mkheader into gpg-error.h + +typedef struct +{ + long _vers; + union { + volatile char _priv[24]; + long _x_align; + long *_xp_align; + } u; +} gpgrt_lock_t; + +#define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ + 0,0,0,0,0,0,0,0, \ + 0,0,0,0,0,0,0,0}}} +## +## Local Variables: +## mode: c +## buffer-read-only: t +## End: +## diff --git a/meta-xilinx-core/recipes-support/libgpg-error/libgpg-error_%.bbappend b/meta-xilinx-core/recipes-support/libgpg-error/libgpg-error_%.bbappend new file mode 100644 index 00000000..f3e920c2 --- /dev/null +++ b/meta-xilinx-core/recipes-support/libgpg-error/libgpg-error_%.bbappend @@ -0,0 +1,8 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append:microblaze = " file://lock-obj-pub.microblazeel-unknown-linux-gnu.h" + +do_configure:append:microblaze () { + cp ${WORKDIR}/lock-obj-pub.microblazeel-unknown-linux-gnu.h ${S}/src/syscfg/ +} + diff --git a/meta-xilinx-core/recipes-xrt/xrt/files/xrt-cstdint.patch b/meta-xilinx-core/recipes-xrt/xrt/files/xrt-cstdint.patch new file mode 100644 index 00000000..67ca68c6 --- /dev/null +++ b/meta-xilinx-core/recipes-xrt/xrt/files/xrt-cstdint.patch @@ -0,0 +1,117 @@ +Add cstdint as necessary + +In GCC 13.1 usage of uint64 and similar will result in an error without + #include <cstdint> + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> + +diff --git a/src/runtime_src/core/common/time.h b/src/runtime_src/core/common/time.h +index a4a96b11d..585d38756 100644 +--- a/src/runtime_src/core/common/time.h ++++ b/src/runtime_src/core/common/time.h +@@ -19,6 +19,7 @@ + + #include "core/common/config.h" + #include <string> ++#include <cstdint> + + namespace xrt_core { + +diff --git a/src/runtime_src/core/edge/user/aie/common_layer/adf_api_config.h b/src/runtime_src/core/edge/user/aie/common_layer/adf_api_config.h +index 196304765..36ce35e80 +--- a/src/runtime_src/core/edge/user/aie/common_layer/adf_api_config.h ++++ b/src/runtime_src/core/edge/user/aie/common_layer/adf_api_config.h +@@ -18,6 +18,7 @@ + + #include <string> + #include <vector> ++#include <cstdint> + + namespace adf + { +diff --git a/src/runtime_src/core/edge/user/zynq_dev.h b/src/runtime_src/core/edge/user/zynq_dev.h +index 6fe36c615..2abd7473b 100644 +--- a/src/runtime_src/core/edge/user/zynq_dev.h ++++ b/src/runtime_src/core/edge/user/zynq_dev.h +@@ -19,6 +19,7 @@ + #include <fstream> + #include <string> + #include <vector> ++#include <cstdint> + + class zynq_device { + public: +diff --git a/src/runtime_src/tools/xclbinutil/CBOR.h b/src/runtime_src/tools/xclbinutil/CBOR.h +index 368459f59..acbf6ebae 100644 +--- a/src/runtime_src/tools/xclbinutil/CBOR.h ++++ b/src/runtime_src/tools/xclbinutil/CBOR.h +@@ -22,6 +22,7 @@ + // #includes here - please keep these to a bare minimum! + #include <string> + #include <sstream> ++#include <cstdint> + + // ------------ F O R W A R D - D E C L A R A T I O N S ---------------------- + // Forward declarations - use these instead whenever possible... +diff --git a/src/runtime_src/tools/xclbinutil/DTCStringsBlock.h b/src/runtime_src/tools/xclbinutil/DTCStringsBlock.h +index 361015962..1c3bca18d 100644 +--- a/src/runtime_src/tools/xclbinutil/DTCStringsBlock.h ++++ b/src/runtime_src/tools/xclbinutil/DTCStringsBlock.h +@@ -19,6 +19,7 @@ + + // ----------------------- I N C L U D E S ----------------------------------- + #include <sstream> ++#include <cstdint> + #include <string> + + // ----------- C L A S S : D T C S t r i n g s B l o c k ------------------- +diff --git a/src/runtime_src/tools/xclbinutil/XclBinSignature.h b/src/runtime_src/tools/xclbinutil/XclBinSignature.h +index b19ab56a4..f1b72d4d2 100644 +--- a/src/runtime_src/tools/xclbinutil/XclBinSignature.h ++++ b/src/runtime_src/tools/xclbinutil/XclBinSignature.h +@@ -18,6 +18,7 @@ + #define __XclBinSignature_h_ + + #include <string> ++#include <cstdint> + + // ----------------------- I N C L U D E S ----------------------------------- + +diff --git a/src/runtime_src/xdp/profile/database/events/vtf_event.h b/src/runtime_src/xdp/profile/database/events/vtf_event.h +index f8d0121db..b5f36554c 100644 +--- a/src/runtime_src/xdp/profile/database/events/vtf_event.h ++++ b/src/runtime_src/xdp/profile/database/events/vtf_event.h +@@ -19,6 +19,7 @@ + #define VTF_EVENT_DOT_H + + #include <fstream> ++#include <cstdint> + + #include "xdp/config.h" + +diff --git a/src/runtime_src/xdp/profile/device/aie_trace/aie_trace_logger.h b/src/runtime_src/xdp/profile/device/aie_trace/aie_trace_logger.h +index 98c57de2e..6077bd247 100644 +--- a/src/runtime_src/xdp/profile/device/aie_trace/aie_trace_logger.h ++++ b/src/runtime_src/xdp/profile/device/aie_trace/aie_trace_logger.h +@@ -17,7 +17,8 @@ + #ifndef XDP_PROFILE_AIE_TRACE_LOGGER_H + #define XDP_PROFILE_AIE_TRACE_LOGGER_H + +-#include<iostream> ++#include <iostream> ++#include <cstdint> + + namespace xdp { + +diff --git a/src/runtime_src/xdp/profile/writer/vp_base/vp_writer.h b/src/runtime_src/xdp/profile/writer/vp_base/vp_writer.h +index a88597464..f392ec0e6 100644 +--- a/src/runtime_src/xdp/profile/writer/vp_base/vp_writer.h ++++ b/src/runtime_src/xdp/profile/writer/vp_base/vp_writer.h +@@ -19,6 +19,7 @@ + + #include <fstream> + #include <string> ++#include <cstdint> + + #include "xdp/config.h" + diff --git a/meta-xilinx-core/recipes-xrt/xrt/xrt.inc b/meta-xilinx-core/recipes-xrt/xrt/xrt.inc new file mode 100644 index 00000000..14b2b968 --- /dev/null +++ b/meta-xilinx-core/recipes-xrt/xrt/xrt.inc @@ -0,0 +1,14 @@ +REPO ?= "git://github.com/Xilinx/XRT.git;protocol=https" +BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" +SRC_URI = "${REPO};${BRANCHARG};name=xrt" + +BRANCH= "2023.2" +SRCREV_xrt = "2865a62b6a417dea523d2d5646154aa94a2cbc28" +PV = "202320.2.16.0" + +SRC_URI += "git://github.com/Xilinx/dma_ip_drivers.git;branch=master;name=dma_ip_drivers;destsuffix=git/src/runtime_src/core/pcie/driver/linux/xocl/lib/libqdma;protocol=https" +SRCREV_dma_ip_drivers = "9f02769a2eddde008158c96efa39d7edb6512578" + +SRC_URI += "git://github.com/serge1/ELFIO.git;branch=main;name=ELFIO;destsuffix=git/src/runtime_src/core/common/elf;protocol=https" +SRCREV_ELFIO = "a04810f12625207cce72665d783babb80f0175a8" +SRCREV_FORMAT = "xrt" diff --git a/meta-xilinx-core/recipes-xrt/xrt/xrt_git.bb b/meta-xilinx-core/recipes-xrt/xrt/xrt_git.bb new file mode 100644 index 00000000..ef3c7172 --- /dev/null +++ b/meta-xilinx-core/recipes-xrt/xrt/xrt_git.bb @@ -0,0 +1,62 @@ +SUMMARY = "Xilinx Runtime(XRT) libraries" +DESCRIPTION = "Xilinx Runtime User Space Libraries and headers" + +require xrt.inc + +SRC_URI += "file://xrt-cstdint.patch;striplevel=2" + +LICENSE = "GPL-2.0-or-later & Apache-2.0 & MIT" +LIC_FILES_CHKSUM = "file://../LICENSE;md5=de2c993ac479f02575bcbfb14ef9b485 \ + file://runtime_src/core/edge/drm/zocl/LICENSE;md5=7d040f51aae6ac6208de74e88a3795f8 \ + file://runtime_src/core/pcie/driver/linux/xocl/LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://runtime_src/core/pcie/linux/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \ + file://runtime_src/core/tools/xbutil2/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \ + file://runtime_src/core/common/elf/LICENSE.txt;md5=b996e8b74af169e7e72e22d9e7d05b06 " + +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynqmp = ".*" +COMPATIBLE_MACHINE:versal = ".*" + +S = "${WORKDIR}/git/src" + +inherit cmake pkgconfig + +BBCLASSEXTEND = "native nativesdk" + +# util-linux is for libuuid-dev. +DEPENDS = "libdrm opencl-headers ocl-icd opencl-clhpp boost util-linux git-replacement-native protobuf-native protobuf elfutils libffi rapidjson" +RDEPENDS:${PN} = "bash ocl-icd boost-system boost-filesystem zocl (= ${PV})" + +EXTRA_OECMAKE += " \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_EXPORT_COMPILE_COMANDS=ON \ + " + +# Systems with AIE also require libmetal, this is implemented in the dynamic-layers +# See: meta-xilinx-core/dynamic-layers/openamp-layer/recipes-xrt/xrt_gt.bbappend +# Note: If meta-openamp is not available, AIE will not be enabled. + +EXTRA_OECMAKE:append:versal = " -DXRT_LIBDFX=true" +EXTRA_OECMAKE:append:zynqmp = " -DXRT_LIBDFX=true" +DEPENDS:append:versal = " libdfx" +DEPENDS:append:zynqmp = " libdfx" + + +FILES_SOLIBSDEV = "" +FILES:${PN} += "\ + ${libdir}/lib*.so \ + ${libdir}/lib*.so.* \ + ${libdir}/ps_kernels_lib \ + /lib/*.so* \ + ${datadir}" +INSANE_SKIP:${PN} += "dev-so" + +pkg_postinst_ontarget:${PN}() { + #!/bin/sh + if [ ! -e /etc/OpenCL/vendors/xilinx.icd ]; then + echo "INFO: Creating ICD entry for Xilinx Platform" + mkdir -p /etc/OpenCL/vendors + echo "libxilinxopencl.so" > /etc/OpenCL/vendors/xilinx.icd + chmod -R 755 /etc/OpenCL + fi +} diff --git a/meta-xilinx-core/recipes-xrt/zocl/zocl_git.bb b/meta-xilinx-core/recipes-xrt/zocl/zocl_git.bb new file mode 100644 index 00000000..6bd579f4 --- /dev/null +++ b/meta-xilinx-core/recipes-xrt/zocl/zocl_git.bb @@ -0,0 +1,25 @@ +SUMMARY = "Xilinx Runtime(XRT) driver module" +DESCRIPTION = "Xilinx Runtime driver module provides memory management and compute unit schedule" + +COMPATIBLE_MACHINE:microblaze = "none" + +require recipes-xrt/xrt/xrt.inc + +LIC_FILES_CHKSUM = "file://LICENSE;md5=7d040f51aae6ac6208de74e88a3795f8" +LICENSE = "GPL-2.0-or-later & Apache-2.0" + +COMPATIBLE_MACHINE ?= "^$" +COMPATIBLE_MACHINE:zynqmp = ".*" +COMPATIBLE_MACHINE:versal = ".*" + +S = "${WORKDIR}/git/src/runtime_src/core/edge/drm/zocl" + +inherit module + +pkg_postinst_ontarget:${PN}() { + #!/bin/sh + echo "Unloading old XRT Linux kernel modules" + ( rmmod zocl || true ) > /dev/null 2>&1 + echo "Loading new XRT Linux kernel modules" + modprobe zocl +} diff --git a/meta-xilinx-core/wic/xilinx-default-sd.wks b/meta-xilinx-core/wic/xilinx-default-sd.wks new file mode 100644 index 00000000..8129f01c --- /dev/null +++ b/meta-xilinx-core/wic/xilinx-default-sd.wks @@ -0,0 +1,9 @@ +# Description: Creates a partitioned SD card image. Boot files +# are located in the first vfat partition. Rootfs will be in second ext4 partition. + +# This wks uses a fixed-size /boot parition. 512MiB was selected as it should be large enough +# for most reference systems and their included bitstreams, while allowing additional space +# for user data or on-target upgrades. To adjust the size of the /boot parition change the +# value of --fixed-size below. See the Yocto Project WIC documentation for more information. +part /boot --source rootfs --change-directory=boot --fixed-size=512M --fstype=vfat --use-label --label boot --active --align 4 +part / --source rootfs --exclude-path=boot/ --fstype=ext4 --use-label --label root --align 4 diff --git a/meta-xilinx-standalone-experimental/README.md b/meta-xilinx-standalone-experimental/README.md new file mode 100644 index 00000000..31aa0f63 --- /dev/null +++ b/meta-xilinx-standalone-experimental/README.md @@ -0,0 +1,60 @@ +# meta-xilinx-standalone-experimental + +This layer contains experimental items that may eventually be added +to the meta-xilinx-standalone layer. The components in this layer +may or may not be buildable as they may require unreleased code. + +The non-Linux software components are still in development and +this should be considered to be a preview release only. For instance, +some components may not be buildable, expect APIs to change on various +parts and pieces. + +## Build Instructions + +**Note:** to use this layer you must REMOVE meta-xilinx-tools from your +project. meta-xilinx-tools is not compatible with this experimental +approach. You may also have to remove other layers that depend +on meta-xilinx-tools, such as meta-kria and meta-system-controller. + +To use the experimental version of the embedded software (firmware) +as well as system configuration, you must build the 'meta-xilinx-setup' +SDK. This SDK is passed a device tree, constructed from System Device tree and +produces a number of configuration files. + +1. Remove meta-xilinx-tools, meta-kria and meta-system-controller, then add the decoupling layer +``` +$ bitbake-layers remove-layer meta-xilinx-tools +$ bitbake-layers remove-layer meta-kria +$ bitbake-layers remove-layer meta-system-controller +$ bitbake-layers add-layer ./<path-to-layer>/meta-xilinx/meta-xilinx-standalone-experimental +``` +2. Build the setup SDK +``` +$ bitbake meta-xilinx-setup +``` +3. Install the setup SDK: +``` +$ .${TMPDIR}/tmp/deploy/sdk/x86_64-xilinx-nativesdk-prestep-2023.2....sh -d prestep -y +``` + +Then follow the instructions in the 'prestep/README-setup' file. + + +## Dependencies + +This layer depends on: + + URI: https://git.yoctoproject.org/poky + layers: meta, meta-poky + branch: langdale + + URI: https://git.openembedded.org/meta-openembedded + layers: meta-oe + branch: langdale + + URI: + https://git.yoctoproject.org/meta-xilinx (official version) + https://github.com/Xilinx/meta-xilinx (development and amd xilinx release) + layers: meta-xilinx-core, meta-xilinx-bsp, meta-xilinx-standalone + branch: langdale or amd xilinx release version (e.g. rel-v2023.1) + diff --git a/meta-xilinx-standalone-experimental/classes/esw.bbclass b/meta-xilinx-standalone-experimental/classes/esw.bbclass new file mode 100644 index 00000000..febdebad --- /dev/null +++ b/meta-xilinx-standalone-experimental/classes/esw.bbclass @@ -0,0 +1,143 @@ +PV = "${ESW_VER}" + +inherit python3native xlnx-embeddedsw pkgconfig cmake + +# Override xlnx-embeddedsw with out version +require conf/dtb-embeddedsw.inc + +SRCREV_FORMAT = "src_decouple" + +S = "${WORKDIR}/git" +B = "${WORKDIR}/build" +OECMAKE_SOURCEPATH = "${S}/${ESW_COMPONENT_SRC}" +LICFILENAME = "license.txt" + +SPECFILE_PATH:arm = "${S}/scripts/specs/arm/Xilinx.spec" +SPECFILE_PATH:aarch64 = "${S}/scripts/specs/arm/Xilinx.spec" +SPECFILE_PATH:microblaze = "${S}/scripts/specs/microblaze/Xilinx.spec" + +ESW_MACHINE ?= "${MACHINE}" + +ESW_CFLAGS += "-specs=${SPECFILE_PATH}" + +inherit ccmake + +COMPATIBLE_HOST = ".*-elf" +COMPATIBLE_HOST:arm = "[^-]*-[^-]*-eabi" + +CONFIG_DTFILE ??= "" +DTS_FILE = "${DEPLOY_DIR_IMAGE}/devicetree/${@os.path.basename(d.getVar('CONFIG_DTFILE').replace('.dts','.dtb'))}" + +DEPENDS += "python3-pyyaml-native lopper-native device-tree python3-dtc-native" + +# We need the deployed output +do_configure[depends] += "device-tree:do_deploy" +do_compile[depends] += "device-tree:do_deploy" +do_install[depends] += "device-tree:do_deploy" + +def get_xlnx_cmake_machine(fam, d): + cmake_machine = fam + if (fam == 'zynqmp'): + cmake_machine = 'ZynqMP' + elif (fam == 'versal'): + cmake_machine = 'Versal' + elif (fam == 'zynq'): + cmake_machine = 'Zynq' + return cmake_machine + +def get_xlnx_cmake_processor(tune, machine, d): + cmake_processor = tune + if tune.startswith('microblaze'): + if (machine == 'psu_pmu_0'): + cmake_processor = 'pmu_microblaze' + elif (machine == 'psv_pmc_0'): + cmake_processor = 'plm_microblaze' + else: + cmake_processor = 'microblaze' + elif tune == 'cortexr5': + cmake_processor = 'cortexr5' + elif tune.startswith('cortexa9'): + cmake_processor = 'cortexa9' + elif (tune in [ 'cortexa53', 'cortexa72-cortexa53' ]): + cmake_processor = 'cortexa53' + elif tune == 'cortexa72': + cmake_processor = 'cortexa72' + return cmake_processor + +XLNX_CMAKE_MACHINE = "${@get_xlnx_cmake_machine(d.getVar('SOC_FAMILY'), d)}" +XLNX_CMAKE_PROCESSOR = "${@get_xlnx_cmake_processor(d.getVar('DEFAULTTUNE'), d.getVar('ESW_MACHINE'), d)}" +XLNX_CMAKE_SYSTEM_NAME ?= "Generic" +XLNX_CMAKE_BSP_VARS ?= "" + +cmake_do_generate_toolchain_file:append() { + cat >> ${WORKDIR}/toolchain.cmake <<EOF + include(CMakeForceCompiler) + CMAKE_FORCE_C_COMPILER("${OECMAKE_C_COMPILER}" GNU) + CMAKE_FORCE_CXX_COMPILER("${OECMAKE_CXX_COMPILER}" GNU) + set( CMAKE_SYSTEM_PROCESSOR "${XLNX_CMAKE_PROCESSOR}" ) + set( CMAKE_MACHINE "${XLNX_CMAKE_MACHINE}" ) + # Will need this in the future to make cmake understand esw variables + # set( CMAKE_SYSTEM_NAME `echo elf | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) + set( CMAKE_SYSTEM_NAME "${XLNX_CMAKE_SYSTEM_NAME}" ) + set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${S}/cmake) + set( CMAKE_LIBRARY_PATH ${CMAKE_INSTALL_LIBDIR}) + if ("${XLNX_CMAKE_PROCESSOR}" STREQUAL "plm_microblaze") + set( CMAKE_BUILD_TYPE Release) + endif() + add_definitions( "${XLNX_CMAKE_BSP_VARS}" ) +EOF +} + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir} + install -m 0755 ${B}/${ESW_COMPONENT_NAME} ${D}${libdir} + install -m 0644 ${B}/include/*.h ${D}${includedir} +} + +CFLAGS:append = " ${ESW_CFLAGS}" + +# We need to find the license file, which vaires depending on the component +# recurse a maximum of x times, could be fancier but it gets complicated since +# we dont know for certain we are running devtool or just externalsrc +python(){ + import os.path + if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC'): + externalsrc = d.getVar('EXTERNALSRC') + lic_file = d.getVar('LIC_FILES_CHKSUM', False) + licpath=externalsrc + for i in range(5): + if os.path.isfile(licpath + '/' + d.getVar('LICFILENAME',True)): + lic_file = lic_file.replace('${S}',licpath) + d.setVar('LIC_FILES_CHKSUM', lic_file) + return + licpath=os.path.dirname(licpath) + bb.error("Couldn't find license file: %s, within directory %s or his parent directories" % (d.getVar('LICFILENAME',True), externalsrc)) +} + +do_generate_driver_data[dirs] = "${B}" +do_generate_driver_data[depends] += "device-tree:do_deploy" +python do_generate_driver_data() { + import glob, subprocess, os + + system_dt = glob.glob(d.getVar('DTS_FILE')) + src_dir = glob.glob(d.getVar('OECMAKE_SOURCEPATH')) + machine = d.getVar('ESW_MACHINE') + + driver_name = d.getVar('REQUIRED_MACHINE_FEATURES') + + if len(system_dt) == 0: + bb.error("Couldn't find device tree %s" % d.getVar('DTS_FILE')) + + if len(src_dir) == 0: + bb.error("Couldn't find source dir %s" % d.getVar('OECMAKE_SOURCEPATH')) + + os.chdir(d.getVar('B')) + command = ["lopper"] + ["-f"] + [system_dt[0]] + ["--"] + ["baremetalconfig_xlnx.py"] + [machine] + [src_dir[0]] + subprocess.run(command, check = True) + src_file = str("x") + driver_name.replace('-', '_') + str("_g.c") + if os.path.exists(src_file): + bb.note("Generated config file for driver %s" % driver_name) + command = ["install"] + ["-m"] + ["0755"] + [src_file] + [src_dir[0]] + subprocess.run(command, check = True) +} diff --git a/meta-xilinx-standalone-experimental/classes/esw_examples.bbclass b/meta-xilinx-standalone-experimental/classes/esw_examples.bbclass new file mode 100644 index 00000000..43e78191 --- /dev/null +++ b/meta-xilinx-standalone-experimental/classes/esw_examples.bbclass @@ -0,0 +1,35 @@ +inherit esw deploy python3native + +DEPENDS += "python3-dtc-native python3-pyyaml-native xilstandalone libxil xiltimer" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +do_generate_eglist () { + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} drvcmake_metadata + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask generate_eglist before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + install -m 0755 ${B}/*.elf ${D}/${base_libdir}/firmware +} + +do_deploy() { + install -d ${DEPLOYDIR}/${BPN}/ + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/*.elf ${DEPLOYDIR}/${BPN}/ +} +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/*.elf" diff --git a/meta-xilinx-standalone-experimental/conf/distro/xilinx-freertos.conf b/meta-xilinx-standalone-experimental/conf/distro/xilinx-freertos.conf new file mode 100644 index 00000000..84638022 --- /dev/null +++ b/meta-xilinx-standalone-experimental/conf/distro/xilinx-freertos.conf @@ -0,0 +1,9 @@ +require conf/distro/xilinx-standalone.inc + +DISTRO_NAME:append = " (freertos)" + +XLNX_CMAKE_SYSTEM_NAME = "FreeRTOS" + +# We need to pass FREERTOS_BSP compliler flag it is consumed +# esw components. +ESW_CFLAGS += " -DFREERTOS_BSP" diff --git a/meta-xilinx-standalone-experimental/conf/dtb-embeddedsw.inc b/meta-xilinx-standalone-experimental/conf/dtb-embeddedsw.inc new file mode 100644 index 00000000..a9192f62 --- /dev/null +++ b/meta-xilinx-standalone-experimental/conf/dtb-embeddedsw.inc @@ -0,0 +1,11 @@ +# The format of this file must be compatible with +# meta-xilinx/meta-xilinx-standalone/classes/xlnx-embeddedsw.bbclass + +# Make it clear decoupling is 'experimental' in the version +ESW_VER = "2023_sdt_experimental" + +REPO = "git://github.com/Xilinx/embeddedsw-experimental-dt-support.git;protocol=https" + +ESW_BRANCH[2023_sdt_experimental] = "xlnx_rel_v2023.2_sdt" +ESW_REV[2023_sdt_experimental] = "742a608800e7621fb7c376daf5124333b5826d6d" +LIC_FILES_CHKSUM[xlnx_rel_v2023.2_sdt] = 'ce611484168a6000bd35df68fc4f4290' diff --git a/meta-xilinx-standalone-experimental/conf/layer.conf b/meta-xilinx-standalone-experimental/conf/layer.conf new file mode 100644 index 00000000..6cfd01c3 --- /dev/null +++ b/meta-xilinx-standalone-experimental/conf/layer.conf @@ -0,0 +1,28 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend \ + ${LAYERDIR}/recipes-*/*.bb \ + ${LAYERDIR}/recipes-*/*.bbappend \ + " + +BBFILE_COLLECTIONS += "xilinx-standalone-exp" +BBFILE_PATTERN_xilinx-standalone-exp = "^${LAYERDIR}/" +BBFILE_PRIORITY_xilinx-standalone-exp = "7" + +# Allow other layers to find the root of this layer if necessary +META_XILINX_STANDALONE_EXP_PATH = "${LAYERDIR}" + +LAYERDEPENDS_xilinx-standalone-exp = "core \ + xilinx \ + xilinx-standalone \ + xilinx-microblaze \ + virtualization-layer \ + " + +LAYERSERIES_COMPAT_xilinx-standalone-exp = "scarthgap" + +# Aid debugging, show where the device trees are we are using +BUILDCFG_VARS:append = " SYSTEM_DTFILE CONFIG_DTFILE" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/empty-application/empty-application_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/empty-application/empty-application_git.bb new file mode 100644 index 00000000..d62779ae --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/empty-application/empty-application_git.bb @@ -0,0 +1,45 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_apps/empty_application/src/" + +DEPENDS += "libxil xiltimer" + +inherit python3native + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + install -m 0644 ${CUSTOM_SRCFILE}/* ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + ) +} + +CUSTOM_APP_IMAGE_NAME ??= "custom-application" + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +inherit image-artifact-names + +CUSTOM_APP_BASE_NAME ?= "${CUSTOM_APP_IMAGE_NAME}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +ESW_COMPONENT ??= "empty_application.elf" + +do_compile:append() { + ${OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/empty_application.bin +} + +do_install() { + : +} + +do_deploy() { + install -Dm 0644 ${B}/${ESW_COMPONENT} ${DEPLOYDIR}/${CUSTOM_APP_BASE_NAME}.elf + ln -sf ${CUSTOM_APP_BASE_NAME}.elf ${DEPLOYDIR}/${CUSTOM_APP_IMAGE_NAME}.elf + install -m 0644 ${B}/empty_application.bin ${DEPLOYDIR}/${CUSTOM_APP_BASE_NAME}.bin + ln -sf ${CUSTOM_APP_BASE_NAME}.bin ${DEPLOYDIR}/${CUSTOM_APP_IMAGE_NAME}.bin +} +addtask deploy before do_build after do_install diff --git a/meta-xilinx-standalone-experimental/recipes-applications/freertos-hello-world/freertos-hello-world_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/freertos-hello-world/freertos-hello-world_git.bb new file mode 100644 index 00000000..8106684b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/freertos-hello-world/freertos-hello-world_git.bb @@ -0,0 +1,39 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/freertos_hello_world/src/" + +DEPENDS += "libxil xilstandalone freertos10-xilinx xiltimer" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + ) +} + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/freertos_hello_world* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +FREERTOS_HELLO_WORLD_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_hello_world.elf ${DEPLOYDIR}/${FREERTOS_HELLO_WORLD_BASE_NAME}.elf + ln -sf ${FREERTOS_HELLO_WORLD_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/freertos_hello_world.elf ${WORKDIR}/package/${base_libdir}/firmware/freertos_hello_world.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_hello_world.bin ${DEPLOYDIR}/${FREERTOS_HELLO_WORLD_BASE_NAME}.bin + ln -sf ${FREERTOS_HELLO_WORLD_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/freertos_hello_world*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-echo-server/freertos-lwip-echo-server_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-echo-server/freertos-lwip-echo-server_git.bb new file mode 100644 index 00000000..f7eae1dc --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-echo-server/freertos-lwip-echo-server_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/freertos_lwip_echo_server/src/" + +DEPENDS += "libxil lwip xiltimer freertos10-xilinx" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/freertos_lwip_echo* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +FREERTOS_LWIP_ECHO_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_echo_server.elf ${DEPLOYDIR}/${FREERTOS_LWIP_ECHO_BASE_NAME}.elf + ln -sf ${FREERTOS_LWIP_ECHO_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_echo_server.elf ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_echo_server.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_echo_server.bin ${DEPLOYDIR}/${FREERTOS_LWIP_ECHO_BASE_NAME}.bin + ln -sf ${FREERTOS_LWIP_ECHO_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/freertos_lwip_echo*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-tcp-perf-client/freertos-lwip-tcp-perf-client_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-tcp-perf-client/freertos-lwip-tcp-perf-client_git.bb new file mode 100644 index 00000000..51b89b8e --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-tcp-perf-client/freertos-lwip-tcp-perf-client_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/freertos_lwip_tcp_perf_client/src/" + +DEPENDS += "libxil lwip xiltimer freertos10-xilinx" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/freertos_lwip_tcp_perf_client* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_tcp_perf_client.elf ${DEPLOYDIR}/${FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME}.elf + ln -sf ${FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_tcp_perf_client.elf ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_tcp_perf_client.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_tcp_perf_client.bin ${DEPLOYDIR}/${FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME}.bin + ln -sf ${FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/freertos_lwip_tcp_perf_client*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-tcp-perf-server/freertos-lwip-tcp-perf-server_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-tcp-perf-server/freertos-lwip-tcp-perf-server_git.bb new file mode 100644 index 00000000..606fd01e --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-tcp-perf-server/freertos-lwip-tcp-perf-server_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/freertos_lwip_tcp_perf_server/src/" + +DEPENDS += "libxil lwip xiltimer freertos10-xilinx" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/freertos_lwip_tcp_perf_server* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +FREERTOS_LWIP_TCP_PERF_SERVER_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_tcp_perf_server.elf ${DEPLOYDIR}/${FREERTOS_LWIP_TCP_PERF_SERVER_BASE_NAME}.elf + ln -sf ${FREERTOS_LWIP_TCP_PERF_SERVER_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_tcp_perf_server.elf ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_tcp_perf_server.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_tcp_perf_server.bin ${DEPLOYDIR}/${FREERTOS_LWIP_TCP_PERF_SERVER_BASE_NAME}.bin + ln -sf ${FREERTOS_LWIP_TCP_PERF_SERVER_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/freertos_lwip_tcp_perf_server*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-udp-perf-client/freertos-lwip-udp-perf-client_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-udp-perf-client/freertos-lwip-udp-perf-client_git.bb new file mode 100644 index 00000000..7f9d86e2 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-udp-perf-client/freertos-lwip-udp-perf-client_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/freertos_lwip_udp_perf_client/src/" + +DEPENDS += "libxil lwip xiltimer freertos10-xilinx" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/freertos_lwip_udp_perf_client* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_udp_perf_client.elf ${DEPLOYDIR}/${FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME}.elf + ln -sf ${FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_udp_perf_client.elf ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_udp_perf_client.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_udp_perf_client.bin ${DEPLOYDIR}/${FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME}.bin + ln -sf ${FREERTOS_LWIP_TCP_PERF_CLIENT_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/freertos_lwip_udp_perf_client*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-udp-perf-server/freertos-lwip-udp-perf-server_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-udp-perf-server/freertos-lwip-udp-perf-server_git.bb new file mode 100644 index 00000000..4fc02f36 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/freertos-lwip-udp-perf-server/freertos-lwip-udp-perf-server_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/freertos_lwip_udp_perf_server/src/" + +DEPENDS += "libxil lwip xiltimer freertos10-xilinx" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/freertos_lwip_udp_perf_server* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +FREERTOS_LWIP_UDP_PERF_SERVER_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_udp_perf_server.elf ${DEPLOYDIR}/${FREERTOS_LWIP_UDP_PERF_SERVER_BASE_NAME}.elf + ln -sf ${FREERTOS_LWIP_UDP_PERF_SERVER_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_udp_perf_server.elf ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_udp_perf_server.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/freertos_lwip_udp_perf_server.bin ${DEPLOYDIR}/${FREERTOS_LWIP_UDP_PERF_SERVER_BASE_NAME}.bin + ln -sf ${FREERTOS_LWIP_UDP_PERF_SERVER_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/freertos_lwip_udp_perf_server*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/hello-world/hello-world_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/hello-world/hello-world_git.bb new file mode 100644 index 00000000..1de5ef8c --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/hello-world/hello-world_git.bb @@ -0,0 +1,44 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_apps/hello_world/src/" + +DEPENDS += "libxil xiltimer" + +inherit python3native + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/hello_world* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +HELLO_WORLD_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/hello_world.elf ${DEPLOYDIR}/${HELLO_WORLD_BASE_NAME}.elf + ln -sf ${HELLO_WORLD_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/hello_world.elf ${WORKDIR}/package/${base_libdir}/firmware/hello_world.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/hello_world.bin ${DEPLOYDIR}/${HELLO_WORLD_BASE_NAME}.bin + ln -sf ${HELLO_WORLD_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/hello_world*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/lwip-echo-server/lwip-echo-server_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/lwip-echo-server/lwip-echo-server_git.bb new file mode 100644 index 00000000..c59d816e --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/lwip-echo-server/lwip-echo-server_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/lwip_echo_server/src/" + +DEPENDS += "libxil lwip xiltimer" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/lwip_echo* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +LWIP_ECHO_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_echo_server.elf ${DEPLOYDIR}/${LWIP_ECHO_BASE_NAME}.elf + ln -sf ${LWIP_ECHO_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/lwip_echo_server.elf ${WORKDIR}/package/${base_libdir}/firmware/lwip_echo.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_echo.bin ${DEPLOYDIR}/${LWIP_ECHO_BASE_NAME}.bin + ln -sf ${LWIP_ECHO_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/lwip_echo*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/lwip-tcp-perf-client/lwip-tcp-perf-client_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/lwip-tcp-perf-client/lwip-tcp-perf-client_git.bb new file mode 100644 index 00000000..b9834e34 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/lwip-tcp-perf-client/lwip-tcp-perf-client_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/lwip_tcp_perf_client/src/" + +DEPENDS += "libxil lwip xiltimer" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/lwip_tcp_perf_client* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +LWIP_TCP_PERF_CLIENT_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_tcp_perf_client.elf ${DEPLOYDIR}/${LWIP_TCP_PERF_CLIENT_BASE_NAME}.elf + ln -sf ${LWIP_TCP_PERF_CLIENT_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/lwip_tcp_perf_client.elf ${WORKDIR}/package/${base_libdir}/firmware/lwip_tcp_perf_client.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_tcp_perf_client.bin ${DEPLOYDIR}/${LWIP_TCP_PERF_CLIENT_BASE_NAME}.bin + ln -sf ${LWIP_TCP_PERF_CLIENT_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/lwip_tcp_perf_client*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/lwip-tcp-perf-server/lwip-tcp-perf-server_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/lwip-tcp-perf-server/lwip-tcp-perf-server_git.bb new file mode 100644 index 00000000..0acc4b8f --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/lwip-tcp-perf-server/lwip-tcp-perf-server_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/lwip_tcp_perf_server/src/" + +DEPENDS += "libxil lwip xiltimer" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/lwip_tcp_perf_server* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +LWIP_TCP_PERF_SERVER_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_tcp_perf_server.elf ${DEPLOYDIR}/${LWIP_TCP_PERF_SERVER_BASE_NAME}.elf + ln -sf ${LWIP_TCP_PERF_SERVER_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/lwip_tcp_perf_server.elf ${WORKDIR}/package/${base_libdir}/firmware/lwip_tcp_perf_server.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_tcp_perf_server.bin ${DEPLOYDIR}/${LWIP_TCP_PERF_SERVER_BASE_NAME}.bin + ln -sf ${LWIP_TCP_PERF_SERVER_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/lwip_tcp_perf_server*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/lwip-udp-perf-client/lwip-udp-perf-client_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/lwip-udp-perf-client/lwip-udp-perf-client_git.bb new file mode 100644 index 00000000..00a9eaa6 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/lwip-udp-perf-client/lwip-udp-perf-client_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/lwip_udp_perf_client/src/" + +DEPENDS += "libxil lwip xiltimer" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/lwip_udp_perf_client* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +LWIP_UDP_PERF_CLIENT_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_udp_perf_client.elf ${DEPLOYDIR}/${LWIP_UDP_PERF_CLIENT_BASE_NAME}.elf + ln -sf ${LWIP_UDP_PERF_CLIENT_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/lwip_udp_perf_client.elf ${WORKDIR}/package/${base_libdir}/firmware/lwip_udp_perf_client.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_udp_perf_client.bin ${DEPLOYDIR}/${LWIP_UDP_PERF_CLIENT_BASE_NAME}.bin + ln -sf ${LWIP_UDP_PERF_CLIENT_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/lwip_udp_perf_client*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/lwip-udp-perf-server/lwip-udp-perf-server_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/lwip-udp-perf-server/lwip-udp-perf-server_git.bb new file mode 100644 index 00000000..5f54caf9 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/lwip-udp-perf-server/lwip-udp-perf-server_git.bb @@ -0,0 +1,48 @@ +inherit esw deploy python3native + +ESW_COMPONENT_SRC = "/lib/sw_apps/lwip_udp_perf_server/src/" + +DEPENDS += "libxil lwip xiltimer" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_generate_app_data() { + # This script should also not rely on relative paths and such + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/lwip_udp_perf_server* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +LWIP_UDP_PERF_SERVER_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_udp_perf_server.elf ${DEPLOYDIR}/${LWIP_UDP_PERF_SERVER_BASE_NAME}.elf + ln -sf ${LWIP_UDP_PERF_SERVER_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/lwip_udp_perf_server.elf ${WORKDIR}/package/${base_libdir}/firmware/lwip_udp_perf_server.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/lwip_udp_perf_server.bin ${DEPLOYDIR}/${LWIP_UDP_PERF_SERVER_BASE_NAME}.bin + ln -sf ${LWIP_UDP_PERF_SERVER_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/lwip_udp_perf_server*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/memory-tests/memory-tests_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/memory-tests/memory-tests_git.bb new file mode 100644 index 00000000..1ece5a8c --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/memory-tests/memory-tests_git.bb @@ -0,0 +1,41 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_apps/memory_tests/src/" + +DEPENDS += "libxil xiltimer" + +inherit python3native + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} memtest + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_install() { + install -d ${D}/${base_libdir}/firmware + # Note that we have to make the ELF executable for it to be stripped + install -m 0755 ${B}/memory_tests* ${D}/${base_libdir}/firmware +} + +inherit image-artifact-names + +MEMORY_TESTS_BASE_NAME ?= "${BPN}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +do_deploy() { + + # We need to deploy the stripped elf, hence why not doing it from ${D} + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/memory_tests.elf ${DEPLOYDIR}/${MEMORY_TESTS_BASE_NAME}.elf + ln -sf ${MEMORY_TESTS_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + ${OBJCOPY} -O binary ${WORKDIR}/package/${base_libdir}/firmware/memory_tests.elf ${WORKDIR}/package/${base_libdir}/firmware/memory_tests.bin + install -m 0644 ${WORKDIR}/package/${base_libdir}/firmware/memory_tests.bin ${DEPLOYDIR}/${MEMORY_TESTS_BASE_NAME}.bin + ln -sf ${MEMORY_TESTS_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} + +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/memory_tests*" diff --git a/meta-xilinx-standalone-experimental/recipes-applications/peripheral-tests/peripheral-tests_git.bb b/meta-xilinx-standalone-experimental/recipes-applications/peripheral-tests/peripheral-tests_git.bb new file mode 100644 index 00000000..b6b15d5a --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-applications/peripheral-tests/peripheral-tests_git.bb @@ -0,0 +1,62 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_apps/peripheral_tests/src/" + +DEPENDS += "libxil xiltimer" + +inherit python3native + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + cp -rf ${S}/scripts/linker_files/ ${S}/${ESW_COMPONENT_SRC}/linker_files + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +python do_generate_app_data() { + import glob, subprocess, os + + system_dt = glob.glob(d.getVar('DTS_FILE')) + srcdir = glob.glob(d.getVar('S')) + src_dir = glob.glob(d.getVar('OECMAKE_SOURCEPATH')) + machine = d.getVar('ESW_MACHINE') + + if len(system_dt) == 0: + bb.error("Couldn't find device tree %s" % d.getVar('DTS_FILE')) + + if len(src_dir) == 0: + bb.error("Couldn't find source dir %s" % d.getVar('OECMAKE_SOURCEPATH')) + + driver_name = d.getVar('REQUIRED_MACHINE_FEATURES') + command = ["lopper"] + ["-f"] + ["-O"] + [src_dir[0]] + [system_dt[0]] + ["--"] + ["baremetal_gentestapp_xlnx"] + [machine] + [srcdir[0]] + subprocess.run(command, check = True) +} +addtask do_generate_app_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +PERIPHERAL_TEST_APP_IMAGE_NAME ??= "${BPN}" + +inherit image-artifact-names + +PERIPHERAL_TEST_BASE_NAME ?= "${PERIPHERAL_TEST_APP_IMAGE_NAME}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +ESW_COMPONENT ??= "peripheral_tests.elf" + +do_compile:append() { + ${OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/peripheral_tests.bin +} + +do_install() { + : +} + +do_deploy() { + install -Dm 0644 ${B}/${ESW_COMPONENT} ${DEPLOYDIR}/${PERIPHERAL_TEST_BASE_NAME}.elf + ln -sf ${PERIPHERAL_TEST_BASE_NAME}.elf ${DEPLOYDIR}/${BPN}-${MACHINE}.elf + install -m 0644 ${B}/peripheral_tests.bin ${DEPLOYDIR}/${PERIPHERAL_TEST_BASE_NAME}.bin + ln -sf ${PERIPHERAL_TEST_BASE_NAME}.bin ${DEPLOYDIR}/${BPN}-${MACHINE}.bin +} +addtask deploy before do_build after do_install diff --git a/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/esw-conf_git.bb b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/esw-conf_git.bb new file mode 100644 index 00000000..e6cf1d8b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/esw-conf_git.bb @@ -0,0 +1,34 @@ +# Can't depend on esw since this is needed for setup! +inherit xlnx-embeddedsw + +# We need to override the inherit +require conf/dtb-embeddedsw.inc + +S = "${WORKDIR}/git" +B = "${WORKDIR}/build" + +INHIBIT_DEFAULT_DEPS = "1" + +# Installing this recipe should install the lopper tools and such +DEPENDS = "lopper xilinx-lops" + +COMPATIBLE_HOST:forcevariable = ".*" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/" + +do_configure[noexec] = '1' +do_compile[noexec] = '1' + +do_install() { + # The configuration step requires only the yaml files, make them + # available to the SDK + cd ${S}${ESW_COMPONENT_SRC} + for each in `find . -name *.yaml` ; do + mkdir -p $(dirname ${D}/${datadir}/embeddedsw${ESW_COMPONENT_SRC}$each) + install -m 0644 $each ${D}/${datadir}/embeddedsw${ESW_COMPONENT_SRC}$each + done +} + +FILES:${PN} += "${datadir}/embeddedsw" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/fsbl-firmware_git.bbappend b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/fsbl-firmware_git.bbappend new file mode 100644 index 00000000..d40f3cdb --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/fsbl-firmware_git.bbappend @@ -0,0 +1,66 @@ +# We WANT to default to this version when available +DEFAULT_PREFERENCE = "100" + +# Reset this +SRC_URI = "${EMBEDDEDSW_SRCURI}" + +inherit esw + +# Not compatible with Zynq +COMPATIBLE_MACHINE:zynq = "none" +COMPATIBLE_MACHINE:microblaze = "none" + +ESW_COMPONENT_SRC = "/lib/sw_apps/undefined/src" +ESW_COMPONENT_SRC:zynq = "/lib/sw_apps/zynq_fsbl/src" +ESW_COMPONENT_SRC:zynqmp = "/lib/sw_apps/zynqmp_fsbl/src" + +DEPENDS += "xilstandalone xiltimer xilffs xilsecure xilpm" + +python() { + psu_init_path = d.getVar('PSU_INIT_PATH') + if not psu_init_path: + psu_init_path = os.path.dirname(d.getVar('SYSTEM_DTFILE')) + + psu_init_c = os.path.join(psu_init_path, 'psu_init.c') + psu_init_h = os.path.join(psu_init_path, 'psu_init.h') + + add_path = False + if os.path.exists(psu_init_c): + d.appendVar('SRC_URI', ' file://psu_init.c') + add_path = True + + if os.path.exists(psu_init_h): + d.appendVar('SRC_URI', ' file://psu_init.h') + add_path = True + + if add_path: + d.prependVar('FILESEXTRAPATHS', '%s:' % psu_init_path) +} + +do_configure:prepend() { + if [ -e ${WORKDIR}/psu_init.c ]; then + install -m 0644 ${WORKDIR}/psu_init.c ${S}/${ESW_COMPONENT_SRC} + else + bbwarn "Using the default psu_init.c, this may not work correctly." + fi + + if [ -e ${WORKDIR}/psu_init.h ]; then + install -m 0644 ${WORKDIR}/psu_init.h ${S}/${ESW_COMPONENT_SRC} + else + bbwarn "Using the default psu_init.h, this may not work correctly." + fi + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} +} + +do_install() { + : +} + +addtask deploy before do_build after do_package + +ESW_COMPONENT = "undefined" +ESW_COMPONENT:zynq = "zynq_fsbl.elf" +ESW_COMPONENT:zynqmp = "zynqmp_fsbl.elf" + +CFLAGS:append:aarch64 = " -DARMA53_64" +CFLAGS:append:armv7r = " -DARMR5" diff --git a/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/plm-firmware_git.bbappend b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/plm-firmware_git.bbappend new file mode 100644 index 00000000..cc6d757f --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/plm-firmware_git.bbappend @@ -0,0 +1,28 @@ +# We WANT to default to this version when available +DEFAULT_PREFERENCE = "100" + +# Reset this +SRC_URI = "${EMBEDDEDSW_SRCURI}" + +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_apps/versal_plm/src/" + +ESW_COMPONENT = "versal_plm.elf" + +do_configure:prepend() { + ( + cd ${S} + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_compile:append() { + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} + +do_install() { + : +} + +DEPENDS += "xilstandalone xiltimer xilffs xilpdi xilplmi xilloader xilpm xilsecure xilsem xilnvm" diff --git a/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/pmu-firmware_git.bbappend b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/pmu-firmware_git.bbappend new file mode 100644 index 00000000..b5908d46 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/pmu-firmware_git.bbappend @@ -0,0 +1,29 @@ +# We WANT to default to this version when available +DEFAULT_PREFERENCE = "100" + +# Reset this +SRC_URI = "${EMBEDDEDSW_SRCURI}" + +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_apps/zynqmp_pmufw/src" + +ESW_COMPONENT = "zynqmp_pmufw.elf" + + +do_configure:prepend() { + ( + cd ${S} + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_compile:append() { + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} + +do_install() { + : +} + +DEPENDS += "xilstandalone xiltimer xilfpga xilskey" diff --git a/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/psm-firmware_git.bbappend b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/psm-firmware_git.bbappend new file mode 100644 index 00000000..c4953ce7 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-bsp/embeddedsw/psm-firmware_git.bbappend @@ -0,0 +1,28 @@ +# We WANT to default to this version when available +DEFAULT_PREFERENCE = "100" + +# Reset this +SRC_URI = "${EMBEDDEDSW_SRCURI}" + +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_apps/versal_psmfw/src/" + +ESW_COMPONENT = "versal_psmfw.elf" + +do_configure:prepend() { + ( + cd ${S} + install -m 0644 ${S}/cmake/UserConfig.cmake ${S}/${ESW_COMPONENT_SRC} + ) +} + +do_compile:append() { + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} + +do_install() { + : +} + +DEPENDS += "xilstandalone libxil xiltimer" diff --git a/meta-xilinx-standalone-experimental/recipes-core/meta/files/README-setup b/meta-xilinx-standalone-experimental/recipes-core/meta/files/README-setup new file mode 100644 index 00000000..0a5736d8 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-core/meta/files/README-setup @@ -0,0 +1,102 @@ +Document Version: 20230112 + +The Yocto Project setup for the System Device Tree workflow is as follows. +Be sure to read everything below, as the steps will be updated in the future +if the setup script changes. + +The steps in this document expect that you have already built the setup +(meta-xilinx-setup) SDK, and installed it. + +* Run the setup script + +The setup environment should be run in a new shell (not the build shell) +to ensure that you do not contaminate the environment for your build. + +We will assume below that the directory "prestep" was used for the SDK, +however you may use any path you wish. + +Source the SDK environment file + $ . <build>/prestep/environment-setup-x86_64-petalinux-linux + +Run the script from the same directory as this README + $ <build>/prestep/dt-processor.sh -c <conf> -s <dtb> -l conf/local.conf + +Note: The -l option will automatically add the necessary parameters to the +local.conf file. If you need to re-run this comment, you just clear the +parameters from the end of the file. Without the -l option the items are +printed to the screen and must be manually added to your conf/local.conf + +For example, zynqmp: + $ ./prestep/dt-processor.sh -c conf -s /proj/yocto/zcu102-sdt/system-top.dts -l conf/local.conf + +The following will be written to the end of the conf/local.conf file: + + # Each multiconfig will define it's own TMPDIR, this is the new default based + # on BASE_TMPDIR for the Linux build + TMPDIR = "${BASE_TMPDIR}/tmp" + + # Use the newly generated MACHINE + MACHINE = "xlnx-zynqmp-zcu102-rev1-0" + + # All of the TMPDIRs must be in a common parent directory. This is defined + # as BASE_TMPDIR. + # Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp + BASE_TMPDIR ?= "${TOPDIR}" + + # The following is the full set of multiconfigs for this configuration + # A large list can cause a slow parse. + BBMULTICONFIG = " cortexa53-0-zynqmp-fsbl-baremetal cortexa53-0-zynqmp-baremetal cortexa53-0-zynqmp-freertos cortexa53-1-zynqmp-baremetal cortexa53-1-zynqmp-freertos cortexa53-2-zynqmp-baremetal cortexa53-2-zynqmp-freertos cortexa53-3-zynqmp-baremetal cortexa53-3-zynqmp-freertos cortexr5-0-zynqmp-fsbl-baremetal cortexr5-0-zynqmp-baremetal cortexr5-0-zynqmp-freertos cortexr5-1-zynqmp-baremetal cortexr5-1-zynqmp-freertos microblaze-0-pmu" + # Alternatively trim the list to the minimum + #BBMULTICONFIG = " cortexa53-0-zynqmp-fsbl-baremetal microblaze-0-pmu" + + +For example, versal: + $ ./prestep/dt-processor.sh -c conf -s /proj/yocto/vmk180-sdt/system-top.dts -l conf/local.conf + +The following will be written to the end of the conf/local.conf file: + + # Each multiconfig will define it's own TMPDIR, this is the new default based + # on BASE_TMPDIR for the Linux build + TMPDIR = "${BASE_TMPDIR}/tmp" + + # Use the newly generated MACHINE + MACHINE = "xlnx-versal-vmk180-rev1-1-x-ebm-01-reva" + + # All of the TMPDIRs must be in a common parent directory. This is defined + # as BASE_TMPDIR. + # Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp + BASE_TMPDIR ?= "${TOPDIR}" + + # The following is the full set of multiconfigs for this configuration + # A large list can cause a slow parse. + BBMULTICONFIG = " cortexa72-0-versal-baremetal cortexa72-0-versal-freertos cortexa72-1-versal-baremetal cortexa72-1-versal-freertos microblaze-0-pmc microblaze-0-psm cortexr5-0-versal-baremetal cortexr5-0-versal-freertos cortexr5-1-versal-baremetal cortexr5-1-versal-freertos" + # Alternatively trim the list to the minimum + #BBMULTICONFIG = " microblaze-0-pmc microblaze-0-psm" + + +You can now EXIT THE NEW SHELL return the build environment for the remaining steps. + +* Bitbake Performance Note + +Each BBMULTICONFIG value requires all of the recipes to be parsed for that +configuration. Thus each multiconfig will add more parsing time. A long list +can lead to a very slow parse (many minutes). To speed up parsing, it is +suggested that you trim this down to only the configurations you require. +A minimum configuration is included with the generated configuration. + +* Build your project + +You should now be able to build your project normally. See the Yocto Project +documentation if you have questions on how to work with the multiconfig +recipes. The following is a simple build for testing. + +In the original build shell +Build your Linux sytem: + $ bitbake petalinux-image-minimal + +The output will be in tmp/deploy/images/... + +If the system is QEMU capable execute QEMU using: + $ runqemu nographic slirp core-image-minimal + +To terminate qemu, usually the command is ctrl-a x diff --git a/meta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh b/meta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh new file mode 100755 index 00000000..1c754689 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-core/meta/files/dt-processor.sh @@ -0,0 +1,1260 @@ +#! /bin/bash + +# Copyright (c) 2021-2022 Xilinx Inc +# Copyright (C) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# This script configures the Yocto Project build system for use with the System +# Device Tree workflow when building for a Xilinx FPGA, such as the ZynqMP or +# Versal. + +error() { echo "ERROR: $1" >&2; exit 1; } + +warn() { echo "WARNING: $1"; } + +info() { echo "INFO: $1"; } + +usage() { + cat <<EOF +$0 + -c <config_dir> Location of the build conf directory + -s <system_dts> Path to system dts + [-d <domain_file>] Path to domain file (.yml/.dts) + [-o <overlay_dts>] Generate overlay dts + [-e <external_fpga>] Apply a partial overlay + [-m <machine_conf>] The name of the machine .conf to generate + [-D <dts_path>] Absolute path or subdirectory of conf/dts to place DTS files in (usually auto detected from DTS) + [-t <machine>] Machine type: zynqmp or versal (usually auto detected) + [-v <soc_variant>] SOC Variant: cg, dr, eg, ev, ai-prime, premium (usually auto detected) + [-r <require_machine>] This machine will be required, instead of the generic machine if defined + [-O <overrides>] Optional, can add additional overrides to the generated machine + [-p <psu_init_path>] Path to psu_init files, defaults to system_dts path + [-i <pdi_path>] Path to the pdi file + [-l <config_file>] write local.conf changes to this file + [-P <petalinux_schema>] Path to petalinux schema file + +EOF + exit +} + +parse_args() { + [ $# -eq 0 ] && usage + [ $1 = "--help" ] && usage + + while getopts ":c:s:d:o:e:m:D:l:hP:p:i:t:v:r:O:" opt; do + case ${opt} in + c) config_dir=$OPTARG ;; + s) system_dts=$OPTARG ;; + o) overlay_dts=$OPTARG ;; + d) domain_file=$OPTARG ;; + e) external_fpga=$OPTARG ;; + m) mach_conf=$OPTARG ; mach_conf=${mach_conf%%.conf} ;; + D) dts_path=$OPTARG ;; + t) machine=$OPTARG ;; + v) soc_variant=$OPTARG ;; + r) incmachine=$OPTARG ;; + O) overrides=$OPTARG ;; + p) psu_init_path=$OPTARG ;; + i) pdi_path=$OPTARG ;; + l) localconf=$OPTARG ;; + P) petalinux_schema=$OPTARG ;; + h) usage ;; + :) error "Missing argument for -$OPTARG" ;; + \?) error "Invalid option -$OPTARG" ;; + esac + done + + [ -z "${config_dir}" ] && error "You must specify the path to the build conf directory with -c" + [ -z "${system_dts}" ] && error "You must specify the path to the system device tree with -s" + [ -f "${config_dir}/local.conf" ] || error "Invalid config dir: ${config_dir}" + [ -f "${system_dts}" ] || error "Unable to find: ${system_dts}" + system_dts=$(realpath ${system_dts}) + if [ -z "$psu_init_path" ]; then + psu_init_path=$(dirname ${system_dts}) + else + psu_init_path=$(realpath ${psu_init_path}) + fi + if [ -z "$pdi_path" ]; then + pdi_path=$(dirname ${system_dts}) + else + pdi_path=$(realpath ${pdi_path}) + fi + if [ -n "$domain_file" ]; then + domain_file=$(realpath ${domain_file}) + fi + +} + +detect_machine() { + if [ -z "${machine}" ]; then + if [ -n "${deviceid}" ]; then + case ${deviceid} in + # ZynqMP variants + xczu*cg) + machine="zynqmp" + soc_variant="cg" ;; + xczu*dr) + machine="zynqmp" + soc_variant="dr" ;; + xczu*eg) + machine="zynqmp" + soc_variant="eg" ;; + xczu*ev) + machine="zynqmp" + soc_variant="ev" ;; + # Versal variants + xcvm*) + machine="versal" + soc_variant="prime" ;; + xcvc*) + machine="versal" + soc_variant="ai-core" ;; + xcve*) + machine="versal" + soc_variant="ai-edge" ;; + xcvn*) + machine="versal" + soc_variant="net" ;; + xcvp*) + machine="versal" + soc_variant="premium" ;; + xcvh*) + machine="versal" + soc_variant="hbm" ;; + # Special Case Starter Kit SOMs + xck26) + if [ -z "${incmachine}" ]; then + incmachine="k26-smk.conf" + fi + machine="zynqmp" + soc_variant="ev" ;; + xck24) + if [ -z "${incmachine}" ]; then + incmachine="k24-smk.conf" + fi + machine="zynqmp" + soc_variant="eg" ;; + esac + else + # Identify the system type first using PSM/PMC/PMU + while read -r cpu core domain cpu_name os_hint; do + case ${cpu} in + pmu-microblaze) + machine="zynqmp" ;; + pmc-microblaze | psm-microblaze) + machine="versal" ;; + esac + done <${cpulist} + fi + fi + + # Machine not provided and we cannot identify.. + [ -z ${machine} ] && \ + error "Unable to autodetect machine type, use -t to specify the machine." + + case ${machine} in + zynqmp | versal) : ;; + *) error "Invalid machine type ${machine}; please choose zynqmp or versal" + esac + + [ -z ${soc_variant} ] && \ + warn "Unable to autodetect soc variant, use -v to specify a variant." +} + +dump_cpus() { + prefix="$1" + while read -r cpu core domain cpu_name os_hint; do + case ${cpu} in + \#*) ;; + \[*) ;; + pmu-microblaze) echo "${prefix}zynqmp-pmu ${cpu_name}" ;; + pmc-microblaze) echo "${prefix}versal-plm ${cpu_name}" ;; + psm-microblaze) echo "${prefix}versal-psm ${cpu_name}" ;; + xlnx,microblaze) echo "${prefix}microblaze ${core} ${cpu_name}";; + arm,*) echo "${prefix}${cpu/,/ } ${core} ${cpu_name}";; + *) echo "${prefix}${cpu} ${core} ${cpu_name}";; + esac + done <${cpulist} +} + +cortex_a53_linux() { + info "cortex-a53 for Linux [ $1 ]" + + if [ "$1" = "None" ]; then + dts_file="cortexa53-${machine}-linux.dts" + system_conf=${dts_file} + conf_file="" + else + mc_name=cortexa53-${machine}-$1-linux + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + conf_file=multiconfig/${mc_name}.conf + fi + + # Check if it is overlay dts otherwise just create linux dts + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + if [ "${overlay_dts}" = "true" ]; then + if [ "${external_fpga}" = "true" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- xlnx_overlay_dt ${machine} full \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} "${system_dts}" -- xlnx_overlay_dt ${machine} partial \ + || error "lopper failed" + fi + dtc -q -O dtb -o pl.dtbo -b 0 -@ pl.dtsi || error "dtc failed" + elif [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' \ + -i "${domain_file}" -i "${lops_dir}/lop-a53-imux.dts" \ + -i "${lops_dir}/lop-domain-linux-a53.dts" \ + -i "${lops_dir}/lop-domain-linux-a53-prune.dts" \ + "${system_dts}" "${dts_file}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a53-imux.dts" \ + -i "${lops_dir}/lop-domain-linux-a53.dts" \ + -i "${lops_dir}/lop-domain-linux-a53-prune.dts" \ + "${system_dts}" "${dts_file}" \ + || error "lopper failed" + fi + rm -f pl.dtsi lop-a53-imux.dts.dtb lop-domain-linux-a53.dts.dtb lop-domain-linux-a53-prune.dts.dtb + ) + + if [ -z "${conf_file}" ]; then + return $? + fi + + ## Generate a multiconfig + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" +EOF +} + +a53_fsbl_done=0 +cortex_a53_baremetal() { + if [ "$1" = "fsbl" ]; then + [ ${a53_fsbl_done} = 1 ] && return + info "cortex-a53 FSBL baremetal configuration" + else + info "cortex-a53 baremetal configuration for core $2 [ $1 ]" + fi + + suffix=""; lto="-nolto" + if [ "$1" != "None" ]; then + suffix="-$1"; lto="" + fi + + mc_name="cortexa53-$2-${machine}${suffix}-baremetal" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + yocto_distro="xilinx-standalone${lto}" + if [ "$1" = "fsbl" ]; then + fsbl_mcdepends="mc::${mc_name}:fsbl-firmware:do_deploy" + fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${mc_name}/deploy/images/\${MACHINE}" + multiconf_min="${multiconf_min} ${mc_name}" + a53_fsbl_done=1 + fi + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' \ + -i "${domain_file}" -i "${lops_dir}/lop-a53-imux.dts" "${system_dts}" "${dts_file}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a53-imux.dts" \ + "${system_dts}" "${dts_file}" || error "lopper failed" + fi + rm -f lop-a53-imux.dts.dtb + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $3 "${embeddedsw}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $3 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + if [ "$1" = "fsbl" ]; then + if [ ! -e "${psu_init_path}/psu_init.c" ]; then + warn "Warning: Unable to find psu_init.c in ${psu_init_path}" + fi + if [ ! -e "${psu_init_path}/psu_init.h" ]; then + warn "Warning: Unable to find psu_init.h in ${psu_init_path}" + fi + + cat <<EOF >"${conf_file}" +PSU_INIT_PATH = "${psu_init_path}" +EOF + else + cat /dev/null >"${conf_file}" + fi + cat <<EOF >>"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$3" +DEFAULTTUNE = "cortexa53" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "${yocto_distro}" +EOF +} + +cortex_a53_freertos() { + info "cortex-a53 FreeRTOS configuration for core $2 [ $1 ]" + + suffix="" + [ "$1" != "None" ] && suffix="-$1" + + mc_name="cortexa53-$2-${machine}${suffix}-freertos" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' \ + -i "${domain_file}" -i "${lops_dir}/lop-a53-imux.dts" "${system_dts}" "${dts_file}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a53-imux.dts" \ + "${system_dts}" "${dts_file}" || error "lopper failed" + fi + rm -f lop-a53-imux.dts.dtb + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $3 "${embeddedsw}" || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $3 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$3" +DEFAULTTUNE = "cortexa53" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "xilinx-freertos" +EOF +} + +cortex_a72_linux() { + info "cortex-a72 for Linux [ $1 ]" + + # Find the first file ending in .pdi + full_pdi_path=$(ls ${pdi_path}/*.pdi 2>/dev/null | head -n 1) + if [ -z "${full_pdi_path}" ]; then + error "Unable to find a pdi file in ${pdi_path}, use the -i option to point to the directory containing a .pdi file" + full_pdi_path="__PATH TO PDI FILE HERE__" + elif [ "${full_pdi_path}" != "$(ls ${pdi_path}/*.pdi 2>/dev/null)" ]; then + warn "Warning: multiple PDI files found, using first found $(basename ${full_pdi_path})." + fi + + if [ "$1" = "None" ]; then + dts_file="cortexa72-${machine}-linux.dts" + system_conf=${dts_file} + conf_file="" + else + mc_name="cortexa72-${machine}-$1-linux" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + conf_file=multiconfig/${mc_name}.conf + fi + + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + # Check if it is overlay dts otherwise just create linux dts + if [ "${overlay_dts}" = "true" ]; then + # As there is no partial support on Versal, As per fpga manager implementation there is + # a flag "external_fpga" which says apply overlay without loading the bit file. + if [ "${external_fpga}" = "true" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- xlnx_overlay_dt \ + ${machine} full external_fpga || error "lopper failed" + else + # If there is no external_fpga flag, then the default is full + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} "${system_dts}" -- xlnx_overlay_dt \ + ${machine} full || error "lopper failed" + fi + dtc -q -O dtb -o pl.dtbo -b 0 -@ pl.dtsi || error "dtc failed" + elif [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' \ + -i "${domain_file}" -i "${lops_dir}/lop-a72-imux.dts" \ + -i "${lops_dir}/lop-domain-a72.dts" \ + -i "${lops_dir}/lop-domain-a72-prune.dts" \ + "${system_dts}" "${dts_file}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a72-imux.dts" \ + -i "${lops_dir}/lop-domain-a72.dts" \ + -i "${lops_dir}/lop-domain-a72-prune.dts" \ + "${system_dts}" "${dts_file}" || error "lopper failed" + fi + rm -f pl.dtsi lop-a72-imux.dts.dtb lop-domain-a72.dts.dtb lop-domain-a72-prune.dts.dtb + ) + + if [ -z "${conf_file}" ]; then + return $? + fi + + ## Generate a multiconfig + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" +EOF +} + +cortex_a72_baremetal() { + info "cortex-a72 baremetal configuration for core $2 [ $1 ]" + + suffix="" + [ "$1" != "None" ] && suffix="-$1" + + mc_name="cortexa72-$2-${machine}${suffix}-baremetal" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' \ + -i "${domain_file}" -i "${lops_dir}/lop-a72-imux.dts" "${system_dts}" "${dts_file}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a72-imux.dts" \ + "${system_dts}" "${dts_file}" || error "lopper failed" + fi + rm -f lop-a72-imux.dts.dtb + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $3 "${embeddedsw}" || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $3 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$3" +DEFAULTTUNE = "cortexa72" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "xilinx-standalone-nolto" +EOF +} + +cortex_a72_freertos() { + info "cortex-a72 FreeRTOS configuration for core $2 [ $1 ]" + + suffix="" + [ "$1" != "None" ] && suffix="-$1" + + mc_name="cortexa72-$2-${machine}${suffix}-freertos" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" lopper -f --enhanced -x '*.yaml' \ + -i "${domain_file}" -i "${lops_dir}/lop-a72-imux.dts" "${system_dts}" "${dts_file}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-a72-imux.dts" \ + "${system_dts}" "${dts_file}" || error "lopper failed" + fi + rm -f lop-a72-imux.dts.dtb + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $3 "${embeddedsw}" || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $3 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$3" +DEFAULTTUNE = "cortexa72" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "xilinx-freertos" +EOF +} + +r5_fsbl_done=0 +cortex_r5_baremetal() { + if [ "$1" = "fsbl" ]; then + [ ${r5_fsbl_done} = 1 ] && return + info "cortex-r5 FSBL baremetal configuration" + else + info "cortex-r5 baremetal configuration for core $2 [ $1 ]" + fi + + suffix=""; lto="-nolto" + if [ "$1" != "None" ]; then + suffix="-$1"; lto="" + fi + + mc_name="cortexr5-$2-${machine}${suffix}-baremetal" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + yocto_distro="xilinx-standalone${lto}" + + if [ "$1" = "fsbl" ]; then + r5fsbl_mcdepends="mc::${mc_name}:fsbl-firmware:do_deploy" + r5fsbl_deploy_dir="\${BASE_TMPDIR}/tmp-${mc_name}/deploy/images/\${MACHINE}" + r5_fsbl_done=1 + fi + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + if [ -n "$domain_file" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' \ + -i "${domain_file}" -i "${lops_dir}/lop-r5-imux.dts" "${system_dts}" "${dts_file}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-r5-imux.dts" \ + "${system_dts}" "${dts_file}" || error "lopper failed" + fi + rm -f lop-r5-imux.dts.dtb + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $3 "${embeddedsw}" || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $3 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + if [ "$1" = "fsbl" ]; then + if [ ! -e "${psu_init_path}/psu_init.c" ]; then + warn "Warning: Unable to find psu_init.c in ${psu_init_path}" + fi + if [ ! -e "${psu_init_path}/psu_init.h" ]; then + warn "Warning: Unable to find psu_init.h in ${psu_init_path}" + fi + + cat <<EOF >"${conf_file}" +PSU_INIT_PATH = "${psu_init_path}" +EOF + else + cat /dev/null >"${conf_file}" + fi + cat <<EOF >>"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$3" +DEFAULTTUNE = "cortexr5" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "$yocto_distro" +EOF +} + +cortex_r5_freertos() { + info "cortex-r5 FreeRTOS configuration for core $2 [ $1 ]" + + suffix="" + [ "$1" != "None" ] && suffix="-$1" + + mc_name="cortexr5-$2-${machine}${suffix}-freertos" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + if [ -n "$domain_file" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' \ + -i "${domain_file}" -i "${lops_dir}/lop-r5-imux.dts" "${system_dts}" "${dts_file}" \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-r5-imux.dts" \ + "${system_dts}" "${dts_file}" || error "lopper failed" + fi + rm -f lop-r5-imux.dts.dtb + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $3 "${embeddedsw}" || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $3 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$3" +DEFAULTTUNE = "cortexr5" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "xilinx-freertos" +EOF +} + +# Generate microblaze tunings +microblaze_done=0 +process_microblaze() { + [ ${microblaze_done} = 1 ] && return + + info "Generating microblaze processor tunes" + + mkdir -p machine/include/${mach_conf} + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-microblaze-yocto.dts" "${system_dts}" \ + || error "lopper failed" + rm -f lop-microblaze-yocto.dts.dtb + ) >machine/include/${mach_conf}/microblaze.inc + + echo "require conf/machine/include/xilinx-microblaze.inc" >> machine/include/${mach_conf}/microblaze.inc + + microblaze_done=1 +} + +# pmu-microblaze is ALWAYS baremetal, no domain +pmu-microblaze() { + info "Microblaze ZynqMP PMU" + + process_microblaze + + mc_name="microblaze-0-pmu" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + multiconf_min="${multiconf_min} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + + pmu_mcdepends="mc::${mc_name}:pmu-firmware:do_deploy" + pmu_firmware_deploy_dir="\${BASE_TMPDIR}/tmp-${mc_name}/deploy/images/\${MACHINE}" + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" "${dts_file}" || error "lopper failed" + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $1 "${embeddedsw}" || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $1 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$1" + +DEFAULTTUNE = "microblaze-pmu" + +TARGET_CFLAGS += "-DPSU_PMU=1U" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "xilinx-standalone" +EOF +} + +# pmc-microblaze is ALWAYS baremetal, no domain +pmc-microblaze() { + info "Microblaze Versal PMC" + + process_microblaze + + mc_name="microblaze-0-pmc" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + multiconf_min="${multiconf_min} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + + plm_mcdepends="mc::${mc_name}:plm-firmware:do_deploy" + plm_deploy_dir="\${BASE_TMPDIR}/tmp-${mc_name}/deploy/images/\${MACHINE}" + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" "${dts_file}" || error "lopper failed" + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $1 "${embeddedsw}" || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $1 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$1" + +DEFAULTTUNE = "microblaze-pmc" + +TARGET_CFLAGS += "-DVERSAL_PLM=1" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "xilinx-standalone" +EOF +} + +# psm-microblaze is ALWAYS baremetal, no domain +psm-microblaze() { + info "Microblaze Versal PSM" + + process_microblaze + + mc_name="microblaze-0-psm" + dts_file="${mc_name}.dts" + multiconf="${multiconf} ${mc_name}" + multiconf_min="${multiconf_min} ${mc_name}" + conf_file="multiconfig/${mc_name}.conf" + libxil="machine/include/${mach_conf}/${mc_name}-libxil.conf" + features="machine/include/${mach_conf}/${mc_name}-features.conf" + + psm_mcdepends="mc::${mc_name}:psm-firmware:do_deploy" + psm_firmware_deploy_dir="\${BASE_TMPDIR}/tmp-${mc_name}/deploy/images/\${MACHINE}" + + # Build device tree + ( + cd ${dts_path} || error "Unable to cd to ${dts_path} dir" + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" "${dts_file}" || error "lopper failed" + ) + + # Build baremetal multiconfig + if [ -n "${domain_file}" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -x '*.yaml' -i "${domain_file}" "${system_dts}" \ + -- baremetaldrvlist_xlnx $1 "${embeddedsw}" || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f "${system_dts}" -- baremetaldrvlist_xlnx $1 "${embeddedsw}" \ + || error "lopper failed" + fi + + mv libxil.conf "${libxil}" + mv distro.conf "${features}" + sed -i ${features} -e "s,DISTRO_FEATURES,MACHINE_FEATURES," + + cat <<EOF >"${conf_file}" +CONFIG_DTFILE = "${dts_file_path}/${dts_file}" + +ESW_MACHINE = "$1" + +DEFAULTTUNE = "microblaze-psm" + +TARGET_CFLAGS += "-DVERSAL_psm=1" + +TMPDIR = "\${BASE_TMPDIR}/tmp-${mc_name}" + +DISTRO = "xilinx-standalone" +EOF +} + +generate_machine() { + info "Generating machine conf file" + conf_file="machine/${mach_conf}.conf" + + # Machine include file + if [ -z ${incmachine} ]; then + if [ -n ${soc_variant} ]; then + incmachine="${machine}-${soc_variant}-generic.conf" + else + incmachine="${machine}-generic.conf" + fi + fi + + mkdir -p machine + # Generate header + cat <<EOF >"${conf_file}" +#@TYPE: Machine +#@NAME: ${mach_conf} +#@DESCRIPTION: ${model} + +#### Preamble +MACHINEOVERRIDES =. "\${@['', '${mach_conf}:']['${mach_conf}' != '\${MACHINE}']}" +#### Regular settings follow + +EOF + + if [ -n "${overrides}" ]; then + cat <<EOF >>"${conf_file}" +MACHINEOVERRIDES .= ":${overrides}" + +EOF + fi + + if [ "${machine}" == "zynqmp" ]; then + cat <<EOF >>"${conf_file}" +TUNEFILE[microblaze-pmu] = "conf/machine/include/${mach_conf}/microblaze.inc" +EOF + elif [ "${machine}" == "versal" ]; then + cat <<EOF >>"${conf_file}" +TUNEFILE[microblaze-pmc] = "conf/machine/include/${mach_conf}/microblaze.inc" +TUNEFILE[microblaze-psm] = "conf/machine/include/${mach_conf}/microblaze.inc" +EOF + fi + + sysdt_path=$(dirname ${system_dts}) + sysdt_base=$(basename ${system_dts}) + cat <<EOF >>"${conf_file}" + +# Set the default (linux) domain device tree +CONFIG_DTFILE ?= "${dts_file_path}/${system_conf}" +CONFIG_DTFILE[vardepsexclude] += "TOPDIR" + +require conf/machine/${incmachine} + +# System Device Tree does not use HDF_MACHINE +HDF_MACHINE = "" + +# Set the system device trees +SYSTEM_DTFILE_DIR = "${sysdt_path}" +SYSTEM_DTFILE = "\${SYSTEM_DTFILE_DIR}/${sysdt_base}" +SYSTEM_DTFILE[vardepsexclude] += "SYSTEM_DTFILE_DIR" + +# Load the dynamic machine features +include conf/machine/include/${mach_conf}/\${BB_CURRENT_MC}-features.conf +LIBXIL_CONFIG = "conf/machine/include/${mach_conf}/\${BB_CURRENT_MC}-libxil.conf" + +EOF + + if [ -n "${fsbl_mcdepends}" ]; then + cat <<EOF >>"${conf_file}" +# First Stage Boot Loader +FSBL_DEPENDS = "" +FSBL_MCDEPENDS = "${fsbl_mcdepends}" +FSBL_DEPLOY_DIR = "${fsbl_deploy_dir}" + +EOF + fi + if [ -n "${r5fsbl_mcdepends}" ]; then + cat <<EOF >>"${conf_file}" +# Cortex-R5 First Stage Boot Loader +R5FSBL_DEPENDS = "" +R5FSBL_MCDEPENDS = "${r5fsbl_mcdepends}" +R5FSBL_DEPLOY_DIR = "${r5fsbl_deploy_dir}" + +EOF + fi + if [ -n "${pmu_mcdepends}" ]; then + cat <<EOF >>"${conf_file}" +# PMU Firware +PMU_DEPENDS = "" +PMU_MCDEPENDS = "${pmu_mcdepends}" +PMU_FIRMWARE_DEPLOY_DIR = "${pmu_firmware_deploy_dir}" + +EOF + fi + if [ -n "${plm_mcdepends}" ]; then + cat <<EOF >>"${conf_file}" +# Platform Loader and Manager +PLM_DEPENDS = "" +PLM_MCDEPENDS = "${plm_mcdepends}" +PLM_DEPLOY_DIR = "${plm_deploy_dir}" + +EOF + fi + if [ -n "${psm_mcdepends}" ]; then + cat <<EOF >>"${conf_file}" +# PSM Firmware +PSM_DEPENDS = "" +PSM_MCDEPENDS = "${psm_mcdepends}" +PSM_FIRMWARE_DEPLOY_DIR = "${psm_firmware_deploy_dir}" + +EOF + fi + + if [ -n "${full_pdi_path}" ]; then + pdi_path_dir=$(dirname ${full_pdi_path}) + pdi_path_base=$(basename ${full_pdi_path}) + cat <<EOF >>"${conf_file}" +# Versal PDI +PDI_PATH_DIR = "${pdi_path_dir}" +PDI_PATH = "\${PDI_PATH_DIR}/${pdi_path_base}" +PDI_PATH[vardepsexclude] += "PDI_PATH_DIR" + +EOF + fi + + cat <<EOF >>"${conf_file}" +# Enable the correct version of the firmware components +PREFERRED_VERSION_fsbl-firmware = "2023_sdt_experimental%" +PREFERRED_VERSION_pmu-firmware = "2023_sdt_experimental%" +PREFERRED_VERSION_plm-firmware = "2023_sdt_experimental%" +PREFERRED_VERSION_psm-firmware = "2023_sdt_experimental%" + +# Exclude BASE_TMPDIR from hash calculations +BB_HASHEXCLUDE_COMMON:append = " BASE_TMPDIR" + +# Update bootbin to use proper device tree +BIF_PARTITION_IMAGE[device-tree] = "\${RECIPE_SYSROOT}/boot/devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE').replace('.dts', '.dtb'))}" +# Remap boot files to ensure the right device tree is listed first +IMAGE_BOOT_FILES =+ "devicetree/\${@os.path.basename(d.getVar('CONFIG_DTFILE').replace('.dts', '.dtb'))}" + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "\${@['', ' ${mach_conf//-/_}']['${mach_conf}' != "\${MACHINE}"]}" +EOF +} + +parse_cpus() { + gen_linux_dts="None" + while read -r cpu core domain cpu_name os_hint; do + # Skip commented lines and WARNINGs + case ${cpu} in + \#* | \[WARNING\]:) continue ;; + esac + + case ${cpu} in + + arm,cortex-a53) + # We need a base cortex_a53_baremetal for the FSBL + if [ "${core}" == 0 ]; then + cortex_a53_baremetal fsbl ${core} ${cpu_name} + fi + if [ "${os_hint}" == "None" ]; then + if [ "${gen_linux_dts}" == "None" ]; then + cortex_a53_linux "${domain}" + gen_linux_dts="True" + fi + cortex_a53_baremetal "${domain}" ${core} ${cpu_name} + cortex_a53_freertos "${domain}" ${core} ${cpu_name} + else + case "${os_hint}" in + linux*) + if [ "${gen_linux_dts}" == "None" ]; then + cortex_a53_linux "${domain}" + gen_linux_dts="True" + fi + ;; + baremetal*) + cortex_a53_baremetal "${domain}" ${core} ${cpu_name};; + freertos*) + cortex_a53_freertos "${domain}" ${core} ${cpu_name};; + *) + warn "cortex-a53 for unknown OS (${os_hint}), parsing baremetal. ${domain}" + cortex_a53_baremetal "${domain}" + esac + fi + ;; + + arm,cortex-a72) + if [ "${os_hint}" == "None" ]; then + if [ "${gen_linux_dts}" == "None" ]; then + cortex_a72_linux "${domain}" + gen_linux_dts="True" + fi + cortex_a72_baremetal "${domain}" ${core} ${cpu_name} + cortex_a72_freertos "${domain}" ${core} ${cpu_name} + else + case "${os_hint}" in + linux*) + if [ "${gen_linux_dts}" == "None" ]; then + cortex_a72_linux "${domain}" + gen_linux_dts="True" + fi + ;; + baremetal*) + cortex_a72_baremetal "${domain}" ${core} ${cpu_name};; + freertos*) + cortex_a72_freertos "${domain}" ${core} ${cpu_name};; + *) + warn "cortex-a72 for unknown OS (${os_hint}), parsing baremetal. ${domain}" + cortex_a72_baremetal "${domain}" + esac + fi + ;; + arm,cortex-r5) + if [ "${os_hint}" == "None" ]; then + # We need a base cortex_r5_baremetal for the FSBL for ZynqMP platform + [ "${machine}" = "zynqmp" ] && cortex_r5_baremetal fsbl ${core} ${cpu_name} + cortex_r5_baremetal "${domain}" ${core} ${cpu_name} + cortex_r5_freertos "${domain}" ${core} ${cpu_name} + else + case "${os_hint}" in + baremetal*) + cortex_r5_baremetal "${domain}" ${core} ${cpu_name};; + freertos*) + cortex_r5_freertos "${domain}" ${core} ${cpu_name};; + *) + warn "cortex-r5 for unknown OS (${os_hint}), parsing baremetal. ${domain}" + cortex_r5_baremetal "${domain}" + esac + fi + ;; + + xlnx,microblaze) + process_microblaze + case "${os_hint}" in + None | baremetal*) + warn "Microblaze for Baremetal ${domain} not yet implemented" ;; + Linux) + warn "Microblaze for Linux ${domain} not yet implemented" ;; + *) + warn "Microblaze for unknown OS (${os_hint}), not yet implemented. ${domain}" ;; + esac + ;; + + pmu-microblaze) + pmu-microblaze ${cpu_name};; + + pmc-microblaze) + pmc-microblaze ${cpu_name};; + + psm-microblaze) + psm-microblaze ${cpu_name};; + *) + warn "Unknown CPU ${cpu}" + + esac + done <${cpulist} +} + +gen_local_conf() { + cat << EOF >> $1 + +# Avoid errors in some baremetal configs as these layers may be present +# but are not used. Note the following lines are optional and can be +# safetly disabled. +SKIP_META_VIRT_SANITY_CHECK = "1" +SKIP_META_SECURITY_SANITY_CHECK = "1" +SKIP_META_TPM_SANITY_CHECK = "1" + +# Each multiconfig will define it's own TMPDIR, this is the new default based +# on BASE_TMPDIR for the Linux build +TMPDIR = "\${BASE_TMPDIR}/tmp" + +# Use the newly generated MACHINE +MACHINE = "${mach_conf}" + +# All of the TMPDIRs must be in a common parent directory. This is defined +# as BASE_TMPDIR. +# Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp +BASE_TMPDIR ?= "\${TOPDIR}" + +# The following is the full set of multiconfigs for this configuration +# A large list can cause a slow parse. +#BBMULTICONFIG ?= "${multiconf}" +# Alternatively trim the list to the minimum +BBMULTICONFIG = "${multiconf_min}" +EOF +} + +gen_petalinux_conf() { + cd "${config_dir}" || exit + ( + if [ "$machine" == "zynqmp" ]; then + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} "${system_dts}" -- petalinuxconfig_xlnx psu_cortexa53_0 ${petalinux_schema} \ + || error "lopper failed" + else + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} "${system_dts}" -- petalinuxconfig_xlnx psv_cortexa72_0 ${petalinux_schema} \ + || error "lopper failed" + fi + ) +} +parse_args "$@" + +lopper=$(command -v lopper) +lopper_dir=$(dirname "${lopper}") +lops_dir=$(ls -d $(dirname "${lopper_dir}")/lib/python*/site-packages/lopper/lops | head -n 1) +embeddedsw=$(dirname "${lopper_dir}")/share/embeddedsw +system_conf="" +multiconf="" + +[ -z "${lopper}" ] && error "Unable to find lopper, please source the prestep environment" + +cpulist=$(mktemp) + +priordir=$(pwd) +cd "${config_dir}" || exit +mkdir -p dts multiconfig machine/include +# Get mach_conf name and model name +( + cd dts || error "Unable to cd to dts dir" + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-machine-name.dts" "${system_dts}" \ + /dev/null > ${cpulist} || error "lopper failed" + rm -f "lop-machine-name.dts.dtb" +) +read local_mach_conf deviceid model < ${cpulist} +if [ -z "${mach_conf}" ]; then + mach_conf=${local_mach_conf} +fi + +if [ -z "${dts_path}"]; then + dts_path=${local_mach_conf} +fi +# Is it relative? If so, relative to conf/dts +if [ "${dts_path##/}" = "${dts_path}" ]; then + dts_path="dts/${dts_path}" +else + dts_path=$(realpath ${dts_path}) +fi +# Convert the DTS_PATH into something we can put in a config file +if [ "${dts_path##/}" = "${dts_path}" ]; then + dts_file_path="\${TOPDIR}/conf/${dts_path}" +else + dts_file_path="${dts_path}" +fi + +# Generate CPU list +( + cd dts || error "Unable to cd to dts dir" + LOPPER_DTC_FLAGS="-b 0 -@" ${lopper} -f --enhanced -i "${lops_dir}/lop-xilinx-id-cpus.dts" "${system_dts}" \ + /dev/null > ${cpulist} || error "lopper failed" + rm -f "lop-xilinx-id-cpus.dts.dtb" +) + +detect_machine +# Now that we know the machine name, we can create the directory +mkdir -p machine/include/${mach_conf} +mkdir -p ${dts_path} + +echo "System Configuration:" +echo "MODEL = \"${model}\"" +echo "MACHINE = \"${mach_conf}\"" +echo "DEVICE_ID = \"${deviceid}\"" +echo "SOC_FAMILY = \"${machine}\"" +echo "SOC_VARIANT = \"${soc_variant}\"" +echo "CPUs:" +dump_cpus " = " +echo + +info "Generating configuration..." +parse_cpus + +generate_machine + +cd ${priordir} +if [ -z "${localconf}" ]; then + echo + echo "To enable this, add the following to your local.conf:" + echo + tmpfile=$(mktemp) + gen_local_conf ${tmpfile} + cat $tmpfile + rm $tmpfile +else + echo + echo "Configuration for local.conf written to ${localconf}" + echo + gen_local_conf ${localconf} +fi + +if [ -n "${petalinux_schema}" ]; then + echo + echo "Generating petalinux config file:" + echo + gen_petalinux_conf +fi + +# Cleanup our temp file +rm -rf ${cpulist} ${config_dir}/CMakeLists.txt ${config_dir}/DRVLISTConfig.cmake diff --git a/meta-xilinx-standalone-experimental/recipes-core/meta/meta-xilinx-setup.bb b/meta-xilinx-standalone-experimental/recipes-core/meta/meta-xilinx-setup.bb new file mode 100644 index 00000000..dc7d647a --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-core/meta/meta-xilinx-setup.bb @@ -0,0 +1,91 @@ +DESCRIPTION = "Xilinx Device Tree based configuration generator" +LICENSE = "MIT" + +SRC_URI += " \ + file://dt-processor.sh \ + file://README-setup \ +" + +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +TOOLCHAIN_TARGET_TASK = "" + +TOOLCHAIN_HOST_TASK = "\ + nativesdk-sdk-provides-dummy \ + nativesdk-lopper \ + nativesdk-xilinx-lops \ + nativesdk-esw-conf \ + " + +MULTIMACH_TARGET_SYS = "${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}" +PACKAGE_ARCH = "${SDK_ARCH}_${SDK_OS}" +PACKAGE_ARCHS = "" +TARGET_ARCH = "none" +TARGET_OS = "none" + +SDK_PACKAGE_ARCHS += "buildtools-dummy-${SDKPKGSUFFIX}" + +TOOLCHAIN_OUTPUTNAME ?= "${SDK_ARCH}-xilinx-nativesdk-prestep-${DISTRO_VERSION}" + +SDK_TITLE = "Device Tree setup tools" + +RDEPENDS = "${TOOLCHAIN_HOST_TASK}" + +EXCLUDE_FROM_WORLD = "1" + +inherit populate_sdk +inherit toolchain-scripts-base +inherit nopackages + +deltask install +deltask populate_sysroot + +do_populate_sdk[stamp-extra-info] = "${PACKAGE_ARCH}" + +REAL_MULTIMACH_TARGET_SYS = "none" + +# Needed to ensure README-setup and dt-processor.sh are available +addtask do_populate_sdk after do_unpack + +create_sdk_files:append () { + + install -m 0644 ${WORKDIR}/README-setup ${SDK_OUTPUT}/${SDKPATH}/. + install -m 0755 ${WORKDIR}/dt-processor.sh ${SDK_OUTPUT}/${SDKPATH}/. + + rm -f ${SDK_OUTPUT}/${SDKPATH}/site-config-* + rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-* + rm -f ${SDK_OUTPUT}/${SDKPATH}/version-* + + # Generate new (mini) sdk-environment-setup file + script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}} + touch $script + echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> $script + echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script + echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script + echo 'export SSL_CERT_FILE="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script + + toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS} + + cat >> $script <<EOF +if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then + for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do + . \$envfile + done +fi +# We have to unset this else it can confuse oe-selftest and other tools +# which may also use the overlapping namespace. +unset OECORE_NATIVE_SYSROOT +EOF + + if [ "${SDKMACHINE}" = "i686" ]; then + echo 'export NO32LIBS="0"' >>$script + echo 'echo "$BB_ENV_PASSTHROUGH_ADDITIONS" | grep -q "NO32LIBS"' >>$script + echo '[ $? != 0 ] && export BB_ENV_PASSTHROUGH_ADDITIONS="NO32LIBS $BB_ENV_PASSTHROUGH_ADDITIONS"' >>$script + fi +} + +# buildtools-tarball doesn't need config site +TOOLCHAIN_NEED_CONFIGSITE_CACHE = "" + +# The recipe doesn't need any default deps +INHIBIT_DEFAULT_DEPS = "1" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/avbuf_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/avbuf_git.bb new file mode 100644 index 00000000..7edd2d9d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/avbuf_git.bb @@ -0,0 +1,10 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "avbuf" + +inherit esw + +DEPENDS += "xilstandalone" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/avbuf/src/" +ESW_COMPONENT_NAME = "libavbuf.a" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axicdma-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axicdma-example_git.bb new file mode 100644 index 00000000..1846b291 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axicdma-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "axicdma" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axicdma/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axicdma_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axicdma_git.bb new file mode 100644 index 00000000..47111dc5 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axicdma_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "axicdma" + +inherit esw python3native + +DEPENDS += "xilstandalone" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axicdma/src/" +ESW_COMPONENT_NAME = "libaxicdma.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axidma-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axidma-example_git.bb new file mode 100644 index 00000000..68a26f45 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axidma-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "axidma" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axidma/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axidma_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axidma_git.bb new file mode 100644 index 00000000..c385d13f --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axidma_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "axidma" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axidma/src/" +ESW_COMPONENT_NAME = "libaxidma.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axiethernet-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axiethernet-example_git.bb new file mode 100644 index 00000000..04c2c151 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axiethernet-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "axiethernet" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axiethernet/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axiethernet_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axiethernet_git.bb new file mode 100644 index 00000000..0b635859 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axiethernet_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "axiethernet" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axiethernet/src/" +ESW_COMPONENT_NAME = "libaxiethernet.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axipmon-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axipmon-example_git.bb new file mode 100644 index 00000000..4aa716e7 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axipmon-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "axipmon" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axipmon/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axipmon_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axipmon_git.bb new file mode 100644 index 00000000..ff2eae91 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axipmon_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "axipmon" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axipmon/src/" +ESW_COMPONENT_NAME = "libaxipmon.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axis-switch_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axis-switch_git.bb new file mode 100644 index 00000000..b34dedb0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axis-switch_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "axis-switch" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axis_switch/src/" +ESW_COMPONENT_NAME = "libaxis_switch.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axivdma-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axivdma-example_git.bb new file mode 100644 index 00000000..2866c02b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axivdma-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "axivdma" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axivdma/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/axivdma_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/axivdma_git.bb new file mode 100644 index 00000000..15268629 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/axivdma_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "axivdma" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/axivdma/src/" +ESW_COMPONENT_NAME = "libaxivdma.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/bram-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/bram-example_git.bb new file mode 100644 index 00000000..a3145467 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/bram-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "bram" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/bram/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/bram_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/bram_git.bb new file mode 100644 index 00000000..3c81c619 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/bram_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "bram" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/bram/src/" +ESW_COMPONENT_NAME = "libbram.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/can-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/can-example_git.bb new file mode 100644 index 00000000..115852fa --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/can-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "can" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/can/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/can_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/can_git.bb new file mode 100644 index 00000000..eb7fc473 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/can_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "can" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/can/src/" +ESW_COMPONENT_NAME = "libcan.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/canfd-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/canfd-example_git.bb new file mode 100644 index 00000000..84276569 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/canfd-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "canfd" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/canfd/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/canfd_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/canfd_git.bb new file mode 100644 index 00000000..5f2e6ea8 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/canfd_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "canfd" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/canfd/src/" +ESW_COMPONENT_NAME = "libcanfd.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/canps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/canps-example_git.bb new file mode 100644 index 00000000..574dc563 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/canps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "canps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/canps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/canps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/canps_git.bb new file mode 100644 index 00000000..c9f61cd2 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/canps_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "canps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/canps/src/" +ESW_COMPONENT_NAME = "libcanps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/cframe_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/cframe_git.bb new file mode 100644 index 00000000..6ffdf85d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/cframe_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "cframe" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/cframe/src/" +ESW_COMPONENT_NAME = "libcframe.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/cfupmc_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/cfupmc_git.bb new file mode 100644 index 00000000..3cb675bc --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/cfupmc_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "cfupmc" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/cfupmc/src/" +ESW_COMPONENT_NAME = "libcfupmc.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/clk-wiz_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/clk-wiz_git.bb new file mode 100644 index 00000000..ae0453a1 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/clk-wiz_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "clk-wiz" + +inherit esw python3native + +DEPENDS += "xilstandalone" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/clk_wiz/src/" +ESW_COMPONENT_NAME = "libclk_wiz.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/clockps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/clockps-example_git.bb new file mode 100644 index 00000000..f9c5bce6 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/clockps-example_git.bb @@ -0,0 +1,40 @@ +inherit esw deploy features_check + +ESW_COMPONENT_SRC = "XilinxProcessorIPLib/drivers/clockps/examples/" + +REQUIRED_MACHINE_FEATURES = "clockps" + +DEPENDS += "libxil xiltimer resetps" + +inherit python3native + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +CLOCKPS_EX_IMAGE_NAME ??= "${BPN}" + +inherit image-artifact-names + +CLOCKPS_EX_NAME ?= "${CLOCKPS_EX_IMAGE_NAME}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +ESW_COMPONENT ??= "*.elf" + +addtask deploy before do_build after do_install + +do_install() { + install -d ${D}/${base_libdir}/firmware + install -m 0755 ${B}/*.elf ${D}/${base_libdir}/firmware +} + +do_deploy() { + install -d ${DEPLOYDIR}/${BPN}/ + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/*.elf ${DEPLOYDIR}/${BPN}/ +} +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/*.elf" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/clockps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/clockps_git.bb new file mode 100644 index 00000000..4bddb2c0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/clockps_git.bb @@ -0,0 +1,10 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "clockps" + +inherit esw + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/clockps/src/" +ESW_COMPONENT_NAME = "libclockps.a" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/common_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/common_git.bb new file mode 100644 index 00000000..541ff225 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/common_git.bb @@ -0,0 +1,23 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "common" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +PACKAGECONFIG ?= "${@bb.utils.contains("MACHINE_FEATURES", "clockps", "clockps", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "scugic", "scugic", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "intc", "intc", "", d)}" +PACKAGECONFIG[clockps] = "${RECIPE_SYSROOT}/usr/lib/libclockps.a,,clockps,," +PACKAGECONFIG[scugic] = "${RECIPE_SYSROOT}/usr/lib/libscugic.a,,scugic,," +PACKAGECONFIG[intc] = "${RECIPE_SYSROOT}/usr/lib/libintc.a,,intc,," + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/common/src/" +ESW_COMPONENT_NAME = "libcommon.a" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetalconfig_xlnx.py ${ESW_MACHINE} ${S}/XilinxProcessorIPLib/drivers/intc/src/ + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetalconfig_xlnx.py ${ESW_MACHINE} ${S}/XilinxProcessorIPLib/drivers/scugic/src/ + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/coresightps-dcc_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/coresightps-dcc_git.bb new file mode 100644 index 00000000..9110b51e --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/coresightps-dcc_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "coresightps-dcc" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/coresightps_dcc/src/" +ESW_COMPONENT_NAME = "libcoresightps_dcc.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/csudma-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/csudma-example_git.bb new file mode 100644 index 00000000..5706967a --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/csudma-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "csudma" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/csudma/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/csudma_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/csudma_git.bb new file mode 100644 index 00000000..8283ce8d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/csudma_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "csudma" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/csudma/src/" +ESW_COMPONENT_NAME = "libcsudma.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/ddrcpsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/ddrcpsu_git.bb new file mode 100644 index 00000000..4728b6c5 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/ddrcpsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "ddrcpsu" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/ddrcpsu/src/" +ESW_COMPONENT_NAME = "libddrcpsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/devcfg-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/devcfg-example_git.bb new file mode 100644 index 00000000..dd70e09d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/devcfg-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "devcfg" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/devcfg/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/devcfg_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/devcfg_git.bb new file mode 100644 index 00000000..4b794d22 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/devcfg_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "devcfg" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/devcfg/src/" +ESW_COMPONENT_NAME = "libdevcfg.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/dfxasm-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/dfxasm-example_git.bb new file mode 100644 index 00000000..974dd48b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/dfxasm-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "dfxasm" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/dfxasm/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/dfxasm_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/dfxasm_git.bb new file mode 100644 index 00000000..81f2157b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/dfxasm_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "dfxasm" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/dfxasm/src/" +ESW_COMPONENT_NAME = "libdfxasm.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/dmaps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/dmaps-example_git.bb new file mode 100644 index 00000000..40d08e4b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/dmaps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "dmaps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/dmaps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/dmaps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/dmaps_git.bb new file mode 100644 index 00000000..1dcd8404 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/dmaps_git.bb @@ -0,0 +1,18 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "dmaps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/dmaps/src/" +ESW_COMPONENT_NAME = "libdmaps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetal_xparameters_xlnx.py ${ESW_MACHINE} ${S} + install -m 0755 xparameters.h ${S}/${ESW_COMPONENT_SRC}/ +} diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/dpdma_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/dpdma_git.bb new file mode 100644 index 00000000..3adb88a6 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/dpdma_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "dpdma" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common avbuf" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/dpdma/src/" +ESW_COMPONENT_NAME = "libdpdma.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/dppsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/dppsu_git.bb new file mode 100644 index 00000000..87cca884 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/dppsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "dppsu" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/dppsu/src/" +ESW_COMPONENT_NAME = "libdppsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/emaclite-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/emaclite-example_git.bb new file mode 100644 index 00000000..6ed717fb --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/emaclite-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "emaclite" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/emaclite/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/emaclite_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/emaclite_git.bb new file mode 100644 index 00000000..9ceb477f --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/emaclite_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "emaclite" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/emaclite/src/" +ESW_COMPONENT_NAME = "libemaclite.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/emacps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/emacps-example_git.bb new file mode 100644 index 00000000..2c57eafe --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/emacps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "emacps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/emacps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/emacps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/emacps_git.bb new file mode 100644 index 00000000..8ed85984 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/emacps_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "emacps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/emacps/src/" +ESW_COMPONENT_NAME = "libemacps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/gpio-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/gpio-example_git.bb new file mode 100644 index 00000000..3f79cfec --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/gpio-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "gpio" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/gpio/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/gpio_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/gpio_git.bb new file mode 100644 index 00000000..83a746b7 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/gpio_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "gpio" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/gpio/src/" +ESW_COMPONENT_NAME = "libgpio.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/gpiops-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/gpiops-example_git.bb new file mode 100644 index 00000000..cc2e1703 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/gpiops-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "gpiops" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/gpiops/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/gpiops_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/gpiops_git.bb new file mode 100644 index 00000000..4bd63d1e --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/gpiops_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "gpiops" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/gpiops/src/" +ESW_COMPONENT_NAME = "libgpiops.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/iic-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/iic-example_git.bb new file mode 100644 index 00000000..b781b82c --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/iic-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "iic" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/iic/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/iic_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/iic_git.bb new file mode 100644 index 00000000..7011f90b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/iic_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "iic" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/iic/src/" +ESW_COMPONENT_NAME = "libiic.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/iicps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/iicps-example_git.bb new file mode 100644 index 00000000..e9df1cbd --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/iicps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "iicps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/iicps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/iicps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/iicps_git.bb new file mode 100644 index 00000000..e96dc2ac --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/iicps_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "iicps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/iicps/src/" +ESW_COMPONENT_NAME = "libiicps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/intc-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/intc-example_git.bb new file mode 100644 index 00000000..0b4b95a8 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/intc-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "intc" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/intc/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/intc_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/intc_git.bb new file mode 100644 index 00000000..331c2e32 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/intc_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "intc" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/intc/src/" +ESW_COMPONENT_NAME = "libintc.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/iomodule_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/iomodule_git.bb new file mode 100644 index 00000000..1f625521 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/iomodule_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "iomodule" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/iomodule/src/" +ESW_COMPONENT_NAME = "libiomodule.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/ipipsu-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/ipipsu-example_git.bb new file mode 100644 index 00000000..0b31601d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/ipipsu-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "ipipsu" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/ipipsu/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/ipipsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/ipipsu_git.bb new file mode 100644 index 00000000..3e2ccc0b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/ipipsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "ipipsu" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/ipipsu/src/" +ESW_COMPONENT_NAME = "libipipsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/llfifo-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/llfifo-example_git.bb new file mode 100644 index 00000000..6b1c211a --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/llfifo-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "llfifo" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/llfifo/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/llfifo_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/llfifo_git.bb new file mode 100644 index 00000000..1fb76b18 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/llfifo_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "llfifo" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/llfifo/src/" +ESW_COMPONENT_NAME = "libllfifo.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/mbox-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/mbox-example_git.bb new file mode 100644 index 00000000..3c4870b4 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/mbox-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "mbox" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/mbox/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/mbox_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/mbox_git.bb new file mode 100644 index 00000000..5c1b8393 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/mbox_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "mbox" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/mbox/src/" +ESW_COMPONENT_NAME = "libmbox.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/mcdma-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/mcdma-example_git.bb new file mode 100644 index 00000000..64979470 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/mcdma-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "mcdma" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/mcdma/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/mcdma_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/mcdma_git.bb new file mode 100644 index 00000000..f13a7e54 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/mcdma_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "mcdma" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/mcdma/src/" +ESW_COMPONENT_NAME = "libmcdma.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/mutex-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/mutex-example_git.bb new file mode 100644 index 00000000..fc0527da --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/mutex-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "mutex" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/mutex/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/mutex_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/mutex_git.bb new file mode 100644 index 00000000..98abc948 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/mutex_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "mutex" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/mutex/src/" +ESW_COMPONENT_NAME = "libmutex.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/nandpsu-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/nandpsu-example_git.bb new file mode 100644 index 00000000..8b7a88b5 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/nandpsu-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "nandpsu" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/nandpsu/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/nandpsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/nandpsu_git.bb new file mode 100644 index 00000000..6d2a71c5 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/nandpsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "nandpsu" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/nandpsu/src/" +ESW_COMPONENT_NAME = "libnandpsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/ospipsv-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/ospipsv-example_git.bb new file mode 100644 index 00000000..0ded4fd2 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/ospipsv-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "ospipsv" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/ospipsv/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/ospipsv_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/ospipsv_git.bb new file mode 100644 index 00000000..f0548efc --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/ospipsv_git.bb @@ -0,0 +1,19 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "ospipsv" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/ospipsv/src/" +ESW_COMPONENT_NAME = "libospipsv.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetal_xparameters_xlnx.py ${ESW_MACHINE} ${S} + install -m 0755 xparameters.h ${S}/${ESW_COMPONENT_SRC}/ +} + diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/pciepsu-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/pciepsu-example_git.bb new file mode 100644 index 00000000..23895fba --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/pciepsu-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "pciepsu" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/pciepsu/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/pciepsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/pciepsu_git.bb new file mode 100644 index 00000000..ccedb1df --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/pciepsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "pciepsu" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/pciepsu/src/" +ESW_COMPONENT_NAME = "libpciepsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/qspips-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/qspips-example_git.bb new file mode 100644 index 00000000..674b879a --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/qspips-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "qspips" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/qspips/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/qspips_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/qspips_git.bb new file mode 100644 index 00000000..fa28d901 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/qspips_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "qspips" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/qspips/src/" +ESW_COMPONENT_NAME = "libqspips.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/qspipsu-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/qspipsu-example_git.bb new file mode 100644 index 00000000..21231450 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/qspipsu-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "qspipsu" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/qspipsu/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/qspipsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/qspipsu_git.bb new file mode 100644 index 00000000..5b4b1614 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/qspipsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "qspipsu" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/qspipsu/src/" +ESW_COMPONENT_NAME = "libqspipsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/resetps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/resetps-example_git.bb new file mode 100644 index 00000000..243393bb --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/resetps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "resetps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/resetps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/resetps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/resetps_git.bb new file mode 100644 index 00000000..c753c666 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/resetps_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "resetps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/resetps/src/" +ESW_COMPONENT_NAME = "libresetps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/rtcpsu-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/rtcpsu-example_git.bb new file mode 100644 index 00000000..ac386c4c --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/rtcpsu-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "rtcpsu" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/rtcpsu/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/rtcpsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/rtcpsu_git.bb new file mode 100644 index 00000000..7b96bf16 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/rtcpsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "rtcpsu" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/rtcpsu/src/" +ESW_COMPONENT_NAME = "librtcpsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/scugic-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/scugic-example_git.bb new file mode 100644 index 00000000..cbef3ce9 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/scugic-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "scugic" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/scugic/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/scugic_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/scugic_git.bb new file mode 100644 index 00000000..f079354d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/scugic_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "scugic" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/scugic/src/" +ESW_COMPONENT_NAME = "libscugic.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/sdps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/sdps-example_git.bb new file mode 100644 index 00000000..550d664b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/sdps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "sdps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sdps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/sdps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/sdps_git.bb new file mode 100644 index 00000000..4caf0e63 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/sdps_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "sdps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sdps/src/" +ESW_COMPONENT_NAME = "libsdps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/spips-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/spips-example_git.bb new file mode 100644 index 00000000..71ead5d3 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/spips-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "spips" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/spips/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/spips_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/spips_git.bb new file mode 100644 index 00000000..ca02fda0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/spips_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "spips" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/spips/src/" +ESW_COMPONENT_NAME = "libspips.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/sysmon-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/sysmon-example_git.bb new file mode 100644 index 00000000..5bc007ad --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/sysmon-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "sysmon" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sysmon/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/sysmon_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/sysmon_git.bb new file mode 100644 index 00000000..5353f6f8 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/sysmon_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "sysmon" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sysmon/src/" +ESW_COMPONENT_NAME = "libsysmon.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsu-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsu-example_git.bb new file mode 100644 index 00000000..2c76a978 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsu-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "sysmonpsu" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sysmonpsu/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsu_git.bb new file mode 100644 index 00000000..871a77a3 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "sysmonpsu" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sysmonpsu/src/" +ESW_COMPONENT_NAME = "libsysmonpsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsv-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsv-example_git.bb new file mode 100644 index 00000000..edce2794 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsv-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "sysmonpsv" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sysmonpsv/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsv_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsv_git.bb new file mode 100644 index 00000000..2c693809 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/sysmonpsv_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "sysmonpsv" + +inherit esw python3native + +DEPENDS += "xilstandalone ${@'scugic' if d.getVar('ESW_MACHINE') != 'psv_pmc_0' and d.getVar('ESW_MACHINE') != 'psv_psm_0' else ''}" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/sysmonpsv/src/" +ESW_COMPONENT_NAME = "libsysmonpsv.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/tmr-inject_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/tmr-inject_git.bb new file mode 100644 index 00000000..dbf3d364 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/tmr-inject_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "tmr-inject" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/tmr_inject/src/" +ESW_COMPONENT_NAME = "libtmr_inject.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/tmr-manager_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/tmr-manager_git.bb new file mode 100644 index 00000000..dd91fed7 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/tmr-manager_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "tmr-manager" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/tmr_manager/src/" +ESW_COMPONENT_NAME = "libtmr_manager.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/tmrctr-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/tmrctr-example_git.bb new file mode 100644 index 00000000..8224d6fe --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/tmrctr-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "tmrctr" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/tmrctr/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/tmrctr_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/tmrctr_git.bb new file mode 100644 index 00000000..cf94a9d0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/tmrctr_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "tmrctr" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/tmrctr/src/" +ESW_COMPONENT_NAME = "libtmrctr.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/trafgen-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/trafgen-example_git.bb new file mode 100644 index 00000000..84c5618c --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/trafgen-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "trafgen" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/trafgen/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/trafgen_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/trafgen_git.bb new file mode 100644 index 00000000..77d000db --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/trafgen_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "trafgen" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/trafgen/src/" +ESW_COMPONENT_NAME = "libtrafgen.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/ttcps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/ttcps-example_git.bb new file mode 100644 index 00000000..d294c383 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/ttcps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "ttcps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/ttcps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/ttcps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/ttcps_git.bb new file mode 100644 index 00000000..ea520656 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/ttcps_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "ttcps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/ttcps/src/" +ESW_COMPONENT_NAME = "libttcps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/uartlite-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/uartlite-example_git.bb new file mode 100644 index 00000000..9aa0f598 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/uartlite-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "uartlite" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/uartlite/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/uartlite_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/uartlite_git.bb new file mode 100644 index 00000000..5998e092 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/uartlite_git.bb @@ -0,0 +1,16 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "uartlite" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/uartlite/src/" +ESW_COMPONENT_NAME = "libuartlite.a" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetalconfig_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} stdin + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC} + install -m 0755 xuartlite_g.c ${S}/${ESW_COMPONENT_SRC} +} diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/uartns550-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/uartns550-example_git.bb new file mode 100644 index 00000000..d81ce77b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/uartns550-example_git.bb @@ -0,0 +1,6 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "uartns550" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/uartns550/examples/" + diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/uartns550_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/uartns550_git.bb new file mode 100644 index 00000000..a08763cb --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/uartns550_git.bb @@ -0,0 +1,16 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "uartns550" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/uartns550/src/" +ESW_COMPONENT_NAME = "libuartns550.a" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetalconfig_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} stdin + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC} + install -m 0755 xuartns550_g.c ${S}/${ESW_COMPONENT_SRC} +} diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/uartps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/uartps-example_git.bb new file mode 100644 index 00000000..bbff466d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/uartps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "uartps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/uartps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/uartps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/uartps_git.bb new file mode 100644 index 00000000..932be9eb --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/uartps_git.bb @@ -0,0 +1,16 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "uartps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/uartps/src/" +ESW_COMPONENT_NAME = "libuartps.a" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetalconfig_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} stdin + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + install -m 0755 xuartps_g.c ${S}/${ESW_COMPONENT_SRC}/ +} diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/uartpsv-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/uartpsv-example_git.bb new file mode 100644 index 00000000..78f878a6 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/uartpsv-example_git.bb @@ -0,0 +1,6 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "uartpsv" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/uartpsv/examples/" + diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/uartpsv_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/uartpsv_git.bb new file mode 100644 index 00000000..01e48caa --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/uartpsv_git.bb @@ -0,0 +1,16 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "uartpsv" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/uartpsv/src/" +ESW_COMPONENT_NAME = "libuartpsv.a" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetalconfig_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} stdin + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + install -m 0755 xuartpsv_g.c ${S}/${ESW_COMPONENT_SRC}/ +} diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/usb-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/usb-example_git.bb new file mode 100644 index 00000000..0d4e113a --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/usb-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "usb" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/usb/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/usb_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/usb_git.bb new file mode 100644 index 00000000..9dac8cba --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/usb_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "usb" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/usb/src/" +ESW_COMPONENT_NAME = "libusb.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/usbpsu-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/usbpsu-example_git.bb new file mode 100644 index 00000000..4eb9bc93 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/usbpsu-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "usbpsu" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/usbpsu/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/usbpsu_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/usbpsu_git.bb new file mode 100644 index 00000000..194b1f0f --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/usbpsu_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "usbpsu" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/usbpsu/src/" +ESW_COMPONENT_NAME = "libusbpsu.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-csc_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-csc_git.bb new file mode 100644 index 00000000..068a43e9 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-csc_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-csc" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_csc/src/" +ESW_COMPONENT_NAME = "libv_csc.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-deinterlacer_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-deinterlacer_git.bb new file mode 100644 index 00000000..741fdd91 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-deinterlacer_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-deinterlacer" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_deinterlacer/src/" +ESW_COMPONENT_NAME = "libv_deinterlacer.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-demosaic-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-demosaic-example_git.bb new file mode 100644 index 00000000..cf2cdf6f --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-demosaic-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "v-demosaic" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_demosaic/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-demosaic_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-demosaic_git.bb new file mode 100644 index 00000000..79ef55f2 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-demosaic_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-demosaic" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_demosaic/src/" +ESW_COMPONENT_NAME = "libv_demosaic.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-rd-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-rd-example_git.bb new file mode 100644 index 00000000..fc13c194 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-rd-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "v-frmbuf-rd" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_frmbuf_rd/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-rd_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-rd_git.bb new file mode 100644 index 00000000..91ee34d8 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-rd_git.bb @@ -0,0 +1,16 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-frmbuf-rd" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_frmbuf_rd/src/" +ESW_COMPONENT_NAME = "libv_frmbuf_rd.a" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetalconfig_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + install -m 0755 xv_frmbufrd_g.c ${S}/${ESW_COMPONENT_SRC}/ +} diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-wr-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-wr-example_git.bb new file mode 100644 index 00000000..87a1be53 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-wr-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "v-frmbuf-wr" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_frmbuf_wr/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-wr_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-wr_git.bb new file mode 100644 index 00000000..d88ac592 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-frmbuf-wr_git.bb @@ -0,0 +1,16 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-frmbuf-wr" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_frmbuf_wr/src/" +ESW_COMPONENT_NAME = "libv_frmbuf_wr.a" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetalconfig_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + install -m 0755 xv_frmbufwr_g.c ${S}/${ESW_COMPONENT_SRC}/ +} diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-gamma-lut-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-gamma-lut-example_git.bb new file mode 100644 index 00000000..4d5dcf03 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-gamma-lut-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "v-gamma-lut" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_gamma_lut/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-gamma-lut_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-gamma-lut_git.bb new file mode 100644 index 00000000..8cf95c9d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-gamma-lut_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-gamma-lut" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_gamma_lut/src/" +ESW_COMPONENT_NAME = "libv_gamma_lut.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-hcresampler_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-hcresampler_git.bb new file mode 100644 index 00000000..1731f984 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-hcresampler_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-hcresampler" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_hcresampler/src/" +ESW_COMPONENT_NAME = "libv_hcresampler.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-hscaler_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-hscaler_git.bb new file mode 100644 index 00000000..b239380e --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-hscaler_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-hscaler" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_hscaler/src/" +ESW_COMPONENT_NAME = "libv_hscaler.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-letterbox_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-letterbox_git.bb new file mode 100644 index 00000000..f5ad5f4e --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-letterbox_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-letterbox" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_letterbox/src/" +ESW_COMPONENT_NAME = "libv_letterbox.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-mix-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-mix-example_git.bb new file mode 100644 index 00000000..8bafbf00 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-mix-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "v-mix" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_mix/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-mix_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-mix_git.bb new file mode 100644 index 00000000..acc19bd0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-mix_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-mix" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_mix/src/" +ESW_COMPONENT_NAME = "libv_mix.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-multi-scaler-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-multi-scaler-example_git.bb new file mode 100644 index 00000000..28660316 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-multi-scaler-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "v-multi-scaler" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_multi_scaler/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-multi-scaler_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-multi-scaler_git.bb new file mode 100644 index 00000000..bd725dbe --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-multi-scaler_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-multi-scaler" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_multi_scaler/src/" +ESW_COMPONENT_NAME = "libv_multi_scaler.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-scenechange-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-scenechange-example_git.bb new file mode 100644 index 00000000..2859de79 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-scenechange-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "v-scenechange" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_scenechange/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-scenechange_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-scenechange_git.bb new file mode 100644 index 00000000..77cf9189 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-scenechange_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-scenechange" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_scenechange/src/" +ESW_COMPONENT_NAME = "libv_scenechange.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-tpg_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-tpg_git.bb new file mode 100644 index 00000000..6ea70db1 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-tpg_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-tpg" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_tpg/src/" +ESW_COMPONENT_NAME = "libv_tpg.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-vcresampler_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-vcresampler_git.bb new file mode 100644 index 00000000..45913cdc --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-vcresampler_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-vcresampler" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_vcresampler/src/" +ESW_COMPONENT_NAME = "libv_vcresampler.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/v-vscaler_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/v-vscaler_git.bb new file mode 100644 index 00000000..9528d2e0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/v-vscaler_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "v-vscaler" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/v_vscaler/src/" +ESW_COMPONENT_NAME = "libv_vscaler.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/video-common_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/video-common_git.bb new file mode 100644 index 00000000..278dee8a --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/video-common_git.bb @@ -0,0 +1,10 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "video-common" + +inherit esw + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/video_common/src/" +ESW_COMPONENT_NAME = "libvideo_common.a" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/vprocss-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/vprocss-example_git.bb new file mode 100644 index 00000000..d9050ec4 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/vprocss-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "vprocss" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/vprocss/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/vprocss_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/vprocss_git.bb new file mode 100644 index 00000000..26b2852f --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/vprocss_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vprocss" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common gpio axis-switch axivdma v-csc v-deinterlacer v-hcresampler v-vcresampler v-hscaler v-vscaler v-letterbox" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/vprocss/src/" +ESW_COMPONENT_NAME = "libvprocss.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/vtc_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/vtc_git.bb new file mode 100644 index 00000000..a82ae5ee --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/vtc_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "vtc" + +inherit esw python3native + +DEPENDS += "xilstandalone video-common" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/vtc/src/" +ESW_COMPONENT_NAME = "libvtc.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/wdtps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/wdtps-example_git.bb new file mode 100644 index 00000000..610a7476 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/wdtps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "wdtps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/wdtps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/wdtps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/wdtps_git.bb new file mode 100644 index 00000000..2c900038 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/wdtps_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "wdtps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/wdtps/src/" +ESW_COMPONENT_NAME = "libwdtps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/wdttb-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/wdttb-example_git.bb new file mode 100644 index 00000000..cad6ca20 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/wdttb-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "wdttb" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/wdttb/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/wdttb_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/wdttb_git.bb new file mode 100644 index 00000000..33331c32 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/wdttb_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "wdttb" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/wdttb/src/" +ESW_COMPONENT_NAME = "libwdttb.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/xadcps-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/xadcps-example_git.bb new file mode 100644 index 00000000..f8878144 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/xadcps-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "xadcps" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/xadcps/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/xadcps_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/xadcps_git.bb new file mode 100644 index 00000000..85800a27 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/xadcps_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "xadcps" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/xadcps/src/" +ESW_COMPONENT_NAME = "libxadcps.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/xdmapcie-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/xdmapcie-example_git.bb new file mode 100644 index 00000000..26983a8f --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/xdmapcie-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "xdmapcie" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/xdmapcie/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/xdmapcie_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/xdmapcie_git.bb new file mode 100644 index 00000000..cab8e9d0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/xdmapcie_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "xdmapcie" + +inherit esw python3native + +DEPENDS += "xilstandalone" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/xdmapcie/src/" +ESW_COMPONENT_NAME = "libxdmapcie.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/xxvethernet-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/xxvethernet-example_git.bb new file mode 100644 index 00000000..d6a87183 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/xxvethernet-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "xxvethernet" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/xxvethernet/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/xxvethernet_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/xxvethernet_git.bb new file mode 100644 index 00000000..491eb07c --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/xxvethernet_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "xxvethernet" + +inherit esw python3native + +DEPENDS += "xilstandalone" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/xxvethernet/src/" +ESW_COMPONENT_NAME = "libxxvethernet.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/zdma-example_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/zdma-example_git.bb new file mode 100644 index 00000000..e74e3279 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/zdma-example_git.bb @@ -0,0 +1,5 @@ +inherit esw_examples features_check + +REQUIRED_MACHINE_FEATURES = "zdma" + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/zdma/examples/" diff --git a/meta-xilinx-standalone-experimental/recipes-drivers/zdma_git.bb b/meta-xilinx-standalone-experimental/recipes-drivers/zdma_git.bb new file mode 100644 index 00000000..e987f560 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-drivers/zdma_git.bb @@ -0,0 +1,13 @@ +inherit features_check + +REQUIRED_MACHINE_FEATURES = "zdma" + +inherit esw python3native + +DEPENDS += "xilstandalone " + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/zdma/src/" +ESW_COMPONENT_NAME = "libzdma.a" + +addtask do_generate_driver_data before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/freertos10-xilinx_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/freertos10-xilinx_git.bb new file mode 100644 index 00000000..22d7955e --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/freertos10-xilinx_git.bb @@ -0,0 +1,15 @@ +inherit esw python3native + +ESW_COMPONENT_SRC = "/ThirdParty/bsp/freertos10_xilinx/src/" +ESW_COMPONENT_NAME = "libfreertos.a" + +DEPENDS += "libxil xilstandalone xiltimer" + +do_configure:prepend() { + # This script should also not rely on relative paths and such + ( + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/libxil_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/libxil_git.bb new file mode 100644 index 00000000..2ec1d6cd --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/libxil_git.bb @@ -0,0 +1,50 @@ +inherit esw python3native features_check + +LIBXIL_CONFIG ??= "" +include ${LIBXIL_CONFIG} + +# The python code allows us to use an include above, instead of require +# as it enforces that the file will be available for inclusion. It also +# gives the user feedback if something isn't configured properly. +python () { + libxil_cfg = d.getVar("LIBXIL_CONFIG") + if libxil_cfg: + bbpath = d.getVar('BBPATH') + libxil_path = bb.utils.which(bbpath, libxil_cfg) + if libxil_path: + return + else: + d.setVar('BB_DONT_CACHE', '1') + bb.parse.SkipRecipe("LIBXIL_CONFIG (%s) was not found." % libxil_cfg) + else: + d.setVar('BB_DONT_CACHE', '1') + raise bb.parse.SkipRecipe("No LIBXIL_CONFIG set.") +} + +ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/" +ESW_COMPONENT_NAME = "libxil.a" + +DEPENDS += "xilstandalone " +REQUIRED_MACHINE_FEATURES = "${MACHINE_FEATURES}" +PACKAGECONFIG ?= "${MACHINE_FEATURES}" + +do_configure:prepend() { + LOPPER_DTC_FLAGS="-b 0 -@" lopper ${DTS_FILE} -- baremetal_xparameters_xlnx.py ${ESW_MACHINE} ${S} + install -m 0755 xparameters.h ${S}/${ESW_COMPONENT_SRC}/ +} + +do_compile() { + # Combines the .a archives produced by all of the dependent items + cd ${RECIPE_SYSROOT}/usr/lib/ + echo create libxil.a > libxil.mri + for each in ${REQUIRED_MACHINE_FEATURES}; do + each=$(echo $each | sed 's/-/_/g') + if [ -e lib$each.a ]; then + echo addlib lib$each.a >> libxil.mri + fi + done + echo “save” >> libxil.mri + echo “end” >> libxil.mri + ${AR} -M <libxil.mri + cp libxil.a ${B} +} diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/lwip_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/lwip_git.bb new file mode 100644 index 00000000..93f0b1e8 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/lwip_git.bb @@ -0,0 +1,34 @@ +inherit esw python3native + +ESW_COMPONENT_SRC = "/ThirdParty/sw_services/lwip213/src/" +ESW_COMPONENT_NAME = "liblwip213.a" + +DEPENDS += "libxil" +DEPENDS:append:xilinx-freertos = "freertos10-xilinx" + +EXTRA_OECMAKE += "-Dlwip213_api_mode=RAW_API" +EXTRA_OECMAKE += "-Dlwip213_dhcp_does_arp_check=ON" +EXTRA_OECMAKE += "-Dlwip213_dhcp=ON" +EXTRA_OECMAKE += "-Dlwip213_pbuf_pool_size=2048" +EXTRA_OECMAKE += "-Dlwip213_ipv6_enable=OFF" +EXTRA_OECMAKE:append:xilinx-freertos = " -Dlwip213_api_mode=SOCKET_API" + +do_configure:prepend() { + # This script should also not rely on relative paths and such + ( + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + install -m 0755 xtopology_g.c ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +do_install() { + install -d ${D}${libdir} + install -d ${D}${includedir} + install -m 0755 ${B}/${ESW_COMPONENT_NAME} ${D}${libdir} + install -m 0644 ${B}/include/*.h ${D}${includedir} + cp -r ${B}/include/arch/ ${D}${includedir} + cp -r ${B}/include/include/lwip/ ${D}${includedir} + cp -r ${B}/include/netif/ ${D}${includedir} +} diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilffs-example_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilffs-example_git.bb new file mode 100644 index 00000000..cae39d17 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilffs-example_git.bb @@ -0,0 +1,32 @@ +inherit esw deploy + +# Requires by dependency xilffs +REQUIRED_MACHINE_FEATURES = "sdps" + +ESW_COMPONENT_SRC = "/lib/sw_services/xilffs/examples/" + +DEPENDS += "xilffs xiltimer" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +do_install() { + install -d ${D}/${base_libdir}/firmware + install -m 0755 ${B}/*.elf ${D}/${base_libdir}/firmware +} + +do_deploy() { + install -d ${DEPLOYDIR}/${BPN}/ + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/*.elf ${DEPLOYDIR}/${BPN}/ +} +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/*.elf" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilffs_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilffs_git.bb new file mode 100644 index 00000000..b8dc3b33 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilffs_git.bb @@ -0,0 +1,11 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilffs/src/" +ESW_COMPONENT_NAME = "libxilffs.a" + +PACKAGECONFIG ??= "read_only word_access" +PACKAGECONFIG[use_mkfs] ="-DXILFFS_use_mkfs=ON,-DXILFFS_use_mkfs=OFF,," +PACKAGECONFIG[read_only] ="-DXILFFS_read_only=ON,-DXILFFS_read_only=OFF,," +PACKAGECONFIG[word_access]="-DXILFFS_word_access=ON,-DXILFFS_word_access=OFF,," + +DEPENDS += "xilstandalone libxil" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilfpga-example_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilfpga-example_git.bb new file mode 100644 index 00000000..a3fb1560 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilfpga-example_git.bb @@ -0,0 +1,29 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_services/xilfpga/examples/" + +DEPENDS += "xilfpga" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +do_install() { + install -d ${D}/${base_libdir}/firmware + install -m 0755 ${B}/*.elf ${D}/${base_libdir}/firmware +} + +do_deploy() { + install -d ${DEPLOYDIR}/${BPN}/ + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/*.elf ${DEPLOYDIR}/${BPN}/ +} +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/*.elf" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilfpga_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilfpga_git.bb new file mode 100644 index 00000000..6eaf40ac --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilfpga_git.bb @@ -0,0 +1,8 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilfpga/src/" +ESW_COMPONENT_NAME = "libxilfpga.a" + +DEPENDS += "libxil xilsecure" +DEPENDS += "libxil ${@'xilmailbox' if d.getVar('MACHINE') == 'versal-generic' else ''}" + diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilloader_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilloader_git.bb new file mode 100644 index 00000000..11b03c1b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilloader_git.bb @@ -0,0 +1,9 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilloader/src/" +ESW_COMPONENT_NAME = "libxilloader.a" + +#DEPENDS += "xilstandalone libxil xilpdi xilffs xilsecure xilpuf xilplmi" +DEPENDS += "xilstandalone libxil xilpm xilpdi xilffs xilsecure xilpuf" + +DEPENDS += "cframe" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilmailbox-example_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilmailbox-example_git.bb new file mode 100644 index 00000000..600369ad --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilmailbox-example_git.bb @@ -0,0 +1,38 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_services/xilmailbox/examples/" + +DEPENDS += "xilmailbox" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +do_generate_eglist () { + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ +} + +addtask generate_eglist before do_configure after do_prepare_recipe_sysroot +do_prepare_recipe_sysroot[rdeptask] = "do_unpack" + +do_install() { + install -d ${D}/${base_libdir}/firmware + install -m 0755 ${B}/*.elf ${D}/${base_libdir}/firmware +} + +do_deploy() { + install -d ${DEPLOYDIR}/${BPN}/ + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/*.elf ${DEPLOYDIR}/${BPN}/ +} +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/*.elf" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilmailbox_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilmailbox_git.bb new file mode 100644 index 00000000..77115515 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilmailbox_git.bb @@ -0,0 +1,15 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilmailbox/src/" +ESW_COMPONENT_NAME = "libxilmailbox.a" + +DEPENDS += "xilstandalone libxil xiltimer" + +do_configure:prepend() { + # This script should also not rely on relative paths and such + ( + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilnvm-example_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilnvm-example_git.bb new file mode 100644 index 00000000..a4a81c8b --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilnvm-example_git.bb @@ -0,0 +1,29 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_services/xilnvm/examples/" + +DEPENDS += "xilnvm" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +do_install() { + install -d ${D}/${base_libdir}/firmware + install -m 0755 ${B}/*.elf ${D}/${base_libdir}/firmware +} + +do_deploy() { + install -d ${DEPLOYDIR}/${BPN}/ + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/*.elf ${DEPLOYDIR}/${BPN}/ +} +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/*.elf" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilnvm_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilnvm_git.bb new file mode 100644 index 00000000..9114aa72 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilnvm_git.bb @@ -0,0 +1,6 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilnvm/src/" +ESW_COMPONENT_NAME = "libxilnvm.a" + +DEPENDS += "libxil xiltimer xilplmi" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilpdi_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilpdi_git.bb new file mode 100644 index 00000000..c008b069 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilpdi_git.bb @@ -0,0 +1,6 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilpdi/src/" +ESW_COMPONENT_NAME = "libxilpdi.a" + +DEPENDS += "xilstandalone libxil" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilplmi_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilplmi_git.bb new file mode 100644 index 00000000..35a1efb0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilplmi_git.bb @@ -0,0 +1,6 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilplmi/src/" +ESW_COMPONENT_NAME = "libxilplmi.a" + +DEPENDS += "xilstandalone libxil cfupmc" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilpm_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilpm_git.bb new file mode 100644 index 00000000..69b505c8 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilpm_git.bb @@ -0,0 +1,15 @@ +inherit esw python3native + +ESW_COMPONENT_SRC = "/lib/sw_services/xilpm/src/" +ESW_COMPONENT_NAME = "libxilpm.a" + +DEPENDS += "libxil ${@'xilplmi cframe' if d.getVar('ESW_MACHINE') == 'psv_pmc_0' else ''}" + +do_configure:prepend:zynqmp() { + # This script should also not rely on relative paths and such + ( + cd ${S} + lopper -f --enhanced --werror ${DTS_FILE} -- generate_config_object pm_cfg_obj.c ${ESW_MACHINE} + install -m 0755 pm_cfg_obj.c ${S}/${ESW_COMPONENT_SRC}/zynqmp/client/common/ + ) +} diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilpuf-example_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilpuf-example_git.bb new file mode 100644 index 00000000..ca0abc12 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilpuf-example_git.bb @@ -0,0 +1,29 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_services/xilpuf/examples/" + +DEPENDS += "xilpuf xilsecure" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +do_install() { + install -d ${D}/${base_libdir}/firmware + install -m 0755 ${B}/*.elf ${D}/${base_libdir}/firmware +} + +do_deploy() { + install -d ${DEPLOYDIR}/${BPN}/ + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/*.elf ${DEPLOYDIR}/${BPN}/ +} +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/*.elf" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilpuf_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilpuf_git.bb new file mode 100644 index 00000000..81bee095 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilpuf_git.bb @@ -0,0 +1,6 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilpuf/src/" +ESW_COMPONENT_NAME = "libxilpuf.a" + +DEPENDS += "libxil xiltimer ${@'xilplmi' if d.getVar('ESW_MACHINE') == 'psv_pmc_0' else 'xilmailbox'}" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilsecure-example_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilsecure-example_git.bb new file mode 100644 index 00000000..993794b5 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilsecure-example_git.bb @@ -0,0 +1,29 @@ +inherit esw deploy + +ESW_COMPONENT_SRC = "/lib/sw_services/xilsecure/examples/" + +DEPENDS += "xilsecure" + +do_configure:prepend() { + ( + cd ${S} + lopper ${DTS_FILE} -- baremetallinker_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} + +ESW_CUSTOM_LINKER_FILE ?= "None" +EXTRA_OECMAKE = "-DCUSTOM_LINKER_FILE=${@d.getVar('ESW_CUSTOM_LINKER_FILE')}" + +do_install() { + install -d ${D}/${base_libdir}/firmware + install -m 0755 ${B}/*.elf ${D}/${base_libdir}/firmware +} + +do_deploy() { + install -d ${DEPLOYDIR}/${BPN}/ + install -Dm 0644 ${WORKDIR}/package/${base_libdir}/firmware/*.elf ${DEPLOYDIR}/${BPN}/ +} +addtask deploy before do_build after do_package + +FILES:${PN} = "${base_libdir}/firmware/*.elf" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilsecure_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilsecure_git.bb new file mode 100644 index 00000000..0001d3fb --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilsecure_git.bb @@ -0,0 +1,6 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilsecure/src/" +ESW_COMPONENT_NAME = "libxilsecure.a" + +DEPENDS += "libxil xiltimer ${@'xilplmi' if d.getVar('ESW_MACHINE') == 'psv_pmc_0' else ''} ${@'xilmailbox' if d.getVar('ESW_MACHINE') == 'psv_cortexa72_0' or d.getVar('ESW_MACHINE') == 'psv_cortexr5_0' else ''}" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilsem_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilsem_git.bb new file mode 100644 index 00000000..3631d7f0 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilsem_git.bb @@ -0,0 +1,6 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilsem/src/" +ESW_COMPONENT_NAME = "libxilsem.a" + +DEPENDS += "xilstandalone libxil" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilskey_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilskey_git.bb new file mode 100644 index 00000000..84782554 --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilskey_git.bb @@ -0,0 +1,6 @@ +inherit esw + +ESW_COMPONENT_SRC = "/lib/sw_services/xilskey/src/" +ESW_COMPONENT_NAME = "libxilskey.a" + +DEPENDS += "libxil" diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xilstandalone_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xilstandalone_git.bb new file mode 100644 index 00000000..facbfbaa --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xilstandalone_git.bb @@ -0,0 +1,18 @@ +inherit esw python3native + +ESW_COMPONENT_SRC = "/lib/bsp/standalone/src/" +ESW_COMPONENT_NAME = "libxilstandalone.a" + +DEPENDS += "libgloss" + +do_configure:prepend() { + # This script should also not rely on relative paths and such + ( + cd ${S} + lopper ${DTS_FILE} -- baremetal_bspconfig_xlnx ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} + install -m 0755 MemConfig.cmake ${S}/${ESW_COMPONENT_SRC}/ + install -m 0755 *.c ${S}/${ESW_COMPONENT_SRC} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 StandaloneExample.cmake ${S}/${ESW_COMPONENT_SRC}/common/ + ) +} diff --git a/meta-xilinx-standalone-experimental/recipes-libraries/xiltimer_git.bb b/meta-xilinx-standalone-experimental/recipes-libraries/xiltimer_git.bb new file mode 100644 index 00000000..dd19671d --- /dev/null +++ b/meta-xilinx-standalone-experimental/recipes-libraries/xiltimer_git.bb @@ -0,0 +1,15 @@ +inherit esw python3native + +ESW_COMPONENT_SRC = "/lib/sw_services/xiltimer/src/" +ESW_COMPONENT_NAME = "libxiltimer.a" + +DEPENDS += "libxil" + +do_configure:prepend() { + # This script should also not rely on relative paths and such + ( + cd ${S} + lopper ${DTS_FILE} -- bmcmake_metadata_xlnx.py ${ESW_MACHINE} ${S}/${ESW_COMPONENT_SRC} hwcmake_metadata ${S} + install -m 0755 *.cmake ${S}/${ESW_COMPONENT_SRC}/ + ) +} diff --git a/meta-xilinx-standalone-experimental/scripts/microblaze_dtb.py b/meta-xilinx-standalone-experimental/scripts/microblaze_dtb.py new file mode 100644 index 00000000..343ae10e --- /dev/null +++ b/meta-xilinx-standalone-experimental/scripts/microblaze_dtb.py @@ -0,0 +1,170 @@ +import argparse +import libfdt +import os +import sys + +# Format: FEATURE : (dtb property, condition_operator, condition_value) +# If dtb property is None, then the item is always on +# +# If the condition_operator is None, then enable if it exists for existance +# +# If the condition_operator is '!', and condition_value is None then enable if +# if is not defined +# +# Otherwise 'condition' and value are evaluated by type. +# +# If the condition is = then any value of condition_values will set it +# If the condition is ! then no value of condition_values will set it + +microblaze_tune_features = { + 'microblaze' : (None, None, None), + 'bigendian': ('xlnx,endianness', '!', 1), + '64-bit' : ('xlnx,data-size', '=', 64), + 'barrel-shift': ('xlnx,use-barrel', '=', 1), + 'pattern-compare': ('xlnx,use-pcmp-instr', '=', 1), + 'reorder' : ('xlnx,use-reorder-instr', '!', 0), + 'frequency-optimized': ('xlnx,area-optimized', '=', 2), + 'multiply-low': ('xlnx,use-hw-mul', '=', 1), + 'multiply-high': ('xlnx,use-hw-mul', '=', 2), + 'divide-hard': ('xlnx,use-div', '=', 1), + 'fpu-soft': ('xlnx,use-fpu', '!', [1,2]), + 'fpu-hard': ('xlnx,use-fpu', '=', 1), + 'fpu-hard-extended':('xlnx,use-fpu', '=', 2), +} + +def processProperties(fdt, node): + TUNE_FEATURES = [] + + for feature in microblaze_tune_features: + (property, cop, cvalue) = microblaze_tune_features[feature] + + if not property: + TUNE_FEATURES.append(feature) + + # Special processing to get the version + if feature == "microblaze": + ver = microblazeVersion(fdt, node) + if ver: + TUNE_FEATURES.append(ver) + continue + + prop_value = fdt.getprop( node, property, libfdt.QUIET_NOTFOUND) + + if not prop_value or prop_value == -1: + if cop == '!': + if not cvalue: + TUNE_FEATURES.append(ver) + continue + continue + + # If no operator + if not cop or (cop == '=' and not cvalue): + TUNE_FEATURES.append(feature) + continue + + ctype = type(cvalue) + if ctype == type(list()): + val_list = cvalue + else: + val_list = [ cvalue ] + + result = False + for value in val_list: + ctype = type(value) + if ctype == type(int()): + val = prop_value.as_uint32() + else: + raise TypeError('Unknown type %s' % ctype) + + if value == val: + result = True + break + else: + result = False + + if (cop == '!' and result == False) or \ + (cop == '=' and result == True): + TUNE_FEATURES.append(feature) + + return TUNE_FEATURES + +def microblazeVersion(fdt, node): + version = None + + val = fdt.getprop( node, 'model', libfdt.QUIET_NOTFOUND) + + if val and val != -1: + val = fdt.getprop( node, 'model' ).as_str() + version = val[val.find('microblaze,') + 11:] + + if version.startswith('8'): + # Strip 8.xx.y, to just 8.xx + v = version.split('.') + version = '.'.join(v[0:2]) + + version = 'v' + version + + return version + +def MicroblazeConfig(dtbfile, out): + fdt = libfdt.Fdt(open(dtbfile, mode='rb').read()) + + cpu = -1 + while (True): + cpu = cpu + 1 + try: + node = fdt.path_offset('/cpus/cpu@%d' % cpu) + + try: + prop = fdt.getprop( node, 'compatible' ) + + prop_val = prop[:-1].decode('utf-8').split('\x00') + + microblaze = False + for val in prop_val: + if "microblaze" in val: + microblaze = True + break + + if not microblaze: + continue + + # Construct TUNE_FEATURE here + TUNE_FEATURES = processProperties(fdt, node) + + out.write('AVAILTUNES += "microblaze-cpu%s"\n' % (cpu)) + out.write('TUNE_FEATURES:tune-microblaze-cpu%s = "%s"\n' % (cpu, ' '.join(TUNE_FEATURES))) + out.write('PACKAGE_EXTRA_ARCHS:tune-microblaze-cpu%s = "${TUNE_PKGARCH}"\n' % (cpu)) + + except Exception as e: + sys.stderr.write("Exception looking at properties: %s\n" % e) + + continue + + except Exception as e: + # CPUs SHOULD be consecutive w/o gaps, so no more to search + break + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Generate MicroBlaze TUNE_FEATURES') + + parser.add_argument('-d', '--dtb-file', action='store', + help='DTB file to process') + + parser.add_argument('-o', '--output', action='store', + help='Output file to store TUNE_FEATURE settings') + + args = parser.parse_args() + + if not args.dtb_file: + sys.stderr.write('ERROR: You must specify a DTB_FILE to process.\n') + sys.exit(1) + + outputf = sys.stdout + if args.output: + if os.path.exists(args.output): + sys.stderr.write('ERROR: The output file "%s" exists!\n' % args.output) + sys.exit(1) + outputf = open(args.output, 'w') + + MicroblazeConfig(args.dtb_file, outputf) diff --git a/meta-xilinx-standalone/README.md b/meta-xilinx-standalone/README.md new file mode 100644 index 00000000..aa672b1d --- /dev/null +++ b/meta-xilinx-standalone/README.md @@ -0,0 +1,71 @@ +# meta-xilinx-standalone + +This layer is meant to augment Yocto/OE functionality to provide a +Baremetal/Standalone distribution as well as a generic version of various +firmware that is required to boot a ZynqMP or Versal system. + +For optimized versions of the firmware and additional components you must +use the meta-xilinx-tools layer. + +## Building + +The software in this layer may be used in either a standard single +configuration build, or a multiconfig build. A multiconfig build, along +with the MACHINES defined in meta-xilinx-bsps will automate the generation +of certain firmwares. +--- +## Standalone Firmware + +The standalone firmware is a generically configured firmware, it can be +build either in a single standalone configuration, or via an automated +multiconfig approach only when needed. + +* multiconfig setup + +To automatically build the standalone firmware with a Linux build, you need +to only add the following to your conf/local.conf file. This will use +the multiconfig mechanism within the Yocto Project to build the corresponding +standalone firmware on demand. + +Edit the conf/local.conf file, add: + +``` +# For zynqmp-generic +BBMULTICONFIG += "fsbl-fw zynqmp-pmufw" +``` + +``` +# For versal-generic +BBMULTICONFIG += "versal-fw" +``` + +**To build:** + +``` +# For zynqmp, select a zynqmp machine or the generic one +$ MACHINE=zynqmp-generic bitbake fsbl pmufw +``` + +``` +# For versal, select a versal machine or the generic one +$ MACHINE=versal-generic bitbake plmfw psmfw +``` +--- + +## Dependencies + +This layer depends on: + + URI: https://git.yoctoproject.org/poky + layers: meta, meta-poky + branch: langdale + + URI: https://git.openembedded.org/meta-openembedded + layers: meta-oe + branch: langdale + + URI: + https://git.yoctoproject.org/meta-xilinx (official version) + https://github.com/Xilinx/meta-xilinx (development and amd xilinx release) + layers: meta-xilinx-microblaze, meta-xilinx-core, meta-xilinx-bsp + branch: langdale or amd xilinx release version (e.g. rel-v2023.1) diff --git a/meta-xilinx-standalone/classes/xlnx-embeddedsw.bbclass b/meta-xilinx-standalone/classes/xlnx-embeddedsw.bbclass new file mode 100644 index 00000000..15b91fdb --- /dev/null +++ b/meta-xilinx-standalone/classes/xlnx-embeddedsw.bbclass @@ -0,0 +1,29 @@ +# Automatically determnine the version from the bb file +ESW_VER ?= "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or 'master'}" + +REPO ??= "git://github.com/Xilinx/embeddedsw.git;protocol=https" + +ESW_BRANCH[2022.1] = "xlnx_rel_v2022.1_update" +ESW_BRANCH[2022.2] = "xlnx_rel_v2022.2" +ESW_BRANCH[2023.1] = "xlnx_rel_v2023.1_update" +ESW_BRANCH[2023.2] = "xlnx_rel_v2023.2" +BRANCH ??= "${@d.getVarFlag('ESW_BRANCH', d.getVar('ESW_VER')) or '${ESW_VER}'}" + +ESW_REV[2022.1] = "56d94a506fd9f80949f4cff08e13015928603f01" +ESW_REV[2022.2] = "5330a64c8efd14f0eef09befdbb8d3d738c33ec2" +ESW_REV[2023.1] = "af784f742dad0ca6e69e05baf8de51152c396b9a" +ESW_REV[2023.2] = "c9a0ee31b2a14cbcfcb56ca369037319b4ad4847" +SRCREV ??= "${@d.getVarFlag('ESW_REV', d.getVar('ESW_VER')) or 'invalid'}" + +EMBEDDEDSW_BRANCHARG ?= "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH') != '']}" +EMBEDDEDSW_SRCURI ?= "${REPO};${EMBEDDEDSW_BRANCHARG}" + +LICENSE = "MIT" +LIC_FILES_CHKSUM[xlnx_rel_v2022.1_update] = 'e62cb7a722c4430999e0a55a7234035d' +LIC_FILES_CHKSUM[xlnx_rel_v2022.2] = 'ce611484168a6000bd35df68fc4f4290' +LIC_FILES_CHKSUM[xlnx_rel_v2023.1_update] = '3c310a3ee2197a4c92c6a0e2937c207c' +LIC_FILES_CHKSUM[xlnx_rel_v2023.2] = '9fceecdbcad88698f265578f3d4cb26c' +LIC_FILES_CHKSUM ??= "file://license.txt;md5=${@d.getVarFlag('LIC_FILES_CHKSUM', d.getVar('BRANCH')) or '0'}" + +SRC_URI = "${EMBEDDEDSW_SRCURI}" +PV .= "+git${SRCPV}" diff --git a/meta-xilinx-standalone/classes/xlnx-standalone.bbclass b/meta-xilinx-standalone/classes/xlnx-standalone.bbclass new file mode 100644 index 00000000..9232b1ef --- /dev/null +++ b/meta-xilinx-standalone/classes/xlnx-standalone.bbclass @@ -0,0 +1,16 @@ +# Only enabled when ilp32 is enabled. +def xlnx_ilp32_dict(machdata, d): + machdata["elf"] = { + "aarch64" : (183, 0, 0, True, 32), + "aarch64_be" :(183, 0, 0, False, 32), + } + return machdata + +# Only enabled when microblaze64 is enabled. +def xlnx_mb64_dict(machdata, d): + machdata["elf"] = { + "microblaze": (189, 0, 0, False, 64), + "microblazeeb":(189, 0, 0, False, 64), + "microblazeel":(189, 0, 0, True, 64), + } + return machdata diff --git a/meta-xilinx-standalone/conf/distro/xilinx-standalone-nolto.conf b/meta-xilinx-standalone/conf/distro/xilinx-standalone-nolto.conf new file mode 100644 index 00000000..ccfd0600 --- /dev/null +++ b/meta-xilinx-standalone/conf/distro/xilinx-standalone-nolto.conf @@ -0,0 +1,4 @@ +require conf/distro/xilinx-standalone.inc + +# Make sure any users get the xilinx-standalone distro override +DISTROOVERRIDES =. "xilinx-standalone:" diff --git a/meta-xilinx-standalone/conf/distro/xilinx-standalone.conf b/meta-xilinx-standalone/conf/distro/xilinx-standalone.conf new file mode 100644 index 00000000..dfc8fa08 --- /dev/null +++ b/meta-xilinx-standalone/conf/distro/xilinx-standalone.conf @@ -0,0 +1,14 @@ +require conf/distro/xilinx-standalone.inc + +DISTRO_NAME:append = " (lto)" + +# By default we want to optimize for size. +FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" + +# Workaround for microblaze -Os bug +FULL_OPTIMIZATION:microblaze = "-O2 -pipe ${DEBUG_FLAGS}" + +# We also need to use Link Time Optimization for many items, make this the +# default. +ESW_CFLAGS += " -Os -flto -ffat-lto-objects" + diff --git a/meta-xilinx-standalone/conf/distro/xilinx-standalone.inc b/meta-xilinx-standalone/conf/distro/xilinx-standalone.inc new file mode 100644 index 00000000..814cb9cd --- /dev/null +++ b/meta-xilinx-standalone/conf/distro/xilinx-standalone.inc @@ -0,0 +1,49 @@ +DISTRO_NAME = "Xilinx Standalone Distro" +DISTRO_VERSION = "1.0" +TARGET_VENDOR = "-xilinx" + +TCLIBC = "newlib" +TCLIBCAPPEND ="" + +# Change SDK name +SDK_VERSION = "xilinx-standalone" + +# Hold this until it gets merged in core, we need libc.a and libgloss.a for cross-canadian +LIBC_DEPENDENCIES:append:xilinx-standalone = " newlib-staticdev libgloss-staticdev" + +ESW_CFLAGS ?= "" + +# Cortex R5 requires an additional cflag to be passed for compatibility with the embeddedsw +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexr5', ' -DARMR5', '', d)}" + +# Make sure all regular recipes are excluded from compatibility +# Avoid using this for native, nativesdk or cross recipes +COMPATOS = "" +# Set the regex for target recipes only, follow TARGET_OS default +COMPATOS:class-target = ".*-linux${LIBCEXTENSION}${ABIEXTENSION}" +COMPATIBLE_HOST ?= "${COMPATOS}" + +# Clear defaults +PREFERRED_PROVIDER_virtual/kernel = "linux-dummy" + +PREFERRED_VERSION_libmetal-xlnx = "${@'standalone' if 'xilinx-standalone-exp' in d.getVar('BBFILE_COLLECTIONS').split() else ''}" +PREFERRED_VERSION_open-amp-xlnx = "${@'standalone' if 'xilinx-standalone-exp' in d.getVar('BBFILE_COLLECTIONS').split() else ''}" + +# Workaround for pulling in nativesdk-mingw-w64-winpthreads +TOOLCHAIN_HOST_TASK:append:sdkmingw32 = " nativesdk-mingw-w64-winpthreads" + +# Disable static for all classes, except for target. This will ensure we can +# share more recipe hashes with other distros, while still building +# static binaries for baremetal targets (by default). The user can of course +# still override this, but will need to specifically select class-target to +# do so. +DISABLE_STATIC:class-target ?= "" + +require conf/distro/include/no-static-libs.inc +require conf/distro/include/yocto-uninative.inc +INHERIT += "uninative" + +BB_SIGNATURE_HANDLER ?= "OEEquivHash" +BB_HASHSERVE ??= "auto" + +MACHINE_FEATURES_BACKFILL_CONSIDERED += "rtc qemu-usermode" diff --git a/meta-xilinx-standalone/conf/layer.conf b/meta-xilinx-standalone/conf/layer.conf new file mode 100644 index 00000000..84d83673 --- /dev/null +++ b/meta-xilinx-standalone/conf/layer.conf @@ -0,0 +1,23 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend \ + ${LAYERDIR}/recipes-*/*.bb \ + ${LAYERDIR}/recipes-*/*.bbappend \ + " + +BBFILE_COLLECTIONS += "xilinx-standalone" +BBFILE_PATTERN_xilinx-standalone = "^${LAYERDIR}/" +BBFILE_PRIORITY_xilinx-standalone = "7" + +LAYERDEPENDS_xilinx-standalone = "core xilinx" +LAYERRECOMMENDS_xilinx-standalone = "xilinx-microblaze" + +LAYERSERIES_COMPAT_xilinx-standalone = "scarthgap" + +PREFERRED_VERSION_plm-firmware ?= "${@d.getVar("XILINX_RELEASE_VERSION").replace('v','')}%" +PREFERRED_VERSION_psm-firmware ?= "${@d.getVar("XILINX_RELEASE_VERSION").replace('v','')}%" +PREFERRED_VERSION_pmu-firmware ?= "${@d.getVar("XILINX_RELEASE_VERSION").replace('v','')}%" +PREFERRED_VERSION_fsbl-firmware ?= "${@d.getVar("XILINX_RELEASE_VERSION").replace('v','')}%" diff --git a/meta-xilinx-standalone/conf/multiconfig/fsbl-fw.conf b/meta-xilinx-standalone/conf/multiconfig/fsbl-fw.conf new file mode 100644 index 00000000..2a603c9e --- /dev/null +++ b/meta-xilinx-standalone/conf/multiconfig/fsbl-fw.conf @@ -0,0 +1,5 @@ +# Build the FSBL for Zynq and ZynqMP + +DISTRO = "xilinx-standalone" + +TMPDIR = "${TOPDIR}/tmp-fsbl-fw" diff --git a/meta-xilinx-standalone/conf/multiconfig/versal-fw.conf b/meta-xilinx-standalone/conf/multiconfig/versal-fw.conf new file mode 100644 index 00000000..3629b373 --- /dev/null +++ b/meta-xilinx-standalone/conf/multiconfig/versal-fw.conf @@ -0,0 +1,9 @@ +# To be used with a versal machine +# Re-use the main machine, which SHOULD allow us to override the default tune! +DEFAULTTUNE = "microblaze" +TUNE_FEATURES:tune-microblaze = "microblaze v10.0 barrel-shift pattern-compare fpu-soft" +#LINKER_HASH_STYLE:microblaze = "" + +DISTRO = "xilinx-standalone" + +TMPDIR = "${TOPDIR}/tmp-microblaze-versal-fw" diff --git a/meta-xilinx-standalone/conf/multiconfig/zynqmp-pmufw.conf b/meta-xilinx-standalone/conf/multiconfig/zynqmp-pmufw.conf new file mode 100644 index 00000000..17d8a6a3 --- /dev/null +++ b/meta-xilinx-standalone/conf/multiconfig/zynqmp-pmufw.conf @@ -0,0 +1,9 @@ +# To be used with a zynqmp machine +# Re-use the main machine, which SHOULD allow us to override the default tune! +DEFAULTTUNE = "microblaze" +TUNE_FEATURES:tune-microblaze = "microblaze v9.2 barrel-shift pattern-compare reorder fpu-soft" +#LINKER_HASH_STYLE:microblaze = "" + +DISTRO = "xilinx-standalone" + +TMPDIR = "${TOPDIR}/tmp-microblaze-zynqmp-pmufw" diff --git a/meta-xilinx-standalone/recipes-bsp/device-tree/device-tree.bbappend b/meta-xilinx-standalone/recipes-bsp/device-tree/device-tree.bbappend new file mode 100644 index 00000000..fcc041fd --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/device-tree/device-tree.bbappend @@ -0,0 +1,16 @@ +COMPATIBLE_HOST:xilinx-standalone = "${HOST_SYS}" +COMPATIBLE_HOST:xilinx-freertos = "${HOST_SYS}" + +COMPATIBLE_MACHINE:cortexa53-zynqmp = ".*" +COMPATIBLE_MACHINE:cortexr5-zynqmp = ".*" +COMPATIBLE_MACHINE:microblaze-pmu = ".*" +COMPATIBLE_MACHINE:microblaze-plm = ".*" +COMPATIBLE_MACHINE:cortexa72-versal = ".*" +COMPATIBLE_MACHINE:cortexr5-versal = ".*" +COMPATIBLE_MACHINE:cortexa9-zynq = ".*" + +# Enable @ flag on dtc which is required by libxil +DTC_FLAGS:append:xilinx-standalone = " -@" +DT_INCLUDE:append:xilinx-standalone = " ${WORKDIR}/git/device_tree/data/kernel_dtsi/${XILINX_RELEASE_VERSION}/include/" +DTC_FLAGS:append:xilinx-freertos = " -@" +DT_INCLUDE:append:xilinx-freertos = " ${WORKDIR}/git/device_tree/data/kernel_dtsi/${XILINX_RELEASE_VERSION}/include/" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-sw_apps-versal_plm-Changes-to-ensure-versionless-bui.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-sw_apps-versal_plm-Changes-to-ensure-versionless-bui.patch new file mode 100644 index 00000000..0dbe68dc --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-sw_apps-versal_plm-Changes-to-ensure-versionless-bui.patch @@ -0,0 +1,261 @@ +From 3b706021d06b9dbbe5848e524da09b527f75ad4f Mon Sep 17 00:00:00 2001 +From: "b.vikram@xilinx.com" <b.vikram@xilinx.com> +Date: Thu, 11 Feb 2021 23:20:31 +0530 +Subject: [PATCH] sw_apps :versal_plm: Changes to ensure versionless build + works with yocto flow + +The syntax of updating BSP_SEQUENTIAL_FILES variable in copy_bsp.sh is updated. +Using COMPILER, ARCHIVER and AASEMBLER variables in bsp Makefile instead of +hardcoding them. This would help yocto flow as it does not use mb-gcc. + +Signed-off-by: Vikram Sreenivasa Batchali <b.vikram@xilinx.com> +Acked-by: Krishna Chaitanya Patakamuri <krishna.chaitanya.patakamuri@xilinx.com> +--- + lib/sw_apps/versal_plm/misc/Makefile | 10 ++++++---- + lib/sw_apps/versal_plm/misc/copy_bsp.sh | 16 ++++++++-------- + lib/sw_apps/zynq_fsbl/misc/copy_bsp.sh | 6 +++--- + lib/sw_apps/zynqmp_fsbl/misc/copy_bsp.sh | 8 ++++---- + lib/sw_apps/zynqmp_pmufw/misc/Makefile | 10 ++++++---- + lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh | 8 ++++---- + 6 files changed, 31 insertions(+), 27 deletions(-) + +diff --git a/lib/sw_apps/versal_plm/misc/Makefile b/lib/sw_apps/versal_plm/misc/Makefile +index 23ac27b52b..d1be4ffc8e 100644 +--- a/lib/sw_apps/versal_plm/misc/Makefile ++++ b/lib/sw_apps/versal_plm/misc/Makefile +@@ -1,5 +1,7 @@ + # Makefile generated by Xilinx. +- ++COMPILER := mb-gcc ++ARCHIVER := mb-gcc-ar ++ASSEMBLER := mb-as + DRIVER_LIB_VERSION = 1.0 + PROCESSOR = psv_pmc_0 + LIBRARIES = ${PROCESSOR}/lib/libxil.a +@@ -28,7 +30,7 @@ par_libs: $(addsuffix /make.libs,$(PAR_SUBDIRS)) + @echo 'Finished building libraries parallelly.' + + archive: +- mb-gcc-ar -r $(LIBRARIES) $(wildcard $(PROCESSOR)/lib/*.o) ++ $(ARCHIVER) -r $(LIBRARIES) $(wildcard $(PROCESSOR)/lib/*.o) + + clean: $(addsuffix /make.clean,$(SUBDIRS)) + rm -f ${PROCESSOR}/lib/libxil.a +@@ -38,11 +40,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ASSEMBLER=mb-as" "ARCHIVER=mb-gcc-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ASSEMBLER=mb-as" "ARCHIVER=mb-gcc-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +diff --git a/lib/sw_apps/versal_plm/misc/copy_bsp.sh b/lib/sw_apps/versal_plm/misc/copy_bsp.sh +index 2e4e393b5d..4f082de37c 100755 +--- a/lib/sw_apps/versal_plm/misc/copy_bsp.sh ++++ b/lib/sw_apps/versal_plm/misc/copy_bsp.sh +@@ -48,33 +48,33 @@ fi + mkdir -p $BSP_DIR/libsrc/xilffs + cp -r $SERVICES_DIR/xilffs/src $BSP_DIR/libsrc/xilffs/ + cp -r $SERVICES_DIR/xilffs/src/include/* $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilffs/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilffs/src/Makefile" + + mkdir -p $BSP_DIR/libsrc/xilpdi + cp -r $SERVICES_DIR/xilpdi/src $BSP_DIR/libsrc/xilpdi/ + cp -r $SERVICES_DIR/xilpdi/src/*.h $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilpdi/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilpdi/src/Makefile" + + mkdir -p $BSP_DIR/libsrc/xilplmi + cp -r $SERVICES_DIR/xilplmi/src $BSP_DIR/libsrc/xilplmi/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilplmi/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilplmi/src/Makefile" + + mkdir -p $BSP_DIR/libsrc/xilpuf + cp -r $SERVICES_DIR/xilpuf/src $BSP_DIR/libsrc/xilpuf/ + cp -r $SERVICES_DIR/xilpuf/src/*.h $BSP_DIR/include/ +-set SP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilpuf/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilpuf/src/Makefile" + + mkdir -p $BSP_DIR/libsrc/xilloader + cp -r $SERVICES_DIR/xilloader/src $BSP_DIR/libsrc/xilloader/ + cp -r $SERVICES_DIR/xilloader/src/*.h $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilloader/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilloader/src/Makefile" + + mkdir -p $BSP_DIR/libsrc/xilpm/src/ + cp -r $SERVICES_DIR/xilpm/src/versal/common/* $BSP_DIR/libsrc/xilpm/src/ + cp -r $SERVICES_DIR/xilpm/src/versal/server/* $BSP_DIR/libsrc/xilpm/src/ + cp -r $SERVICES_DIR/xilpm/src/versal/common/*.h $BSP_DIR/include/ + cp -r $SERVICES_DIR/xilpm/src/versal/server/*.h $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilpm/src/versal/common/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilpm/src/versal/common/Makefile" + + mkdir -p $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/Makefile $BSP_DIR/libsrc/xilsecure/src/ +@@ -84,7 +84,7 @@ cp -r $SERVICES_DIR/xilsecure/src/common/*.h $BSP_DIR/include/ + cp -r $SERVICES_DIR/xilsecure/src/versal/*.h $BSP_DIR/include/ + mv $BSP_DIR/libsrc/xilsecure/src/libxilsecure_pmc.a $BSP_DIR/libsrc/xilsecure/src/libxilsecure.a + rm $BSP_DIR/libsrc/xilsecure/src/libxilsecure_*.a +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilsecure/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilsecure/src/Makefile" + + mkdir -p $BSP_DIR/libsrc/xilsem + cp -r $SERVICES_DIR/xilsem/src $BSP_DIR/libsrc/xilsem/ +@@ -116,7 +116,7 @@ do + cp -r $DRIVERS_DIR/$line/src/*.h $BSP_DIR/include/ + # copy all the HSM generated driver files DRIVER_g.c + cp $WORKING_DIR/x"$line"_g.c $BSP_DIR/libsrc/$line/src/ +- set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/$line/src/Makefile ++ BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/$line/src/Makefile" + done < $DRIVERS_LIST + + #copy the processor code. +diff --git a/lib/sw_apps/zynq_fsbl/misc/copy_bsp.sh b/lib/sw_apps/zynq_fsbl/misc/copy_bsp.sh +index 70dae119b2..70a83ffd50 100755 +--- a/lib/sw_apps/zynq_fsbl/misc/copy_bsp.sh ++++ b/lib/sw_apps/zynq_fsbl/misc/copy_bsp.sh +@@ -75,18 +75,18 @@ do + cp -r $DRIVERS_DIR/$line/src $BSP_DIR/libsrc/$line + # copy all the HSM generated driver files DRIVER_g.c + # cp $BOARD_DIR/x"$line"_g.c $BSP_DIR/libsrc/$line/src/ +- set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/$line/src/Makefile ++ BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/$line/src/Makefile" + + done < $DRIVERS_LIST + + # copy the libraries required + cp -r $SERVICES_DIR/xilffs/ $BSP_DIR/libsrc/ + cp -r $SERVICES_DIR/xilffs/src/include/* $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilffs/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilffs/src/Makefile" + + cp -r $SERVICES_DIR/xilrsa/ $BSP_DIR/libsrc/ + cp -r $SERVICES_DIR/xilrsa/src/include/* $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilrsa/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilrsa/src/Makefile" + + #copy the xparameters.h + cp $BOARD_DIR/xparameters.h $BSP_DIR/include/ +diff --git a/lib/sw_apps/zynqmp_fsbl/misc/copy_bsp.sh b/lib/sw_apps/zynqmp_fsbl/misc/copy_bsp.sh +index 8cc6e3a66e..120aeb8fc7 100755 +--- a/lib/sw_apps/zynqmp_fsbl/misc/copy_bsp.sh ++++ b/lib/sw_apps/zynqmp_fsbl/misc/copy_bsp.sh +@@ -65,7 +65,7 @@ fi + mkdir -p $BSP_DIR/libsrc/xilffs + cp -r $SERVICES_DIR/xilffs/src $BSP_DIR/libsrc/xilffs/ + cp -r $SERVICES_DIR/xilffs/src/include/* $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilffs/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilffs/src/Makefile" + + mkdir -p $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/Makefile $BSP_DIR/libsrc/xilsecure/src/ +@@ -73,13 +73,13 @@ cp -r $SERVICES_DIR/xilsecure/src/common/* $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/zynqmp/* $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/common/*.h $BSP_DIR/include/ + cp -r $SERVICES_DIR/xilsecure/src/zynqmp/*.h $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilsecure/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilsecure/src/Makefile" + + cp -r $SERVICES_DIR/xilpm/ $BSP_DIR/libsrc/ + cp -r $SERVICES_DIR/xilpm/src/zynqmp/client/common/* $BSP_DIR/libsrc/xilpm/src/ + cp -r $SERVICES_DIR/xilpm/src/zynqmp/client/common/*.h $BSP_DIR/include/ + cp $WORKING_DIR/pm_cfg_obj.c $BSP_DIR/libsrc/xilpm/src/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilpm/src/zynqmp/client/common/Makefile ++BSP_SEQUENTIAL_MAKEFILES="BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilpm/src/zynqmp/client/common/Makefile" + + rm -rf $BSP_DIR/libsrc/xilpm/src/zynqmp/ + rm -rf $BSP_DIR/libsrc/xilpm/src/versal/ +@@ -161,7 +161,7 @@ do + + # copy all the HSM generated driver files DRIVER_g.c + # cp $BOARD_DIR/x"$line"_g.c $BSP_DIR/libsrc/$line/src/ +- set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/$line/src/Makefile ++ BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/$line/src/Makefile" + + done < $DRIVERS_LIST + +diff --git a/lib/sw_apps/zynqmp_pmufw/misc/Makefile b/lib/sw_apps/zynqmp_pmufw/misc/Makefile +index 142581b2b9..a773498512 100644 +--- a/lib/sw_apps/zynqmp_pmufw/misc/Makefile ++++ b/lib/sw_apps/zynqmp_pmufw/misc/Makefile +@@ -1,5 +1,7 @@ + # Makefile generated by Xilinx. +- ++COMPILER := mb-gcc ++ARCHIVER := mb-gcc-ar ++ASSEMBLER := mb-as + DRIVER_LIB_VERSION = 1.0 + PROCESSOR = psu_pmu_0 + LIBRARIES = ${PROCESSOR}/lib/libxil.a +@@ -28,7 +30,7 @@ par_libs: $(addsuffix /make.libs,$(PAR_SUBDIRS)) + @echo 'Finished building libraries parallelly.' + + archive: +- mb-gcc-ar -r $(LIBRARIES) $(wildcard $(PROCESSOR)/lib/*.o) ++ $(ARCHIVER) -r $(LIBRARIES) $(wildcard $(PROCESSOR)/lib/*.o) + + clean: $(addsuffix /make.clean,$(SUBDIRS)) + rm -f ${PROCESSOR}/lib/libxil.a +@@ -38,11 +40,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ARCHIVER=mb-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ARCHIVER=mb-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +diff --git a/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh b/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh +index c683e4f73d..be8616968e 100755 +--- a/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh ++++ b/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh +@@ -52,14 +52,14 @@ cp -r $SERVICES_DIR/xilfpga/src/interface/zynqmp/xilfpga_pcap.c $BSP_DIR/libsrc/ + cp -r $SERVICES_DIR/xilfpga/src/*.h $BSP_DIR/include/ + cp -r $SERVICES_DIR/xilfpga/src/interface/zynqmp/*.h $BSP_DIR/include/ + rm -r $BSP_DIR/libsrc/xilfpga/src/interface/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilfpga/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilfpga/src/Makefile" + mkdir -p $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/Makefile $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/common/* $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/zynqmp/* $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/common/*.h $BSP_DIR/include/ + cp -r $SERVICES_DIR/xilsecure/src/zynqmp/*.h $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilsecure/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilsecure/src/Makefile" + cp -r $SERVICES_DIR/xilskey/ $BSP_DIR/libsrc/ + + # remove the xilskey library files which are not required for PMU +@@ -81,7 +81,7 @@ rm -r $BSP_DIR/libsrc/xilskey/src/include/xilskey_bbram.h + # copy the xilskey library header files to include directory + cp -r $BSP_DIR/libsrc/xilskey/src/*.h $BSP_DIR/include/ + cp -r $BSP_DIR/libsrc/xilskey/src/include/*.h $BSP_DIR/include/ +-set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/xilskey/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilskey/src/Makefile" + + # copy bsp standalone code + cp $STANDALONE_DIR/common/* $BSP_DIR/libsrc/standalone/src/ +@@ -108,7 +108,7 @@ do + cp -r $DRIVERS_DIR/$line/src/*.h $BSP_DIR/include/ + # copy all the HSM generated driver files DRIVER_g.c + cp $WORKING_DIR/x"$line"_g.c $BSP_DIR/libsrc/$line/src/ +- set BSP_SEQUENTIAL_MAKEFILES += $BSP_DIR/libsrc/$line/src/Makefile ++ BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/$line/src/Makefile" + + done < $DRIVERS_LIST + +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_fw-Fixup-core-makefiles.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_fw-Fixup-core-makefiles.patch new file mode 100644 index 00000000..e49bc259 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_fw-Fixup-core-makefiles.patch @@ -0,0 +1,73 @@ +From 0f117593c792fbe7cfddf7b84e5342b640c2716b Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@xilinx.com> +Date: Mon, 13 Sep 2021 14:02:45 -0700 +Subject: [PATCH] versal_fw: Fixup core makefiles + +The Yocto Project build environment needs to be able to override a few +additional variables that may not be appropriate to do on the regular +command line build version. This Yocto Project specific will allow this +behavior. + +Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> +--- + lib/sw_apps/versal_plm/misc/Makefile | 6 ++++-- + lib/sw_apps/versal_psmfw/misc/Makefile | 6 ++++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/lib/sw_apps/versal_plm/misc/Makefile b/lib/sw_apps/versal_plm/misc/Makefile +index d1be4ffc8e..c7dc1a3dbe 100644 +--- a/lib/sw_apps/versal_plm/misc/Makefile ++++ b/lib/sw_apps/versal_plm/misc/Makefile +@@ -2,6 +2,8 @@ + COMPILER := mb-gcc + ARCHIVER := mb-gcc-ar + ASSEMBLER := mb-as ++COMPILER_FLAGS := -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare ++EXTRA_COMPILER_FLAGS := -g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects + DRIVER_LIB_VERSION = 1.0 + PROCESSOR = psv_pmc_0 + LIBRARIES = ${PROCESSOR}/lib/libxil.a +@@ -40,11 +42,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +diff --git a/lib/sw_apps/versal_psmfw/misc/Makefile b/lib/sw_apps/versal_psmfw/misc/Makefile +index 02d85e492e..f6386dcbed 100644 +--- a/lib/sw_apps/versal_psmfw/misc/Makefile ++++ b/lib/sw_apps/versal_psmfw/misc/Makefile +@@ -11,6 +11,8 @@ PAR_SUBDIRS := $(patsubst %/Makefile, %, $(BSP_PARALLEL_MAKEFILES)) + COMPILER := mb-gcc + ARCHIVER := mb-ar + ASSEMBLER := mb-as ++COMPILER_FLAGS := -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare ++EXTRA_COMPILER_FLAGS := -g -ffunction-sections -fdata-sections -Wall -Wextra + + ifneq (,$(findstring win,$(RDI_PLATFORM))) + SHELL = CMD +@@ -41,11 +43,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_psmfw-misc-Update-makefile-for-version-less-b.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_psmfw-misc-Update-makefile-for-version-less-b.patch new file mode 100644 index 00000000..295d59bb --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_psmfw-misc-Update-makefile-for-version-less-b.patch @@ -0,0 +1,56 @@ +From 79e17afd2c943c53978dceab2f8fd17cba8994ec Mon Sep 17 00:00:00 2001 +From: Rajan Vaja <rajan.vaja@xilinx.com> +Date: Mon, 15 Feb 2021 22:53:37 -0800 +Subject: [PATCH] versal_psmfw: misc: Update makefile for version less build + with yocto + +Use COMPILER, ARCHIVER and ASSEMBLER variables in Makefile instead of +hard coding them. This would help yocto flow as it does not use +mb-gcc. + +Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> +Acked-by: Nicole Baze <nicole.baze@xilinx.com> +--- + lib/sw_apps/versal_psmfw/misc/Makefile | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/lib/sw_apps/versal_psmfw/misc/Makefile b/lib/sw_apps/versal_psmfw/misc/Makefile +index 6374302f5c..2164c19f03 100644 +--- a/lib/sw_apps/versal_psmfw/misc/Makefile ++++ b/lib/sw_apps/versal_psmfw/misc/Makefile +@@ -8,6 +8,9 @@ SUBDIRS := $(patsubst %/Makefile, %, $(BSP_MAKEFILES)) + BSP_PARALLEL_MAKEFILES := $(filter-out $(BSP_SEQUENTIAL_MAKEFILES),$(BSP_MAKEFILES)) + SEQ_SUBDIRS := $(patsubst %/Makefile, %, $(BSP_SEQUENTIAL_MAKEFILES)) + PAR_SUBDIRS := $(patsubst %/Makefile, %, $(BSP_PARALLEL_MAKEFILES)) ++COMPILER := mb-gcc ++ARCHIVER := mb-ar ++ASSEMBLER := mb-as + + ifneq (,$(findstring win,$(RDI_PLATFORM))) + SHELL = CMD +@@ -28,7 +31,7 @@ par_libs: $(addsuffix /make.libs,$(PAR_SUBDIRS)) + @echo 'Finished building libraries parallelly.' + + archive: +- mb-ar -r $(LIBRARIES) $(wildcard $(PROCESSOR)/lib/*.o) ++ $(ARCHIVER) -r $(LIBRARIES) $(wildcard $(PROCESSOR)/lib/*.o) + + clean: $(addsuffix /make.clean,$(SUBDIRS)) + rm -f ${PROCESSOR}/lib/libxil.a +@@ -38,11 +41,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ASSEMBLER=mb-as" "ARCHIVER=mb-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ASSEMBLER=mb-as" "ARCHIVER=mb-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_psmfw-misc-Update-mcpu-version-in-Makefile.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_psmfw-misc-Update-mcpu-version-in-Makefile.patch new file mode 100644 index 00000000..072691d8 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-versal_psmfw-misc-Update-mcpu-version-in-Makefile.patch @@ -0,0 +1,35 @@ +From 7b5cd70e8d77f5df345a2f1a29e09a51af248040 Mon Sep 17 00:00:00 2001 +From: Rajan Vaja <rajan.vaja@xilinx.com> +Date: Fri, 26 Feb 2021 02:30:28 -0800 +Subject: [PATCH] versal_psmfw: misc: Update mcpu version in Makefile + +Use -mcpu=v10.0 instead of -mcpu=v as -mcpu=v is not defined and +PSM is using v10.0. + +Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> +Acked-by: Nicole Baze <nicole.baze@xilinx.com> +--- + lib/sw_apps/versal_psmfw/misc/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/sw_apps/versal_psmfw/misc/Makefile b/lib/sw_apps/versal_psmfw/misc/Makefile +index 2164c19f03..02d85e492e 100644 +--- a/lib/sw_apps/versal_psmfw/misc/Makefile ++++ b/lib/sw_apps/versal_psmfw/misc/Makefile +@@ -41,11 +41,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Correct-structure-header-of-PmResetOps.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Correct-structure-header-of-PmResetOps.patch new file mode 100644 index 00000000..a5d0894a --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Correct-structure-header-of-PmResetOps.patch @@ -0,0 +1,30 @@ +From 27d08d91eedb77c28e7776d0ccf6b92d79d3b6bb Mon Sep 17 00:00:00 2001 +From: Rajan Vaja <rajan.vaja@xilinx.com> +Date: Mon, 15 Feb 2021 22:47:13 -0800 +Subject: [PATCH] zynqmp_pmufw: Correct structure header of PmResetOps + +Update structure header of PmResetOps for using resetAssert instead +of assert. + +Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> +Acked-by: Mounika Akula <mounika.akula@xilinx.com> +--- + lib/sw_apps/zynqmp_pmufw/src/pm_reset.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/sw_apps/zynqmp_pmufw/src/pm_reset.c b/lib/sw_apps/zynqmp_pmufw/src/pm_reset.c +index bcd8aa73db..a693eb4196 100644 +--- a/lib/sw_apps/zynqmp_pmufw/src/pm_reset.c ++++ b/lib/sw_apps/zynqmp_pmufw/src/pm_reset.c +@@ -29,7 +29,7 @@ + + /** + * PmResetOps - Reset operations +- * @assert Assert or release reset line ++ * @resetAssert Assert or release reset line + * @getStatus Get current status of reset line + * @pulse Function performing reset pulse operation + */ +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Fix-reset-ops-for-assert.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Fix-reset-ops-for-assert.patch new file mode 100644 index 00000000..a0e67dfd --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Fix-reset-ops-for-assert.patch @@ -0,0 +1,93 @@ +From 57a5a13ef730c5c46d9db159ed9b7a466cc70388 Mon Sep 17 00:00:00 2001 +From: Rajan Vaja <rajan.vaja@xilinx.com> +Date: Wed, 27 Jan 2021 22:19:51 -0800 +Subject: [PATCH] zynqmp_pmufw: Fix reset ops for assert() + +New compiler toolchain treats "assert" as a macro always. So rename +the existing "assert" variable to "resetAssert" in the codebase. + +Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> +Acked-by: Ravi Patel <ravi.patel@xilinx.com> +Acked-by: Tejas Patel <tejas.patel@xilinx.com> +--- + lib/sw_apps/zynqmp_pmufw/src/pm_reset.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/lib/sw_apps/zynqmp_pmufw/src/pm_reset.c b/lib/sw_apps/zynqmp_pmufw/src/pm_reset.c +index c66aae4a0c..bcd8aa73db 100644 +--- a/lib/sw_apps/zynqmp_pmufw/src/pm_reset.c ++++ b/lib/sw_apps/zynqmp_pmufw/src/pm_reset.c +@@ -1,5 +1,5 @@ + /* +-* Copyright (c) 2014 - 2020 Xilinx, Inc. All rights reserved. ++* Copyright (c) 2014 - 2021 Xilinx, Inc. All rights reserved. + * SPDX-License-Identifier: MIT + */ + +@@ -34,7 +34,7 @@ + * @pulse Function performing reset pulse operation + */ + typedef struct PmResetOps { +- void (*const assert)(const PmReset* const rst, const u32 action); ++ void (*const resetAssert)(const PmReset* const rst, const u32 action); + u32 (*const getStatus)(const PmReset* const s); + u32 (*const pulse)(const PmReset* const rst); + } PmResetOps; +@@ -399,37 +399,37 @@ static u32 PmResetPulsePl(const PmReset* const rst) + } + + static const PmResetOps pmResetOpsGeneric = { +- .assert = PmResetAssertGen, ++ .resetAssert = PmResetAssertGen, + .getStatus = PmResetGetStatusGen, + .pulse = PmResetPulseGen, + }; + + static const PmResetOps pmResetOpsGpo = { +- .assert = PmResetAssertGpo, ++ .resetAssert = PmResetAssertGpo, + .getStatus = PmResetGetStatusGpo, + .pulse = PmResetPulseGpo, + }; + + static const PmResetOps pmResetOpsRom = { +- .assert = PmResetAssertRom, ++ .resetAssert = PmResetAssertRom, + .getStatus = PmResetGetStatusRom, + .pulse = PmResetPulseRom, + }; + + static const PmResetOps pmResetOpsNoAssert = { +- .assert = NULL, ++ .resetAssert = NULL, + .getStatus = PmResetGetStatusRom, + .pulse = PmResetPulseRom, + }; + + static const PmResetOps pmResetOpsPl = { +- .assert = PmResetAssertPl, ++ .resetAssert = PmResetAssertPl, + .getStatus = PmResetGetStatusPl, + .pulse = PmResetPulsePl, + }; + + static const PmResetOps pmResetOpsGpioBankIO = { +- .assert = NULL, ++ .resetAssert = NULL, + .getStatus = PmResetGetStatusGpioBankIOs, + .pulse = PmResetPulseGpioBankIOs, + }; +@@ -1885,8 +1885,8 @@ s32 PmResetDoAssert(const PmReset *reset, u32 action) + switch (action) { + case PM_RESET_ACTION_RELEASE: + case PM_RESET_ACTION_ASSERT: +- if (NULL != reset->ops->assert) { +- reset->ops->assert(reset, action); ++ if (NULL != reset->ops->resetAssert) { ++ reset->ops->resetAssert(reset, action); + } else { + status = XST_INVALID_PARAM; + } +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Fixup-core-makefiles.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Fixup-core-makefiles.patch new file mode 100644 index 00000000..b725b4f5 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/0001-zynqmp_pmufw-Fixup-core-makefiles.patch @@ -0,0 +1,46 @@ +From 159269e971d4e0814744ab9f6e3f15902440a436 Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@xilinx.com> +Date: Mon, 13 Sep 2021 13:24:50 -0700 +Subject: [PATCH] zynqmp_pmufw: Fixup core makefile + +The Yocto Project build environment needs to be able to override a few +additional variables that may not be appropriate to do on the regular +command line build version. This Yocto Project specific will allow this +behavior. + +Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> +--- + lib/sw_apps/zynqmp_pmufw/misc/Makefile | 6 ++++-- + 1 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/lib/sw_apps/zynqmp_pmufw/misc/Makefile b/lib/sw_apps/zynqmp_pmufw/misc/Makefile +index a773498512..4203e9c91d 100644 +--- a/lib/sw_apps/zynqmp_pmufw/misc/Makefile ++++ b/lib/sw_apps/zynqmp_pmufw/misc/Makefile +@@ -2,6 +2,8 @@ + COMPILER := mb-gcc + ARCHIVER := mb-gcc-ar + ASSEMBLER := mb-as ++COMPILER_FLAGS := -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul ++EXTRA_COMPILER_FLAGS := -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects + DRIVER_LIB_VERSION = 1.0 + PROCESSOR = psu_pmu_0 + LIBRARIES = ${PROCESSOR}/lib/libxil.a +@@ -40,11 +42,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v9.2 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean + +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/2023.1/0001-versal_fw-Fixup-core-makefiles.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/2023.1/0001-versal_fw-Fixup-core-makefiles.patch new file mode 100644 index 00000000..d6cb0e38 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/2023.1/0001-versal_fw-Fixup-core-makefiles.patch @@ -0,0 +1,101 @@ +From 607322dafb2979affd329ea70a2a7952203188a4 Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Wed, 7 Dec 2022 15:42:15 -0800 +Subject: [PATCH] versal_fw: Fixup core makefiles + +The Yocto Project build environment needs to be able to override a few +additional variables that may not be appropriate to do on the regular +command line build version. This patch preserves the default while +allowing it to be overriden as necessary. + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + lib/sw_apps/versal_plm/misc/versal/Makefile | 6 ++++-- + lib/sw_apps/versal_plm/misc/versal_net/Makefile | 6 ++++-- + lib/sw_apps/versal_psmfw/misc/Makefile | 6 ++++-- + 3 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/lib/sw_apps/versal_plm/misc/versal/Makefile b/lib/sw_apps/versal_plm/misc/versal/Makefile +index 5c8e719e9c..af070716b6 100644 +--- a/lib/sw_apps/versal_plm/misc/versal/Makefile ++++ b/lib/sw_apps/versal_plm/misc/versal/Makefile +@@ -2,6 +2,8 @@ + COMPILER := mb-gcc + ARCHIVER := mb-gcc-ar + ASSEMBLER := mb-as ++COMPILER_FLAGS := -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare ++EXTRA_COMPILER_FLAGS := -g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects + DRIVER_LIB_VERSION = 1.0 + PROCESSOR = psv_pmc_0 + LIBRARIES = ${PROCESSOR}/lib/libxil.a +@@ -40,11 +42,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +diff --git a/lib/sw_apps/versal_plm/misc/versal_net/Makefile b/lib/sw_apps/versal_plm/misc/versal_net/Makefile +index abffa6c5ed..4af5a02001 100644 +--- a/lib/sw_apps/versal_plm/misc/versal_net/Makefile ++++ b/lib/sw_apps/versal_plm/misc/versal_net/Makefile +@@ -2,6 +2,8 @@ + COMPILER := mb-gcc + ARCHIVER := mb-gcc-ar + ASSEMBLER := mb-as ++COMPILER_FLAGS := -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare ++EXTRA_COMPILER_FLAGS := -g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects + DRIVER_LIB_VERSION = 1.0 + PROCESSOR = psx_pmc_0 + LIBRARIES = ${PROCESSOR}/lib/libxil.a +@@ -40,11 +42,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +diff --git a/lib/sw_apps/versal_psmfw/misc/Makefile b/lib/sw_apps/versal_psmfw/misc/Makefile +index 02d85e492e..f6386dcbed 100644 +--- a/lib/sw_apps/versal_psmfw/misc/Makefile ++++ b/lib/sw_apps/versal_psmfw/misc/Makefile +@@ -11,6 +11,8 @@ PAR_SUBDIRS := $(patsubst %/Makefile, %, $(BSP_PARALLEL_MAKEFILES)) + COMPILER := mb-gcc + ARCHIVER := mb-ar + ASSEMBLER := mb-as ++COMPILER_FLAGS := -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare ++EXTRA_COMPILER_FLAGS := -g -ffunction-sections -fdata-sections -Wall -Wextra + + ifneq (,$(findstring win,$(RDI_PLATFORM))) + SHELL = CMD +@@ -41,11 +43,11 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c -mcpu=v10.0 -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra" ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(COMPILER)" "ASSEMBLER=$(ASSEMBLER)" "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS=$(COMPILER_FLAGS)" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.clean: + $(MAKE) -C $(subst /make.clean,,$@) -s clean +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/2023.1/makefile-skip-copy_bsp.sh.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/2023.1/makefile-skip-copy_bsp.sh.patch new file mode 100644 index 00000000..1300c7e1 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/2023.1/makefile-skip-copy_bsp.sh.patch @@ -0,0 +1,104 @@ +From d703670357546d9aab66baea1f6751ba1cbdf7ad Mon Sep 17 00:00:00 2001 +From: Mark Hatle <mark.hatle@amd.com> +Date: Wed, 7 Dec 2022 15:30:23 -0800 +Subject: [PATCH] Prevent makefile from calling copy_bsp.sh + +If we call copy_bsp.sh we will undo any manual compliation steps we +have already done. Avoid this. + +YP integration specific + +Signed-off-by: Mark Hatle <mark.hatle@amd.com> +--- + lib/sw_apps/versal_plm/src/versal/Makefile | 4 ++-- + lib/sw_apps/versal_plm/src/versal_net/Makefile | 4 ++-- + lib/sw_apps/versal_psmfw/src/versal/Makefile | 4 ++-- + lib/sw_apps/versal_psmfw/src/versal_net/Makefile | 6 +++--- + lib/sw_apps/zynqmp_pmufw/src/Makefile | 4 ++-- + 5 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/lib/sw_apps/versal_plm/src/versal/Makefile b/lib/sw_apps/versal_plm/src/versal/Makefile +index d1ebd1d374..bfb8c83adb 100644 +--- a/lib/sw_apps/versal_plm/src/versal/Makefile ++++ b/lib/sw_apps/versal_plm/src/versal/Makefile +@@ -32,8 +32,8 @@ $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + + $(LIBS): +- echo "Copying BSP files" +- ../../misc/versal/copy_bsp.sh ++ #echo "Copying BSP files" ++ #../../misc/versal/copy_bsp.sh + echo "Compiling bsp" + $(MAKE) -C ../../misc/versal/versal_plm_bsp + +diff --git a/lib/sw_apps/versal_plm/src/versal_net/Makefile b/lib/sw_apps/versal_plm/src/versal_net/Makefile +index 39c7aa38e3..081d8f1b2e 100644 +--- a/lib/sw_apps/versal_plm/src/versal_net/Makefile ++++ b/lib/sw_apps/versal_plm/src/versal_net/Makefile +@@ -32,8 +32,8 @@ $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + + $(LIBS): +- echo "Copying BSP files" +- ../../misc/versal_net/copy_bsp.sh ++ #echo "Copying BSP files" ++ #../../misc/versal_net/copy_bsp.sh + echo "Compiling bsp" + $(MAKE) -C ../../misc/versal_net/versal_plm_bsp + +diff --git a/lib/sw_apps/versal_psmfw/src/versal/Makefile b/lib/sw_apps/versal_psmfw/src/versal/Makefile +index 1572bbbca9..ce182acaa7 100644 +--- a/lib/sw_apps/versal_psmfw/src/versal/Makefile ++++ b/lib/sw_apps/versal_psmfw/src/versal/Makefile +@@ -34,8 +34,8 @@ $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + + $(LIBS): +- echo "Copying BSP files" +- ../../misc/copy_bsp.sh ++ #echo "Copying BSP files" ++ #../../misc/copy_bsp.sh + echo "Compiling bsp" + $(MAKE) -C ../../misc/versal_psmfw_bsp + +diff --git a/lib/sw_apps/versal_psmfw/src/versal_net/Makefile b/lib/sw_apps/versal_psmfw/src/versal_net/Makefile +index a72ffa1de2..3670310daa 100644 +--- a/lib/sw_apps/versal_psmfw/src/versal_net/Makefile ++++ b/lib/sw_apps/versal_psmfw/src/versal_net/Makefile +@@ -34,8 +34,8 @@ $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + + $(LIBS): +- echo "Copying BSP files" +- ../../misc/versal_net/copy_bsp.sh ++ #echo "Copying BSP files" ++ #../../misc/versal_net/copy_bsp.sh + echo "Compiling bsp" + $(MAKE) -C ../../misc/versal_net/versal_psmfw_bsp + +@@ -44,4 +44,4 @@ $(LIBS): + + clean: + rm -rf $(OBJS) $(LIBS) $(EXEC) *.o *.d ../common/*.o ../common/*.d +- rm -rf ../../misc/versal_net/versal_psmfw_bsp +\ No newline at end of file ++ rm -rf ../../misc/versal_net/versal_psmfw_bsp +diff --git a/lib/sw_apps/zynqmp_pmufw/src/Makefile b/lib/sw_apps/zynqmp_pmufw/src/Makefile +index 1750c0a329..17f6a545ea 100644 +--- a/lib/sw_apps/zynqmp_pmufw/src/Makefile ++++ b/lib/sw_apps/zynqmp_pmufw/src/Makefile +@@ -28,8 +28,8 @@ $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + + $(LIBS): +- echo "Copying BSP files" +- ../misc/copy_bsp.sh ++ #echo "Copying BSP files" ++ #../misc/copy_bsp.sh + echo "Compiling bsp" + $(MAKE) -C ../misc/zynqmp_pmufw_bsp + +-- +2.17.1 + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/fsbl-fixups.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/fsbl-fixups.patch new file mode 100644 index 00000000..2c3b4e67 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/fsbl-fixups.patch @@ -0,0 +1,230 @@ +Index: git/lib/sw_apps/zynqmp_fsbl/misc/makefile +=================================================================== +--- git.orig/lib/sw_apps/zynqmp_fsbl/misc/makefile ++++ git/lib/sw_apps/zynqmp_fsbl/misc/makefile +@@ -4,15 +4,46 @@ DRIVER_LIB_VERSION = 1.0 + PROC ?= a53 + A53_STATE ?= 64 + ++ifeq "${CROSS_COMP}" "armclang" ++LTO_FLAGS = -mfpu=fp-armv8 -Wall -Wextra -march=armv8-a --target=aarch64-arm-none-eabi -Oz ++else ++LTO_FLAGS = -Wall -Wextra -Os -flto -ffat-lto-objects ++endif ++ + ifeq "${PROC}" "a53" + PROCESSOR = zynqmp_fsbl_bsp/psu_cortexa53_0 ++ifeq "${A53_STATE}" "64" ++ifeq "${CROSS_COMP}" "armclang" ++CC := armclang --target=aarch64-arm-none-eabi ++AS := armasm ++LINKER := armlink ++ARCHIVER := armar ++EXTRA_COMPILER_FLAGS := -g $(LTO_FLAGS) ++else ++CC := $(CROSS)aarch64-none-elf-gcc ++AS := $(CROSS)aarch64-none-elf-gcc ++LINKER := $(CROSS)aarch64-none-elf-gcc ++ARCHIVER := $(CROSS)aarch64-none-elf-ar ++EXTRA_COMPILER_FLAGS := -g $(LTO_FLAGS) ++endif ++endif ++ifeq "${A53_STATE}" "32" ++CC := $(CROSS)arm-none-eabi-gcc ++AS := $(CROSS)arm-none-eabi-gcc ++LINKER := $(CROSS)arm-none-eabi-gcc ++ARCHIVER := $(CROSS)arm-none-eabi-ar ++EXTRA_COMPILER_FLAGS := -g -DARMA53_32 -mfpu=vfpv3 -mfloat-abi=hard -march=armv7-a $(LTO_FLAGS) ++endif + endif + ifeq "${PROC}" "r5" + PROCESSOR = zynqmp_fsbl_bsp/psu_cortexr5_0 ++CC := $(CROSS)armr5-none-eabi-gcc ++AS := $(CROSS)armr5-none-eabi-gcc ++LINKER := $(CROSS)armr5-none-eabi-gcc ++ARCHIVER := $(CROSS)armr5-none-eabi-ar ++EXTRA_COMPILER_FLAGS := -g -DARMR5 -Wall -Wextra -mfloat-abi=hard -mfpu=vfpv3-d16 $(LTO_FLAGS) + endif +-LTO_FLAGS = -Wall -Wextra -Os -flto -ffat-lto-objects + OTHER_FLAGS = -mfpu=vfpv3 -mfloat-abi=hard +-LTO_ARMCLANG_FLAGS = -mfpu=fp-armv8 -Wall -Wextra -march=armv8-a --target=aarch64-arm-none-eabi -Oz + LIBRARIES = ${PROCESSOR}/lib/libxil.a + BSP_MAKEFILES := $(wildcard $(PROCESSOR)/libsrc/*/src/Makefile) + SUBDIRS := $(patsubst %/Makefile, %, $(BSP_MAKEFILES)) +@@ -44,46 +75,13 @@ $(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/ + + %/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,) + @echo "Running Make include in $(subst /make.include,,$@)" +-ifeq "${PROC}" "a53" +-ifeq "${A53_STATE}" "64" +-ifeq "${CROSS_COMP}" "armclang" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=armclang" \ +- "ARCHIVER=armar" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=-g $(LTO_ARMCLANG_FLAGS)" +-else +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=aarch64-none-elf-gcc" \ +- "ARCHIVER=aarch64-none-elf-ar" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=-g $(LTO_FLAGS)" +-endif +-endif +-ifeq "${A53_STATE}" "32" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=arm-none-eabi-gcc" \ +- "ARCHIVER=arm-none-eabi-ar" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=-DARMA53_32 -mfpu=vfpv3 -mfloat-abi=hard -g -march=armv7-a $(LTO_FLAGS)" +-endif +-endif +-ifeq "${PROC}" "r5" +- $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=armr5-none-eabi-gcc" \ +- "ARCHIVER=armr5-none-eabi-ar" "COMPILER_FLAGS= -O2 -c -mcpu=cortex-r5" "EXTRA_COMPILER_FLAGS=-g -DARMR5 -Wall -Wextra -mfloat-abi=hard -mfpu=vfpv3-d16 $(LTO_FLAGS)" +-endif ++ $(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=$(CC)" \ ++ "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + %/make.libs: include + @echo "Running Make libs in $(subst /make.libs,,$@)" +-ifeq "${PROC}" "a53" +-ifeq "${A53_STATE}" "64" +-ifeq "${CROSS_COMP}" "armclang" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=armclang" \ +- "ARCHIVER=armar" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=-g $(LTO_ARMCLANG_FLAGS)" +-else +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=aarch64-none-elf-gcc" \ +- "ARCHIVER=aarch64-none-elf-ar" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=-g $(LTO_FLAGS)" +-endif +-endif +-ifeq "${A53_STATE}" "32" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=arm-none-eabi-gcc" \ +- "ARCHIVER=arm-none-eabi-ar" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=-DARMA53_32 -mfpu=vfpv3 -mfloat-abi=hard -g -march=armv7-a $(LTO_FLAGS)" +-endif +-endif +-ifeq "${PROC}" "r5" +- $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=armr5-none-eabi-gcc" "ARCHIVER=armr5-none-eabi-ar" "COMPILER_FLAGS= -O2 -c -mcpu=cortex-r5" "EXTRA_COMPILER_FLAGS=-g -DARMR5 -Wall -Wextra -mfloat-abi=hard -mfpu=vfpv3-d16 $(LTO_FLAGS)" +-endif ++ $(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=$(CC)" \ ++ "ARCHIVER=$(ARCHIVER)" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=$(EXTRA_COMPILER_FLAGS)" + + clean: + rm -f ${PROCESSOR}/lib/libxil.a +Index: git/lib/sw_apps/zynqmp_fsbl/src/Makefile +=================================================================== +--- git.orig/lib/sw_apps/zynqmp_fsbl/src/Makefile ++++ git/lib/sw_apps/zynqmp_fsbl/src/Makefile +@@ -49,6 +49,7 @@ ifeq '$(CROSS_COMP)' 'armclang' + CC := armclang --target=aarch64-arm-none-eabi + AS := armasm + LINKER := armlink ++ARCHIVER := armar + ECFLAGS = -DARMA53_64 -Wall -Oz -flto -c -march=armv8-a -mcpu=cortex-a53 + ASFLAGS = --cpu=8-A.64 --fpu=fp-armv8 + LSCRIPT := --scatter=scatter_a53_64.scat +@@ -59,8 +60,9 @@ else + CC := $(CROSS)aarch64-none-elf-gcc + AS := $(CROSS)aarch64-none-elf-gcc + LINKER := $(CROSS)aarch64-none-elf-gcc ++ARCHIVER := $(CROSS)aarch64-none-elf-ar + DUMP := $(CROSS)aarch64-none-elf-objdump -xSD +-ECFLAGS = -march=armv8-a -DARMA53_$(A53_STATE) -Os -flto -ffat-lto-objects ++ECFLAGS := -march=armv8-a -DARMA53_$(A53_STATE) -Os -flto -ffat-lto-objects + LSCRIPT := -Tlscript_a53.ld + LDFLAGS := -Wl,--start-group,-lxil,-lxilffs,-lxilsecure,-lxilpm,-lgcc,-lc,--end-group -L$(LIBPATH) -L./ -Wl,--build-id=none + OBJS += $(patsubst %.S, %.o, $(S_SOURCES)) +@@ -69,6 +71,7 @@ else + CC := $(CROSS)arm-none-eabi-gcc + AS := $(CROSS)arm-none-eabi-gcc + LINKER := $(CROSS)arm-none-eabi-gcc ++ARCHIVER := $(CROSS)arm-none-eabi-ar + DUMP := $(CROSS)arm-none-eabi-objdump -xSD + ECFLAGS := -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -DARMA53_$(A53_STATE) -Os -flto -ffat-lto-objects + LSCRIPT := -Tlscript.ld +@@ -80,6 +83,7 @@ endif + ifeq "$(CC)" "armcc" + AS=armasm + LINKER=armlink ++ARCHIVER=armar + CFLAGS += -c --c99 --wchar32 + CC_FLAGS += --cpu=Cortex-A9 --fpu=VFPv3_FP16 + LDFLAGS = --entry=_vector_table "$(LIBPATH)/libxil.a(*.o)" --no_search_dynamic_libraries --userlibpath=$(LIBPATH),. --library=xil +@@ -106,7 +110,8 @@ $(LIBS): + echo "Copying BSP files" + ../misc/copy_bsp.sh $(BOARD) $(PROC) $(A53_STATE) $(CROSS_COMP) + echo "Compiling bsp" +- make -C ../misc BOARD=$(BOARD) PROC=$(PROC) A53_STATE=$(A53_STATE) CROSS_COMP=$(CROSS_COMP) ++ make -C ../misc BOARD=$(BOARD) PROC=$(PROC) A53_STATE=$(A53_STATE) CROSS_COMP=$(CROSS_COMP) \ ++ CROSS="$(CROSS)" CC="$(CC)" AS="$(AS)" LINKER="$(LINKER)" ARCHIVER="$(ARCHIVER)" + + %.o:%.c + $(CC) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) -c $< -o $@ $(INCLUDEPATH) +Index: git/lib/sw_apps/zynq_fsbl/src/Makefile +=================================================================== +--- git.orig/lib/sw_apps/zynq_fsbl/src/Makefile ++++ git/lib/sw_apps/zynq_fsbl/src/Makefile +@@ -31,21 +31,22 @@ INCLUDEPATH := -I$(BSP_DIR)/ps7_cortexa9 + LIBPATH := $(BSP_DIR)/ps7_cortexa9_0/lib + + +-ifeq "$(CC)" "arm-none-eabi-gcc" +-AS=arm-none-eabi-gcc +-CFLAGS=-Wall -O0 -g3 -c -fmessage-length=0 +-LINKER=arm-none-eabi-gcc +-LDFLAGS = -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lxilffs,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lrsa,-lxil,-lgcc,-lc,--end-group +-LD1FLAGS = -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -Wl,-T -Wl,lscript.ld -L$(LIBPATH) -specs=../misc/Xilinx.spec +-ECFLAGS = -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard +-endif +-ifeq "$(CC)" "armcc" ++ifeq "${CROSS_COMP}" "armclang" + AS=armasm + LINKER=armlink + CFLAGS += -c --c99 --wchar32 ++EC_FLAGS=--debug --wchar32 + CC_FLAGS += --cpu=Cortex-A9 --fpu=VFPv3_FP16 + LDFLAGS = --entry=_vector_table "$(LIBPATH)/libxil.a(*.o)" --no_search_dynamic_libraries --userlibpath=$(LIBPATH),. --library=xil,xilffs,rsa + LSCRIPT = --scatter="scatter.scat" ++else ++AS=arm-none-eabi-gcc ++CFLAGS=-Wall -O0 -g3 -c -fmessage-length=0 ++EC_FLAGS=-g ++LINKER=arm-none-eabi-gcc ++LDFLAGS = -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lxilffs,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lrsa,-lxil,-lgcc,-lc,--end-group ++LD1FLAGS = -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -Wl,-T -Wl,lscript.ld -L$(LIBPATH) -specs=../misc/Xilinx.spec ++ECFLAGS = -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard + endif + + all: $(EXEC) +@@ -53,33 +54,23 @@ all: $(EXEC) + $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(LINKER) $(LD1FLAGS) -o $@ $(OBJS) $(LDFLAGS) + rm -rf $(OBJS) +- +- +-$(LIBS): ++ ++$(LIBS): + echo "Copying BSP files" + $(BSP_DIR)/copy_bsp.sh $(BOARD) $(CC) + echo "Compiling bsp" +- if [ $(CC) == "arm-none-eabi-gcc" ]; then \ +- make -C $(BSP_DIR) -k all "CC=arm-none-eabi-gcc" "AR=arm-none-eabi-ar" "C_FLAGS=-O2 -c" "EC_FLAGS=-g"; \ +- elif [ $(CC) == "armcc" ]; then \ +- make -C $(BSP_DIR) -k all "CC=armcc" "AR=armar" "C_FLAGS= -O2 -c" "EC_FLAGS=--debug --wchar32"; \ +- fi; ++ make -C $(BSP_DIR) -k all "CC=$(CC)" "AR=$(AR)" "C_FLAGS=$(C_FLAGS)" "EC_FLAGS=$(EC_FLAGS)" + + %.o:%.c + $(CC) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) -c $< -o $@ $(INCLUDEPATH) + ++ifneq "$(CROSS_COMP)" "armclang" + %.o:%.S +- if [ $(CC) == "arm-none-eabi-gcc" ]; then \ +- $(AS) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) -c $< -o $@ $(INCLUDEPATH); \ +- elif [ $(CC) == "armcc" ]; then \ +- $(CC) $(INCLUDEPATH) -E -o fsbl_handoff.s fsbl_handoff.S; \ +- $(AS) $(CC_FLAGS) -c fsbl_handoff.s -o fsbl_handoff.o $(INCLUDEPATH); \ +- rm fsbl_handoff.s; \ +- fi; +- +- ++ $(AS) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) -c $< -o $@ $(INCLUDEPATH) ++ + %.o:%.s + $(AS) $(CC_FLAGS) $(CFLAGS) $(ECFLAGS) -c $< -o $@ $(INCLUDEPATH) ++endif + + clean: + rm -rf $(OBJS) $(BSP_DIR)/ps7_cortexa9_0 $(EXEC) diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/makefile-skip-copy_bsp.sh.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/makefile-skip-copy_bsp.sh.patch new file mode 100644 index 00000000..5b9cc71b --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/makefile-skip-copy_bsp.sh.patch @@ -0,0 +1,54 @@ +Prevent makefile from calling copy_bsp.sh + +If we call copy_bsp.sh we will undo any manual compliation steps we +have already done. Avoid this. + +YP integration specific + +Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> + +diff --git a/lib/sw_apps/zynqmp_pmufw/src/Makefile b/lib/sw_apps/zynqmp_pmufw/src/Makefile +index 1750c0a329..17f6a545ea 100644 +--- a/lib/sw_apps/zynqmp_pmufw/src/Makefile ++++ b/lib/sw_apps/zynqmp_pmufw/src/Makefile +@@ -28,8 +28,8 @@ $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + + $(LIBS): +- echo "Copying BSP files" +- ../misc/copy_bsp.sh ++ #echo "Copying BSP files" ++ #../misc/copy_bsp.sh + echo "Compiling bsp" + $(MAKE) -C ../misc/zynqmp_pmufw_bsp + +diff --git a/lib/sw_apps/versal_plm/src/Makefile b/lib/sw_apps/versal_plm/src/Makefile +index b4536e8584..a8643ecd47 100644 +--- a/lib/sw_apps/versal_plm/src/Makefile ++++ b/lib/sw_apps/versal_plm/src/Makefile +@@ -30,8 +30,8 @@ $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + + $(LIBS): +- echo "Copying BSP files" +- ../misc/copy_bsp.sh ++ #echo "Copying BSP files" ++ #../misc/copy_bsp.sh + echo "Compiling bsp" + $(MAKE) -C ../misc/versal_plm_bsp + +diff --git a/lib/sw_apps/versal_psmfw/src/Makefile b/lib/sw_apps/versal_psmfw/src/Makefile +index fdfee0a092..1ed664114b 100644 +--- a/lib/sw_apps/versal_psmfw/src/Makefile ++++ b/lib/sw_apps/versal_psmfw/src/Makefile +@@ -29,8 +29,8 @@ $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + + $(LIBS): +- echo "Copying BSP files" +- ../misc/copy_bsp.sh ++ #echo "Copying BSP files" ++ #../misc/copy_bsp.sh + echo "Compiling bsp" + $(MAKE) -C ../misc/versal_psmfw_bsp + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/zynqmp_pmufw-fixup.patch b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/zynqmp_pmufw-fixup.patch new file mode 100644 index 00000000..50ce7bcb --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/embeddedsw/zynqmp_pmufw-fixup.patch @@ -0,0 +1,19 @@ +Fix incorrect copy that triggers a failure: + +| cp: -r not specified; omitting directory '../misc/../../../../lib/bsp/standalone/src/common/clocking' + +Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> + +diff --git a/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh b/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh +index be8616968e..c3eca3f092 100755 +--- a/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh ++++ b/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh +@@ -84,7 +84,7 @@ cp -r $BSP_DIR/libsrc/xilskey/src/include/*.h $BSP_DIR/include/ + BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilskey/src/Makefile" + + # copy bsp standalone code +-cp $STANDALONE_DIR/common/* $BSP_DIR/libsrc/standalone/src/ ++cp -r $STANDALONE_DIR/common/* $BSP_DIR/libsrc/standalone/src/ + cp $STANDALONE_DIR/microblaze/* $BSP_DIR/libsrc/standalone/src/ + cp -r $STANDALONE_DIR/profile $BSP_DIR/libsrc/standalone/src/ + cp $WORKING_DIR/bspconfig.h $BSP_DIR/include diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware.inc b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware.inc new file mode 100644 index 00000000..34051bfa --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware.inc @@ -0,0 +1,76 @@ +DESCRIPTION = "First Stage Bootloader" + +inherit xlnx-embeddedsw deploy + +COMPATIBLE_HOST = ".*-(elf|.*eabi)" +COMPATIBLE_MACHINE = "none" +COMPATIBLE_MACHINE:zynq = ".*" +COMPATIBLE_MACHINE:zynqmp = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/git" + +APP_DIR = "undefined" +APP_DIR:zynq = "zynq_fsbl" +APP_DIR:zynqmp = "zynqmp_fsbl" + +B = "${S}/lib/sw_apps/${APP_DIR}/src" + +# The makefile does not handle parallelization +PARALLEL_MAKE = "-j1" + +do_configure() { + : +} + +COMPILER = "${CC}" +COMPILER_FLAGS = "-O2 -c" +EXTRA_COMPILER_FLAGS = "-g -Wall -Wextra -Os -flto -ffat-lto-objects" +ARCHIVER = "${AR}" + +BSP_DIR ?= "${B}/../misc/undefined" +BSP_DIR:zynq ?= "${B}/../misc/zynq_fsbl_bsp" +BSP_DIR:zynqmp ?= "${B}/../misc/zynqmp_fsbl_bsp" +BSP_TARGETS_DIR ?= "${BSP_DIR}/psu_cortexa53_0/libsrc" + +# FSBL components expect AS to be CC. +AS = "${CC}" +LINKER = "${CC}" +DUMP = "${OBJDUMP} -xSD" + +def bsp_make_vars(d): + s = ["COMPILER", "CC", "COMPILER_FLAGS", "EXTRA_COMPILER_FLAGS", "ARCHIVER", "AR", "AS", "LINKER", "DUMP"] + return " ".join(["\"%s=%s\"" % (v, d.getVar(v)) for v in s]) + +EXTRA_OEMAKE = "${@bsp_make_vars(d)}" + +ARM_INSTRUCTION_SET:eabi:arm = "arm" +do_compile() { + oe_runmake +} + +do_install() { + : +} + +PACKAGES = "" + +# This is the default in most BSPs. A MACHINE.conf can override this! +FSBL_IMAGE_NAME ??= "fsbl-${MACHINE}" + +inherit image-artifact-names + +FSBL_BASE_NAME ?= "${FSBL_IMAGE_NAME}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +ESW_COMPONENT ??= "fsbl.elf" + +do_deploy() { + install -Dm 0644 ${B}/${ESW_COMPONENT} ${DEPLOYDIR}/${FSBL_BASE_NAME}.elf + ln -sf ${FSBL_BASE_NAME}.elf ${DEPLOYDIR}/${FSBL_IMAGE_NAME}.elf +} + +addtask deploy before do_build after do_install + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2022.1.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2022.1.bb new file mode 100644 index 00000000..3f9740a0 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2022.1.bb @@ -0,0 +1,11 @@ +require fsbl-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://fsbl-fixups.patch \ + " + +# This version does not build for zynq +COMPATIBLE_MACHINE:zynq = "none" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2022.2.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2022.2.bb new file mode 100644 index 00000000..3f9740a0 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2022.2.bb @@ -0,0 +1,11 @@ +require fsbl-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://fsbl-fixups.patch \ + " + +# This version does not build for zynq +COMPATIBLE_MACHINE:zynq = "none" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2023.1.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2023.1.bb new file mode 100644 index 00000000..8816dc4d --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2023.1.bb @@ -0,0 +1,11 @@ +require fsbl-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://fsbl-fixups.patch \ + " + +# This version does not build for zynq +COMPATIBLE_MACHINE:zynq = "none" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2023.2.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2023.2.bb new file mode 100644 index 00000000..8816dc4d --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_2023.2.bb @@ -0,0 +1,11 @@ +require fsbl-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://fsbl-fixups.patch \ + " + +# This version does not build for zynq +COMPATIBLE_MACHINE:zynq = "none" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_git.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_git.bb new file mode 100644 index 00000000..f5e55ecc --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-firmware_git.bb @@ -0,0 +1,14 @@ +# Only should be used for development +DEFAULT_PREFERENCE = "-1" + +require fsbl-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://fsbl-fixups.patch \ + " + +# This version does not build for zynq +COMPATIBLE_MACHINE:zynq = "none" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-fw-cfg.inc b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-fw-cfg.inc new file mode 100644 index 00000000..ebd9e00a --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl-fw-cfg.inc @@ -0,0 +1,7 @@ +# Default fsbl configuration, using fsbl-fw multiconfig +# +# This requires MULTICONFIG += "fsbl-fw" to be added to local.conf +FSBL_DEPENDS ?= "" +FSBL_MCDEPENDS ?= "mc::fsbl-fw:fsbl-firmware:do_deploy" +FSBL_DEPLOY_DIR ?= "${TOPDIR}/tmp-fsbl-fw/deploy/images/${MACHINE}" +FSBL_IMAGE_NAME ?= "fsbl-${MACHINE}" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl.bbappend b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl.bbappend new file mode 100644 index 00000000..4507a0c7 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/fsbl.bbappend @@ -0,0 +1,18 @@ +# Include the fsbl-fw setting, if it's enabled +FSBL_INC = "${@bb.utils.contains('BBMULTICONFIG', 'fsbl-fw', 'fsbl-fw-cfg.inc', '', d)}" +require ${FSBL_INC} + +def check_fsbl_variables(d): + # If both are blank, the user MUST pass in the path to the firmware! + if not d.getVar('FSBL_DEPENDS') and not d.getVar('FSBL_MCDEPENDS'): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + if not os.path.exists(d.getVar('FSBL_FILE') + ".elf"): + if not d.getVar('WITHIN_EXT_SDK'): + raise bb.parse.SkipRecipe("The expect file %s.elf is not available.\nSet FSBL_FILE to the path with a precompiled FSBL binary or you may need to enable BBMULTICONFIG += 'fsbl-fw' to generate it." % d.getVar('FSBL_FILE')) + else: + # We found the file, so be sure to track it + d.setVar('SRC_URI', 'file://${FSBL_FILE}.elf') + d.setVarFlag('do_install', 'file-checksums', '${FSBL_FILE}.elf:True') + d.setVarFlag('do_deploy', 'file-checksums', '${FSBL_FILE}.elf:True') diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware.inc b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware.inc new file mode 100644 index 00000000..1551f776 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware.inc @@ -0,0 +1,86 @@ +DESCRIPTION = "Platform Loader and Manager" +SUMMARY = "Platform Loader and Manager for Versal devices" + +inherit xlnx-embeddedsw deploy + +COMPATIBLE_HOST = "microblaze.*-elf" +COMPATIBLE_MACHINE = "none" +COMPATIBLE_MACHINE:versal = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/git" +B = "${S}/lib/sw_apps/versal_plm/src" + +# The makefile does not handle parallelization +PARALLEL_MAKE = "-j1" + +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + ${B}/../misc/copy_bsp.sh +} + +# All do_compiles need this, even if it's overriden +MB_OBJCOPY ??= "${OBJCOPY}" + +# Only add a dependency if we need to use OUR binutils +DEPENDS .= "${@' virtual/${TARGET_PREFIX}binutils' if d.getVar('MB_OBJCOPY') == d.getVar('OBJCOPY') else ''}" + +COMPILER = "${CC}" +COMPILER_FLAGS = "-O2 -c" +EXTRA_COMPILER_FLAGS = "-g -Wall -Wextra -Os -flto -ffat-lto-objects" +ARCHIVER = "${AR}" + +BSP_DIR ?= "${B}/../misc/versal_plm_bsp" +BSP_TARGETS_DIR ?= "${BSP_DIR}/psv_pmc_0/libsrc" + +def bsp_make_vars(d): + s = ["COMPILER", "CC", "COMPILER_FLAGS", "EXTRA_COMPILER_FLAGS", "ARCHIVER", "AR", "AS"] + return " ".join(["\"%s=%s\"" % (v, d.getVar(v)) for v in s]) + +EXTRA_OEMAKE = "${@bsp_make_vars(d)}" + +do_compile() { + # the Makefile in ${B}/../misc/Makefile, does not handle CC, AR, AS, etc + # properly. So do its job manually. Preparing the includes first, then libs. + for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do + oe_runmake -C $(dirname $i) -s include + done + for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do + oe_runmake -C $(dirname $i) -s libs + done + + # --build-id=none is required due to linker script not defining a location for it. + # Again, recipe-systoot include is necessary + oe_runmake CC_FLAGS="-MMD -MP -Wl,--build-id=none -I${STAGING_DIR_TARGET}/usr/include" + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} + +do_install() { + : +} + +PACKAGES = "" + +# This is the default in most BSPs. A MACHINE.conf can override this! +PLM_IMAGE_NAME ??= "plm-${MACHINE}" + +inherit image-artifact-names + +PLM_BASE_NAME ?= "${PLM_IMAGE_NAME}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +ESW_COMPONENT ??= "plm.elf" + +do_deploy() { + install -Dm 0644 ${B}/${ESW_COMPONENT} ${DEPLOYDIR}/${PLM_BASE_NAME}.elf + ln -sf ${PLM_BASE_NAME}.elf ${DEPLOYDIR}/${PLM_IMAGE_NAME}.elf + install -m 0644 ${B}/${ESW_COMPONENT}.bin ${DEPLOYDIR}/${PLM_BASE_NAME}.bin + ln -sf ${PLM_BASE_NAME}.bin ${DEPLOYDIR}/${PLM_IMAGE_NAME}.bin +} + +addtask deploy before do_build after do_install + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2022.1.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2022.1.bb new file mode 100644 index 00000000..cc810241 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2022.1.bb @@ -0,0 +1,16 @@ +require plm-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2022.2.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2022.2.bb new file mode 100644 index 00000000..cc810241 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2022.2.bb @@ -0,0 +1,16 @@ +require plm-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2023.1.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2023.1.bb new file mode 100644 index 00000000..37861b75 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2023.1.bb @@ -0,0 +1,29 @@ +require plm-firmware.inc + +# Separate build directories for versal and versal-net +SOC_DIR = "versal" +SOC_DIR:versal-net = "versal_net" +B = "${S}/lib/sw_apps/versal_plm/src/${SOC_DIR}" + +BSP_DIR ?= "${B}/../../misc/versal_plm_bsp" + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + ${B}/../../misc/${SOC_DIR}/copy_bsp.sh +} + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2023.2.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2023.2.bb new file mode 100644 index 00000000..37861b75 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_2023.2.bb @@ -0,0 +1,29 @@ +require plm-firmware.inc + +# Separate build directories for versal and versal-net +SOC_DIR = "versal" +SOC_DIR:versal-net = "versal_net" +B = "${S}/lib/sw_apps/versal_plm/src/${SOC_DIR}" + +BSP_DIR ?= "${B}/../../misc/versal_plm_bsp" + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + ${B}/../../misc/${SOC_DIR}/copy_bsp.sh +} + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_git.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_git.bb new file mode 100644 index 00000000..bbc7519f --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plm-firmware_git.bb @@ -0,0 +1,32 @@ +# Only should be used for development +DEFAULT_PREFERENCE = "-1" + +require plm-firmware.inc + +# Separate build directories for versal and versal-net +SOC_DIR = "versal" +SOC_DIR:versal-net = "versal_net" +B = "${S}/lib/sw_apps/versal_plm/src/${SOC_DIR}" + +BSP_DIR ?= "${B}/../../misc/versal_plm_bsp" + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + ${B}/../../misc/${SOC_DIR}/copy_bsp.sh +} + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/plmfw.bbappend b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plmfw.bbappend new file mode 100644 index 00000000..49c897e1 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/plmfw.bbappend @@ -0,0 +1,26 @@ +# Include the versal-fw setting, if it's enabled +PLMFW_INC = "${@bb.utils.contains('BBMULTICONFIG', 'versal-fw', 'versal-fw-cfg.inc', '', d)}" +require ${PLMFW_INC} + +def check_plm_vars(d): + # If both are blank, the user MUST pass in the path to the firmware! + if not d.getVar('PLM_DEPENDS') and not d.getVar('PLM_MCDEPENDS'): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + msg = "" + fail = False + if not os.path.exists(d.getVar('PLM_FILE') + ".elf"): + msg = msg + "The expected file %s.elf is not available. " % d.getVar('PLM_FILE') + fail = True + if not os.path.exists(d.getVar('PLM_FILE') + ".bin"): + msg = msg + "The expected file %s.bin is not available. " % d.getVar('PLM_FILE') + fail = True + if fail: + if not d.getVar('WITHIN_EXT_SDK'): + raise bb.parse.SkipRecipe("%s\nEither specify PLM_FILE, or you may need to enable BBMULTICONFIG += 'versal-fw' to generate it." % msg) + else: + # We found the file, so be sure to track it + d.setVar('SRC_URI', 'file://${PLM_FILE}.elf file://${PLM_FILE}.bin') + d.setVarFlag('do_install', 'file-checksums', '${PLM_FILE}.elf:True') + d.setVarFlag('do_deploy', 'file-checksums', '${PLM_FILE}.elf:True ${PLM_FILE}.bin:True') diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware.inc b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware.inc new file mode 100644 index 00000000..ed3ac959 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware.inc @@ -0,0 +1,85 @@ +DESCRIPTION = "PMU Firmware" + +inherit xlnx-embeddedsw deploy + +COMPATIBLE_HOST = "microblaze.*-elf" +COMPATIBLE_MACHINE = "none" +COMPATIBLE_MACHINE:zynqmp = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/git" +B = "${S}/lib/sw_apps/zynqmp_pmufw/src" + +# The makefile does not handle parallelization +PARALLEL_MAKE = "-j1" + +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + ${B}/../misc/copy_bsp.sh +} + +# All do_compiles need this, even if it's overriden +MB_OBJCOPY ??= "${OBJCOPY}" + +# Only add a dependency if we need to use OUR binutils +DEPENDS .= "${@' virtual/${TARGET_PREFIX}binutils' if d.getVar('MB_OBJCOPY') == d.getVar('OBJCOPY') else ''}" + +COMPILER = "${CC}" +COMPILER_FLAGS = "-O2 -c" +EXTRA_COMPILER_FLAGS = "-g -Wall -Wextra -Os -flto -ffat-lto-objects" +ARCHIVER = "${AR}" + +BSP_DIR ?= "${B}/../misc/zynqmp_pmufw_bsp" +BSP_TARGETS_DIR ?= "${BSP_DIR}/psu_pmu_0/libsrc" + +def bsp_make_vars(d): + s = ["COMPILER", "CC", "COMPILER_FLAGS", "EXTRA_COMPILER_FLAGS", "ARCHIVER", "AR", "AS"] + return " ".join(["\"%s=%s\"" % (v, d.getVar(v)) for v in s]) + +EXTRA_OEMAKE = "${@bsp_make_vars(d)}" + +do_compile() { + # the Makefile in ${B}/../misc/Makefile, does not handle CC, AR, AS, etc + # properly. So do its job manually. Preparing the includes first, then libs. + for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do + oe_runmake -C $(dirname $i) -s include + done + for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do + oe_runmake -C $(dirname $i) -s libs + done + + # --build-id=none is required due to linker script not defining a location for it. + # Again, recipe-systoot include is necessary + oe_runmake CC_FLAGS="-MMD -MP -Wl,--build-id=none -I${STAGING_DIR_TARGET}/usr/include" + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} + +do_install() { + : +} + +PACKAGES = "" + +# This is the default in most BSPs. A MACHINE.conf can override this! +PMU_FIRMWARE_IMAGE_NAME ??= "pmu-firmware-${MACHINE}" + +inherit image-artifact-names + +PMU_FIRMWARE_BASE_NAME ?= "${PMU_FIRMWARE_IMAGE_NAME}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +ESW_COMPONENT ??= "executable.elf" + +do_deploy() { + install -Dm 0644 ${B}/${ESW_COMPONENT} ${DEPLOYDIR}/${PMU_FIRMWARE_BASE_NAME}.elf + ln -sf ${PMU_FIRMWARE_BASE_NAME}.elf ${DEPLOYDIR}/${PMU_FIRMWARE_IMAGE_NAME}.elf + install -m 0644 ${B}/${ESW_COMPONENT}.bin ${DEPLOYDIR}/${PMU_FIRMWARE_BASE_NAME}.bin + ln -sf ${PMU_FIRMWARE_BASE_NAME}.bin ${DEPLOYDIR}/${PMU_FIRMWARE_IMAGE_NAME}.bin +} + +addtask deploy before do_build after do_install + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2022.1.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2022.1.bb new file mode 100644 index 00000000..2c554d6d --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2022.1.bb @@ -0,0 +1,16 @@ +require pmu-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-zynqmp_pmufw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2022.2.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2022.2.bb new file mode 100644 index 00000000..2c554d6d --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2022.2.bb @@ -0,0 +1,16 @@ +require pmu-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-zynqmp_pmufw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2023.1.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2023.1.bb new file mode 100644 index 00000000..fe6deddc --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2023.1.bb @@ -0,0 +1,16 @@ +require pmu-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-zynqmp_pmufw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2023.2.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2023.2.bb new file mode 100644 index 00000000..fe6deddc --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_2023.2.bb @@ -0,0 +1,16 @@ +require pmu-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-zynqmp_pmufw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_git.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_git.bb new file mode 100644 index 00000000..c55cd149 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmu-firmware_git.bb @@ -0,0 +1,19 @@ +# Only should be used for development +DEFAULT_PREFERENCE = "-1" + +require pmu-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-zynqmp_pmufw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-ffunction-sections -fdata-sections -Wall -Wextra -Os -flto -ffat-lto-objects" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmufw.bbappend b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmufw.bbappend new file mode 100644 index 00000000..241da1d0 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/pmufw.bbappend @@ -0,0 +1,26 @@ +# Include the zynqmp-pmufw setting, if it's enabled +PMUFW_INC = "${@bb.utils.contains('BBMULTICONFIG', 'zynqmp-pmufw', 'zynqmp-pmufw-cfg.inc', '', d)}" +require ${PMUFW_INC} + +def check_pmu_vars(d): + # If both are blank, the user MUST pass in the path to the firmware! + if not d.getVar('PMU_DEPENDS') and not d.getVar('PMU_MCDEPENDS'): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + msg = "" + fail = False + if not os.path.exists(d.getVar('PMU_FILE') + ".elf"): + msg = msg + "The expected file %s.elf is not available. " % d.getVar('PMU_FILE') + fail = True + if not os.path.exists(d.getVar('PMU_FILE') + ".bin"): + msg = msg + "The expected file %s.bin is not available. " % d.getVar('PMU_FILE') + fail = True + if fail: + if not d.getVar('WITHIN_EXT_SDK'): + raise bb.parse.SkipRecipe("%s\nEither specify PMU_FILE, or you may need to enable BBMULTICONFIG += 'zynqmp-pmufw' to generate it." % msg) + else: + # We found the file, so be sure to track it + d.setVar('SRC_URI', 'file://${PMU_FILE}.elf file://${PMU_FILE}.bin') + d.setVarFlag('do_install', 'file-checksums', '${PMU_FILE}.elf:True') + d.setVarFlag('do_deploy', 'file-checksums', '${PMU_FILE}.elf:True ${PMU_FILE}.bin:True') diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware.inc b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware.inc new file mode 100644 index 00000000..05b2a1cc --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware.inc @@ -0,0 +1,86 @@ +ESCRIPTION = "PSM Firmware" +SUMMARY = "PSM firmware for versal devices" + +inherit xlnx-embeddedsw deploy + +COMPATIBLE_HOST = "microblaze.*-elf" +COMPATIBLE_MACHINE = "none" +COMPATIBLE_MACHINE:versal = ".*" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/git" +B = "${S}/lib/sw_apps/versal_psmfw/src" + +# The makefile does not handle parallelization +PARALLEL_MAKE = "-j1" + +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + ${B}/../misc/copy_bsp.sh +} + +# All do_compiles need this, even if it's overriden +MB_OBJCOPY ??= "${OBJCOPY}" + +# Only add a dependency if we need to use OUR binutils +DEPENDS .= "${@' virtual/${TARGET_PREFIX}binutils' if d.getVar('MB_OBJCOPY') == d.getVar('OBJCOPY') else ''}" + +COMPILER = "${CC}" +COMPILER_FLAGS = "-O2 -c" +EXTRA_COMPILER_FLAGS = "-g -Wall -Wextra -Os -flto -ffat-lto-objects" +ARCHIVER = "${AR}" + +BSP_DIR ?= "${B}/../misc/versal_psmfw_bsp" +BSP_TARGETS_DIR ?= "${BSP_DIR}/psv_psm_0/libsrc" + +def bsp_make_vars(d): + s = ["COMPILER", "CC", "COMPILER_FLAGS", "EXTRA_COMPILER_FLAGS", "ARCHIVER", "AR", "AS"] + return " ".join(["\"%s=%s\"" % (v, d.getVar(v)) for v in s]) + +EXTRA_OEMAKE = "${@bsp_make_vars(d)}" + +do_compile() { + # the Makefile in ${B}/../misc/Makefile, does not handle CC, AR, AS, etc + # properly. So do its job manually. Preparing the includes first, then libs. + for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do + oe_runmake -C $(dirname $i) -s include + done + for i in $(ls ${BSP_TARGETS_DIR}/*/src/Makefile); do + oe_runmake -C $(dirname $i) -s libs + done + + # --build-id=none is required due to linker script not defining a location for it. + # Again, recipe-systoot include is necessary + oe_runmake CC_FLAGS="-MMD -MP -Wl,--build-id=none -I${STAGING_DIR_TARGET}/usr/include" + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} + +do_install() { + : +} + +PACKAGES = "" + +# This is the default in most BSPs. A MACHINE.conf can override this! +PSM_FIRMWARE_IMAGE_NAME ??= "psm-firmware-${MACHINE}" + +inherit image-artifact-names + +PSM_FIRMWARE_BASE_NAME ?= "${PSM_FIRMWARE_IMAGE_NAME}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" + +ESW_COMPONENT ??= "psmfw.elf" + +do_deploy() { + install -Dm 0644 ${B}/${ESW_COMPONENT} ${DEPLOYDIR}/${PSM_FIRMWARE_BASE_NAME}.elf + ln -sf ${PSM_FIRMWARE_BASE_NAME}.elf ${DEPLOYDIR}/${PSM_FIRMWARE_IMAGE_NAME}.elf + install -m 0644 ${B}/${ESW_COMPONENT}.bin ${DEPLOYDIR}/${PSM_FIRMWARE_BASE_NAME}.bin + ln -sf ${PSM_FIRMWARE_BASE_NAME}.bin ${DEPLOYDIR}/${PSM_FIRMWARE_IMAGE_NAME}.bin +} + +addtask deploy before do_build after do_install + +# Disable buildpaths QA check warnings. +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2022.1.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2022.1.bb new file mode 100644 index 00000000..d861fb1c --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2022.1.bb @@ -0,0 +1,16 @@ +require psm-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2022.2.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2022.2.bb new file mode 100644 index 00000000..d861fb1c --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2022.2.bb @@ -0,0 +1,16 @@ +require psm-firmware.inc + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra" + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2023.1.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2023.1.bb new file mode 100644 index 00000000..569c5a46 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2023.1.bb @@ -0,0 +1,34 @@ +require psm-firmware.inc + +# Separate build directories for versal and versal-net +SOC_DIR = "versal" +SOC_DIR:versal-net = "versal_net" +B = "${S}/lib/sw_apps/versal_psmfw/src/${SOC_DIR}" + +BSP_DIR ?= "${B}/../../misc/versal_psmfw_bsp" + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra" + +# Override default since we're in a subdirectory deeper now... +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + if [ ${SOC_DIR} != "versal" ]; then + ${B}/../../misc/${SOC_DIR}/copy_bsp.sh + else + ${B}/../../misc/copy_bsp.sh + fi +} + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2023.2.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2023.2.bb new file mode 100644 index 00000000..569c5a46 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_2023.2.bb @@ -0,0 +1,34 @@ +require psm-firmware.inc + +# Separate build directories for versal and versal-net +SOC_DIR = "versal" +SOC_DIR:versal-net = "versal_net" +B = "${S}/lib/sw_apps/versal_psmfw/src/${SOC_DIR}" + +BSP_DIR ?= "${B}/../../misc/versal_psmfw_bsp" + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra" + +# Override default since we're in a subdirectory deeper now... +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + if [ ${SOC_DIR} != "versal" ]; then + ${B}/../../misc/${SOC_DIR}/copy_bsp.sh + else + ${B}/../../misc/copy_bsp.sh + fi +} + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_git.bb b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_git.bb new file mode 100644 index 00000000..42e0a95f --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psm-firmware_git.bb @@ -0,0 +1,37 @@ +# Only should be used for development +DEFAULT_PREFERENCE = "-1" + +require psm-firmware.inc + +# Separate build directories for versal and versal-net +SOC_DIR = "versal" +SOC_DIR:versal-net = "versal_net" +B = "${S}/lib/sw_apps/versal_psmfw/src/${SOC_DIR}" + +BSP_DIR ?= "${B}/../../misc/versal_psmfw_bsp" + +FILESPATH .= ":${FILE_DIRNAME}/embeddedsw/2023.1:${FILE_DIRNAME}/embeddedsw" + +SRC_URI += " \ + file://makefile-skip-copy_bsp.sh.patch \ + file://0001-versal_fw-Fixup-core-makefiles.patch \ + " + +EXTRA_COMPILER_FLAGS = "-g -ffunction-sections -fdata-sections -Wall -Wextra" + +# Override default since we're in a subdirectory deeper now... +do_configure() { + # manually do the copy_bsp step first, so as to be able to fix up use of + # mb-* commands + if [ ${SOC_DIR} != "versal" ]; then + ${B}/../../misc/${SOC_DIR}/copy_bsp.sh + else + ${B}/../../misc/copy_bsp.sh + fi +} + +do_compile() { + oe_runmake + + ${MB_OBJCOPY} -O binary ${B}/${ESW_COMPONENT} ${B}/${ESW_COMPONENT}.bin +} diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/psmfw.bbappend b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psmfw.bbappend new file mode 100644 index 00000000..dc7c6df6 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/psmfw.bbappend @@ -0,0 +1,27 @@ +# Include the versal-fw setting, if it's enabled +PSMFW_INC = "${@bb.utils.contains('BBMULTICONFIG', 'versal-fw', 'versal-fw-cfg.inc', '', d)}" +require ${PSMFW_INC} + +def check_psm_vars(d): + # If both are blank, the user MUST pass in the path to the firmware! + if not d.getVar('PSM_DEPENDS') and not d.getVar('PSM_MCDEPENDS'): + # Don't cache this, as the items on disk can change! + d.setVar('BB_DONT_CACHE', '1') + + msg = "" + fail = False + if not os.path.exists(d.getVar('PSM_FILE') + ".elf"): + msg = msg + "The expected file %s.elf is not available. " % d.getVar('PSM_FILE') + fail = True + if not os.path.exists(d.getVar('PSM_FILE') + ".bin"): + msg = msg + "The expected file %s.bin is not available. " % d.getVar('PSM_FILE') + fail = True + + if fail: + if not d.getVar('WITHIN_EXT_SDK'): + raise bb.parse.SkipRecipe("%s\nEither specify PSM_FILE, or you may need to enable BBMULTICONFIG += 'versal-fw' to generate it." % msg) + else: + # We found the file, so be sure to track it + d.setVar('SRC_URI', 'file://${PSM_FILE}.elf file://${PSM_FILE}.bin') + d.setVarFlag('do_install', 'file-checksums', '${PSM_FILE}.elf:True') + d.setVarFlag('do_deploy', 'file-checksums', '${PSM_FILE}.elf:True ${PSM_FILE}.bin:True') diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/versal-fw-cfg.inc b/meta-xilinx-standalone/recipes-bsp/embeddedsw/versal-fw-cfg.inc new file mode 100644 index 00000000..bae740e2 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/versal-fw-cfg.inc @@ -0,0 +1,13 @@ +# Default fsbl configuration, using fsbl-fw multiconfig +# +# This requires MULTICONFIG += "versal-fw" to be added to local.conf +PSM_DEPENDS ?= "" +PSM_MCDEPENDS ?= "mc::versal-fw:psm-firmware:do_deploy" +PSM_FIRMWARE_IMAGE_NAME ?= "psm-firmware-${MACHINE}" +PSM_FIRMWARE_DEPLOY_DIR ?= "${TOPDIR}/tmp-microblaze-versal-fw/deploy/images/${MACHINE}" + +PLM_DEPENDS ?= "" +PLM_MCDEPENDS ?= "mc::versal-fw:plm-firmware:do_deploy" +PLM_IMAGE_NAME ?= "plm-${MACHINE}" +PLM_DEPLOY_DIR ?= "${TOPDIR}/tmp-microblaze-versal-fw/deploy/images/${MACHINE}" + diff --git a/meta-xilinx-standalone/recipes-bsp/embeddedsw/zynqmp-pmufw-cfg.inc b/meta-xilinx-standalone/recipes-bsp/embeddedsw/zynqmp-pmufw-cfg.inc new file mode 100644 index 00000000..982c4425 --- /dev/null +++ b/meta-xilinx-standalone/recipes-bsp/embeddedsw/zynqmp-pmufw-cfg.inc @@ -0,0 +1,7 @@ +# Default fsbl configuration, using fsbl-fw multiconfig +# +# This requires MULTICONFIG += "zynqmp-pmufw" to be added to local.conf +PMU_DEPENDS ?= "" +PMU_MCDEPENDS ?= "mc::zynqmp-pmufw:pmu-firmware:do_deploy" +PMU_FIRMWARE_DEPLOY_DIR ?= "${TOPDIR}/tmp-microblaze-zynqmp-pmufw/deploy/images/${MACHINE}" +PMU_FIRMWARE_IMAGE_NAME ?= "pmu-firmware-${MACHINE}" diff --git a/meta-xilinx-standalone/recipes-core/meta/meta-toolchain.bbappend b/meta-xilinx-standalone/recipes-core/meta/meta-toolchain.bbappend new file mode 100644 index 00000000..0d824324 --- /dev/null +++ b/meta-xilinx-standalone/recipes-core/meta/meta-toolchain.bbappend @@ -0,0 +1 @@ +COMPATIBLE_HOST = "${HOST_SYS}" diff --git a/meta-xilinx-standalone/recipes-core/newlib/libgloss_%.bbappend b/meta-xilinx-standalone/recipes-core/newlib/libgloss_%.bbappend new file mode 100644 index 00000000..fcdc1ebd --- /dev/null +++ b/meta-xilinx-standalone/recipes-core/newlib/libgloss_%.bbappend @@ -0,0 +1,9 @@ +COMPATIBLE_HOST = ".*-elf" +COMPATIBLE_HOST:arm = "[^-]*-[^-]*-eabi" + +EXTRA_OECONF:append:xilinx-standalone = " \ + --enable-newlib-io-c99-formats \ + --enable-newlib-io-long-long \ + --enable-newlib-io-float \ + --enable-newlib-io-long-double \ +" diff --git a/meta-xilinx-standalone/recipes-core/newlib/newlib_%.bbappend b/meta-xilinx-standalone/recipes-core/newlib/newlib_%.bbappend new file mode 100644 index 00000000..aff092cc --- /dev/null +++ b/meta-xilinx-standalone/recipes-core/newlib/newlib_%.bbappend @@ -0,0 +1,14 @@ +COMPATIBLE_HOST = ".*-elf" +COMPATIBLE_HOST:arm = "[^-]*-[^-]*-eabi" + +EXTRA_OECONF:append:xilinx-standalone = " \ + --enable-newlib-io-c99-formats \ + --enable-newlib-io-long-long \ + --enable-newlib-io-float \ + --enable-newlib-io-long-double \ +" + +# Avoid trimmping CCARGS from CC by newlib configure +do_configure:prepend:xilinx-standalone(){ + export CC_FOR_TARGET="${CC}" +} diff --git a/meta-xilinx-standalone/recipes-devtools/binutils/binutils-cross-canadian_%.bbappend b/meta-xilinx-standalone/recipes-devtools/binutils/binutils-cross-canadian_%.bbappend new file mode 100644 index 00000000..5ba6039b --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/binutils/binutils-cross-canadian_%.bbappend @@ -0,0 +1 @@ +require binutils-xilinx-standalone.inc diff --git a/meta-xilinx-standalone/recipes-devtools/binutils/binutils-cross_%.bbappend b/meta-xilinx-standalone/recipes-devtools/binutils/binutils-cross_%.bbappend new file mode 100644 index 00000000..5ba6039b --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/binutils/binutils-cross_%.bbappend @@ -0,0 +1 @@ +require binutils-xilinx-standalone.inc diff --git a/meta-xilinx-standalone/recipes-devtools/binutils/binutils-xilinx-standalone.inc b/meta-xilinx-standalone/recipes-devtools/binutils/binutils-xilinx-standalone.inc new file mode 100644 index 00000000..48db3cf3 --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/binutils/binutils-xilinx-standalone.inc @@ -0,0 +1,26 @@ +LDGOLD:xilinx-standalone = "" +LDGOLD_ALTS:xilinx-standalone = "" + +EXTRA_OECONF:append:xilinx-standalone = " \ + --disable-gprof \ + --disable-shared \ + --enable-lto \ + --enable-static \ +" + +# CortexR5 and 32-bit arm are both "arm" +EXTRA_OECONF:append:xilinx-standalone:arm = " \ + --enable-interwork \ +" + +EXTRA_OECONF:append:xilinx-standalone:microblaze = " \ + --disable-initfini-array \ +" + +# Workaround for: +# ERROR: binutils-cross-canadian-aarch64-2.39-r0 do_package_qa: QA +# Issue: non -staticdev package contains static .a library: +# binutils-cross-canadian-aarch64 path +# '/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-oesdk-linux/usr/lib/aarch64-xilinx-elf/bfd-plugins/libdep.a' +# [staticdev] +INSANE_SKIP:${PN} += "staticdev" diff --git a/meta-xilinx-standalone/recipes-devtools/gcc/gcc-configure-xilinx-standalone.inc b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-configure-xilinx-standalone.inc new file mode 100644 index 00000000..0320a780 --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-configure-xilinx-standalone.inc @@ -0,0 +1,7 @@ +# Mimic the file gcc-configure-common from the Yocto Project +LINKER_HASH_STYLE:xilinx-standalone = "" +SYMVERS_CONF:xilinx-standalone = "" + +EXTRA_OECONF:append:xilinx-standalone:microblaze = " --disable-initfini_array" + +EXTRA_OECONF:append:xilinx-standalone:microblaze = " --disable-__cxa_atexit" diff --git a/meta-xilinx-standalone/recipes-devtools/gcc/gcc-cross-canadian_%.bbappend b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-cross-canadian_%.bbappend new file mode 100644 index 00000000..449db177 --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-cross-canadian_%.bbappend @@ -0,0 +1,13 @@ +require gcc-configure-xilinx-standalone.inc +require gcc-xilinx-standalone.inc + +# Temporary hack to build gcc cross canadian for tclibc-newlib as --with-sysroot=/not/exist +# has been removed from TARGET_OS for elf and eabi in gcc-cross-canadian.inc + +python() { + if 'xilinx-standalone' in d.getVar("DISTROOVERRIDES").split(':'): + extraoeconfgcc = d.getVar('EXTRA_OECONF') + extraoeconfgcc += " --with-sysroot=/not/exist" + d.delVar('EXTRA_OECONF') + d.setVar('EXTRA_OECONF', extraoeconfgcc) +} diff --git a/meta-xilinx-standalone/recipes-devtools/gcc/gcc-cross_%.bbappend b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-cross_%.bbappend new file mode 100644 index 00000000..69782d71 --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-cross_%.bbappend @@ -0,0 +1,2 @@ +require gcc-configure-xilinx-standalone.inc +require gcc-xilinx-standalone.inc diff --git a/meta-xilinx-standalone/recipes-devtools/gcc/gcc-runtime_%.bbappend b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-runtime_%.bbappend new file mode 100644 index 00000000..3a7d1395 --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-runtime_%.bbappend @@ -0,0 +1,45 @@ +require gcc-configure-xilinx-standalone.inc + +COMPATIBLE_HOST = "${HOST_SYS}" + +EXTRA_OECONF:append:xilinx-standalone:class-target = " \ + --disable-libstdcxx-pch \ + --with-newlib \ + --disable-threads \ + --enable-plugins \ + --with-gnu-as \ + --disable-libitm \ +" + +EXTRA_OECONF:append:xilinx-standalone:aarch64:class-target = " \ + --disable-multiarch \ + --with-arch=armv8-a \ + " + +EXTRA_OECONF:append:xilinx-standalone:armv7r:class-target = " \ + --disable-tls \ + --disable-decimal-float \ + " + +EXTRA_OECONF:append:xilinx-standalone:armv8r:class-target = " \ + --disable-tls \ + --disable-decimal-float \ + " + +EXTRA_OECONF:append:xilinx-standalone:microblaze:class-target = " \ + --without-long-double-128 \ + " + +# Changes local to gcc-runtime... + +# Dont build libitm, etc. +RUNTIMETARGET:xilinx-standalone:class-target = "libstdc++-v3" + +do_install:append:xilinx-standalone:class-target() { + # Fixup what gcc-runtime normally would do, we don't want linux directories! + rm -rf ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux +} + +FILES:${PN}-dbg:append:xilinx-standalone:class-target = "\ + ${libdir}/libstdc++.a-gdb.py \ +" diff --git a/meta-xilinx-standalone/recipes-devtools/gcc/gcc-source_%.bbappend b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-source_%.bbappend new file mode 100644 index 00000000..0d824324 --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-source_%.bbappend @@ -0,0 +1 @@ +COMPATIBLE_HOST = "${HOST_SYS}" diff --git a/meta-xilinx-standalone/recipes-devtools/gcc/gcc-xilinx-standalone.inc b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-xilinx-standalone.inc new file mode 100644 index 00000000..2faf7a4b --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/gcc/gcc-xilinx-standalone.inc @@ -0,0 +1,27 @@ +EXTRA_OECONF:append:xilinx-standalone = " \ + --disable-libstdcxx-pch \ + --with-newlib \ + --disable-threads \ + --enable-plugins \ + --with-gnu-as \ + --disable-libitm \ +" + +EXTRA_OECONF:append:xilinx-standalone:aarch64 = " \ + --disable-multiarch \ + --with-arch=armv8-a \ + " + +EXTRA_OECONF:append:xilinx-standalone:armv7r = " \ + --disable-tls \ + --disable-decimal-float \ + " + +EXTRA_OECONF:append:xilinx-standalone:armv8r = " \ + --disable-tls \ + --disable-decimal-float \ + " + +EXTRA_OECONF:append:xilinx-standalone:microblaze = " \ + --without-long-double-128 \ + " diff --git a/meta-xilinx-standalone/recipes-devtools/gcc/libgcc_%.bbappend b/meta-xilinx-standalone/recipes-devtools/gcc/libgcc_%.bbappend new file mode 100644 index 00000000..861b3f9c --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/gcc/libgcc_%.bbappend @@ -0,0 +1,29 @@ +require gcc-configure-xilinx-standalone.inc + +COMPATIBLE_HOST = "${HOST_SYS}" + +python do_multilib_install:xilinx-standalone:class-target () { + pass +} + +standalone_fixup () { + ( + cd ${D}${libdir} + for each in ${TARGET_SYS}/*/* ; do + ln -s $each $(basename $each) + done + ) + + # Apparently we can end up with an empty /lib occasionally + find ${D}/lib -type d | sort -r | xargs rmdir || : +} + +FIXUP_FUNCTION = "" +FIXUP_FUNCTION:xilinx-standalone:class-target = " standalone_fixup" + +do_install[postfuncs] .= "${FIXUP_FUNCTION}" + +FILES:${PN}-dev:append:xilinx-standalone:class-target = " \ + ${libdir}/*.a \ + ${libdir}/*.o \ +" diff --git a/meta-xilinx-standalone/recipes-devtools/qemu/qemuwrapper-cross_1.0.bbappend b/meta-xilinx-standalone/recipes-devtools/qemu/qemuwrapper-cross_1.0.bbappend new file mode 100644 index 00000000..0d824324 --- /dev/null +++ b/meta-xilinx-standalone/recipes-devtools/qemu/qemuwrapper-cross_1.0.bbappend @@ -0,0 +1 @@ +COMPATIBLE_HOST = "${HOST_SYS}" diff --git a/meta-xilinx-standalone/recipes-kernel/linux/linux-dummy.bbappend b/meta-xilinx-standalone/recipes-kernel/linux/linux-dummy.bbappend new file mode 100644 index 00000000..0d824324 --- /dev/null +++ b/meta-xilinx-standalone/recipes-kernel/linux/linux-dummy.bbappend @@ -0,0 +1 @@ +COMPATIBLE_HOST = "${HOST_SYS}" diff --git a/meta-xilinx-vendor/COPYING.MIT b/meta-xilinx-vendor/COPYING.MIT new file mode 100644 index 00000000..fb950dc6 --- /dev/null +++ b/meta-xilinx-vendor/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/meta-xilinx-vendor/README.md b/meta-xilinx-vendor/README.md new file mode 100644 index 00000000..1903df17 --- /dev/null +++ b/meta-xilinx-vendor/README.md @@ -0,0 +1,52 @@ +# meta-xilinx-vendor + +This layer enables third party vendor boards for AMD Xilinx MicroBlaze, Zynq, +ZynqMP and Versal devices and provides related metadata. + +## Supported Boards/Machines + +**Boards/Machines supported by this layer:** + +> **Variable usage examples:** +> +> Machine Configuration file: `MACHINE = "ultra96-zynqmp"` +> +> Reference XSA: `HDF_MACHINE = "ultra96-zynqmp"` +> +> HW Board Device tree: `YAML_DT_BOARD_FLAGS = "{BOARD avnet-ultra96-rev1}"` + +| Devices | Vendor Evaluation Board | Machine Configuration file | Reference XSA | HW Board Device tree | QEMU tested | HW tested | +|------------|-------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|------------------|----------------------|-------------|-----------| +| MicroBlaze | NA | NA | NA | NA | No | No | +| Zynq-7000 | [Avent Microzed](https://www.xilinx.com/products/boards-and-kits/1-5lakcu.html) | [microzed-zynq7](conf/machine/microzed-zynq7.conf) | NA | `zynq-microzed.dtb` | No | No | +| | [Avnet Picozed](https://www.xilinx.com/products/boards-and-kits/1-58nuel.html) | [picozed-zynq7](conf/machine/picozed-zynq7.conf) | NA | NA | No | No | +| | [Avnet Minized](https://www.xilinx.com/products/boards-and-kits/1-odbhjd.html) | [minized-zynq7](conf/machine/minized-zynq7.conf) | NA | NA | No | No | +| | [Avnet/Digilent ZedBoard](https://www.xilinx.com/products/boards-and-kits/1-8dyf-11.html) | [zedboard-zynq7](conf/machine/zedboard-zynq7.conf) | NA | NA | No | No | +| | [Digilent Zybo](https://www.xilinx.com/support/university/boards-portfolio/xup-boards/DigilentZYBO.html) | [zybo-zynq7](conf/machine/zybo-zynq7.conf) | NA | `zynq-zybo.dtb` | No | No | +| | [Digilent Zybo Linux BD](https://www.xilinx.com/support/university/boards-portfolio/xup-boards/DigilentZYBO.html) | [zybo-linux-bd-zynq7](conf/machine/zybo-linux-bd-zynq7.conf) | NA | NA | No | No | +| ZynqMP | [Avent Ultra96 v1](https://www.xilinx.com/products/boards-and-kits/1-vad4rl.html) | [ultra96-zynqmp](conf/machine/ultra96-zynqmp.conf) | `ultra96-zynqmp` | `avnet-ultra96-rev1` | Yes | Yes | +| Versal | NA | NA | NA | NA | NA | NA | + +> **Note:** +``` +1. For Zybo Linux BD reference design refer meta-xilinx-contrib layer. +2. Ultra96 Machine configuration file is unsupported and is compatible with v1 board only. Refer to meta-avnet for v2 board. +``` + +## Dependencies + +This layer depends on: + + URI: https://git.yoctoproject.org/poky + layers: meta, meta-poky + branch: langdale + + URI: https://git.openembedded.org/meta-openembedded + layers: meta-oe + branch: langdale + + URI: + https://git.yoctoproject.org/meta-xilinx (official version) + https://github.com/Xilinx/meta-xilinx (development and amd xilinx release) + layers: meta-xilinx-microblaze, meta-xilinx-core + branch: langdale or amd xilinx release version (e.g. rel-v2023.1) diff --git a/meta-xilinx-vendor/conf/layer.conf b/meta-xilinx-vendor/conf/layer.conf new file mode 100644 index 00000000..d07d7db0 --- /dev/null +++ b/meta-xilinx-vendor/conf/layer.conf @@ -0,0 +1,18 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have a packages directory, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILES_DYNAMIC += " \ +xilinx-tools:${LAYERDIR}/dynamic-layers/meta-xilinx-tools/recipes-*/*/*.bb \ +xilinx-tools:${LAYERDIR}/dynamic-layers/meta-xilinx-tools/recipes-*/*/*.bbappend \ +" + +BBFILE_COLLECTIONS += "xilinx-vendor" +BBFILE_PATTERN_xilinx-vendor = "^${LAYERDIR}/" +BBFILE_PRIORITY_xilinx-vendor = "5" + +LAYERDEPENDS_xilinx-vendor = "xilinx" +LAYERSERIES_COMPAT_xilinx-vendor = "scarthgap" diff --git a/meta-xilinx-vendor/conf/machine/microzed-zynq7.conf b/meta-xilinx-vendor/conf/machine/microzed-zynq7.conf new file mode 100644 index 00000000..750657dc --- /dev/null +++ b/meta-xilinx-vendor/conf/machine/microzed-zynq7.conf @@ -0,0 +1,20 @@ +#@TYPE: Machine +#@NAME: microzed-zynq7 +#@DESCRIPTION: Machine support for microZed. (http://www.microzed.org/) + +require conf/machine/zynq-generic.conf + +SPL_BINARY ?= "spl/boot.bin" +UBOOT_ELF = "u-boot" + +EXTRA_IMAGEDEPENDS += " \ + u-boot-xlnx-uenv \ + " + +KERNEL_DEVICETREE = "zynq-microzed.dtb" + +IMAGE_BOOT_FILES += " \ + boot.bin \ + uEnv.txt \ + " + diff --git a/meta-xilinx-vendor/conf/machine/minized-zynq7.conf b/meta-xilinx-vendor/conf/machine/minized-zynq7.conf new file mode 100644 index 00000000..415ebc61 --- /dev/null +++ b/meta-xilinx-vendor/conf/machine/minized-zynq7.conf @@ -0,0 +1,23 @@ +#@TYPE: Machine +#@NAME: minized-zynq7 +#@DESCRIPTION: Machine support for MiniZed. (http://www.minized.org/) + +require conf/machine/zynq-generic.conf + +MACHINE_FEATURES = "ext2 vfat usbhost wifi bluetooth" + +UBOOT_MACHINE ?= "zynq_minized_config" + +EXTRA_IMAGEDEPENDS += " \ + u-boot-xlnx-uenv \ + " + +SERIAL_CONSOLES ?= "115200;ttyPS0" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree" + +MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "linux-firmware-bcm43430" + +IMAGE_BOOT_FILES += " \ + uEnv.txt \ + " diff --git a/meta-xilinx-vendor/conf/machine/picozed-zynq7.conf b/meta-xilinx-vendor/conf/machine/picozed-zynq7.conf new file mode 100644 index 00000000..3ce023a6 --- /dev/null +++ b/meta-xilinx-vendor/conf/machine/picozed-zynq7.conf @@ -0,0 +1,22 @@ +#@TYPE: Machine +#@NAME: picozed-zynq7 +#@DESCRIPTION: Machine support for picoZed. (http://www.picozed.org/) +# +# Note: This machine configuration is intended as a generic config for +# the picozed SOM. It also covers the multiple SKUs for the picoZed +# including 7010, 7020, 7015 and 7030. + +require conf/machine/zynq-generic.conf + +SPL_BINARY ?= "spl/boot.bin" +UBOOT_ELF = "u-boot" + +EXTRA_IMAGEDEPENDS += " \ + u-boot-xlnx-uenv \ + " + +IMAGE_BOOT_FILES += " \ + boot.bin \ + uEnv.txt \ + " + diff --git a/meta-xilinx-vendor/conf/machine/ultra96-zynqmp.conf b/meta-xilinx-vendor/conf/machine/ultra96-zynqmp.conf new file mode 100644 index 00000000..d0b95cac --- /dev/null +++ b/meta-xilinx-vendor/conf/machine/ultra96-zynqmp.conf @@ -0,0 +1,80 @@ +#@TYPE: Machine +#@NAME: ultra96-zynqmp +#@DESCRIPTION: Machine support for Ultra96 Evaluation Board. + +#### Preamble +MACHINEOVERRIDES =. "${@['', 'ultra96-zynqmp:']['ultra96-zynqmp' !='${MACHINE}']}" +#### Regular settings follow + +# Variables that changes based on hw design or board specific requirement must be +# defined before calling the required inclusion file else pre-expansion value +# defined in zynqmp-generic.conf will be set. + +# Yocto device-tree variables +YAML_CONSOLE_DEVICE_CONFIG:pn-device-tree ?= "psu_uart_1" +YAML_MAIN_MEMORY_CONFIG:pn-device-tree ?= "PSU_DDR_0" +YAML_DT_BOARD_FLAGS ?= "{BOARD avnet-ultra96-rev1}" + +# Yocto arm-trusted-firmware(TF-A) variables +ATF_CONSOLE ?= "cadence1" +TFA_BL33_LOAD ?= "0x8000000" + +# Yocto PMUFW variables +YAML_SERIAL_CONSOLE_STDIN:pn-pmu-firmware ?= "psu_uart_1" +YAML_SERIAL_CONSOLE_STDOUT:pn-pmu-firmware ?= "psu_uart_1" + +# Yocto FSBL variables +YAML_SERIAL_CONSOLE_STDIN:pn-fsbl-firmware ?= "psu_uart_1" +YAML_SERIAL_CONSOLE_STDOUT:pn-fsbl-firmware ?= "psu_uart_1" + +# Yocto KERNEL Variables +UBOOT_ENTRYPOINT ?= "0x200000" +UBOOT_LOADADDRESS ?= "0x200000" + +# ultra96-zynqmp Serial Console +# In Ultra96 uart1 is the primary uart device but DTG set the serial0 alias +# to uart1, hence we are using ttyPS0 for Ultra96. +SERIAL_CONSOLES ?= "115200;ttyPS1 115200;ttyPS0" +YAML_SERIAL_CONSOLE_BAUDRATE ?= "115200" + +# Required generic machine inclusion +# Ultra96 board uses ZynqMP EG device hence use soc variant based generic machine +# inclusion +require conf/machine/zynqmp-eg-generic.conf + +# This eval board machine conf file uses ultra96-zynqmp xsa as reference input. +# User can override with ultra96 custom xsa using HDF_BASE and HDF_PATH variables +# from local.conf. +HDF_MACHINE = "ultra96-zynqmp" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu100-revC.dtb" + +# Ultra96 has 2GB memory only but default zynqmp-generic has QB_MEM set to 4G, +# Hence set QB_MEM to 2GB. +QB_MEM = "-m 2G" + +# Ultra96 board uses ultra96-arm.dtb as QEMU HW PS DTB. +QEMU_HW_DTB_PS = "${QEMU_HW_DTB_PATH}/ultra96-arm.dtb" + +# Both psu_uart_0 and psu_uart_1 are defined, but 1 is the primary uart. +# +# hw ps7_uart_0 (0xFF000000) - linux serial1 (ttyPS1) +# hw ps7_uart_1 (0xFF010000) - linux serial0 (ttyPS0) +# ? dcc / axi_uart16550_0 ? - linux serial2 +QB_XILINX_SERIAL = "-serial null -serial mon:stdio" + +# KERNEL_DEVICETREE is disabled as we use board device tree from DTG to match +# the xsa. User can enable explicitly if required from local.conf. +# KERNEL_DEVICETREE = "xilinx/zynqmp-zcu100-revC.dtb" + +# Enable bluetooth and wifi module +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += " \ + linux-firmware-wl18xx \ + linux-firmware-ti-bt-wl180x \ + " + +#### No additional settings should be after the Postamble +#### Postamble +PACKAGE_EXTRA_ARCHS:append = "${@['', ' ultra96_zynqmp']['ultra96-zynqmp' != '${MACHINE}']}" diff --git a/meta-xilinx-vendor/conf/machine/zedboard-zynq7.conf b/meta-xilinx-vendor/conf/machine/zedboard-zynq7.conf new file mode 100644 index 00000000..c7c2f7eb --- /dev/null +++ b/meta-xilinx-vendor/conf/machine/zedboard-zynq7.conf @@ -0,0 +1,21 @@ +#@TYPE: Machine +#@NAME: zedboard-zynq7 +#@DESCRIPTION: Machine support for ZedBoard. (http://www.zedboard.org/) +# +# For details on the Evaluation board: +# http://www.zedboard.org/content/overview +# For design files (including 'zynq_fsbl_0.elf') for the ZedBoard: +# http://www.zedboard.org/reference-designs-categories/zynq-concepts-tools-and-techniques-zedboard +# + +require conf/machine/zynq-generic.conf + +SPL_BINARY ?= "spl/boot.bin" + +KERNEL_DEVICETREE = "zynq-zed.dtb" + +IMAGE_BOOT_FILES += " \ + boot.bin \ + uEnv.txt \ + boot.scr \ + " diff --git a/meta-xilinx-vendor/conf/machine/zybo-linux-bd-zynq7.conf b/meta-xilinx-vendor/conf/machine/zybo-linux-bd-zynq7.conf new file mode 100644 index 00000000..98718ae3 --- /dev/null +++ b/meta-xilinx-vendor/conf/machine/zybo-linux-bd-zynq7.conf @@ -0,0 +1,24 @@ +#@TYPE: Machine +#@NAME: zybo-linux-bd-zynq7 +#@DESCRIPTION: Machine support for zybo-linux-bd project. +# +# generated base on ZYBO linux-bd project +# + +require conf/machine/zynq-generic.conf + +MACHINE_FEATURES += "keyboard screen alsa sdio" + +SPL_BINARY ?= "spl/boot.bin" +FORCE_PLATFORM_INIT = "1" +UBOOT_ELF = "u-boot" + +IMAGE_BOOT_FILES += " \ + boot.bin \ + bitstream \ + uEnv.txt \ + " + +KERNEL_FEATURES += " \ + features/xilinx/v4l2/v4l2.scc \ + " diff --git a/meta-xilinx-vendor/conf/machine/zybo-zynq7.conf b/meta-xilinx-vendor/conf/machine/zybo-zynq7.conf new file mode 100644 index 00000000..37c4b6cc --- /dev/null +++ b/meta-xilinx-vendor/conf/machine/zybo-zynq7.conf @@ -0,0 +1,24 @@ +#@TYPE: Machine +#@NAME: zybo-zynq7 +#@DESCRIPTION: Machine support for ZYBO. +# +# For details on the ZYBO board: +# https://www.digilentinc.com/Products/Detail.cfm?Prod=ZYBO +# + +require conf/machine/zynq-generic.conf + +SPL_BINARY ?= "spl/boot.bin" +UBOOT_ELF = "u-boot" + +EXTRA_IMAGEDEPENDS += " \ + u-boot-xlnx-uenv \ + " + +KERNEL_DEVICETREE = "zynq-zybo.dtb" + +IMAGE_BOOT_FILES += " \ + boot.bin \ + uEnv.txt \ + " + diff --git a/meta-xilinx-vendor/dynamic-layers/meta-xilinx-tools/recipes-bsp/embeddedsw/pmu-firmware_%.bbappend b/meta-xilinx-vendor/dynamic-layers/meta-xilinx-tools/recipes-bsp/embeddedsw/pmu-firmware_%.bbappend new file mode 100644 index 00000000..f2c2c09f --- /dev/null +++ b/meta-xilinx-vendor/dynamic-layers/meta-xilinx-tools/recipes-bsp/embeddedsw/pmu-firmware_%.bbappend @@ -0,0 +1,8 @@ +# Ultra96 Compiler Flags +ULTRA96_VERSION ?= "1" +YAML_COMPILER_FLAGS:append:ultra96-zynqmp = " \ + -DBOARD_SHUTDOWN_PIN=2 \ + -DBOARD_SHUTDOWN_PIN_STATE=0 \ + -DENABLE_MOD_ULTRA96 \ + ${@bb.utils.contains('ULTRA96_VERSION', '2', ' -DULTRA96_VERSION=2 ', ' -DULTRA96_VERSION=1 ', d)} \ + " diff --git a/meta-xilinx-vendor/recipes-bsp/device-tree/device-tree.bbappend b/meta-xilinx-vendor/recipes-bsp/device-tree/device-tree.bbappend new file mode 100644 index 00000000..341e69dc --- /dev/null +++ b/meta-xilinx-vendor/recipes-bsp/device-tree/device-tree.bbappend @@ -0,0 +1,13 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +# device tree sources for the various machines +COMPATIBLE_MACHINE:picozed-zynq7 = ".*" +SRC_URI:append:picozed-zynq7 = " file://picozed-zynq7.dts" + +COMPATIBLE_MACHINE:zybo-linux-bd-zynq7 = ".*" +SRC_URI:append:zybo-linux-bd-zynq7 = " \ + file://zybo-linux-bd-zynq7.dts \ + file://pcw.dtsi \ + file://pl.dtsi \ + " + diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/picozed-zynq7.dts b/meta-xilinx-vendor/recipes-bsp/device-tree/files/picozed-zynq7.dts index 4ec64f5e..6f9b653a 100644 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/picozed-zynq7.dts +++ b/meta-xilinx-vendor/recipes-bsp/device-tree/files/picozed-zynq7.dts @@ -34,7 +34,7 @@ phy-handle = <ðernet_phy>; ethernet_phy: ethernet-phy@0 { - compatible = "marvell,88e1512"; + compatible = "marvell,88e1512", "marvell,88e1510"; device_type = "ethernet-phy"; reg = <0>; }; diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/pcw.dtsi b/meta-xilinx-vendor/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/pcw.dtsi index 0f678d39..0f678d39 100644 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/pcw.dtsi +++ b/meta-xilinx-vendor/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/pcw.dtsi diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/pl.dtsi b/meta-xilinx-vendor/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/pl.dtsi index 32bc7688..32bc7688 100644 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/pl.dtsi +++ b/meta-xilinx-vendor/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/pl.dtsi diff --git a/meta-xilinx-bsp/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.dts b/meta-xilinx-vendor/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.dts index 19654392..19654392 100644 --- a/meta-xilinx-bsp/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.dts +++ b/meta-xilinx-vendor/recipes-bsp/device-tree/files/zybo-linux-bd-zynq7/zybo-linux-bd-zynq7.dts diff --git a/meta-xilinx-vendor/recipes-bsp/platform-init/platform-init.bbappend b/meta-xilinx-vendor/recipes-bsp/platform-init/platform-init.bbappend new file mode 100644 index 00000000..fbe42821 --- /dev/null +++ b/meta-xilinx-vendor/recipes-bsp/platform-init/platform-init.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/platform-init:" + +COMPATIBLE_MACHINE:picozed-zynq7 = "picozed-zynq7" + diff --git a/meta-xilinx-bsp/recipes-bsp/platform-init/platform-init/picozed-zynq7/ps7_init_gpl.c b/meta-xilinx-vendor/recipes-bsp/platform-init/platform-init/picozed-zynq7/ps7_init_gpl.c index 5587ab25..5587ab25 100644 --- a/meta-xilinx-bsp/recipes-bsp/platform-init/platform-init/picozed-zynq7/ps7_init_gpl.c +++ b/meta-xilinx-vendor/recipes-bsp/platform-init/platform-init/picozed-zynq7/ps7_init_gpl.c diff --git a/meta-xilinx-bsp/recipes-bsp/platform-init/platform-init/picozed-zynq7/ps7_init_gpl.h b/meta-xilinx-vendor/recipes-bsp/platform-init/platform-init/picozed-zynq7/ps7_init_gpl.h index df5205e8..df5205e8 100644 --- a/meta-xilinx-bsp/recipes-bsp/platform-init/platform-init/picozed-zynq7/ps7_init_gpl.h +++ b/meta-xilinx-vendor/recipes-bsp/platform-init/platform-init/picozed-zynq7/ps7_init_gpl.h diff --git a/meta-xilinx-vendor/recipes-core/init-ifupdown/files/interfaces b/meta-xilinx-vendor/recipes-core/init-ifupdown/files/interfaces new file mode 100644 index 00000000..8daba016 --- /dev/null +++ b/meta-xilinx-vendor/recipes-core/init-ifupdown/files/interfaces @@ -0,0 +1,32 @@ +# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) + +# The loopback interface +auto lo +iface lo inet loopback + +# Wireless interfaces +auto wlan0 +iface wlan0 inet dhcp + wireless_mode managed + wireless_essid any + wpa-driver wext + wpa-conf /etc/wpa_supplicant.conf + +iface atml0 inet dhcp + +# Wired or wireless interfaces +auto eth0 +iface eth0 inet dhcp +iface eth1 inet dhcp + +# Ethernet/RNDIS gadget (g_ether) +# ... or on host side, usbnet and random hwaddr +iface usb0 inet static + address 192.168.7.2 + netmask 255.255.255.0 + network 192.168.7.0 + gateway 192.168.7.1 + +# Bluetooth networking +iface bnep0 inet dhcp + diff --git a/meta-xilinx-vendor/recipes-core/init-ifupdown/init-ifupdown_%.bbappend b/meta-xilinx-vendor/recipes-core/init-ifupdown/init-ifupdown_%.bbappend new file mode 100644 index 00000000..2638026c --- /dev/null +++ b/meta-xilinx-vendor/recipes-core/init-ifupdown/init-ifupdown_%.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS:prepend:ultra96 := "${THISDIR}/files:" |