#!/bin/bash # Source this file to setup the environment function setup_cucu() { INSTALL_PATH=/home/tools LOAD_BITSTREAM=$INSTALL_PATH/scripts export DMA_IP_DRIVERS="$INSTALL_PATH/drivers/$hostname/dma_ip_drivers-onic-gamma/xilinx_pcie_drivers" if [ ! -d $DMA_IP_DRIVERS ]; then echo "error: DMA_IP_DRIVERS $DMA_IP_DRIVERS directory does not exist" >&2 return fi export PATH="$DMA_IP_DRIVERS/QDMA/linux-kernel/bin/:$PATH" if [ -x /opt/Xilinx/Vivado/2020.1/settings64.sh ]; then source /opt/Xilinx/Vivado/2020.1/settings64.sh elif [ -x /opt/Xilinx/Vivado/2021.2/settings64.sh ]; then source /opt/Xilinx/Vivado/2021.2/settings64.sh fi } function setup_meep() { . /nfs/apps/XILINX/xilinx_22_env.sh export PATH="$PATH:/apps/QDMA/meep-ionic/2022.1.4.4/linux-kernel/bin/" # Select the first FPGA in the node local line=$(grep fpgan /etc/motd | sed -n 2p | tr -d ' ') export FPGACTL_PCIDEV=$(echo "$line" | awk -F'|' '{print $5}') export FPGACTL_SERIAL=$(echo "$line" | awk -F'|' '{print $4}') export FPGACTL_UART=$(echo "$line" | awk -F'|' '{print "/dev/"$7}') # Setup mappings # Delta between where we load in the dma device and RAM local delta_addr=-0x5ffe0000 # See https://gitlab.bsc.es/hwdesign/fpga/integration-lab/fpga-tools/-/blob/6a63bcea6d1d59df3c7d62311aa4935efd54d3a3/boot_riscv/boot_sa.sh#L36-40 export FPGACTL_BOOTLOADER_ADDR=$((0x80000000+$delta_addr)) export FPGACTL_KERNEL_ADDR=$((0x84000000+$delta_addr)) export FPGACTL_INITRD_ADDR=$((0x8c300000+$delta_addr)) export FPGACTL_ROOTFS_ADDR=$((0x100000000+$delta_addr)) export FPGACTL_BOOTROM_ADDR=$((0x00000100)) } hostname=$(hostname) case "$hostname" in cucu) setup_cucu ;; fpgan*) setup_meep ;; *) echo "ERROR: unknown host $hostname";; esac