forked from M-Labs/artiq
bootloader: fix compilation problems
This commit is contained in:
parent
8f76a3218e
commit
818d6b2f5a
@ -12,7 +12,7 @@ use crc::crc32;
|
|||||||
use byteorder::{ByteOrder, BigEndian};
|
use byteorder::{ByteOrder, BigEndian};
|
||||||
use board_misoc::{ident, cache, sdram, boot, mem as board_mem};
|
use board_misoc::{ident, cache, sdram, boot, mem as board_mem};
|
||||||
#[cfg(has_ethmac)]
|
#[cfg(has_ethmac)]
|
||||||
use board_misoc::{clock, config, ethmac, net_settings};
|
use board_misoc::{clock, ethmac, net_settings};
|
||||||
use board_misoc::uart_console::Console;
|
use board_misoc::uart_console::Console;
|
||||||
|
|
||||||
fn check_integrity() -> bool {
|
fn check_integrity() -> bool {
|
||||||
@ -151,7 +151,7 @@ fn flash_boot() {
|
|||||||
|
|
||||||
#[cfg(has_ethmac)]
|
#[cfg(has_ethmac)]
|
||||||
fn network_boot() {
|
fn network_boot() {
|
||||||
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr};
|
use smoltcp::wire::IpCidr;
|
||||||
|
|
||||||
println!("Initializing network...");
|
println!("Initializing network...");
|
||||||
|
|
||||||
@ -161,33 +161,28 @@ fn network_boot() {
|
|||||||
let mut neighbor_map = [None; 2];
|
let mut neighbor_map = [None; 2];
|
||||||
let neighbor_cache =
|
let neighbor_cache =
|
||||||
smoltcp::iface::NeighborCache::new(&mut neighbor_map[..]);
|
smoltcp::iface::NeighborCache::new(&mut neighbor_map[..]);
|
||||||
let mut ip_addrs = [IpCidr::new(ip_addr, 0)];
|
|
||||||
let net_addresses = net_settings::get_adresses();
|
let net_addresses = net_settings::get_adresses();
|
||||||
println!("network addresses: {}", net_addresses);
|
println!("network addresses: {}", net_addresses);
|
||||||
|
let mut ip_addrs = [
|
||||||
|
IpCidr::new(net_addresses.ipv4_addr, 0),
|
||||||
|
IpCidr::new(net_addresses.ipv6_ll_addr, 0),
|
||||||
|
IpCidr::new(net_addresses.ipv6_ll_addr, 0)
|
||||||
|
];
|
||||||
let mut interface = match net_addresses.ipv6_addr {
|
let mut interface = match net_addresses.ipv6_addr {
|
||||||
Some(addr) => {
|
Some(addr) => {
|
||||||
let ip_addrs = [
|
ip_addrs[2] = IpCidr::new(addr, 0);
|
||||||
IpCidr::new(net_addresses.ipv4_addr, 0),
|
|
||||||
IpCidr::new(net_addresses.ipv6_ll_addr, 0),
|
|
||||||
IpCidr::new(addr, 0)
|
|
||||||
];
|
|
||||||
smoltcp::iface::EthernetInterfaceBuilder::new(net_device)
|
smoltcp::iface::EthernetInterfaceBuilder::new(net_device)
|
||||||
.ethernet_addr(net_addresses.hardware_addr)
|
.ethernet_addr(net_addresses.hardware_addr)
|
||||||
.ip_addrs(ip_addrs)
|
.ip_addrs(&mut ip_addrs[..])
|
||||||
.neighbor_cache(neighbor_cache)
|
.neighbor_cache(neighbor_cache)
|
||||||
.finalize()
|
.finalize()
|
||||||
}
|
}
|
||||||
None => {
|
None =>
|
||||||
let ip_addrs = [
|
|
||||||
IpCidr::new(net_addresses.ipv4_addr, 0),
|
|
||||||
IpCidr::new(net_addresses.ipv6_ll_addr, 0)
|
|
||||||
];
|
|
||||||
smoltcp::iface::EthernetInterfaceBuilder::new(net_device)
|
smoltcp::iface::EthernetInterfaceBuilder::new(net_device)
|
||||||
.ethernet_addr(net_addresses.hardware_addr)
|
.ethernet_addr(net_addresses.hardware_addr)
|
||||||
.ip_addrs(ip_addrs)
|
.ip_addrs(&mut ip_addrs[..2])
|
||||||
.neighbor_cache(neighbor_cache)
|
.neighbor_cache(neighbor_cache)
|
||||||
.finalize()
|
.finalize()
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut socket_set_storage = [];
|
let mut socket_set_storage = [];
|
||||||
|
@ -36,14 +36,8 @@ pub fn get_adresses() -> NetAddresses {
|
|||||||
let eeprom = i2c_eeprom::EEPROM::kasli_eeprom();
|
let eeprom = i2c_eeprom::EEPROM::kasli_eeprom();
|
||||||
hardware_addr =
|
hardware_addr =
|
||||||
eeprom.read_eui48()
|
eeprom.read_eui48()
|
||||||
.map(|addr_buf| {
|
.map(|addr_buf| EthernetAddress(addr_buf))
|
||||||
let hardware_addr = EthernetAddress(addr_buf);
|
.unwrap_or_else(|_e| EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x21]));
|
||||||
hardware_addr
|
|
||||||
})
|
|
||||||
.unwrap_or_else(|e| {
|
|
||||||
let hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x21]);
|
|
||||||
hardware_addr
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#[cfg(soc_platform = "sayma_amc")]
|
#[cfg(soc_platform = "sayma_amc")]
|
||||||
{ hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x11]); }
|
{ hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x11]); }
|
||||||
|
Loading…
Reference in New Issue
Block a user