Beispiel #1
0
def gen_overlay(args, dtcdir, outdir, link):
    prj = args.prj
    if dtcdir is None:
        log.error("Device Tree Compiler must be specified")
        return
    outdir = outdir if outdir is not None else prj.basedir + ".os"
    shutil2.mkdir(outdir)
    outdir = outdir + "/overlay"

    log.info("Generate device tree overlay in project directory '" + prj.dir +
             "'")

    dictionary = {}
    dictionary["DEVICE"] = "zynqmp" if "xczu" in prj.impl.part else "zynq"

    log.info("Exporting device tree overlay...")
    prj.apply_template("artico3_devicetree_overlay", dictionary, outdir, link)

    log.info("Building device tree overlay...")
    shutil2.chdir(outdir)
    subprocess.run("""
        bash -c "{0}/dtc -I dts -O dtb -@ -o artico3.dtbo artico3.dts"
        bash -c "{0}/dtc -I dts -O dts -@ -o artico3.dtso artico3.dts"
        """.format(dtcdir),
                   shell=True,
                   check=True)

    print()
    shutil2.chdir(prj.dir)
Beispiel #2
0
def clean(args, cross):
    prj = args.prj
    swdir = prj.basedir + ".sw"

    if args.remove:
        shutil2.rmtree(swdir)
    else:
        try:
            shutil2.chdir(swdir)
        except:
            log.error("software directory '" + swdir + "' not found")
            return

        if cross == "":
            if "xczu" in prj.impl.part:
                cc = "/opt/Xilinx/SDK/{0}/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-".format(prj.impl.xil[1])
            else:
                #~ cc = "/opt/Xilinx/SDK/{0}/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-".format(prj.impl.xil[1])
                cc = "/opt/Xilinx/SDK/{0}/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-".format(prj.impl.xil[1])
        else:
            cc = cross

        subprocess.run("""
            bash -c "export CROSS_COMPILE={0} &&
            make clean"
            """.format(cc), shell=True, check=True)


        print()
        shutil2.chdir(prj.dir)
Beispiel #3
0
def gen_driver(args, kdir, outdir, link, cross):
    prj = args.prj
    if kdir is None:
        log.error("Linux kernel source path must be specified")
        return
    outdir = outdir if outdir is not None else prj.basedir + ".os"
    shutil2.mkdir(outdir)
    outdir = outdir + "/driver"

    log.info("Generate Linux driver in project directory '" + prj.dir + "'")

    dictionary = {}

    log.info("Exporting Linux driver...")
    prj.apply_template("artico3_driver_linux", dictionary, outdir, link)

    log.info("Building Linux driver...")

    if cross == "":
        if "xczu" in prj.impl.part:
            cc = "/opt/Xilinx/SDK/{0}/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-".format(
                prj.impl.xil[1])
        else:
            #~ cc = "/opt/Xilinx/SDK/{0}/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-".format(prj.impl.xil[1])
            cc = "/opt/Xilinx/SDK/{0}/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-".format(
                prj.impl.xil[1])
    else:
        cc = cross

    if "xczu" in prj.impl.part:
        arch = "arm64"
    else:
        arch = "arm"

    shutil2.chdir(outdir)

    subprocess.run("""
        bash -c "export CROSS_COMPILE={0} &&
        export ARCH={1} &&
        export KDIR={2} &&
        make"
        """.format(cc, arch, kdir),
                   shell=True,
                   check=True)

    print()
    shutil2.chdir(prj.dir)
Beispiel #4
0
def _build(prj, hwdir):
    hwdir = hwdir if hwdir is not None else prj.basedir + ".hw"
    try:
        shutil2.chdir(hwdir)
    except:
        log.error("hardware directory '" + hwdir + "' not found")
        return

    # NOTE: for some reason, using the subprocess module as in the
    #       original RDK does not work (does not recognize source and,
    #       therefore, Vivado is not started).
    subprocess.run("""
        bash -c "source /opt/Xilinx/Vivado/{0}/settings64.sh &&
        vivado -mode batch -notrace -nojournal -nolog -source build.tcl"
        """.format(prj.impl.xil[1]),
                   shell=True,
                   check=True)

    print()
    shutil2.chdir(prj.dir)