Skip to content

Commit

Permalink
gateware.platform: add support for using yowasp when yosys is not ava…
Browse files Browse the repository at this point in the history
…ilable
  • Loading branch information
antoinevg committed Dec 9, 2024
1 parent be05684 commit 1fc9680
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions luna/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from amaranth import Elaboratable
from amaranth._unused import MustUse

from luna.gateware.platform import configure_toolchain

# Log formatting strings.
LOG_FORMAT_COLOR = "\u001b[37;1m%(levelname)-8s| \u001b[0m\u001b[1m%(module)-12s|\u001b[0m %(message)s"
LOG_FORMAT_PLAIN = "%(levelname)-8s:n%(module)-12s>%(message)s"
Expand Down Expand Up @@ -108,8 +110,15 @@ def top_level_cli(fragment, *pos_args, **kwargs):
join_text = "and uploading gateware to attached" if args.upload else "for"
logging.info(f"Building {join_text} {platform.name}...")

# Configure toolchain.
if not configure_toolchain(platform):
logging.info(f"Failed to configure the toolchain for: {platform.toolchain}")
logging.info(f"Continuing anyway.")

# Now that we're actually building, re-enable Unused warnings.
MustUse._MustUse__silence = False

# Perform the build.
products = platform.build(fragment,
do_program=args.upload,
build_dir=build_dir
Expand Down
5 changes: 3 additions & 2 deletions luna/gateware/platform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from amaranth import Record

from .core import NullPin, LUNAPlatform
from .toolchain import configure_toolchain


def _get_platform_from_string(platform):
Expand Down Expand Up @@ -63,11 +64,11 @@ def get_appropriate_platform() -> LUNAPlatform:
"Unable to autodetect a supported platform. "
"The LUNA_PLATFORM environment variable must be set.")
platform = _get_platform_from_string(platform_string)

# If possible, override the platform's device type with the detected FPGA.
if fpga_device is not None:
platform.device = fpga_device

return platform


Expand Down

0 comments on commit 1fc9680

Please sign in to comment.