Update backend features to be more clear

This commit is contained in:
Emil Fresk 2023-02-20 20:56:18 +01:00 committed by Henrik Tjäder
parent 9552790dcc
commit 4442c46926
6 changed files with 31 additions and 32 deletions

View file

@ -23,16 +23,15 @@ proc-macro = true
[features] [features]
default = [] default = []
debugprint = []
# list of supported codegen backends # list of supported codegen backends
cortex_m_source_masking = [] cortex-m-source-masking = []
cortex_m_basepri = [] cortex-m-basepri = []
# riscv_clic = [] # riscv-clic = []
# riscv_ch32 = [] # riscv-ch32 = []
# backend API test # backend API test
test_template = [] test-template = []
[dependencies] [dependencies]
indexmap = "1.9.2" indexmap = "1.9.2"

View file

@ -1,18 +1,18 @@
#[cfg(not(any( #[cfg(not(any(
feature = "cortex_m_source_masking", feature = "cortex-m-source-masking",
feature = "cortex_m_basepri", feature = "cortex-m-basepri",
feaute = "test_template" feaute = "test-template"
)))] )))]
compile_error!("No backend selected"); 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::*; pub use cortex::*;
#[cfg(feature = "test_template")] #[cfg(feature = "test-template")]
pub use cortex::*; 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; mod cortex;
#[cfg(feature = "test_template")] #[cfg(feature = "test-template")]
mod template; mod template;

View file

@ -8,9 +8,9 @@ use quote::quote;
use std::collections::HashSet; use std::collections::HashSet;
use syn::{parse, Attribute, Ident}; use syn::{parse, Attribute, Ident};
#[cfg(feature = "cortex_m_basepri")] #[cfg(feature = "cortex-m-basepri")]
pub use basepri::*; pub use basepri::*;
#[cfg(feature = "cortex_m_source_masking")] #[cfg(feature = "cortex-m-source-masking")]
pub use source_masking::*; pub use source_masking::*;
/// Whether `name` is an exception with configurable priority /// 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 { mod source_masking {
use super::*; use super::*;
use std::collections::HashMap; use std::collections::HashMap;
@ -119,7 +119,7 @@ mod source_masking {
} }
} }
#[cfg(feature = "cortex_m_basepri")] #[cfg(feature = "cortex-m-basepri")]
mod basepri { mod basepri {
use super::*; use super::*;

View file

@ -65,13 +65,13 @@ trybuild = "1"
[features] [features]
default = [] default = []
thumbv6 = ["rtic-macros/cortex_m_source_masking"] thumbv6-backend = ["rtic-macros/cortex-m-source-masking"]
thumbv7 = ["rtic-macros/cortex_m_basepri"] thumbv7-backend = ["rtic-macros/cortex-m-basepri"]
thumbv8_base = ["rtic-macros/cortex_m_source_masking"] thumbv8base-backend = ["rtic-macros/cortex-m-source-masking"]
thumbv8_main = ["rtic-macros/cortex_m_basepri"] thumbv8main-backend = ["rtic-macros/cortex-m-basepri"]
# riscv_clic = ["rtic-macros/riscv_clic"] # riscv-clic-backend = ["rtic-macros/riscv-clic"]
# riscv_ch32 = ["rtic-macros/riscv_ch32"] # riscv-ch32-backend = ["rtic-macros/riscv-ch32"]
# riscv_esp32c3 = ["rtic-macros/riscv_esp32c3"] # riscv-esp32c3-backend = ["rtic-macros/riscv-esp32c3"]
# needed for testing # needed for testing
test-critical-section = ["cortex-m/critical-section-single-core", "rtic-monotonics/systick_100hz"] test-critical-section = ["cortex-m/critical-section-single-core", "rtic-monotonics/systick_100hz"]

View file

@ -6,18 +6,18 @@ pub mod executor;
#[cfg(all( #[cfg(all(
cortex_m_basepri, cortex_m_basepri,
not(any(feature = "thumbv7", feature = "thumbv8_main")) not(any(feature = "thumbv7-backend", feature = "thumbv8main-backend"))
))] ))]
compile_error!( 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( #[cfg(all(
cortex_m_source_masking, cortex_m_source_masking,
not(any(feature = "thumbv6", feature = "thumbv8_base")) not(any(feature = "thumbv6-backend", feature = "thumbv8base-backend"))
))] ))]
compile_error!( 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)] #[cfg(cortex_m_basepri)]

View file

@ -55,10 +55,10 @@ impl Backends {
fn to_rtic_feature(&self) -> &str { fn to_rtic_feature(&self) -> &str {
match self { match self {
Backends::Thumbv6 => "thumbv6", Backends::Thumbv6 => "thumbv6-backend",
Backends::Thumbv7 => "thumbv7", Backends::Thumbv7 => "thumbv7-backend",
Backends::Thumbv8Base => "thumbv8_base", Backends::Thumbv8Base => "thumbv8base-backend",
Backends::Thumbv8Main => "thumbv8_main", Backends::Thumbv8Main => "thumbv8main-backend",
} }
} }
} }