Enable critical-section-impl by default only from board crates, not from hal

There are a lot of non-binary crates depending on rp2040-hal. That way,
the default-features of rp2040-hal may be activated unintentionally
through an indirect dependency. Therefore, a binary crate which wants
to disable the `critical-section-impl` feature to provide its own one
could have a hard time to do so.

In contrast, the board support crates are usually only used by top-level
binary crates. So disabling the default features on those should usually
just work.

Binary crates depending on rp2040-hal directly, which don't use any
board support crate, might need to activate the feature manually. This
is reasonable because those binary crates need to replicate some
boilerplate from the board crates anyhow.
This commit is contained in:
Jan Niehusmann 2022-08-24 14:30:25 +00:00
parent 6ef6838132
commit 280de7cb99
19 changed files with 36 additions and 19 deletions

View file

@ -25,6 +25,7 @@ smart-leds = "0.3.0"
ws2812-pio = "0.3.0" ws2812-pio = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -25,6 +25,7 @@ nb = "1.0.0"
ws2812-pio = "0.3.0" ws2812-pio = "0.3.0"
[features] [features]
default = ["rt", "boot2"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -18,7 +18,8 @@ embedded-hal = { version = "0.2.4", features = ["unproven"] }
rp2040-boot2 = { version = "0.2.0", optional = true } rp2040-boot2 = { version = "0.2.0", optional = true }
[features] [features]
default = ["rt", "boot2"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -21,7 +21,8 @@ panic-halt= "0.2.0"
embedded-hal ="0.2.5" embedded-hal ="0.2.5"
[features] [features]
default = ["rt", "boot2"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -25,6 +25,7 @@ nb = "1.0.0"
ws2812-pio = "0.3.0" ws2812-pio = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -24,6 +24,7 @@ nb = "1.0.0"
ws2812-pio = "0.3.0" ws2812-pio = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -25,6 +25,7 @@ embedded-hal ="0.2.5"
nb = "1.0" nb = "1.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -27,6 +27,7 @@ defmt = "0.3.0"
defmt-rtt = "0.3.0" defmt-rtt = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -28,6 +28,7 @@ arrayvec = { version="0.7.1", default-features=false }
nb = "1.0.0" nb = "1.0.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -23,6 +23,7 @@ embedded-hal ="0.2.5"
nb = "1.0" nb = "1.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -28,6 +28,7 @@ defmt = "0.3.0"
defmt-rtt = "0.3.0" defmt-rtt = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -26,6 +26,7 @@ defmt = "0.3.0"
defmt-rtt = "0.3.0" defmt-rtt = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -43,7 +43,8 @@ defmt = "0.3.0"
defmt-rtt = "0.3.0" defmt-rtt = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]
rp2040-e5 = ["rp2040-hal/rp2040-e5"] rp2040-e5 = ["rp2040-hal/rp2040-e5"]

View file

@ -23,6 +23,7 @@ embedded-hal ="0.2.5"
nb = "1.0" nb = "1.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -17,7 +17,8 @@ rp2040-hal = { path = "../../rp2040-hal", version = "0.5.0" }
cortex-m-rt = { version = "0.7", optional = true } cortex-m-rt = { version = "0.7", optional = true }
[features] [features]
default = ["rt", "boot2"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -26,6 +26,7 @@ pio = "0.1.0"
ws2812-pio = "0.3.0" ws2812-pio = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -26,6 +26,7 @@ pio = "0.1.0"
ws2812-pio = "0.3.0" ws2812-pio = "0.3.0"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -37,6 +37,7 @@ pio = "0.2.0"
pio-proc = "0.2.1" pio-proc = "0.2.1"
[features] [features]
default = ["boot2", "rt"] default = ["boot2", "rt", "critical-section-impl"]
critical-section-impl = ["rp2040-hal/critical-section-impl"]
boot2 = ["rp2040-boot2"] boot2 = ["rp2040-boot2"]
rt = ["cortex-m-rt","rp2040-hal/rt"] rt = ["cortex-m-rt","rp2040-hal/rt"]

View file

@ -44,7 +44,6 @@ pio-proc = "0.2.0"
dht-sensor = "0.2.1" dht-sensor = "0.2.1"
[features] [features]
default = ["critical-section-impl"]
rt = ["rp2040-pac/rt"] rt = ["rp2040-pac/rt"]
rom-func-cache = [] rom-func-cache = []
disable-intrinsics = [] disable-intrinsics = []