diff --git a/.vscode/settings.json b/.vscode/settings.json index 4c6c3bece..ca242662b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,8 +3,8 @@ "editor.formatOnSave": true, "rust-analyzer.checkOnSave.allFeatures": false, "rust-analyzer.checkOnSave.allTargets": false, - //"rust-analyzer.cargo.target": "thumbv7em-none-eabi", - //"rust-analyzer.checkOnSave.target": "thumbv7em-none-eabi", + "rust-analyzer.cargo.target": "thumbv7em-none-eabi", + "rust-analyzer.checkOnSave.target": "thumbv7em-none-eabi", "rust-analyzer.procMacro.enable": true, "rust-analyzer.cargo.loadOutDirsFromCheck": true, "files.watcherExclude": { diff --git a/embassy-extras/src/fmt.rs b/embassy-extras/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-extras/src/fmt.rs +++ b/embassy-extras/src/fmt.rs @@ -104,56 +104,66 @@ macro_rules! panic { } macro_rules! trace { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::trace!($($x)*); + ::log::trace!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::trace!($($x)*); + ::defmt::trace!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! debug { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { - #[cfg(fevature = "log")] - ::log::debug!($($x)*); + #[cfg(feature = "log")] + ::log::debug!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::debug!($($x)*); + ::defmt::debug!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! info { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::info!($($x)*); + ::log::info!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::info!($($x)*); + ::defmt::info!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! warn { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::warn!($($x)*); + ::log::warn!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::warn!($($x)*); + ::defmt::warn!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! error { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::error!($($x)*); + ::log::error!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::error!($($x)*); + ::defmt::error!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } diff --git a/embassy-net/src/fmt.rs b/embassy-net/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-net/src/fmt.rs +++ b/embassy-net/src/fmt.rs @@ -104,56 +104,66 @@ macro_rules! panic { } macro_rules! trace { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::trace!($($x)*); + ::log::trace!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::trace!($($x)*); + ::defmt::trace!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! debug { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { - #[cfg(fevature = "log")] - ::log::debug!($($x)*); + #[cfg(feature = "log")] + ::log::debug!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::debug!($($x)*); + ::defmt::debug!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! info { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::info!($($x)*); + ::log::info!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::info!($($x)*); + ::defmt::info!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! warn { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::warn!($($x)*); + ::log::warn!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::warn!($($x)*); + ::defmt::warn!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! error { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::error!($($x)*); + ::log::error!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::error!($($x)*); + ::defmt::error!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } diff --git a/embassy-nrf/src/fmt.rs b/embassy-nrf/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-nrf/src/fmt.rs +++ b/embassy-nrf/src/fmt.rs @@ -104,56 +104,66 @@ macro_rules! panic { } macro_rules! trace { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::trace!($($x)*); + ::log::trace!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::trace!($($x)*); + ::defmt::trace!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! debug { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { - #[cfg(fevature = "log")] - ::log::debug!($($x)*); + #[cfg(feature = "log")] + ::log::debug!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::debug!($($x)*); + ::defmt::debug!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! info { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::info!($($x)*); + ::log::info!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::info!($($x)*); + ::defmt::info!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! warn { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::warn!($($x)*); + ::log::warn!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::warn!($($x)*); + ::defmt::warn!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! error { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::error!($($x)*); + ::log::error!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::error!($($x)*); + ::defmt::error!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } diff --git a/embassy-rp/src/fmt.rs b/embassy-rp/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-rp/src/fmt.rs +++ b/embassy-rp/src/fmt.rs @@ -104,56 +104,66 @@ macro_rules! panic { } macro_rules! trace { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::trace!($($x)*); + ::log::trace!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::trace!($($x)*); + ::defmt::trace!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! debug { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { - #[cfg(fevature = "log")] - ::log::debug!($($x)*); + #[cfg(feature = "log")] + ::log::debug!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::debug!($($x)*); + ::defmt::debug!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! info { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::info!($($x)*); + ::log::info!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::info!($($x)*); + ::defmt::info!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! warn { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::warn!($($x)*); + ::log::warn!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::warn!($($x)*); + ::defmt::warn!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! error { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::error!($($x)*); + ::log::error!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::error!($($x)*); + ::defmt::error!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } diff --git a/embassy-stm32/src/fmt.rs b/embassy-stm32/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy-stm32/src/fmt.rs +++ b/embassy-stm32/src/fmt.rs @@ -104,56 +104,66 @@ macro_rules! panic { } macro_rules! trace { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::trace!($($x)*); + ::log::trace!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::trace!($($x)*); + ::defmt::trace!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! debug { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { - #[cfg(fevature = "log")] - ::log::debug!($($x)*); + #[cfg(feature = "log")] + ::log::debug!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::debug!($($x)*); + ::defmt::debug!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! info { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::info!($($x)*); + ::log::info!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::info!($($x)*); + ::defmt::info!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! warn { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::warn!($($x)*); + ::log::warn!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::warn!($($x)*); + ::defmt::warn!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! error { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::error!($($x)*); + ::log::error!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::error!($($x)*); + ::defmt::error!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } diff --git a/embassy/src/fmt.rs b/embassy/src/fmt.rs index 2646c57ab..066970813 100644 --- a/embassy/src/fmt.rs +++ b/embassy/src/fmt.rs @@ -104,56 +104,66 @@ macro_rules! panic { } macro_rules! trace { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::trace!($($x)*); + ::log::trace!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::trace!($($x)*); + ::defmt::trace!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! debug { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { - #[cfg(fevature = "log")] - ::log::debug!($($x)*); + #[cfg(feature = "log")] + ::log::debug!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::debug!($($x)*); + ::defmt::debug!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! info { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::info!($($x)*); + ::log::info!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::info!($($x)*); + ::defmt::info!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! warn { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::warn!($($x)*); + ::log::warn!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::warn!($($x)*); + ::defmt::warn!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } macro_rules! error { - ($($x:tt)*) => { + ($s:literal $(, $x:expr)* $(,)?) => { { #[cfg(feature = "log")] - ::log::error!($($x)*); + ::log::error!($s $(, $x)*); #[cfg(feature = "defmt")] - ::defmt::error!($($x)*); + ::defmt::error!($s $(, $x)*); + #[cfg(not(any(feature = "log", feature="defmt")))] + let _ = ($( & $x ),*); } }; } diff --git a/stm32-metapac/Cargo.toml b/stm32-metapac/Cargo.toml index c92c5f003..971d76956 100644 --- a/stm32-metapac/Cargo.toml +++ b/stm32-metapac/Cargo.toml @@ -9,16 +9,18 @@ resolver = "2" cortex-m = "0.7.2" cortex-m-rt = { version = "0.6.8", optional = true } +# BEGIN BUILD DEPENDENCIES +# These are removed when generating the pre-generated crate using the tool at gen/. [build-dependencies] regex = "1.4.6" chiptool = { git = "https://github.com/embassy-rs/chiptool", rev = "86b77165078065058098e981d49d2dd213b2feba" } serde = { version = "1.0.123", features = [ "derive" ]} serde_yaml = "0.8.15" +# END BUILD DEPENDENCIES [features] rt = ["cortex-m-rt/device"] - # BEGIN GENERATED FEATURES # Generated by gen_features.py. DO NOT EDIT. stm32f030c6 = []