bootloader: fix compilation problems

This commit is contained in:
Sebastien Bourdeauducq 2019-10-21 13:28:17 +08:00
parent 8f76a3218e
commit 818d6b2f5a
2 changed files with 13 additions and 24 deletions

View File

@ -12,7 +12,7 @@ use crc::crc32;
use byteorder::{ByteOrder, BigEndian};
use board_misoc::{ident, cache, sdram, boot, mem as board_mem};
#[cfg(has_ethmac)]
use board_misoc::{clock, config, ethmac, net_settings};
use board_misoc::{clock, ethmac, net_settings};
use board_misoc::uart_console::Console;
fn check_integrity() -> bool {
@ -151,7 +151,7 @@ fn flash_boot() {
#[cfg(has_ethmac)]
fn network_boot() {
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr};
use smoltcp::wire::IpCidr;
println!("Initializing network...");
@ -161,33 +161,28 @@ fn network_boot() {
let mut neighbor_map = [None; 2];
let neighbor_cache =
smoltcp::iface::NeighborCache::new(&mut neighbor_map[..]);
let mut ip_addrs = [IpCidr::new(ip_addr, 0)];
let net_addresses = net_settings::get_adresses();
println!("network addresses: {}", net_addresses);
let mut interface = match net_addresses.ipv6_addr {
Some(addr) => {
let ip_addrs = [
let mut ip_addrs = [
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)
.ethernet_addr(net_addresses.hardware_addr)
.ip_addrs(ip_addrs)
.neighbor_cache(neighbor_cache)
.finalize()
}
None => {
let ip_addrs = [
IpCidr::new(net_addresses.ipv4_addr, 0),
IpCidr::new(net_addresses.ipv6_ll_addr, 0)
];
let mut interface = match net_addresses.ipv6_addr {
Some(addr) => {
ip_addrs[2] = IpCidr::new(addr, 0);
smoltcp::iface::EthernetInterfaceBuilder::new(net_device)
.ethernet_addr(net_addresses.hardware_addr)
.ip_addrs(ip_addrs)
.ip_addrs(&mut ip_addrs[..])
.neighbor_cache(neighbor_cache)
.finalize()
}
None =>
smoltcp::iface::EthernetInterfaceBuilder::new(net_device)
.ethernet_addr(net_addresses.hardware_addr)
.ip_addrs(&mut ip_addrs[..2])
.neighbor_cache(neighbor_cache)
.finalize()
};
let mut socket_set_storage = [];

View File

@ -36,14 +36,8 @@ pub fn get_adresses() -> NetAddresses {
let eeprom = i2c_eeprom::EEPROM::kasli_eeprom();
hardware_addr =
eeprom.read_eui48()
.map(|addr_buf| {
let hardware_addr = EthernetAddress(addr_buf);
hardware_addr
})
.unwrap_or_else(|e| {
let hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x21]);
hardware_addr
});
.map(|addr_buf| EthernetAddress(addr_buf))
.unwrap_or_else(|_e| EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x21]));
}
#[cfg(soc_platform = "sayma_amc")]
{ hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x11]); }