target/xxx: remove with-uartbone, add_uartbone and deal with case where uartbone is required inconditionnally

This commit is contained in:
Gwenhael Goavec-Merou 2023-10-23 17:30:39 +02:00
parent a6f3c5276e
commit afbf9eb8c9
7 changed files with 9 additions and 47 deletions

View file

@ -85,7 +85,6 @@ class BaseSoC(SoCCore):
eth_dynamic_ip = False,
with_hyperram = False,
with_sdcard = False,
with_uartbone = False,
with_spi_flash = False,
with_led_chaser = True,
with_video_terminal = False,
@ -141,10 +140,6 @@ class BaseSoC(SoCCore):
if with_etherbone:
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip)
# UartBone ---------------------------------------------------------------------------------
if with_uartbone:
self.add_uartbone(baudrate=1e6)
# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.leds = LedChaser(
@ -204,7 +199,6 @@ def main():
parser.add_target_argument("--eth-reset-time", default="10e-3", help="Duration of Ethernet PHY reset.")
parser.add_target_argument("--with-hyperram", action="store_true", help="Add HyperRAM.")
parser.add_target_argument("--with-sdcard", action="store_true", help="Add SDCard.")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add UartBone on 2nd serial.")
parser.add_target_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI).")
parser.add_target_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (HDMI).")
parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
@ -221,7 +215,6 @@ def main():
eth_dynamic_ip = args.eth_dynamic_ip,
with_hyperram = args.with_hyperram,
with_sdcard = args.with_sdcard,
with_uartbone = args.with_uartbone,
with_spi_flash = args.with_spi_flash,
with_video_terminal = args.with_video_terminal,
with_video_framebuffer = args.with_video_framebuffer,

View file

@ -55,7 +55,6 @@ class BaseSoC(SoCCore):
eth_dynamic_ip = False,
with_hyperram = False,
with_sdcard = False,
with_uartbone = False,
with_led_chaser = True,
**kwargs):
platform = antmicro_lpddr4_test_board.Platform()
@ -103,10 +102,6 @@ class BaseSoC(SoCCore):
if with_etherbone:
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip)
# UartBone ---------------------------------------------------------------------------------
if with_uartbone:
self.add_uartbone(baudrate=1e6)
# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.leds = LedChaser(
@ -128,7 +123,6 @@ def main():
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
parser.add_target_argument("--with-hyperram", action="store_true", help="Add HyperRAM.")
parser.add_target_argument("--with-sdcard", action="store_true", help="Add SDCard.")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add UartBone on 2nd serial.")
args = parser.parse_args()
assert not (args.with_etherbone and args.eth_dynamic_ip)
@ -142,7 +136,6 @@ def main():
eth_dynamic_ip = args.eth_dynamic_ip,
with_hyperram = args.with_hyperram,
with_sdcard = args.with_sdcard,
with_uartbone = args.with_uartbone,
**parser.soc_argdict)
builder = Builder(soc, **parser.builder_argdict)
if args.build:

View file

@ -122,7 +122,6 @@ class BaseSoC(SoCCore):
def __init__(self, board, revision, sys_clk_freq=60e6, toolchain="trellis",
with_ethernet = False,
with_etherbone = False,
with_uartbone = False,
eth_ip = "192.168.1.50",
eth_phy = 0,
with_led_chaser = True,
@ -155,6 +154,11 @@ class BaseSoC(SoCCore):
)
# SoCCore ----------------------------------------------------------------------------------
# Uartbone ---------------------------------------------------------------------------------
if kwargs["with_uartbone"]:
if board != "i5a-907":
raise ValueError("uartbone only supported on i5a-907")
SoCCore.__init__(self, platform, int(sys_clk_freq), ident="LiteX SoC on Colorlight " + board.upper(), **kwargs)
# SDR SDRAM --------------------------------------------------------------------------------
@ -192,12 +196,6 @@ class BaseSoC(SoCCore):
pads = platform.request_all("user_led_n"),
sys_clk_freq = sys_clk_freq)
# Uartbone ---------------------------------------------------------------------------------
if with_uartbone:
if board != "i5a-907":
raise ValueError("uartbone only supported on i5a-907")
self.add_uartbone(uart_name="uartbone")
# SPI Flash --------------------------------------------------------------------------------
if with_spi_flash:
if board == "i5a-907":
@ -229,7 +227,6 @@ def main():
ethopts = parser.target_group.add_mutually_exclusive_group()
ethopts.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support.")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add uartbone on 'FAN OUT' connector.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
parser.add_target_argument("--eth-phy", default=0, type=int, help="Ethernet PHY (0 or 1).")
parser.add_target_argument("--use-internal-osc", action="store_true", help="Use internal oscillator.")
@ -242,7 +239,6 @@ def main():
toolchain = args.toolchain,
with_ethernet = args.with_ethernet,
with_etherbone = args.with_etherbone,
with_uartbone = args.with_uartbone,
eth_ip = args.eth_ip,
eth_phy = args.eth_phy,
use_internal_osc = args.use_internal_osc,

