make config demo errors non-fatal

This commit is contained in:
Sebastien Bourdeauducq 2020-06-25 11:27:50 +08:00
parent 654d65a6d5
commit 507edb5a78
1 changed files with 17 additions and 13 deletions

View File

@ -6,7 +6,7 @@
extern crate alloc; extern crate alloc;
use core::{cmp, str}; use core::{cmp, str};
use log::info; use log::{info, error};
use libboard_zynq::{timer::GlobalTimer, logger, devc}; use libboard_zynq::{timer::GlobalTimer, logger, devc};
use libsupport_zynq::ram; use libsupport_zynq::ram;
@ -46,7 +46,8 @@ pub fn main_core0() {
ram::init_alloc_linker(); ram::init_alloc_linker();
let mut cfg = config::Config::new().unwrap(); match config::Config::new() {
Ok(mut cfg) => {
match cfg.read_str("FOO") { match cfg.read_str("FOO") {
Ok(val) => info!("FOO = {}", val), Ok(val) => info!("FOO = {}", val),
Err(error) => info!("failed to read config FOO: {}", error), Err(error) => info!("failed to read config FOO: {}", error),
@ -59,6 +60,9 @@ pub fn main_core0() {
Ok(val) => info!("read FOOBAR = {}", val), Ok(val) => info!("read FOOBAR = {}", val),
Err(error) => info!("failed to read config FOOBAR: {}", error), Err(error) => info!("failed to read config FOOBAR: {}", error),
} }
},
Err(error) => error!("config failed: {}", error)
}
if devc::DevC::new().is_done() { if devc::DevC::new().is_done() {
info!("gateware already loaded"); info!("gateware already loaded");