netboot #100
@ -2,6 +2,7 @@
|
|||||||
members = [
|
members = [
|
||||||
"libc",
|
"libc",
|
||||||
"libdyld",
|
"libdyld",
|
||||||
|
"libconfig",
|
||||||
"libcoreio",
|
"libcoreio",
|
||||||
"libdwarf",
|
"libdwarf",
|
||||||
"libunwind",
|
"libunwind",
|
||||||
@ -9,6 +10,16 @@ members = [
|
|||||||
"szl"
|
"szl"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Note: we are using dev profile for szl to override the opt-level only
|
||||||
|
[profile.dev]
|
||||||
|
panic = "abort"
|
||||||
|
debug = true
|
||||||
|
codegen-units = 1
|
||||||
|
opt-level = 'z'
|
||||||
|
lto = true
|
||||||
|
debug-assertions = false
|
||||||
|
overflow-checks = false
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
debug = true
|
debug = true
|
||||||
@ -16,13 +27,6 @@ codegen-units = 1
|
|||||||
opt-level = 's'
|
opt-level = 's'
|
||||||
lto = true
|
lto = true
|
||||||
|
|
||||||
[profile.release.package.smoltcp]
|
|
||||||
opt-level = 2
|
|
||||||
[profile.release.package.libasync]
|
|
||||||
opt-level = 2
|
|
||||||
[profile.release.package.libboard_zynq]
|
|
||||||
opt-level = 2
|
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
core_io = { path = "./libcoreio" }
|
core_io = { path = "./libcoreio" }
|
||||||
compiler_builtins = { git = "https://git.m-labs.hk/M-Labs/compiler-builtins-zynq.git"}
|
compiler_builtins = { git = "https://git.m-labs.hk/M-Labs/compiler-builtins-zynq.git"}
|
||||||
|
15
src/libconfig/Cargo.toml
Normal file
15
src/libconfig/Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[package]
|
||||||
|
name = "libconfig"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["M-Labs"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
libboard_zynq = { git = "https://git.m-labs.hk/M-Labs/zynq-rs.git" }
|
||||||
|
core_io = { version = "0.1", features = ["collections"] }
|
||||||
|
fatfs = { version = "0.3", features = ["core_io"], default-features = false }
|
||||||
|
log = "0.4"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
ipv6 = []
|
||||||
|
|
@ -1,10 +1,15 @@
|
|||||||
use crate::sd_reader;
|
#![no_std]
|
||||||
use core::fmt;
|
extern crate alloc;
|
||||||
use alloc::{string::FromUtf8Error, string::String, vec::Vec};
|
|
||||||
use core_io::{self as io, BufRead, BufReader, Read};
|
|
||||||
|
|
||||||
|
use core::fmt;
|
||||||
|
use alloc::{string::FromUtf8Error, string::String, vec::Vec, rc::Rc};
|
||||||
|
use core_io::{self as io, BufRead, BufReader, Read};
|
||||||
use libboard_zynq::sdio;
|
use libboard_zynq::sdio;
|
||||||
|
|
||||||
|
pub mod sd_reader;
|
||||||
|
pub mod net_settings;
|
||||||
|
pub mod bootgen;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error<'a> {
|
pub enum Error<'a> {
|
||||||
SdError(sdio::sd_card::CardInitializationError),
|
SdError(sdio::sd_card::CardInitializationError),
|
||||||
@ -63,7 +68,7 @@ fn parse_config<'a>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
fs: Option<fatfs::FileSystem<sd_reader::SdReader>>,
|
fs: Option<Rc<fatfs::FileSystem<sd_reader::SdReader>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
@ -76,7 +81,11 @@ impl Config {
|
|||||||
let reader = sd_reader::SdReader::new(sd);
|
let reader = sd_reader::SdReader::new(sd);
|
||||||
|
|
||||||
let fs = reader.mount_fatfs(sd_reader::PartitionEntry::Entry1)?;
|
let fs = reader.mount_fatfs(sd_reader::PartitionEntry::Entry1)?;
|
||||||
Ok(Config { fs: Some(fs) })
|
Ok(Config { fs: Some(Rc::new(fs)) })
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_fs(fs: Option<Rc<fatfs::FileSystem<sd_reader::SdReader>>>) -> Self {
|
||||||
|
Config { fs }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_dummy() -> Self {
|
pub fn new_dummy() -> Self {
|
@ -2,31 +2,37 @@ use core::fmt;
|
|||||||
|
|
||||||
use libboard_zynq::smoltcp::wire::{EthernetAddress, IpAddress};
|
use libboard_zynq::smoltcp::wire::{EthernetAddress, IpAddress};
|
||||||
|
|
||||||
use crate::config;
|
use super::Config;
|
||||||
|
|
||||||
pub struct NetAddresses {
|
pub struct NetAddresses {
|
||||||
pub hardware_addr: EthernetAddress,
|
pub hardware_addr: EthernetAddress,
|
||||||
pub ipv4_addr: IpAddress,
|
pub ipv4_addr: IpAddress,
|
||||||
|
#[cfg(feature = "ipv6")]
|
||||||
pub ipv6_ll_addr: IpAddress,
|
pub ipv6_ll_addr: IpAddress,
|
||||||
|
#[cfg(feature = "ipv6")]
|
||||||
pub ipv6_addr: Option<IpAddress>
|
pub ipv6_addr: Option<IpAddress>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for NetAddresses {
|
impl fmt::Display for NetAddresses {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "MAC={} IPv4={} IPv6-LL={} IPv6=",
|
write!(f, "MAC={} IPv4={} ",
|
||||||
self.hardware_addr, self.ipv4_addr, self.ipv6_ll_addr)?;
|
self.hardware_addr, self.ipv4_addr)?;
|
||||||
match self.ipv6_addr {
|
|
||||||
Some(addr) => write!(f, "{}", addr)?,
|
#[cfg(feature = "ipv6")]
|
||||||
None => write!(f, "no configured address")?
|
{
|
||||||
|
write!(f, "IPv6-LL={}", self.ipv6_ll_addr)?;
|
||||||
|
match self.ipv6_addr {
|
||||||
|
Some(addr) => write!(f, " {}", addr)?,
|
||||||
|
None => write!(f, " IPv6: no configured address")?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_adresses(cfg: &config::Config) -> NetAddresses {
|
pub fn get_adresses(cfg: &Config) -> NetAddresses {
|
||||||
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x52]);
|
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x52]);
|
||||||
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 52);
|
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 52);
|
||||||
let mut ipv6_addr = None;
|
|
||||||
|
|
||||||
if let Ok(Ok(addr)) = cfg.read_str("mac").map(|s| s.parse()) {
|
if let Ok(Ok(addr)) = cfg.read_str("mac").map(|s| s.parse()) {
|
||||||
hardware_addr = addr;
|
hardware_addr = addr;
|
||||||
@ -34,10 +40,10 @@ pub fn get_adresses(cfg: &config::Config) -> NetAddresses {
|
|||||||
if let Ok(Ok(addr)) = cfg.read_str("ip").map(|s| s.parse()) {
|
if let Ok(Ok(addr)) = cfg.read_str("ip").map(|s| s.parse()) {
|
||||||
ipv4_addr = addr;
|
ipv4_addr = addr;
|
||||||
}
|
}
|
||||||
if let Ok(Ok(addr)) = cfg.read_str("ip6").map(|s| s.parse()) {
|
#[cfg(feature = "ipv6")]
|
||||||
ipv6_addr = Some(addr);
|
let ipv6_addr = cfg.read_str("ipv6").ok().and_then(|s| s.parse().ok());
|
||||||
}
|
|
||||||
|
|
||||||
|
#[cfg(feature = "ipv6")]
|
||||||
let ipv6_ll_addr = IpAddress::v6(
|
let ipv6_ll_addr = IpAddress::v6(
|
||||||
0xfe80, 0x0000, 0x0000, 0x0000,
|
0xfe80, 0x0000, 0x0000, 0x0000,
|
||||||
(((hardware_addr.0[0] ^ 0x02) as u16) << 8) | (hardware_addr.0[1] as u16),
|
(((hardware_addr.0[0] ^ 0x02) as u16) << 8) | (hardware_addr.0[1] as u16),
|
||||||
@ -46,9 +52,11 @@ pub fn get_adresses(cfg: &config::Config) -> NetAddresses {
|
|||||||
((hardware_addr.0[4] as u16) << 8) | (hardware_addr.0[5] as u16));
|
((hardware_addr.0[4] as u16) << 8) | (hardware_addr.0[5] as u16));
|
||||||
|
|
||||||
NetAddresses {
|
NetAddresses {
|
||||||
hardware_addr: hardware_addr,
|
hardware_addr,
|
||||||
ipv4_addr: ipv4_addr,
|
ipv4_addr,
|
||||||
ipv6_ll_addr: ipv6_ll_addr,
|
#[cfg(feature = "ipv6")]
|
||||||
ipv6_addr: ipv6_addr
|
ipv6_ll_addr,
|
||||||
|
#[cfg(feature = "ipv6")]
|
||||||
|
ipv6_addr
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,12 +21,11 @@ byteorder = { version = "1.3", default-features = false }
|
|||||||
void = { version = "1", default-features = false }
|
void = { version = "1", default-features = false }
|
||||||
futures = { version = "0.3", default-features = false, features = ["async-await"] }
|
futures = { version = "0.3", default-features = false, features = ["async-await"] }
|
||||||
async-recursion = "0.3"
|
async-recursion = "0.3"
|
||||||
fatfs = { version = "0.3", features = ["core_io"], default-features = false }
|
|
||||||
log_buffer = { version = "1.2" }
|
log_buffer = { version = "1.2" }
|
||||||
libm = { version = "0.2", features = ["unstable"] }
|
libm = { version = "0.2", features = ["unstable"] }
|
||||||
vcell = "0.1"
|
vcell = "0.1"
|
||||||
|
|
||||||
libboard_zynq = { git = "https://git.m-labs.hk/M-Labs/zynq-rs.git" }
|
libboard_zynq = { git = "https://git.m-labs.hk/M-Labs/zynq-rs.git", features = ["ipv6"]}
|
||||||
libsupport_zynq = { default-features = false, features = ["alloc_core"], git = "https://git.m-labs.hk/M-Labs/zynq-rs.git" }
|
libsupport_zynq = { default-features = false, features = ["alloc_core"], git = "https://git.m-labs.hk/M-Labs/zynq-rs.git" }
|
||||||
libcortex_a9 = { git = "https://git.m-labs.hk/M-Labs/zynq-rs.git" }
|
libcortex_a9 = { git = "https://git.m-labs.hk/M-Labs/zynq-rs.git" }
|
||||||
libasync = { git = "https://git.m-labs.hk/M-Labs/zynq-rs.git" }
|
libasync = { git = "https://git.m-labs.hk/M-Labs/zynq-rs.git" }
|
||||||
@ -36,3 +35,4 @@ dyld = { path = "../libdyld" }
|
|||||||
dwarf = { path = "../libdwarf" }
|
dwarf = { path = "../libdwarf" }
|
||||||
unwind = { path = "../libunwind" }
|
unwind = { path = "../libunwind" }
|
||||||
libc = { path = "../libc" }
|
libc = { path = "../libc" }
|
||||||
|
libconfig = { path = "../libconfig", features = ["ipv6"]}
|
||||||
|
@ -20,9 +20,8 @@ use libboard_zynq::{
|
|||||||
use libcortex_a9::{semaphore::Semaphore, mutex::Mutex};
|
use libcortex_a9::{semaphore::Semaphore, mutex::Mutex};
|
||||||
use futures::{select_biased, future::FutureExt};
|
use futures::{select_biased, future::FutureExt};
|
||||||
use libasync::{smoltcp::{Sockets, TcpStream}, task};
|
use libasync::{smoltcp::{Sockets, TcpStream}, task};
|
||||||
|
use libconfig::{Config, net_settings};
|
||||||
|
|
||||||
use crate::config;
|
|
||||||
use crate::net_settings;
|
|
||||||
use crate::proto_async::*;
|
use crate::proto_async::*;
|
||||||
use crate::kernel;
|
use crate::kernel;
|
||||||
use crate::rpc;
|
use crate::rpc;
|
||||||
@ -315,7 +314,7 @@ async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Contr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main(timer: GlobalTimer, cfg: &config::Config) {
|
pub fn main(timer: GlobalTimer, cfg: &Config) {
|
||||||
let net_addresses = net_settings::get_adresses(cfg);
|
let net_addresses = net_settings::get_adresses(cfg);
|
||||||
info!("network addresses: {}", net_addresses);
|
info!("network addresses: {}", net_addresses);
|
||||||
|
|
||||||
|
@ -1,171 +0,0 @@
|
|||||||
use crate::sd_reader;
|
|
||||||
use core_io::{Error, Read, Seek, SeekFrom};
|
|
||||||
use libboard_zynq::{devc, sdio};
|
|
||||||
use log::{info, debug};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum PlLoadingError {
|
|
||||||
BootImageNotFound,
|
|
||||||
InvalidBootImageHeader,
|
|
||||||
MissingBitstreamPartition,
|
|
||||||
EncryptedBitstream,
|
|
||||||
IoError(Error),
|
|
||||||
DevcError(devc::DevcError),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Error> for PlLoadingError {
|
|
||||||
fn from(error: Error) -> Self {
|
|
||||||
PlLoadingError::IoError(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<devc::DevcError> for PlLoadingError {
|
|
||||||
fn from(error: devc::DevcError) -> Self {
|
|
||||||
PlLoadingError::DevcError(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl core::fmt::Display for PlLoadingError {
|
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
|
||||||
use PlLoadingError::*;
|
|
||||||
match self {
|
|
||||||
BootImageNotFound => write!(
|
|
||||||
f,
|
|
||||||
"Boot image not found, make sure `boot.bin` exists and your SD card is plugged in."
|
|
||||||
),
|
|
||||||
InvalidBootImageHeader => write!(
|
|
||||||
f,
|
|
||||||
"Invalid boot image header. Check if the file is correct."
|
|
||||||
),
|
|
||||||
MissingBitstreamPartition => write!(
|
|
||||||
f,
|
|
||||||
"Bitstream partition not found. Check your compile configuration."
|
|
||||||
),
|
|
||||||
EncryptedBitstream => write!(f, "Encrypted bitstream is not supported."),
|
|
||||||
IoError(e) => write!(f, "Error while reading: {}", e),
|
|
||||||
DevcError(e) => write!(f, "PCAP interface error: {}", e),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
struct PartitionHeader {
|
|
||||||
pub encrypted_length: u32,
|
|
||||||
pub unencrypted_length: u32,
|
|
||||||
pub word_length: u32,
|
|
||||||
pub dest_load_addr: u32,
|
|
||||||
pub dest_exec_addr: u32,
|
|
||||||
pub data_offset: u32,
|
|
||||||
pub attribute_bits: u32,
|
|
||||||
pub section_count: u32,
|
|
||||||
pub checksum_offset: u32,
|
|
||||||
pub header_offset: u32,
|
|
||||||
pub cert_offset: u32,
|
|
||||||
pub reserved: [u32; 4],
|
|
||||||
pub checksum: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Read a u32 word from the reader.
|
|
||||||
fn read_u32<Reader: Read>(reader: &mut Reader) -> Result<u32, PlLoadingError> {
|
|
||||||
let mut buffer: [u8; 4] = [0; 4];
|
|
||||||
reader.read_exact(&mut buffer)?;
|
|
||||||
let mut result: u32 = 0;
|
|
||||||
for i in 0..4 {
|
|
||||||
result |= (buffer[i] as u32) << (i * 8);
|
|
||||||
}
|
|
||||||
Ok(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Load PL partition header.
|
|
||||||
fn load_pl_header<File: Read + Seek>(
|
|
||||||
file: &mut File,
|
|
||||||
) -> Result<Option<PartitionHeader>, PlLoadingError> {
|
|
||||||
let mut buffer: [u8; 0x40] = [0; 0x40];
|
|
||||||
file.read_exact(&mut buffer)?;
|
|
||||||
let header = unsafe { core::mem::transmute::<_, PartitionHeader>(buffer) };
|
|
||||||
if header.attribute_bits & (2 << 4) != 0 {
|
|
||||||
Ok(Some(header))
|
|
||||||
} else {
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Locate the PL bitstream from the image, and return the size (in bytes) of the bitstream if successful.
|
|
||||||
/// This function would seek the file to the location of the bitstream.
|
|
||||||
fn locate_bitstream<File: Read + Seek>(file: &mut File) -> Result<usize, PlLoadingError> {
|
|
||||||
const BOOT_HEADER_SIGN: u32 = 0x584C4E58;
|
|
||||||
// read boot header signature
|
|
||||||
file.seek(SeekFrom::Start(0x24))?;
|
|
||||||
if read_u32(file)? != BOOT_HEADER_SIGN {
|
|
||||||
return Err(PlLoadingError::InvalidBootImageHeader);
|
|
||||||
}
|
|
||||||
// read partition header offset
|
|
||||||
file.seek(SeekFrom::Start(0x9C))?;
|
|
||||||
let ptr = read_u32(file)?;
|
|
||||||
debug!("Partition header pointer = {:0X}", ptr);
|
|
||||||
file.seek(SeekFrom::Start(ptr as u64))?;
|
|
||||||
|
|
||||||
let mut header_opt = None;
|
|
||||||
// at most 3 partition headers
|
|
||||||
for _ in 0..3 {
|
|
||||||
let result = load_pl_header(file)?;
|
|
||||||
if let Some(h) = result {
|
|
||||||
header_opt = Some(h);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let header = match header_opt {
|
|
||||||
None => return Err(PlLoadingError::MissingBitstreamPartition),
|
|
||||||
Some(h) => h,
|
|
||||||
};
|
|
||||||
|
|
||||||
let encrypted_length = header.encrypted_length;
|
|
||||||
let unencrypted_length = header.unencrypted_length;
|
|
||||||
debug!("Unencrypted length = {:0X}", unencrypted_length);
|
|
||||||
if encrypted_length != unencrypted_length {
|
|
||||||
return Err(PlLoadingError::EncryptedBitstream);
|
|
||||||
}
|
|
||||||
|
|
||||||
let start_addr = header.data_offset;
|
|
||||||
debug!("Partition start address: {:0X}", start_addr);
|
|
||||||
file.seek(SeekFrom::Start(start_addr as u64 * 4))?;
|
|
||||||
|
|
||||||
Ok(unencrypted_length as usize * 4)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Load bitstream from bootgen file.
|
|
||||||
/// This function parses the file, locate the bitstream and load it through the PCAP driver.
|
|
||||||
/// It requires a large buffer, please enable the DDR RAM before using it.
|
|
||||||
pub fn load_bitstream<File: Read + Seek>(
|
|
||||||
file: &mut File,
|
|
||||||
) -> Result<(), PlLoadingError> {
|
|
||||||
let size = locate_bitstream(file)?;
|
|
||||||
let mut buffer: alloc::vec::Vec<u8> = alloc::vec::Vec::with_capacity(size);
|
|
||||||
unsafe {
|
|
||||||
buffer.set_len(buffer.capacity());
|
|
||||||
}
|
|
||||||
file.read_exact(&mut buffer)?;
|
|
||||||
|
|
||||||
let mut devcfg = devc::DevC::new();
|
|
||||||
devcfg.enable();
|
|
||||||
devcfg.program(&buffer)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn load_bitstream_from_sd() -> Result<(), PlLoadingError> {
|
|
||||||
let sdio0 = sdio::Sdio::sdio0(true);
|
|
||||||
if sdio0.is_card_inserted() {
|
|
||||||
info!("Card inserted. Mounting file system.");
|
|
||||||
let sd = sdio::sd_card::SdCard::from_sdio(sdio0).unwrap();
|
|
||||||
let reader = sd_reader::SdReader::new(sd);
|
|
||||||
|
|
||||||
let fs = reader.mount_fatfs(sd_reader::PartitionEntry::Entry1)?;
|
|
||||||
let root_dir = fs.root_dir();
|
|
||||||
let mut file = root_dir.open_file("/BOOT.BIN").map_err(|_| PlLoadingError::BootImageNotFound)?;
|
|
||||||
info!("Found boot image!");
|
|
||||||
load_bitstream(&mut file)
|
|
||||||
} else {
|
|
||||||
info!("SD card not inserted. Bitstream cannot be loaded.");
|
|
||||||
Err(PlLoadingError::BootImageNotFound)
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,10 +21,8 @@ use libregister::RegisterW;
|
|||||||
use nb;
|
use nb;
|
||||||
use void::Void;
|
use void::Void;
|
||||||
use embedded_hal::blocking::delay::DelayMs;
|
use embedded_hal::blocking::delay::DelayMs;
|
||||||
|
use libconfig::{Config, load_pl};
|
||||||
|
|
||||||
mod sd_reader;
|
|
||||||
mod config;
|
|
||||||
mod net_settings;
|
|
||||||
mod proto_core_io;
|
mod proto_core_io;
|
||||||
mod proto_async;
|
mod proto_async;
|
||||||
mod comms;
|
mod comms;
|
||||||
@ -39,7 +37,6 @@ mod rtio;
|
|||||||
mod rtio;
|
mod rtio;
|
||||||
mod kernel;
|
mod kernel;
|
||||||
mod moninj;
|
mod moninj;
|
||||||
mod load_pl;
|
|
||||||
mod eh_artiq;
|
mod eh_artiq;
|
||||||
mod panic;
|
mod panic;
|
||||||
mod logger;
|
mod logger;
|
||||||
@ -99,7 +96,7 @@ fn identifier_read(buf: &mut [u8]) -> &str {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_rtio(timer: &mut GlobalTimer, cfg: &config::Config) {
|
fn init_rtio(timer: &mut GlobalTimer, cfg: &Config) {
|
||||||
let clock_sel =
|
let clock_sel =
|
||||||
if let Ok(rtioclk) = cfg.read_str("rtioclk") {
|
if let Ok(rtioclk) = cfg.read_str("rtioclk") {
|
||||||
match rtioclk.as_ref() {
|
match rtioclk.as_ref() {
|
||||||
@ -185,7 +182,7 @@ pub fn main_core0() {
|
|||||||
let buffer_logger = unsafe {
|
let buffer_logger = unsafe {
|
||||||
logger::BufferLogger::new(&mut LOG_BUFFER[..])
|
logger::BufferLogger::new(&mut LOG_BUFFER[..])
|
||||||
};
|
};
|
||||||
buffer_logger.set_uart_log_level(log::LevelFilter::Debug);
|
buffer_logger.set_uart_log_level(log::LevelFilter::Info);
|
||||||
buffer_logger.register();
|
buffer_logger.register();
|
||||||
log::set_max_level(log::LevelFilter::Debug);
|
log::set_max_level(log::LevelFilter::Debug);
|
||||||
|
|
||||||
@ -197,11 +194,11 @@ pub fn main_core0() {
|
|||||||
init_gateware();
|
init_gateware();
|
||||||
info!("detected gateware: {}", identifier_read(&mut [0; 64]));
|
info!("detected gateware: {}", identifier_read(&mut [0; 64]));
|
||||||
|
|
||||||
let cfg = match config::Config::new() {
|
let cfg = match Config::new() {
|
||||||
Ok(cfg) => cfg,
|
Ok(cfg) => cfg,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!("config initialization failed: {}", err);
|
warn!("config initialization failed: {}", err);
|
||||||
config::Config::new_dummy()
|
Config::new_dummy()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user