mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fixup dabao demo apps
- add boot delay on hello world - otherwise you might miss it because it prints before the console is enumerated - add preemption to the dabao environment - improve error handling
This commit is contained in:
parent
0ef31b1288
commit
df9ae96263
4 changed files with 26 additions and 5 deletions
|
|
@ -19,6 +19,7 @@ bao1x-api = { path = "../../libs/bao1x-api" }
|
||||||
bao1x-hal-service = { path = "../../services/bao1x-hal-service", optional = true }
|
bao1x-hal-service = { path = "../../services/bao1x-hal-service", optional = true }
|
||||||
bao1x-emu = { path = "../../services/bao1x-emu", optional = true }
|
bao1x-emu = { path = "../../services/bao1x-emu", optional = true }
|
||||||
usb-bao1x = { path = "../../services/usb-bao1x" }
|
usb-bao1x = { path = "../../services/usb-bao1x" }
|
||||||
|
bytemuck = "1.24.0"
|
||||||
|
|
||||||
aes = { path = "../../services/aes", default-features = false, optional = true }
|
aes = { path = "../../services/aes", default-features = false, optional = true }
|
||||||
|
|
||||||
|
|
@ -31,6 +32,7 @@ bao1x = ["utralib/bao1x", "usb-bao1x/bao1x", "aes/bao1x"]
|
||||||
board-dabao = [
|
board-dabao = [
|
||||||
"bao1x-hal-service",
|
"bao1x-hal-service",
|
||||||
"bao1x-hal/board-dabao",
|
"bao1x-hal/board-dabao",
|
||||||
|
# "bao1x-hal/debug-print-duart",
|
||||||
"usb-bao1x/board-dabao",
|
"usb-bao1x/board-dabao",
|
||||||
]
|
]
|
||||||
ctap-bringup = []
|
ctap-bringup = []
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ mod ctap;
|
||||||
mod repl;
|
mod repl;
|
||||||
mod shell;
|
mod shell;
|
||||||
use cmds::*;
|
use cmds::*;
|
||||||
|
#[cfg(feature = "usb")]
|
||||||
use usb_bao1x::UsbHid;
|
use usb_bao1x::UsbHid;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
@ -12,6 +13,10 @@ fn main() {
|
||||||
log::info!("my PID is {}", xous::process::id());
|
log::info!("my PID is {}", xous::process::id());
|
||||||
let tt = ticktimer::Ticktimer::new().unwrap();
|
let tt = ticktimer::Ticktimer::new().unwrap();
|
||||||
|
|
||||||
|
let hal = bao1x_hal_service::Hal::new();
|
||||||
|
// allow preemption in the dabao console environment
|
||||||
|
hal.set_preemption(true);
|
||||||
|
|
||||||
#[cfg(feature = "usb")]
|
#[cfg(feature = "usb")]
|
||||||
{
|
{
|
||||||
let usb = UsbHid::new();
|
let usb = UsbHid::new();
|
||||||
|
|
|
||||||
|
|
@ -83,13 +83,21 @@ impl Repl {
|
||||||
// take the input and pass it on to the various command parsers, and attach result
|
// take the input and pass it on to the various command parsers, and attach result
|
||||||
if let Some(local) = &mut self.input {
|
if let Some(local) = &mut self.input {
|
||||||
println!("[console] {}", local);
|
println!("[console] {}", local);
|
||||||
if let Some(res) = self.env.dispatch(Some(local), None).expect("command dispatch failed") {
|
match self.env.dispatch(Some(local), None) {
|
||||||
println!("{}\r", res);
|
Ok(Some(res)) => println!("{}\r", res),
|
||||||
|
Ok(None) => println!("\r"),
|
||||||
|
Err(e) => {
|
||||||
|
println!("Command error: {:?}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if let Some(msg) = &self.msg {
|
} else if let Some(msg) = &self.msg {
|
||||||
log::trace!("processing callback msg: {:?}", msg);
|
log::trace!("processing callback msg: {:?}", msg);
|
||||||
if let Some(res) = self.env.dispatch(None, Some(msg)).expect("callback failed") {
|
match self.env.dispatch(None, Some(msg)) {
|
||||||
println!("{}", res);
|
Ok(Some(res)) => println!("{}\r", res),
|
||||||
|
Ok(None) => println!("\r"),
|
||||||
|
Err(e) => {
|
||||||
|
println!("Command error: {:?}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,13 @@ fn main() -> ! {
|
||||||
log::set_max_level(log::LevelFilter::Info);
|
log::set_max_level(log::LevelFilter::Info);
|
||||||
log::info!("Hello world PID is {}", xous::process::id());
|
log::info!("Hello world PID is {}", xous::process::id());
|
||||||
|
|
||||||
println!("Hello world");
|
// This delay of 5 seconds allows users watching over USB serial
|
||||||
|
// console a few seconds to connect the console and see the output.
|
||||||
|
// Otherwise, it will "print" to a console that's not listening.
|
||||||
|
std::thread::sleep(std::time::Duration::from_secs(5));
|
||||||
|
|
||||||
|
// This is the hello world!
|
||||||
|
println!("Hello world!");
|
||||||
|
|
||||||
// This ensures a graceful exit from the process.
|
// This ensures a graceful exit from the process.
|
||||||
xous::terminate_process(0)
|
xous::terminate_process(0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue