@@ -78,6 +78,7 @@ def __init__(self, variant="a7-35", toolchain="vivado", sys_clk_freq=100e6,
7878 eth_ip = "192.168.1.50" ,
7979 remote_ip = None ,
8080 eth_dynamic_ip = False ,
81+ eth_dhcp = False ,
8182 with_usb = False ,
8283 with_led_chaser = True ,
8384 with_spi_flash = False ,
@@ -123,7 +124,13 @@ def __init__(self, variant="a7-35", toolchain="vivado", sys_clk_freq=100e6,
123124 if with_etherbone :
124125 self .add_etherbone (phy = self .ethphy , ip_address = eth_ip , with_ethmac = with_ethernet )
125126 elif with_ethernet :
126- self .add_ethernet (phy = self .ethphy , dynamic_ip = eth_dynamic_ip , local_ip = eth_ip , remote_ip = remote_ip )
127+ self .add_ethernet (
128+ phy = self .ethphy ,
129+ dynamic_ip = eth_dynamic_ip ,
130+ with_dhcp = eth_dhcp ,
131+ local_ip = None if (eth_dynamic_ip or eth_dhcp ) else eth_ip ,
132+ remote_ip = remote_ip ,
133+ )
127134
128135 # SPI Flash --------------------------------------------------------------------------------
129136 if with_spi_flash :
@@ -207,6 +214,7 @@ def main():
207214 parser .add_target_argument ("--eth-ip" , default = "192.168.1.50" , help = "Ethernet/Etherbone IP address." )
208215 parser .add_target_argument ("--remote-ip" , default = "192.168.1.100" , help = "Remote IP address of TFTP server." )
209216 parser .add_target_argument ("--eth-dynamic-ip" , action = "store_true" , help = "Enable dynamic Ethernet IP assignment." )
217+ parser .add_target_argument ("--eth-dhcp" , action = "store_true" , help = "Enable Ethernet DHCP support." )
210218 sdopts = parser .target_group .add_mutually_exclusive_group ()
211219 sdopts .add_argument ("--with-spi-sdcard" , action = "store_true" , help = "Enable SPI-mode SDCard support." )
212220 sdopts .add_argument ("--with-sdcard" , action = "store_true" , help = "Enable SDCard support." )
@@ -218,7 +226,7 @@ def main():
218226 parser .add_target_argument ("--with-can" , action = "store_true" , help = "Enable CAN support (Through CTU-CAN-FD Core and SN65HVD230 'PMOD'." )
219227 args = parser .parse_args ()
220228
221- assert not (args .with_etherbone and args .eth_dynamic_ip )
229+ assert not (args .with_etherbone and ( args .eth_dynamic_ip or args . eth_dhcp ) )
222230
223231 soc = BaseSoC (
224232 variant = args .variant ,
@@ -231,6 +239,7 @@ def main():
231239 eth_ip = args .eth_ip ,
232240 remote_ip = args .remote_ip ,
233241 eth_dynamic_ip = args .eth_dynamic_ip ,
242+ eth_dhcp = args .eth_dhcp ,
234243 with_usb = args .with_usb ,
235244 with_spi_flash = args .with_spi_flash ,
236245 with_pmod_gpio = args .with_pmod_gpio ,
0 commit comments