View file

@ -72,7 +72,6 @@ class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=75e6, device="LIFCL-40-9BG400C", toolchain="radiant",
with_led_chaser = True,
with_spi_flash = False,
with_uartbone = False,
**kwargs):
platform = lattice_crosslink_nx_evn.Platform(device=device, toolchain=toolchain)
@ -99,10 +98,6 @@ class BaseSoC(SoCCore):
pads = Cat(*[platform.request("user_led", i) for i in range(14)]),
sys_clk_freq = sys_clk_freq)
# UARTBone ---------------------------------------------------------------------------------
if with_uartbone:
self.add_uartbone()
# SPI Flash --------------------------------------------------------------------------------
if with_spi_flash:
from litespi.modules import MX25L12833F
@ -122,7 +117,6 @@ def main():
parser.add_target_argument("--address", default=0x0, help="Flash address to program bitstream at.")
parser.add_target_argument("--prog-target", default="direct", help="Programming Target (direct or flash).")
parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add UartBone on 1st serial.")
args = parser.parse_args()
soc = BaseSoC(
@ -130,7 +124,6 @@ def main():
device = args.device,
toolchain = args.toolchain,
with_spi_flash = args.with_spi_flash,
with_uartbone = args.with_uartbone,
**parser.soc_argdict
)
builder = Builder(soc, **parser.builder_argdict)

View file

@ -95,11 +95,6 @@ class BaseSoC(SoCCore):
pads = platform.request_all("user_led_n"),
sys_clk_freq = sys_clk_freq)
# Add a UARTBone bridge --------------------------------------------------------------------
debug_uart = False
if debug_uart:
self.add_uartbone()
# Flash --------------------------------------------------------------------------------------------
def flash(bios_flash_offset, target="lattice_ice40up5k_evn"):

View file

@ -69,12 +69,11 @@ class BaseSoC(SoCMini):
self.crg = _CRG(platform, sys_clk_freq)
# SoCMini ----------------------------------------------------------------------------------
kwargs["uart_name"] = "crossover"
kwargs["uart_name"] = "crossover"
kwargs["uart_baudrate"] = 1e6 # CH552 firmware does not support traditional baudrates.
kwargs["with_uartbone"] = True
SoCMini.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Tang Nano", **kwargs)
# UARTBone ---------------------------------------------------------------------------------
self.add_uartbone(baudrate=int(1e6)) # CH552 firmware does not support traditional baudrates.
# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.leds = LedChaser(

View file

@ -58,7 +58,6 @@ class _CRG(LiteXModule):
class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=50e6,
with_led_chaser = True,
with_uartbone = False,
with_video_terminal = False,
with_spi_sdcard = False,
with_ethernet = False,
@ -79,14 +78,10 @@ class BaseSoC(SoCCore):
kwargs["uart_name"] = "crossover"
else:
kwargs["uart_name"] = "jtag_uart"
if with_uartbone:
if kwargs["with_uartbone"]:
kwargs["uart_name"] = "crossover"
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Terasic DECA", **kwargs)
# UARTbone ---------------------------------------------------------------------------------
if with_uartbone:
self.add_uartbone(uart_name=real_uart_name, baudrate=kwargs["uart_baudrate"])
# Ethernet ---------------------------------------------------------------------------------
if with_ethernet or with_etherbone:
self.platform.toolchain.additional_sdc_commands += [
@ -144,7 +139,6 @@ def main():
ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
parser.add_target_argument("--with-uartbone", action="store_true", help="Enable UARTbone support.")
parser.add_target_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (VGA).")
parser.add_target_argument("--with-spi-sdcard", action="store_true", help="Enable SPI SD card controller.")
args = parser.parse_args()
@ -155,7 +149,6 @@ def main():
with_etherbone = args.with_etherbone,
eth_ip = args.eth_ip,
eth_dynamic_ip = args.eth_dynamic_ip,
with_uartbone = args.with_uartbone,
with_video_terminal = args.with_video_terminal,
with_spi_sdcard = args.with_spi_sdcard,
**parser.soc_argdict