Exemple #1
0
    parser.add_argument("action", nargs="+", help="specify an action")

    return parser.parse_args()

if __name__ == "__main__":
    args = _get_args()

    external_target = ""
    external_platform = ""
    if args.external:
        external_target = os.path.join(args.external, "targets")
        external_platform = os.path.join(args.external, "platforms")
        sys.path.insert(1, os.path.abspath(args.external))

    # create top-level SoC object
    target_module = misoc_import("targets", external_target, args.target)
    if args.sub_target:
        top_class = getattr(target_module, args.sub_target)
    else:
        top_class = target_module.default_subtarget

    if args.platform is None:
        if hasattr(top_class, "default_platform"):
            platform_name = top_class.default_platform
        else:
            raise ValueError("Target has no default platform, specify a platform with -p your_platform")
    else:
        platform_name = args.platform
    platform_module = misoc_import("mibuild.platforms", external_platform, platform_name)
    platform_kwargs = dict((k, autotype(v)) for k, v in args.platform_option)
    platform = platform_module.Platform(**platform_kwargs)
Exemple #2
0
    return parser.parse_args()


if __name__ == "__main__":
    args = _get_args()

    external_target = ""
    external_platform = ""
    if args.external:
        external_target = os.path.join(args.external, "targets")
        external_platform = os.path.join(args.external, "platforms")
        sys.path.insert(1, os.path.abspath(args.external))

    # create top-level SoC object
    target_module = misoc_import("targets", external_target, args.target)
    if args.sub_target:
        top_class = getattr(target_module, args.sub_target)
    else:
        top_class = target_module.default_subtarget

    if args.platform is None:
        if hasattr(top_class, "default_platform"):
            platform_name = top_class.default_platform
        else:
            raise ValueError(
                "Target has no default platform, specify a platform with -p your_platform"
            )
    else:
        platform_name = args.platform
    platform_module = misoc_import("mibuild.platforms", external_platform,
Exemple #3
0
#!/usr/bin/env python3

import os, sys, argparse

from migen.util.misc import autotype

from misoc_import import misoc_import

if __name__ == "__main__":
	parser = argparse.ArgumentParser(description="Program extra data to flash memory.")
	parser.add_argument("-f", "--flash-proxy-dir", default=None, help="set search directory for flash proxy bitstreams")
	parser.add_argument("-X", "--external", default="", help="use external directory for platforms and imports")
	parser.add_argument("-Op", "--platform-option", default=[], nargs=2, action="append", help="set platform-specific option")
	parser.add_argument("platform", help="target platform")
	parser.add_argument("file", help="file to flash")
	parser.add_argument("address", help="flash address to write")
	args = parser.parse_args()

	external_platform = ""
	if args.external:
		external_platform = os.path.join(args.external, "platforms")
		sys.path.insert(1, os.path.abspath(args.external))

	platform_module = misoc_import("mibuild.platforms", external_platform, args.platform)
	platform_kwargs = dict((k, autotype(v)) for k, v in args.platform_option)
	platform = platform_module.Platform(**platform_kwargs)

	prog = platform.create_programmer()
	prog.set_flash_proxy_dir(args.flash_proxy_dir)
	prog.flash(int(args.address, 0), args.file)
Exemple #4
0
import os
import sys
import argparse

from migen.util.misc import autotype

from misoc_import import misoc_import

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Program extra data to flash memory.")
    parser.add_argument("-f", "--flash-proxy-dir", default=None, help="set search directory for flash proxy bitstreams")
    parser.add_argument("-X", "--external", default="", help="use external directory for platforms and imports")
    parser.add_argument("-Op", "--platform-option", default=[], nargs=2, action="append", help="set platform-specific option")
    parser.add_argument("platform", help="target platform")
    parser.add_argument("file", help="file to flash")
    parser.add_argument("address", help="flash address to write")
    args = parser.parse_args()

    external_platform = ""
    if args.external:
        external_platform = os.path.join(args.external, "platforms")
        sys.path.insert(1, os.path.abspath(args.external))

    platform_module = misoc_import("mibuild.platforms", external_platform, args.platform)
    platform_kwargs = dict((k, autotype(v)) for k, v in args.platform_option)
    platform = platform_module.Platform(**platform_kwargs)

    prog = platform.create_programmer()
    prog.set_flash_proxy_dir(args.flash_proxy_dir)
    prog.flash(int(args.address, 0), args.file)