boards: digilent_nexys4ddr, kosagi_netv2, sipeed_tang_primer_20k: added eth_ip/remote_ip arg

This commit is contained in:
Gwenhael Goavec-Merou 2024-09-13 15:40:12 +02:00
parent 4604379f46
commit 3050716e8e
3 changed files with 36 additions and 16 deletions

View File

@ -56,6 +56,8 @@ class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=75e6, def __init__(self, sys_clk_freq=75e6,
with_ethernet = False, with_ethernet = False,
with_etherbone = False, with_etherbone = False,
eth_ip = "192.168.1.50",
remote_ip = None,
with_led_chaser = True, with_led_chaser = True,
with_video_terminal = False, with_video_terminal = False,
with_video_framebuffer = False, with_video_framebuffer = False,
@ -85,10 +87,10 @@ class BaseSoC(SoCCore):
self.ethphy = LiteEthPHYRMII( self.ethphy = LiteEthPHYRMII(
clock_pads = self.platform.request("eth_clocks"), clock_pads = self.platform.request("eth_clocks"),
pads = self.platform.request("eth")) pads = self.platform.request("eth"))
if with_ethernet:
self.add_ethernet(phy=self.ethphy)
if with_etherbone: if with_etherbone:
self.add_etherbone(phy=self.ethphy) self.add_etherbone(phy=self.ethphy, ip_address=eth_ip, with_ethmac=with_ethernet)
elif with_ethernet:
self.add_ethernet(phy=self.ethphy, local_ip=eth_ip, remote_ip=remote_ip)
# Video ------------------------------------------------------------------------------------ # Video ------------------------------------------------------------------------------------
if with_video_terminal or with_video_framebuffer: if with_video_terminal or with_video_framebuffer:
@ -109,22 +111,26 @@ class BaseSoC(SoCCore):
def main(): def main():
from litex.build.parser import LiteXArgumentParser from litex.build.parser import LiteXArgumentParser
parser = LiteXArgumentParser(platform=digilent_nexys4ddr.Platform, description="LiteX SoC on Nexys4DDR.") parser = LiteXArgumentParser(platform=digilent_nexys4ddr.Platform, description="LiteX SoC on Nexys4DDR.")
parser.add_target_argument("--sys-clk-freq", default=75e6, type=float, help="System clock frequency.") parser.add_target_argument("--sys-clk-freq", default=75e6, type=float, help="System clock frequency.")
ethopts = parser.target_group.add_mutually_exclusive_group() ethopts = parser.target_group.add_mutually_exclusive_group()
ethopts.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.") ethopts.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support.") 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("--remote-ip", default="192.168.1.100", help="Remote IP address of TFTP server.")
sdopts = parser.target_group.add_mutually_exclusive_group() sdopts = parser.target_group.add_mutually_exclusive_group()
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support.") sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support.")
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support.") sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support.")
viopts = parser.target_group.add_mutually_exclusive_group() viopts = parser.target_group.add_mutually_exclusive_group()
viopts.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (VGA).") viopts.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (VGA).")
viopts.add_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (VGA).") viopts.add_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (VGA).")
args = parser.parse_args() args = parser.parse_args()
soc = BaseSoC( soc = BaseSoC(
sys_clk_freq = args.sys_clk_freq, sys_clk_freq = args.sys_clk_freq,
with_ethernet = args.with_ethernet, with_ethernet = args.with_ethernet,
with_etherbone = args.with_etherbone, with_etherbone = args.with_etherbone,
eth_ip = args.eth_ip,
remote_ip = args.remote_ip,
with_video_terminal = args.with_video_terminal, with_video_terminal = args.with_video_terminal,
with_video_framebuffer = args.with_video_framebuffer, with_video_framebuffer = args.with_video_framebuffer,
**parser.soc_argdict **parser.soc_argdict

View File

@ -64,6 +64,8 @@ class BaseSoC(SoCCore):
def __init__(self, variant="a7-35", sys_clk_freq=100e6, def __init__(self, variant="a7-35", sys_clk_freq=100e6,
with_pcie = False, with_pcie = False,
with_ethernet = False, with_ethernet = False,
eth_ip = "192.168.1.50",
remote_ip = None,
with_led_chaser = True, with_led_chaser = True,
**kwargs): **kwargs):
platform = kosagi_netv2.Platform(variant=variant) platform = kosagi_netv2.Platform(variant=variant)
@ -91,7 +93,7 @@ class BaseSoC(SoCCore):
self.ethphy = LiteEthPHYRMII( self.ethphy = LiteEthPHYRMII(
clock_pads = self.platform.request("eth_clocks"), clock_pads = self.platform.request("eth_clocks"),
pads = self.platform.request("eth")) pads = self.platform.request("eth"))
self.add_ethernet(phy=self.ethphy) self.add_ethernet(phy=self.ethphy, local_ip=eth_ip, remote_ip=remote_ip)
# PCIe ------------------------------------------------------------------------------------- # PCIe -------------------------------------------------------------------------------------
if with_pcie: if with_pcie:
@ -114,6 +116,8 @@ def main():
parser.add_target_argument("--variant", default="a7-35", help="Board variant (a7-35 or a7-100).") parser.add_target_argument("--variant", default="a7-35", help="Board variant (a7-35 or a7-100).")
parser.add_target_argument("--sys-clk-freq", default=100e6, type=float, help="System clock frequency.") parser.add_target_argument("--sys-clk-freq", default=100e6, type=float, help="System clock frequency.")
parser.add_target_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.") parser.add_target_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
parser.add_target_argument("--remote-ip", default="192.168.1.100", help="Remote IP address of TFTP server.")
parser.add_target_argument("--with-pcie", action="store_true", help="Enable PCIe support.") parser.add_target_argument("--with-pcie", action="store_true", help="Enable PCIe support.")
parser.add_target_argument("--driver", action="store_true", help="Generate PCIe driver.") parser.add_target_argument("--driver", action="store_true", help="Generate PCIe driver.")
sdopts = parser.target_group.add_mutually_exclusive_group() sdopts = parser.target_group.add_mutually_exclusive_group()
@ -125,6 +129,8 @@ def main():
variant = args.variant, variant = args.variant,
sys_clk_freq = args.sys_clk_freq, sys_clk_freq = args.sys_clk_freq,
with_ethernet = args.with_ethernet, with_ethernet = args.with_ethernet,
eth_ip = args.eth_ip,
remote_ip = args.remote_ip,
with_pcie = args.with_pcie, with_pcie = args.with_pcie,
**parser.soc_argdict **parser.soc_argdict
) )

