Пример #1
0
    def test_find_xilinx_path(self):
        path = utils.find_xilinx_path()
        if path is None:
            print "Note: A Xilinx toolchain is required for this test"
        #print "Path: %s" % path
        self.assertIsNotNone(path)

        #Testing Vivado path
        path = utils.find_xilinx_path(build_tool="Vivado")
        #print "Path: %s" % path
        self.assertIsNotNone(path)
Пример #2
0
def initialize_environment(env, xilinx_path="", build_tool="ISE", version_number=""):
    """
	Initialized an environment to contain all the xilinx build tools

	Args:
		env (Scons.Environment): An environment to add all the xilinx tools too
		xilinx_path (string): A user defined path to the xilinx base directory
			(leave empty to use the default system location)
		build_type (string): to use, valid build types are found with
			utils.get_xilinx_tool_types
			(leave empty to use "ISE")
		version_number (string): specify a version number to use for one of the
			tool chains: e.g.
				build_tool = ISE -> version number = 13.2
				build_tool = Vivado -> version number = 2013.1
			(leave empty for the latest version)

	Returns:
		SCons.Environment): with the xilinx tools added

	Raises:
		Configuration Error
	"""
    xpath = utils.find_xilinx_path(xilinx_path, build_tool, version_number)

    # print "path to xilinx build tool: %s " % xpath
    env['XIL_SCRIPT_LOC'] = xpath
    env['XILINX_DSP'] = xpath
    env['XILINX_PLANAHEAD'] = os.path.join(xpath, "PlanAhead")
    env['XILINX'] = xpath

    if "USER" not in os.environ:
        os.environ["USER"] = getpass.getuser()
    if "XILINXD_LICENSE_FILE" in os.environ:
        #print "Found License File Location: %s" % os.environ["XILINXD_LICENSE_FILE"]
        env['ENV']['XILINXD_LICENSE_FILE'] = os.environ["XILINXD_LICENSE_FILE"]
    if "LM_LICENSE_FILE" in os.environ:
        env['ENV']['LM_LICENSE_FILE'] = os.environ["LM_LICENSE_FILE"]
    env['ENV']['USER'] = os.environ["USER"]
    if os.name == "nt" and 'HOME' not in env['ENV'].keys():
        env['ENV']['HOME'] = os.environ['USERPROFILE']
    else:
        env['ENV']['HOME'] = os.environ["HOME"]

    if 'LD_LIBRARY_PATH' not in env:
        env['LD_LIBRARY_PATH'] = ''
    # print "xilinx path: %s" % xilinx_path
    # print "build tool: %s" % build_tool
    # print "version number: %s" % version_number
    # print "xpath: %s" % xpath
    # This is used for the license file
    if os.name == "nt":
        env["ENV"]["USERNAME"] = env['ENV']["USER"]

    if build_tool.lower() == "ise" or build_tool.lower() == "planahead":
        env.AppendENVPath("PATH", os.path.join(xpath, "PlanAhead", "bin"))
        env.AppendENVPath("PATH", os.path.join(xpath, "ISE", "sysgen", "util"))
        if utils.is_64_bit():
            # 64 bit machine
            if os.name == "nt":
                env.AppendENVPath("PATH", os.path.join(xpath, "common", "bin", "nt64"))
                env.AppendENVPath("PATH", os.path.join(xpath, "ISE", "bin", "nt64"))
                lib_path = os.path.join(xpath, "ISE", "lib", "nt64")
                env['LD_LIBRARY_PATH'] = string.join([lib_path, env['LD_LIBRARY_PATH']], os.pathsep)
                lib_path = os.path.join(xpath, "common", "lib", "nt64")
                env['LD_LIBRARY_PATH'] = string.join([lib_path, env['LD_LIBRARY_PATH']], os.pathsep)
            # print "LD_LIBRARY_PATH: %s" % str(env['LD_LIBRARY_PATH'])
            else:
                env.AppendENVPath("PATH", os.path.join(xpath, "common", "bin", "lin64"))
                env.AppendENVPath("PATH", os.path.join(xpath, "ISE", "bin", "lin64"))
                lib_path = os.path.join(xpath, "ISE", "lib", "lin64")
                env['LD_LIBRARY_PATH'] = string.join([lib_path, env['LD_LIBRARY_PATH']], os.pathsep)
                lib_path = os.path.join(xpath, "common", "lib", "lin64")
                env['LD_LIBRARY_PATH'] = string.join([lib_path, env['LD_LIBRARY_PATH']], os.pathsep)
                # print "LD_LIBRARY_PATH: %s" % str(env['LD_LIBRARY_PATH'])
        else:
            # 32 bit machine
            env.AppendENVPath("PATH", os.path.join(xpath, "common", "bin", "lin"))
            env.AppendENVPath("PATH", os.path.join(xpath, "ISE", "bin", "lin"))
            lib_path = os.path.join(xpath, "ISE", "lib", "lin")
            env['LD_LIBRARY_PATH'] = string.join([lib_path, env['LD_LIBRARY_PATH']], os.pathsep)
            lib_path = os.path.join(xpath, "common", "lib", "lin")
            env['LD_LIBRARY_PATH'] = string.join([lib_path, env['LD_LIBRARY_PATH']], os.pathsep)
            # print "LD_LIBRARY_PATH: %s" % str(env['LD_LIBRARY_PATH'])
    else:

        raise XilinxNotImplemented("Vivado is not implemented yet")

    return env