Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xtask: Allow tasks & the kernel to specify default features. #1830

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions build/xtask/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ impl Config {
&self,
verbose: bool,
crate_name: &str,
no_default_features: bool,
features: &[String],
sysroot: Option<&'a Path>,
) -> BuildConfig<'a> {
let mut args = vec![
"--no-default-features".to_string(),
"--target".to_string(),
self.target.to_string(),
];
let mut args = vec!["--target".to_string(), self.target.to_string()];
if no_default_features {
args.push("--no-default-features".to_string());
}
if verbose {
args.push("-v".to_string());
}
Expand Down Expand Up @@ -305,6 +305,7 @@ impl Config {
let mut out = self.common_build_config(
verbose,
&self.kernel.name,
self.kernel.no_default_features,
&self.kernel.features,
sysroot,
);
Expand All @@ -327,6 +328,7 @@ impl Config {
let mut out = self.common_build_config(
verbose,
&task_toml.name,
task_toml.no_default_features,
&task_toml.features,
sysroot,
);
Expand Down Expand Up @@ -626,6 +628,8 @@ pub struct Kernel {
pub stacksize: Option<u32>,
#[serde(default)]
pub features: Vec<String>,
#[serde(default)]
pub no_default_features: bool,
}

fn default_name() -> String {
Expand Down
2 changes: 1 addition & 1 deletion drv/stm32h7-fmc-demo-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ task-net-api = { path = "../../task/net-api", features = ["vlan"] }

cortex-m = { workspace = true }
idol-runtime = { workspace = true }
cfg-if = { workspace = true }
num-traits = { workspace = true }
stm32h7 = { workspace = true }
serde = { workspace = true }
Expand All @@ -22,7 +23,6 @@ build-util = { path = "../../build/util" }
idol = { workspace = true }

[features]
default = ["h743"]
h743 = ["stm32h7/stm32h743", "drv-stm32xx-sys-api/h743"]
h753 = ["stm32h7/stm32h753", "drv-stm32xx-sys-api/h753"]
init-hw = []
Expand Down
14 changes: 9 additions & 5 deletions drv/stm32h7-fmc-demo-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ use task_net_api::{
};
use userlib::*;

#[cfg(feature = "h743")]
use stm32h7::stm32h743 as device;

#[cfg(feature = "h753")]
use stm32h7::stm32h753 as device;
cfg_if::cfg_if! {
if #[cfg(feature = "h743")] {
use stm32h7::stm32h743 as device;
} else if #[cfg(feature = "h753")] {
use stm32h7::stm32h753 as device;
} else {
compile_error!("missing supported SoC feature");
}
}

use drv_stm32xx_sys_api as sys_api;
use idol_runtime::{NotificationHandler, RequestError};
Expand Down
2 changes: 2 additions & 0 deletions lib/toml-task/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ pub struct Task<T = ordered_toml::Value> {
pub sections: IndexMap<String, String>,
#[serde(default)]
pub max_sizes: IndexMap<String, u32>,
#[serde(default)]
pub no_default_features: bool,
}

impl<T> Task<T> {
Expand Down
1 change: 0 additions & 1 deletion task/idle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021"

[features]
default = []
insomniac = []

[dependencies]
Expand Down
Loading