From 4addd5d6e4b52568c73d1df59c3fd8386739be78 Mon Sep 17 00:00:00 2001 From: Viktor Sonesten Date: Fri, 22 Apr 2022 13:34:23 +0200 Subject: [PATCH] manifest: increase internal feature flag granularity Closes #11 --- hal/Cargo.toml | 150 ++++++++++++++++++++++++++-------------------- hal/src/lib.rs | 4 +- hal/src/serial.rs | 87 +++++---------------------- 3 files changed, 102 insertions(+), 139 deletions(-) diff --git a/hal/Cargo.toml b/hal/Cargo.toml index 01d4b063..08ee1a0c 100644 --- a/hal/Cargo.toml +++ b/hal/Cargo.toml @@ -93,136 +93,154 @@ atsamv71q21 = { version = "0.21.0", path = "../pac/atsamv71q21", optional = tru atsamv71q21b = { version = "0.21.0", path = "../pac/atsamv71q21b", optional = true } [features] +# Internal-only feature flags; do not set directly. +# Refer to ยง2 in the data sheet. +v71 = [] +v70 = [] +e70 = [] +s70 = [] +pins-64 = [] # J variants +pins-100 = [] # N variants +pins-144 = [] # Q variants +flash-2M = [] # "21"-suffix +flash-1M = [] # "20"-suffix +flash-512K = [] # "19"-suffix +rev-a = [] # No suffix after flash memory density number +rev-b = ["device-selected"] # "b"-suffix device-selected = [] -same70j19 = ["atsame70j19", "device-selected"] + +same70j19 = ["atsame70j19", "e70", "pins-64", "flash-512K", "rev-a"] same70j19-rt = ["same70j19", "atsame70j19/rt"] -same70j19b = ["atsame70j19b", "device-selected"] +same70j19b = ["atsame70j19b", "e70", "pins-64", "flash-512K", "rev-b"] same70j19b-rt = ["same70j19b", "atsame70j19b/rt"] -same70j20 = ["atsame70j20", "device-selected"] +same70j20 = ["atsame70j20", "e70", "pins-64", "flash-1M", "rev-a"] same70j20-rt = ["same70j20", "atsame70j20/rt"] -same70j20b = ["atsame70j20b", "device-selected"] +same70j20b = ["atsame70j20b", "e70", "pins-64", "flash-1M", "rev-b"] same70j20b-rt = ["same70j20b", "atsame70j20b/rt"] -same70j21 = ["atsame70j21", "device-selected"] +same70j21 = ["atsame70j21", "e70", "pins-64", "flash-2M", "rev-a"] same70j21-rt = ["same70j21", "atsame70j21/rt"] -same70j21b = ["atsame70j21b", "device-selected"] +same70j21b = ["atsame70j21b", "e70", "pins-64", "flash-2M", "rev-b"] same70j21b-rt = ["same70j21b", "atsame70j21b/rt"] -same70n19 = ["atsame70n19", "device-selected"] +same70n19 = ["atsame70n19", "e70", "pins-100", "flash-512K", "rev-a"] same70n19-rt = ["same70n19", "atsame70n19/rt"] -same70n19b = ["atsame70n19b", "device-selected"] +same70n19b = ["atsame70n19b", "e70", "pins-100", "flash-512K", "rev-b"] same70n19b-rt = ["same70n19b", "atsame70n19b/rt"] -same70n20 = ["atsame70n20", "device-selected"] +same70n20 = ["atsame70n20", "e70", "pins-100", "flash-1M", "rev-a"] same70n20-rt = ["same70n20", "atsame70n20/rt"] -same70n20b = ["atsame70n20b", "device-selected"] +same70n20b = ["atsame70n20b", "e70", "pins-100", "flash-1M", "rev-b"] same70n20b-rt = ["same70n20b", "atsame70n20b/rt"] -same70n21 = ["atsame70n21", "device-selected"] +same70n21 = ["atsame70n21", "e70", "pins-100", "flash-2M", "rev-a"] same70n21-rt = ["same70n21", "atsame70n21/rt"] -same70n21b = ["atsame70n21b", "device-selected"] +same70n21b = ["atsame70n21b", "e70", "pins-100", "flash-2M", "rev-b"] same70n21b-rt = ["same70n21b", "atsame70n21b/rt"] -same70q19 = ["atsame70q19", "device-selected"] +same70q19 = ["atsame70q19", "e70", "pins-144", "flash-512K", "rev-a"] same70q19-rt = ["same70q19", "atsame70q19/rt"] -same70q19b = ["atsame70q19b", "device-selected"] +same70q19b = ["atsame70q19b", "e70", "pins-144", "flash-512K", "rev-b"] same70q19b-rt = ["same70q19b", "atsame70q19b/rt"] -same70q20 = ["atsame70q20", "device-selected"] +same70q20 = ["atsame70q20", "e70", "pins-144", "flash-1M", "rev-a"] same70q20-rt = ["same70q20", "atsame70q20/rt"] -same70q20b = ["atsame70q20b", "device-selected"] +same70q20b = ["atsame70q20b", "e70", "pins-144", "flash-1M", "rev-b"] same70q20b-rt = ["same70q20b", "atsame70q20b/rt"] -same70q21 = ["atsame70q21", "device-selected"] +same70q21 = ["atsame70q21", "e70", "pins-144", "flash-2M", "rev-a"] same70q21-rt = ["same70q21", "atsame70q21/rt"] -same70q21b = ["atsame70q21b", "device-selected"] +same70q21b = ["atsame70q21b", "e70", "pins-144", "flash-2M", "rev-b"] same70q21b-rt = ["same70q21b", "atsame70q21b/rt"] -sams70j19 = ["atsams70j19", "device-selected"] + +sams70j19 = ["atsams70j19", "s70", "pins-64", "flash-512K", "rev-a"] sams70j19-rt = ["sams70j19", "atsams70j19/rt"] -sams70j19b = ["atsams70j19b", "device-selected"] +sams70j19b = ["atsams70j19b", "s70", "pins-64", "flash-512K", "rev-b"] sams70j19b-rt = ["sams70j19b", "atsams70j19b/rt"] -sams70j20 = ["atsams70j20", "device-selected"] +sams70j20 = ["atsams70j20", "s70", "pins-64", "flash-1M", "rev-a"] sams70j20-rt = ["sams70j20", "atsams70j20/rt"] -sams70j20b = ["atsams70j20b", "device-selected"] +sams70j20b = ["atsams70j20b", "s70", "pins-64", "flash-1M", "rev-b"] sams70j20b-rt = ["sams70j20b", "atsams70j20b/rt"] -sams70j21 = ["atsams70j21", "device-selected"] +sams70j21 = ["atsams70j21", "s70", "pins-64", "flash-2M", "rev-a"] sams70j21-rt = ["sams70j21", "atsams70j21/rt"] -sams70j21b = ["atsams70j21b", "device-selected"] +sams70j21b = ["atsams70j21b", "s70", "pins-64", "flash-2M", "rev-b"] sams70j21b-rt = ["sams70j21b", "atsams70j21b/rt"] -sams70n19 = ["atsams70n19", "device-selected"] +sams70n19 = ["atsams70n19", "s70", "pins-100", "flash-512K", "rev-a"] sams70n19-rt = ["sams70n19", "atsams70n19/rt"] -sams70n19b = ["atsams70n19b", "device-selected"] +sams70n19b = ["atsams70n19b", "s70", "pins-100", "flash-512K", "rev-a"] sams70n19b-rt = ["sams70n19b", "atsams70n19b/rt"] -sams70n20 = ["atsams70n20", "device-selected"] +sams70n20 = ["atsams70n20", "s70", "pins-100", "flash-1M", "rev-a"] sams70n20-rt = ["sams70n20", "atsams70n20/rt"] -sams70n20b = ["atsams70n20b", "device-selected"] +sams70n20b = ["atsams70n20b", "s70", "pins-100", "flash-1M", "rev-b"] sams70n20b-rt = ["sams70n20b", "atsams70n20b/rt"] -sams70n21 = ["atsams70n21", "device-selected"] +sams70n21 = ["atsams70n21", "s70", "pins-100", "flash-2M", "rev-a"] sams70n21-rt = ["sams70n21", "atsams70n21/rt"] -sams70n21b = ["atsams70n21b", "device-selected"] +sams70n21b = ["atsams70n21b", "s70", "pins-100", "flash-2M", "rev-b"] sams70n21b-rt = ["sams70n21b", "atsams70n21b/rt"] -sams70q19 = ["atsams70q19", "device-selected"] +sams70q19 = ["atsams70q19", "s70", "pins-144", "flash-512K", "rev-a"] sams70q19-rt = ["sams70q19", "atsams70q19/rt"] -sams70q19b = ["atsams70q19b", "device-selected"] +sams70q19b = ["atsams70q19b", "s70", "pins-144", "flash-512K", "rev-b"] sams70q19b-rt = ["sams70q19b", "atsams70q19b/rt"] -sams70q20 = ["atsams70q20", "device-selected"] +sams70q20 = ["atsams70q20", "s70", "pins-144", "flash-1M", "rev-a"] sams70q20-rt = ["sams70q20", "atsams70q20/rt"] -sams70q20b = ["atsams70q20b", "device-selected"] +sams70q20b = ["atsams70q20b", "s70", "pins-144", "flash-1M", "rev-b"] sams70q20b-rt = ["sams70q20b", "atsams70q20b/rt"] -sams70q21 = ["atsams70q21", "device-selected"] +sams70q21 = ["atsams70q21", "s70", "pins-144", "flash-2M", "rev-a"] sams70q21-rt = ["sams70q21", "atsams70q21/rt"] -sams70q21b = ["atsams70q21b", "device-selected"] +sams70q21b = ["atsams70q21b", "s70", "pins-144", "flash-2M", "rev-b"] sams70q21b-rt = ["sams70q21b", "atsams70q21b/rt"] -samv70j19 = ["atsamv70j19", "device-selected"] + +samv70j19 = ["atsamv70j19", "v70", "pins-64", "flash-512K", "rev-a"] samv70j19-rt = ["samv70j19", "atsamv70j19/rt"] -samv70j19b = ["atsamv70j19b", "device-selected"] +samv70j19b = ["atsamv70j19b", "v70", "pins-64", "flash-512K", "rev-b"] samv70j19b-rt = ["samv70j19b", "atsamv70j19b/rt"] -samv70j20 = ["atsamv70j20", "device-selected"] +samv70j20 = ["atsamv70j20", "v70", "pins-64", "flash-1M", "rev-a"] samv70j20-rt = ["samv70j20", "atsamv70j20/rt"] -samv70j20b = ["atsamv70j20b", "device-selected"] +samv70j20b = ["atsamv70j20b", "v70", "pins-64", "flash-1M", "rev-b"] samv70j20b-rt = ["samv70j20b", "atsamv70j20b/rt"] -samv70n19 = ["atsamv70n19", "device-selected"] +samv70n19 = ["atsamv70n19", "v70", "pins-100", "flash-512K", "rev-a"] samv70n19-rt = ["samv70n19", "atsamv70n19/rt"] -samv70n19b = ["atsamv70n19b", "device-selected"] +samv70n19b = ["atsamv70n19b", "v70", "pins-100", "flash-512K", "rev-b"] samv70n19b-rt = ["samv70n19b", "atsamv70n19b/rt"] -samv70n20 = ["atsamv70n20", "device-selected"] +samv70n20 = ["atsamv70n20", "v70", "pins-100", "flash-1M", "rev-a"] samv70n20-rt = ["samv70n20", "atsamv70n20/rt"] -samv70n20b = ["atsamv70n20b", "device-selected"] +samv70n20b = ["atsamv70n20b", "v70", "pins-100", "flash-1M", "rev-b"] samv70n20b-rt = ["samv70n20b", "atsamv70n20b/rt"] -samv70q19 = ["atsamv70q19", "device-selected"] +samv70q19 = ["atsamv70q19", "v70", "pins-144", "flash-512K", "rev-a"] samv70q19-rt = ["samv70q19", "atsamv70q19/rt"] -samv70q19b = ["atsamv70q19b", "device-selected"] +samv70q19b = ["atsamv70q19b", "v70", "pins-144", "flash-512K", "rev-b"] samv70q19b-rt = ["samv70q19b", "atsamv70q19b/rt"] -samv70q20 = ["atsamv70q20", "device-selected"] +samv70q20 = ["atsamv70q20", "v70", "pins-144", "flash-1M", "rev-a"] samv70q20-rt = ["samv70q20", "atsamv70q20/rt"] -samv70q20b = ["atsamv70q20b", "device-selected"] +samv70q20b = ["atsamv70q20b", "v70", "pins-144", "flash-1M", "rev-b"] samv70q20b-rt = ["samv70q20b", "atsamv70q20b/rt"] -samv71j19 = ["atsamv71j19", "device-selected"] + +samv71j19 = ["atsamv71j19", "v71", "pins-64", "flash-512K", "rev-a"] samv71j19-rt = ["samv71j19", "atsamv71j19/rt"] -samv71j19b = ["atsamv71j19b", "device-selected"] +samv71j19b = ["atsamv71j19b", "v71", "pins-64", "flash-512K", "rev-b"] samv71j19b-rt = ["samv71j19b", "atsamv71j19b/rt"] -samv71j20 = ["atsamv71j20", "device-selected"] +samv71j20 = ["atsamv71j20", "v71", "pins-64", "flash-1M", "rev-a"] samv71j20-rt = ["samv71j20", "atsamv71j20/rt"] -samv71j20b = ["atsamv71j20b", "device-selected"] +samv71j20b = ["atsamv71j20b", "v71", "pins-64", "flash-1M", "rev-b"] samv71j20b-rt = ["samv71j20b", "atsamv71j20b/rt"] -samv71j21 = ["atsamv71j21", "device-selected"] +samv71j21 = ["atsamv71j21", "v71", "pins-64", "flash-2M", "rev-a"] samv71j21-rt = ["samv71j21", "atsamv71j21/rt"] -samv71j21b = ["atsamv71j21b", "device-selected"] +samv71j21b = ["atsamv71j21b", "v71", "pins-64", "flash-2M", "rev-b"] samv71j21b-rt = ["samv71j21b", "atsamv71j21b/rt"] -samv71n19 = ["atsamv71n19", "device-selected"] +samv71n19 = ["atsamv71n19", "v71", "pins-100", "flash-512K", "rev-a"] samv71n19-rt = ["samv71n19", "atsamv71n19/rt"] -samv71n19b = ["atsamv71n19b", "device-selected"] +samv71n19b = ["atsamv71n19b", "v71", "pins-100", "flash-512K", "rev-b"] samv71n19b-rt = ["samv71n19b", "atsamv71n19b/rt"] -samv71n20 = ["atsamv71n20", "device-selected"] +samv71n20 = ["atsamv71n20", "v71", "pins-100", "flash-1M", "rev-a"] samv71n20-rt = ["samv71n20", "atsamv71n20/rt"] -samv71n20b = ["atsamv71n20b", "device-selected"] +samv71n20b = ["atsamv71n20b", "v71", "pins-100", "flash-1M", "rev-b"] samv71n20b-rt = ["samv71n20b", "atsamv71n20b/rt"] -samv71n21 = ["atsamv71n21", "device-selected"] +samv71n21 = ["atsamv71n21", "v71", "pins-100", "flash-2M", "rev-a"] samv71n21-rt = ["samv71n21", "atsamv71n21/rt"] -samv71n21b = ["atsamv71n21b", "device-selected"] +samv71n21b = ["atsamv71n21b", "v71", "pins-100", "flash-2M", "rev-b"] samv71n21b-rt = ["samv71n21b", "atsamv71n21b/rt"] -samv71q19 = ["atsamv71q19", "device-selected"] +samv71q19 = ["atsamv71q19", "v71", "pins-144", "flash-512K", "rev-a"] samv71q19-rt = ["samv71q19", "atsamv71q19/rt"] -samv71q19b = ["atsamv71q19b", "device-selected"] +samv71q19b = ["atsamv71q19b", "v71", "pins-144", "flash-512K", "rev-b"] samv71q19b-rt = ["samv71q19b", "atsamv71q19b/rt"] -samv71q20 = ["atsamv71q20", "device-selected"] +samv71q20 = ["atsamv71q20", "v71", "pins-144", "flash-1M", "rev-a"] samv71q20-rt = ["samv71q20", "atsamv71q20/rt"] -samv71q20b = ["atsamv71q20b", "device-selected"] +samv71q20b = ["atsamv71q20b", "v71", "pins-144", "flash-1M", "rev-b"] samv71q20b-rt = ["samv71q20b", "atsamv71q20b/rt"] -samv71q21 = ["atsamv71q21", "device-selected"] +samv71q21 = ["atsamv71q21", "v71", "pins-144", "flash-2M", "rev-a"] samv71q21-rt = ["samv71q21", "atsamv71q21/rt"] -samv71q21b = ["atsamv71q21b", "device-selected"] +samv71q21b = ["atsamv71q21b", "v71", "pins-144", "flash-2M", "rev-b"] samv71q21b-rt = ["samv71q21b", "atsamv71q21b/rt"] diff --git a/hal/src/lib.rs b/hal/src/lib.rs index 1b8888d5..b49db4ea 100644 --- a/hal/src/lib.rs +++ b/hal/src/lib.rs @@ -141,7 +141,7 @@ pub use atsamv71q21 as target_device; #[cfg(feature = "samv71q21b")] pub use atsamv71q21b as target_device; -#[cfg(feature = "device-selected")] +#[cfg(feature = "rev-b")] pub mod serial; -#[cfg(feature = "device-selected")] +#[cfg(feature = "rev-b")] pub mod watchdog; diff --git a/hal/src/serial.rs b/hal/src/serial.rs index 2eccf881..a678ab11 100644 --- a/hal/src/serial.rs +++ b/hal/src/serial.rs @@ -2,35 +2,15 @@ use crate::{ehal, nb}; // Smaller part have 3x UART & 2x USART use crate::target_device::{UART0, UART1, UART2, USART0, USART1}; -#[cfg(any( - feature = "sams70n19b", - feature = "sams70n20b", - feature = "sams70n21b", - feature = "sams70q19b", - feature = "sams70q20b", - feature = "sams70q21b", - feature = "same70n19b", - feature = "same70n20b", - feature = "same70n21b", - feature = "same70q19b", - feature = "same70q20b", - feature = "same70q21b", +#[cfg(all( + any(feature = "e70", feature = "s70"), + any(feature = "pins-100", feature = "pins-144") ))] use crate::target_device::{UART3, USART2}; -#[cfg(any( - feature = "sams70n19b", - feature = "sams70n20b", - feature = "sams70n21b", - feature = "sams70q19b", - feature = "sams70q20b", - feature = "sams70q21b", - feature = "same70n19b", - feature = "same70n20b", - feature = "same70n21b", - feature = "same70q19b", - feature = "same70q20b", - feature = "same70q21b", +#[cfg(all( + any(feature = "e70", feature = "s70"), + any(feature = "pins-100", feature = "pins-144") ))] use crate::target_device::UART4; @@ -46,54 +26,24 @@ pub type Serial0 = Serial; pub type Serial1 = Serial; pub type Serial2 = Serial; -#[cfg(any( - feature = "sams70n19b", - feature = "sams70n20b", - feature = "sams70n21b", - feature = "sams70q19b", - feature = "sams70q20b", - feature = "sams70q21b", - feature = "same70n19b", - feature = "same70n20b", - feature = "same70n21b", - feature = "same70q19b", - feature = "same70q20b", - feature = "same70q21b", +#[cfg(all( + any(feature = "e70", feature = "s70"), + any(feature = "pins-100", feature = "pins-144") ))] pub type Serial3 = Serial; -#[cfg(any( - feature = "sams70n19b", - feature = "sams70n20b", - feature = "sams70n21b", - feature = "sams70q19b", - feature = "sams70q20b", - feature = "sams70q21b", - feature = "same70n19b", - feature = "same70n20b", - feature = "same70n21b", - feature = "same70q19b", - feature = "same70q20b", - feature = "same70q21b", +#[cfg(all( + any(feature = "e70", feature = "s70"), + any(feature = "pins-100", feature = "pins-144") ))] pub type Serial4 = Serial; pub type Serial5 = Serial; pub type Serial6 = Serial; -#[cfg(any( - feature = "sams70n19b", - feature = "sams70n20b", - feature = "sams70n21b", - feature = "sams70q19b", - feature = "sams70q20b", - feature = "sams70q21b", - feature = "same70n19b", - feature = "same70n20b", - feature = "same70n21b", - feature = "same70q19b", - feature = "same70q20b", - feature = "same70q21b", +#[cfg(all( + any(feature = "e70", feature = "s70"), + any(feature = "pins-100", feature = "pins-144") ))] pub type Serial7 = Serial; @@ -132,12 +82,7 @@ impl ehal::serial::Write for Serial { } } -#[cfg(any( - feature = "sams70q20b", - feature = "sams70q21b", - feature = "same70q20b", - feature = "same70q21b", -))] +#[cfg(all(any(feature = "e70", feature = "s70"), feature = "pins-100"))] impl ehal::serial::Write for Serial { type Error = Error;