2021-01-04 08:35:45 -05:00
|
|
|
#
|
|
|
|
# This file is part of LiteX-Boards.
|
|
|
|
#
|
2021-07-28 06:03:37 -04:00
|
|
|
# This file is Copyright (c) 2017-2021 Florent Kermarrec <florent@enjoy-digital.fr>
|
2019-06-24 06:38:58 -04:00
|
|
|
# This file is Copyright (c) 2019 Tim 'mithro' Ansell <me@mith.ro>
|
2020-08-23 09:00:17 -04:00
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
2019-06-24 06:38:58 -04:00
|
|
|
|
|
|
|
import subprocess
|
|
|
|
import unittest
|
|
|
|
import os
|
|
|
|
|
|
|
|
from migen import *
|
|
|
|
|
|
|
|
from litex.soc.integration.builder import *
|
|
|
|
|
|
|
|
class TestTargets(unittest.TestCase):
|
2021-10-13 11:01:09 -04:00
|
|
|
excluded_platforms = [
|
2021-12-13 09:54:56 -05:00
|
|
|
"qmtech_daughterboard", # Reason: Not a real platform.
|
|
|
|
"quicklogic_quickfeather", # Reason: No default clock.
|
|
|
|
"efinix_titanium_ti60_f225_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"efinix_trion_t120_bga576_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"efinix_trion_t20_bga256_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"efinix_trion_t20_mipi_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"efinix_xyloni_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"sipeed_tang_primer", # Reason: Require Anlogic toolchain.
|
|
|
|
"jungle_electronics_fireant", # Reason: Require Efinity toolchain.
|
2022-03-28 09:42:21 -04:00
|
|
|
"efinix_t8f81_dev_kit", # Reason: Require Efinity toolchain.
|
2022-04-14 06:23:41 -04:00
|
|
|
"adi_plutosdr", # Reason: No default clock.
|
2022-09-13 08:55:24 -04:00
|
|
|
"newae_cw305", # Reason: No default clock.
|
2021-10-13 11:01:09 -04:00
|
|
|
]
|
|
|
|
excluded_targets = [
|
2021-12-13 09:54:56 -05:00
|
|
|
"simple", # Reason: Generic target.
|
|
|
|
"quicklogic_quickfeather", # Reason: No default clock.
|
|
|
|
"efinix_titanium_ti60_f225_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"efinix_trion_t120_bga576_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"efinix_trion_t20_bga256_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"efinix_trion_t20_mipi_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"efinix_xyloni_dev_kit", # Reason: Require Efinity toolchain.
|
|
|
|
"sipeed_tang_primer", # Reason: Require Anlogic toolchain.
|
|
|
|
"jungle_electronics_fireant", # Reason: Require Efinity toolchain.
|
2022-03-28 09:42:21 -04:00
|
|
|
"efinix_t8f81_dev_kit", # Reason: Require Efinity toolchain.
|
2021-10-13 11:01:09 -04:00
|
|
|
]
|
2021-10-01 07:53:05 -04:00
|
|
|
|
2021-07-28 06:03:37 -04:00
|
|
|
# Build simple design for all platforms.
|
2021-07-28 06:13:40 -04:00
|
|
|
def test_platforms(self):
|
2021-07-28 06:03:37 -04:00
|
|
|
# Collect platforms.
|
2019-06-24 06:38:58 -04:00
|
|
|
platforms = []
|
2021-07-28 06:03:37 -04:00
|
|
|
for file in os.listdir("./litex_boards/platforms/"):
|
|
|
|
if file.endswith(".py"):
|
|
|
|
file = file.replace(".py", "")
|
2021-10-01 07:53:05 -04:00
|
|
|
if file not in ["__init__"] + self.excluded_platforms:
|
2021-07-28 06:03:37 -04:00
|
|
|
platforms.append(file)
|
2019-06-24 06:38:58 -04:00
|
|
|
|
2021-07-28 06:03:37 -04:00
|
|
|
# Test platforms with simple design.
|
2020-02-03 03:44:22 -05:00
|
|
|
for name in platforms:
|
|
|
|
with self.subTest(platform=name):
|
2021-09-09 05:36:18 -04:00
|
|
|
os.system("rm -rf build")
|
2019-06-24 06:38:58 -04:00
|
|
|
cmd = """\
|
2021-07-28 06:03:37 -04:00
|
|
|
python3 -m litex_boards.targets.simple litex_boards.platforms.{} \
|
2022-06-29 03:41:57 -04:00
|
|
|
--build \
|
2022-04-21 06:31:31 -04:00
|
|
|
--no-compile \
|
|
|
|
--uart-name="stub" \
|
2021-07-28 06:13:40 -04:00
|
|
|
""".format(name)
|
|
|
|
subprocess.check_call(cmd, shell=True)
|
|
|
|
|
|
|
|
# Build default configuration for all targets.
|
|
|
|
def test_targets(self):
|
|
|
|
# Collect targets.
|
|
|
|
targets = []
|
|
|
|
for file in os.listdir("./litex_boards/targets/"):
|
|
|
|
if file.endswith(".py"):
|
|
|
|
file = file.replace(".py", "")
|
2021-10-01 07:53:05 -04:00
|
|
|
if file not in ["__init__"] + self.excluded_targets:
|
2021-07-28 06:13:40 -04:00
|
|
|
targets.append(file)
|
|
|
|
|
|
|
|
# Test targets.
|
|
|
|
for name in targets:
|
|
|
|
with self.subTest(target=name):
|
2021-09-09 05:36:18 -04:00
|
|
|
os.system("rm -rf build")
|
2021-07-28 06:13:40 -04:00
|
|
|
cmd = """\
|
|
|
|
python3 -m litex_boards.targets.{} \
|
2021-12-09 10:09:38 -05:00
|
|
|
--cpu-type=vexriscv \
|
|
|
|
--cpu-variant=minimal \
|
2022-06-29 03:41:57 -04:00
|
|
|
--build \
|
2022-04-21 06:31:31 -04:00
|
|
|
--no-compile \
|
2020-02-03 03:44:22 -05:00
|
|
|
""".format(name)
|
2019-06-24 06:38:58 -04:00
|
|
|
subprocess.check_call(cmd, shell=True)
|