mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
Update backend features to be more clear
This commit is contained in:
parent
9552790dcc
commit
4442c46926
6 changed files with 31 additions and 32 deletions
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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::*;
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue