diff --git a/make.py b/make.py index 1fd6ce10..4753b422 100755 --- a/make.py +++ b/make.py @@ -159,7 +159,7 @@ def main(): if "sdcard" in board.soc_capabilities: soc.add_sdcard() if "ethernet" in board.soc_capabilities: - soc.configure_ethernet(remote_ip=args.remote_ip) + soc.configure_ethernet(remote_ip=args.remote_ip, local_ip=args.local_ip) #if "leds" in board.soc_capabilities: # soc.add_leds() if "rgb_led" in board.soc_capabilities: diff --git a/soc_linux.py b/soc_linux.py index 5f340653..9d2aa6a6 100644 --- a/soc_linux.py +++ b/soc_linux.py @@ -20,6 +20,7 @@ from litex.soc.cores.pwm import PWM from litex.tools.litex_json2dts_linux import generate_dts +from litex.soc.integration.soc import add_ip_address_constants # SoCLinux ----------------------------------------------------------------------------------------- @@ -57,19 +58,9 @@ def add_i2c(self): # Ethernet configuration ------------------------------------------------------------------- - def configure_ethernet(self, remote_ip): - remote_ip = remote_ip.split(".") - try: # FIXME: Improve. - self.constants.pop("REMOTEIP1") - self.constants.pop("REMOTEIP2") - self.constants.pop("REMOTEIP3") - self.constants.pop("REMOTEIP4") - except: - pass - self.add_constant("REMOTEIP1", int(remote_ip[0])) - self.add_constant("REMOTEIP2", int(remote_ip[1])) - self.add_constant("REMOTEIP3", int(remote_ip[2])) - self.add_constant("REMOTEIP4", int(remote_ip[3])) + def configure_ethernet(self, remote_ip, local_ip): + add_ip_address_constants(self, "REMOTEIP", remote_ip, check_duplicate=False) + add_ip_address_constants(self, "LOCALIP", local_ip, check_duplicate=False) # DTS generation ---------------------------------------------------------------------------