From 596b9a265c5b52b3e30f90c898784aca86dd0aa4 Mon Sep 17 00:00:00 2001 From: Michael Birtwell Date: Fri, 14 Jan 2022 16:52:23 +0000 Subject: [PATCH] Prefer DHCP to the built-in static IPs Signed-off-by: Michael Birtwell --- RELEASE_NOTES.rst | 3 ++- artiq/firmware/libboard_misoc/net_settings.rs | 11 +---------- doc/manual/installing.rst | 10 +++++----- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index d592a2743..0bd400186 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -42,7 +42,8 @@ Highlights: * ``PCA9548`` I2C switch class renamed to ``I2CSwitch``, to accomodate support for PCA9547, and possibly other switches in future. Readback has been removed, and now only one channel per switch is supported. -* The "ip" config option can now be set to "use_dhcp" to use DHCP to obtain an IP address. +* The "ip" config option can now be set to "use_dhcp" in order to use DHCP to obtain an IP address. + DHCP will also be used if no "ip" config option is set. Breaking changes: diff --git a/artiq/firmware/libboard_misoc/net_settings.rs b/artiq/firmware/libboard_misoc/net_settings.rs index 754f326fa..4c70dece6 100644 --- a/artiq/firmware/libboard_misoc/net_settings.rs +++ b/artiq/firmware/libboard_misoc/net_settings.rs @@ -60,16 +60,7 @@ pub fn get_adresses() -> NetAddresses { } })) { Ok(Ok(addr)) => ipv4_addr = addr, - _ => { - #[cfg(soc_platform = "kasli")] - { ipv4_addr = IpAddress::v4(192, 168, 1, 70); } - #[cfg(soc_platform = "sayma_amc")] - { ipv4_addr = IpAddress::v4(192, 168, 1, 60); } - #[cfg(soc_platform = "metlino")] - { ipv4_addr = IpAddress::v4(192, 168, 1, 65); } - #[cfg(soc_platform = "kc705")] - { ipv4_addr = IpAddress::v4(192, 168, 1, 50); } - } + _ => ipv4_addr = USE_DHCP, } let ipv6_ll_addr = IpAddress::v6( diff --git a/doc/manual/installing.rst b/doc/manual/installing.rst index 6ee48c75c..1695aeac6 100644 --- a/doc/manual/installing.rst +++ b/doc/manual/installing.rst @@ -261,18 +261,18 @@ If you purchased a Kasli device from M-Labs, it usually comes with the IP addres and then reboot the device (with ``artiq_flash start`` or a power cycle). -In other cases, install OpenOCD as before, and flash the IP (and, if necessary, MAC) addresses directly: :: +If the ip config field is not set, or set to "use_dhcp" then the device will attempt to obtain an IP address using +DHCP. If a static IP address is wanted, install OpenOCD as before, and flash the IP (and, if necessary, MAC) addresses +directly: :: $ artiq_mkfs flash_storage.img -s mac xx:xx:xx:xx:xx:xx -s ip xx.xx.xx.xx $ artiq_flash -t [board] -V [variant] -f flash_storage.img storage start For Kasli devices, flashing a MAC address is not necessary as they can obtain it from their EEPROM. -Alternatively you can set the "ip" config field to "use_dhcp" to have the device use DHCP to obtain an IP address on -boot. e.g. :: +If DHCP has been used the address can be found in the console output, which can be viewed using: :: - $ artiq_mkfs flash_storage.img -s ip use_dhcp - $ artiq_flash -t [board] -V [variant] -f flash_storage.img storage start + $ python -m misoc.tools.flterm /dev/ttyUSB2 Check that you can ping the device. If ping fails, check that the Ethernet link LED is ON - on Kasli, it is the LED next to the SFP0 connector. As a next step, look at the messages emitted on the UART during boot. Use a program such as flterm or PuTTY to connect to the device's serial port at 115200bps 8-N-1 and reboot the device. On Kasli, the serial port is on FTDI channel 2 with v1.1 hardware (with channel 0 being JTAG) and on FTDI channel 1 with v1.0 hardware.