~ruther/nix-fpga

0a072151f5c64b3d488b67a3dee3344ce57aa52b — Rutherther 5 months ago 63d383f main
feat: add vitis
M flake.nix => flake.nix +4 -0
@@ 25,6 25,10 @@
        vivado = pkgs.callPackage ./pkgs/xilinx/vivado/fhs-package.nix { inherit myLib; };
        vivado-udev-rules = pkgs.callPackage ./pkgs/xilinx/vivado/udev.nix {};

        vitis-shell = pkgs.callPackage ./pkgs/xilinx/vitis/fhs-shell.nix { inherit myLib; };
        vitis = pkgs.callPackage ./pkgs/xilinx/vitis/fhs-package.nix { inherit myLib; };
        vitis-udev-rules = pkgs.callPackage ./pkgs/xilinx/vitis/udev.nix {};

        ise-shell = pkgs.callPackage ./pkgs/xilinx/ise/fhs-shell.nix {
          inherit myLib;
          ise-usb-driver = self.packages.${system}.ise-usb-driver;

M pkgs/xilinx/common.nix => pkgs/xilinx/common.nix +26 -0
@@ 1,5 1,6 @@
{
  targetPkgs = pkgs: with pkgs; [
    bash
    gnumake
    coreutils
    stdenv.cc.cc


@@ 20,6 21,7 @@
    glibc.dev
    fontconfig
    liberation_ttf
    lsb-release

    # Xilinx ISE
    glib


@@ 37,5 39,29 @@
    xorg.libXrandr
    xorg.libSM
    xorg.libICE

    # to compile some xilinx examples
    opencl-clhpp
    ocl-icd
    opencl-headers

    # Vitis
    python3
    swt
    (pkgs.runCommandLocal "swt-4" {} ''
      mkdir -p $out/lib
      ln -s ${swt}/lib/libswt-pi-gtk-4527.so $out/lib/libswt-pi4-gtk.so
    '')
    gtk3
    jdk21
    xorg.xlsclients

    # Debug
    strace

    # "arch" is needed for vitis
    toybox
    unzip
    (lib.hiPrio gcc)
  ];
}

A pkgs/xilinx/vitis/fhs-package.nix => pkgs/xilinx/vitis/fhs-package.nix +83 -0
@@ 0,0 1,83 @@
{ pkgs, myLib }:

myLib.finalPkgGenerator.override {
  mainProgram = "vitis";

  fhsEnv = pkgs.callPackage ./fhs.nix { inherit myLib; requireInstallDir = true; };

  executables = [
    # From Vivado bin folder
    "cdoutil_int"
    "combine_dfx_bitstreams"
    "cs_server"
    "diffbd"
    "hw_server"
    "hw_serverpv"
    "ldlibpath.sh"
    "loader"
    "manage_ipcache"
    "program_ftdi"
    "rdiArgs.sh"
    "setEnvAndRunCmd.sh"
    "setupEnv.sh"
    "stapl_player"
    "svf_utility"
    "symbol_server"
    "tcflog"
    "unsetldlibpath.sh"
    "unwrapped"
    "updatemem"
    "vivado"
    "vlm"
    "wbtcv"
    "xar"
    "xcd"
    "xcrg"
    "xelab"
    "xlicdiag"
    "xrcserver"
    "xrt_server"
    "xsc"
    "xsdb"
    "xsim"
    "xtclsh"
    "xvc_pcie"
    "xvhdl"
    "xvlog"

    # From Vitis bin folder
    "apcc"
    "hlsArgs.sh"
    "ldlibpath.sh"
    "loader"
    "rdiArgs.sh"
    "setEnvAndRunCmd.sh"
    "setupEnv.sh"
    "unsetldlibpath.sh"
    "unwrapped"
    "vitis_hls"
    "vitis"
    "xlicdiag"

    # From ModelComposer bin folder
    "ldlibpath.sh"
    "loader"
    "model_composer"
    "modelcomposerArgs.sh"
    "rdiArgs.sh"
    "setEnvAndRunCmd.sh"
    "setPatchEnv.sh"
    "setupEnv.sh"
    "unsetldlibpath.sh"
    "unwrapped"

    # From DocNav bin folder
    "AppRun"
    "docnav"
    "lib"
    "libexec"
    "pdfjs"
    "plugins"
    "translations"
  ];
}

A pkgs/xilinx/vitis/fhs-shell.nix => pkgs/xilinx/vitis/fhs-shell.nix +7 -0
@@ 0,0 1,7 @@
{ pkgs, lib, myLib }:

let
  fhs = pkgs.callPackage ./fhs.nix {  inherit myLib; };
in pkgs.writeShellScriptBin "vitis-shell" ''
  exec ${lib.getExe fhs} bash "$@"
''

A pkgs/xilinx/vitis/fhs.nix => pkgs/xilinx/vitis/fhs.nix +18 -0
@@ 0,0 1,18 @@
{ pkgs, myLib, requireInstallDir ? false, ... }:

pkgs.buildFHSEnv {
  targetPkgs = (import ../common.nix).targetPkgs;

  name = "vitis";

  runScript = ''
    ${myLib.runScriptPrefix "vitis" requireInstallDir}
    if [[ ! -z $INSTALL_DIR ]]; then
      source $INSTALL_DIR/settings64.sh $INSTALL_DIR
    fi
    export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
    exec "$@"
  '';

  meta.mainProgram = "vitis";
}

Do not follow this link