View File

@ -110,6 +110,7 @@ class BaseSoC(SoCCore):
with_ethernet = False, with_ethernet = False,
with_etherbone = False, with_etherbone = False,
eth_ip = "192.168.1.50", eth_ip = "192.168.1.50",
remote_ip = None,
eth_dynamic_ip = False, eth_dynamic_ip = False,
dock = "standard", dock = "standard",
**kwargs): **kwargs):
@ -159,7 +160,12 @@ class BaseSoC(SoCCore):
refclk_cd = None refclk_cd = None
) )
if with_ethernet: if with_ethernet:
self.add_ethernet(phy=self.ethphy, dynamic_ip=eth_dynamic_ip, with_timing_constraints=False) self.add_ethernet(phy=self.ethphy,
dynamic_ip = eth_dynamic_ip,
local_ip = eth_ip,
remote_ip = remote_ip,
with_timing_constraints = False
)
if with_etherbone: if with_etherbone:
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip, with_timing_constraints=False) self.add_etherbone(phy=self.ethphy, ip_address=eth_ip, with_timing_constraints=False)
@ -209,10 +215,11 @@ def main():
parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).") parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
parser.add_target_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI).") parser.add_target_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI).")
ethopts = parser.target_group.add_mutually_exclusive_group() ethopts = parser.target_group.add_mutually_exclusive_group()
ethopts.add_argument("--with-ethernet", action="store_true", help="Add Ethernet.") ethopts.add_argument("--with-ethernet", action="store_true", help="Add Ethernet.")
ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone.") ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Etherbone IP address.") parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Etherbone IP address.")
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.") parser.add_target_argument("--remote-ip", default="192.168.1.100", help="Remote IP address of TFTP server.")
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
args = parser.parse_args() args = parser.parse_args()
soc = BaseSoC( soc = BaseSoC(
@ -223,6 +230,7 @@ def main():
with_ethernet = args.with_ethernet, with_ethernet = args.with_ethernet,
with_etherbone = args.with_etherbone, with_etherbone = args.with_etherbone,
eth_ip = args.eth_ip, eth_ip = args.eth_ip,
remote_ip = args.remote_ip,
eth_dynamic_ip = args.eth_dynamic_ip, eth_dynamic_ip = args.eth_dynamic_ip,
dock = args.dock, dock = args.dock,
**parser.soc_argdict **parser.soc_argdict