From 4442c4692634c90ba60653d42d72f9f259ae1a16 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Mon, 20 Feb 2023 20:56:18 +0100 Subject: [PATCH] Update backend features to be more clear --- rtic-macros/Cargo.toml | 11 +++++------ rtic-macros/src/codegen/bindings.rs | 14 +++++++------- rtic-macros/src/codegen/bindings/cortex.rs | 8 ++++---- rtic/Cargo.toml | 14 +++++++------- rtic/src/export.rs | 8 ++++---- xtask/src/main.rs | 8 ++++---- 6 files changed, 31 insertions(+), 32 deletions(-) diff --git a/rtic-macros/Cargo.toml b/rtic-macros/Cargo.toml index bdc2c12278..94aa88b1a8 100644 --- a/rtic-macros/Cargo.toml +++ b/rtic-macros/Cargo.toml @@ -23,16 +23,15 @@ proc-macro = true [features] default = [] -debugprint = [] # list of supported codegen backends -cortex_m_source_masking = [] -cortex_m_basepri = [] -# riscv_clic = [] -# riscv_ch32 = [] +cortex-m-source-masking = [] +cortex-m-basepri = [] +# riscv-clic = [] +# riscv-ch32 = [] # backend API test -test_template = [] +test-template = [] [dependencies] indexmap = "1.9.2" diff --git a/rtic-macros/src/codegen/bindings.rs b/rtic-macros/src/codegen/bindings.rs index a187820ea0..68378b5e7e 100644 --- a/rtic-macros/src/codegen/bindings.rs +++ b/rtic-macros/src/codegen/bindings.rs @@ -1,18 +1,18 @@ #[cfg(not(any( - feature = "cortex_m_source_masking", - feature = "cortex_m_basepri", - feaute = "test_template" + feature = "cortex-m-source-masking", + feature = "cortex-m-basepri", + feaute = "test-template" )))] compile_error!("No backend selected"); -#[cfg(any(feature = "cortex_m_source_masking", feature = "cortex_m_basepri"))] +#[cfg(any(feature = "cortex-m-source-masking", feature = "cortex-m-basepri"))] pub use cortex::*; -#[cfg(feature = "test_template")] +#[cfg(feature = "test-template")] pub use cortex::*; -#[cfg(any(feature = "cortex_m_source_masking", feature = "cortex_m_basepri"))] +#[cfg(any(feature = "cortex-m-source-masking", feature = "cortex-m-basepri"))] mod cortex; -#[cfg(feature = "test_template")] +#[cfg(feature = "test-template")] mod template; diff --git a/rtic-macros/src/codegen/bindings/cortex.rs b/rtic-macros/src/codegen/bindings/cortex.rs index d5eb12e21f..3f0584c551 100644 --- a/rtic-macros/src/codegen/bindings/cortex.rs +++ b/rtic-macros/src/codegen/bindings/cortex.rs @@ -8,9 +8,9 @@ use quote::quote; use std::collections::HashSet; use syn::{parse, Attribute, Ident}; -#[cfg(feature = "cortex_m_basepri")] +#[cfg(feature = "cortex-m-basepri")] pub use basepri::*; -#[cfg(feature = "cortex_m_source_masking")] +#[cfg(feature = "cortex-m-source-masking")] pub use source_masking::*; /// Whether `name` is an exception with configurable priority @@ -30,7 +30,7 @@ fn is_exception(name: &Ident) -> bool { ) } -#[cfg(feature = "cortex_m_source_masking")] +#[cfg(feature = "cortex-m-source-masking")] mod source_masking { use super::*; use std::collections::HashMap; @@ -119,7 +119,7 @@ mod source_masking { } } -#[cfg(feature = "cortex_m_basepri")] +#[cfg(feature = "cortex-m-basepri")] mod basepri { use super::*; diff --git a/rtic/Cargo.toml b/rtic/Cargo.toml index 4448fd3c88..51a580e8df 100644 --- a/rtic/Cargo.toml +++ b/rtic/Cargo.toml @@ -65,13 +65,13 @@ trybuild = "1" [features] default = [] -thumbv6 = ["rtic-macros/cortex_m_source_masking"] -thumbv7 = ["rtic-macros/cortex_m_basepri"] -thumbv8_base = ["rtic-macros/cortex_m_source_masking"] -thumbv8_main = ["rtic-macros/cortex_m_basepri"] -# riscv_clic = ["rtic-macros/riscv_clic"] -# riscv_ch32 = ["rtic-macros/riscv_ch32"] -# riscv_esp32c3 = ["rtic-macros/riscv_esp32c3"] +thumbv6-backend = ["rtic-macros/cortex-m-source-masking"] +thumbv7-backend = ["rtic-macros/cortex-m-basepri"] +thumbv8base-backend = ["rtic-macros/cortex-m-source-masking"] +thumbv8main-backend = ["rtic-macros/cortex-m-basepri"] +# riscv-clic-backend = ["rtic-macros/riscv-clic"] +# riscv-ch32-backend = ["rtic-macros/riscv-ch32"] +# riscv-esp32c3-backend = ["rtic-macros/riscv-esp32c3"] # needed for testing test-critical-section = ["cortex-m/critical-section-single-core", "rtic-monotonics/systick_100hz"] diff --git a/rtic/src/export.rs b/rtic/src/export.rs index 2ce8ce202c..82132c270d 100644 --- a/rtic/src/export.rs +++ b/rtic/src/export.rs @@ -6,18 +6,18 @@ pub mod executor; #[cfg(all( cortex_m_basepri, - not(any(feature = "thumbv7", feature = "thumbv8_main")) + not(any(feature = "thumbv7-backend", feature = "thumbv8main-backend")) ))] compile_error!( - "Building for Cortex-M with basepri, but 'thumbv7' or 'thumbv8_main' backend not selected" + "Building for Cortex-M with basepri, but 'thumbv7-backend' or 'thumbv8main-backend' backend not selected" ); #[cfg(all( cortex_m_source_masking, - not(any(feature = "thumbv6", feature = "thumbv8_base")) + not(any(feature = "thumbv6-backend", feature = "thumbv8base-backend")) ))] compile_error!( - "Building for Cortex-M with source masking, but 'thumbv6' or 'thumbv8_base' backend not selected" + "Building for Cortex-M with source masking, but 'thumbv6-backend' or 'thumbv8base-backend' backend not selected" ); #[cfg(cortex_m_basepri)] diff --git a/xtask/src/main.rs b/xtask/src/main.rs index b270a44030..9ff0ae272e 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -55,10 +55,10 @@ impl Backends { fn to_rtic_feature(&self) -> &str { match self { - Backends::Thumbv6 => "thumbv6", - Backends::Thumbv7 => "thumbv7", - Backends::Thumbv8Base => "thumbv8_base", - Backends::Thumbv8Main => "thumbv8_main", + Backends::Thumbv6 => "thumbv6-backend", + Backends::Thumbv7 => "thumbv7-backend", + Backends::Thumbv8Base => "thumbv8base-backend", + Backends::Thumbv8Main => "thumbv8main-backend", } } }