From 770c986e72b0402043d68d37964ad94ea56eae78 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 31 Oct 2025 11:17:50 +0800 Subject: [PATCH 1/3] make dabao-console a default app for the dabao target --- xtask/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 938ec2d87..ae29cca4e 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -787,7 +787,7 @@ fn main() -> Result<(), Box> { // minimal set of services for app development on a dabao. Need to save space for the app itself! let bao_rram_pkgs = ["xous-ticktimer", "xous-log", "xous-names", "usb-bao1x", "bao1x-hal-service"].to_vec(); - let bao_app_pkgs: Vec<&'static str> = [].to_vec(); + let bao_app_pkgs: Vec<&'static str> = ["dabao-console"].to_vec(); builder.add_loader_feature("debug-print"); builder.add_kernel_feature("v2p"); From dd144b9446a7421dba110d5204428f0becff30e8 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 31 Oct 2025 12:12:52 +0800 Subject: [PATCH 2/3] fix feature tree for dabao build "usb" is now default for dabao-console, should not be passed as a universal feature to all apps as not all apps have that feature --- apps-dabao/dabao-console/Cargo.toml | 2 +- xtask/src/main.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/apps-dabao/dabao-console/Cargo.toml b/apps-dabao/dabao-console/Cargo.toml index a6ee3ffc5..3adc665a6 100644 --- a/apps-dabao/dabao-console/Cargo.toml +++ b/apps-dabao/dabao-console/Cargo.toml @@ -38,4 +38,4 @@ board-dabao = [ ctap-bringup = [] usb = [] aestests = ["aes"] -default = [] +default = ["usb"] diff --git a/xtask/src/main.rs b/xtask/src/main.rs index ae29cca4e..0e78416f0 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -791,7 +791,6 @@ fn main() -> Result<(), Box> { builder.add_loader_feature("debug-print"); builder.add_kernel_feature("v2p"); - builder.add_detached_app_feature("usb"); match task.as_deref() { Some("dabao") => builder.target_bao1x_soc(), _ => panic!("should be unreachable"), From 0bcd861d9c3d5e81283752e0a7ea792ea7ad7a52 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 1 Nov 2025 14:19:58 +0800 Subject: [PATCH 3/3] add app deduplication code this ensures that a given app is not included more than once significantly, this allows for an app to be in the default list and also selectable from the menu and you don't end up with two copies of it in the binary. --- xtask/src/builder.rs | 30 ++++++++++++++++++++++++++++++ xtask/src/main.rs | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/xtask/src/builder.rs b/xtask/src/builder.rs index f6d92aa98..d791b4196 100644 --- a/xtask/src/builder.rs +++ b/xtask/src/builder.rs @@ -461,6 +461,36 @@ impl Builder { self } + /// Searches through the services and apps name spaces and removes duplicates + pub fn deduplicate_processes(&mut self) { + let mut pid_names = Vec::::new(); + let mut dup_indices = Vec::<(usize, usize)>::new(); + { + // ensure the borrows that compose name_spaces go out of scope after searching for duplicates + let name_spaces = [&self.services, &self.apps]; + for (ns, name_space) in name_spaces.iter().enumerate() { + for (i, service) in name_space.iter().enumerate() { + if let Some(name) = &service.name() { + if pid_names.contains(&name) { + dup_indices.push((ns, i)); + } else { + pid_names.push(name.to_owned()); + } + } + } + } + } + if dup_indices.len() > 0 { + println!("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + for (dupe_ns, dupe_i) in dup_indices { + let removed = + if dupe_ns == 0 { self.services.remove(dupe_i) } else { self.apps.remove(dupe_i) }; + println!("WARNING: Found duplicate package name, removing later instances of {:?}", removed); + } + println!("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + } + } + /// add a feature to be passed on to services pub fn add_feature(&mut self, feature: &str) -> &mut Builder { self.features.push(feature.into()); diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 0e78416f0..8f50fa5a1 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -833,6 +833,14 @@ fn main() -> Result<(), Box> { std::process::exit(1); } } + // clean up any duplicates - this is an artifact of wanting to include dabao-console + // as a "default app" to make behavior more intuitive for beginners trying out dabao, + // but also wanting to list it in the UI as an app so that developers are /aware/ of + // dabao-console as an app they can modify. Simply hiding it by sticking it in the services + // directory makes in hard to discover. Maybe this will be changed to handle it entirely + // at the UI layer but anyways - this avoids accidental duplicate processes which is a good thing + // in general. + builder.deduplicate_processes(); builder.build()?; // the intent of this call is to check that crates we are sourcing from crates.io