Пример #1
0
 def __init__(self, rootdir):
     Toolchain.__init__(self, rootdir)
     self.toolchain = 'vivado'
     self.synthtool = 'vivado'
     self.synthoptions = []
     self.files = []
     self.edam = None
     self.backend = None
Пример #2
0
    def __init__(self, rootdir):
        Toolchain.__init__(self, rootdir)
        self.toolchain = 'nextpnr-xilinx-fasm2bels'
        self.files = []
        self.fasm2bels = True

        self.dbroot = os.getenv('XRAY_DATABASE_DIR', None)

        assert self.dbroot
Пример #3
0
def inspect_host(spec):
    toolchain = Toolchain(spec=spec)
    print('Host Environment:')
    print('  Host: {} {}'.format(spec.host, spec.arch))
    print('  Target: {} {}'.format(spec.target, spec.arch))
    compiler_path = toolchain.compiler_path()
    if not compiler_path:
        compiler_path = '(Will Install)'
    print('  Compiler: {} (version: {}) {}'.format(spec.compiler,
                                                   toolchain.compiler_version,
                                                   compiler_path))
    compilers = ['{} {}'.format(c[0], c[1]) for c in Toolchain.all_compilers()]
    print('  Available Compilers: {}'.format(', '.join(compilers)))
    print('  Available Projects: {}'.format(', '.join(Project.projects())))
Пример #4
0
    def __init__(self, rootdir):
        Toolchain.__init__(self, rootdir)
        self.toolchain = 'nextpnr-xilinx-fasm2bels'
        self.files = []
        self.fasm2bels = True

        self.dbroot = subprocess.check_output(
            'prjxray-config', shell=True).decode('utf-8').strip()

        capnp_schema_dir = subprocess.check_output(
            'capnp-schemas-dir', shell=True).decode('utf-8').strip()

        self.files.append({'name': capnp_schema_dir, 'file_type': 'capnp'})

        assert self.dbroot
Пример #5
0
    def install(self, env):
        if self.installed:
            return

        sh = env.shell

        installed_path, installed_version = Toolchain.find_compiler(
            env.spec.compiler, env.spec.compiler_version)
        if installed_path:
            print('Compiler {} {} already exists at {}'.format(
                env.spec.compiler, installed_version, installed_path))
            self.installed = True
            return

        sudo = env.config.get('sudo', current_os() == 'linux')
        sudo = ['sudo'] if sudo else []

        version = env.toolchain.compiler_version.replace('\..+', '')

        script = tempfile.NamedTemporaryFile(delete=False)
        script_path = script.name
        script.write(LLVM_SH.encode())
        script.close()

        # Make script executable
        os.chmod(
            script_path, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
            | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
        sh.exec(*sudo, [script_path, version], check=True)

        self.installed = True
Пример #6
0
def default_spec(env):
    target, arch = current_platform().split('-')
    host = current_host()
    compiler, version = Toolchain.default_compiler(target, arch)
    return BuildSpec(host=host,
                     compiler=compiler,
                     compiler_version='{}'.format(version),
                     target=target,
                     arch=arch)
Пример #7
0
    def install(self, env):
        if self.installed:
            return

        sh = env.shell
        config = env.config

        installed_path, installed_version = Toolchain.find_compiler(
            env.spec.compiler, env.spec.compiler_version)
        if installed_path:
            print('Compiler {} {} already exists at {}'.format(
                env.spec.compiler, installed_version, installed_path))
            self.installed = True
            return

        packages = UniqueList(config.get('compiler_packages', []))
        compiler = env.spec.compiler
        version = env.spec.compiler_version

        Script([InstallPackages(packages)], name='install gcc').run(env)

        self.installed = True
Пример #8
0
 def __init__(self):
     Toolchain.__init__(self)
     self.icecubedir = self.ICECUBEDIR_DEFAULT
Пример #9
0
def generate():
    start_time = datetime.now()
    toolchains = ToolchainSet()
    main_release = "releases"
    toolchains_path = os.path.join(TOOLCHAINS_DIR, main_release)
    toolchain_list = []

    # Find all toolchains
    for a in os.scandir(os.path.join(toolchains_path, "toolchains")):
        try:
            toolchain_list += os.scandir(
                os.path.join(toolchains_path, "toolchains", a.name,
                             'available_toolchains'))
        except FileNotFoundError:
            pass
    # Iterate over all toolchains
    for toolchain in sorted([
            e for e in toolchain_list if e.is_file()
            and not e.name.startswith('.') and not e.name.endswith(".sha256")
    ],
                            key=lambda t: t.name):
        t = Toolchain(toolchain.name)

        arch_path = os.path.join(toolchains_path, "toolchains", t.arch)

        t.set_test_result(arch_path, t.name)

        with open(
                os.path.join(toolchains_path, "toolchains", t.arch,
                             "summaries", t.name + ".csv")) as f:
            t.set_summary(f)

        toolchains.add(main_release, t)

    for p in ['index', 'status', 'faq', 'news']:
        template = jinja_env.get_template("templates/%s.jinja" % p)
        html = template.render(toolchains=toolchains,
                               datetime=datetime,
                               start_time=start_time)
        with open(os.path.join(WWW_DIR, p + ".html"), 'w') as f:
            f.write(html)
        print("Page generated in", os.path.join(WWW_DIR, p + ".html"))

    template = jinja_env.get_template("templates/arch_listing.jinja")
    for a in toolchains.arch_list(main_release):
        page_name = "%s_%s" % (main_release, a)
        html = template.render(release=main_release,
                               arch=a,
                               toolchains=toolchains,
                               datetime=datetime,
                               start_time=start_time)
        with open(os.path.join(WWW_DIR, page_name + ".html"), 'w') as f:
            f.write(html)
        print("Page generated in", os.path.join(WWW_DIR, page_name + ".html"))

    template = jinja_env.get_template("templates/toolchains.jinja")
    page_name = "toolchains"
    html = template.render(release=main_release,
                           toolchains=toolchains,
                           datetime=datetime,
                           start_time=start_time)
    with open(os.path.join(WWW_DIR, page_name + ".html"), 'w') as f:
        f.write(html)
    print("Page generated in", os.path.join(WWW_DIR, page_name + ".html"))
Пример #10
0
 def __init__(self, rootdir):
     Toolchain.__init__(self, rootdir)
     self.toolchain = 'nextpnr-xilinx'
     self.files = []
     self.fasm2bels = False
     self.dbroot = None
Пример #11
0
 def __init__(self, rootdir):
     Toolchain.__init__(self, rootdir)
     self.toolchain = 'vpr'
     self.files = []
     self.fasm2bels = False
     self.dbroot = None
Пример #12
0
 def __init__(self):
     Toolchain.__init__(self)
     self.radiantdir = Radiant.RADIANTDIR_DEFAULT
Пример #13
0
 def __init__(self, rootdir):
     Toolchain.__init__(self, rootdir)
     self.files = []
     self.edam = None
     self.backend = None
Пример #14
0
    Scripts.load()

    if not env.project and args.command != 'mirror':
        print('No project specified and no project found in current directory')
        sys.exit(1)

    print('Using Spec:')
    print('  Host: {} {}'.format(spec.host, current_arch()))
    print('  Target: {} {}'.format(spec.target, spec.arch))
    print('  Compiler: {} {}'.format(spec.compiler, spec.compiler_version))

    if not env.config.get('enabled', True):
        raise Exception("The project is disabled in this configuration")

    if env.config.get('needs_compiler', True):
        env.toolchain = Toolchain(spec=env.spec)

    if args.dump_config:
        from pprint import pprint
        print('Spec: ', end='')
        pprint(env.spec)
        print('Config:')
        pprint(env.config)

    # Run a build with a specific spec/toolchain
    if args.command == 'build':
        run_build(env)
    # run a single action, usually local to a project
    else:
        run_action(args.command, env)