From 280de7cb99be87f291b7b07c1c52cab8230a1a61 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Wed, 24 Aug 2022 14:30:25 +0000 Subject: [PATCH] 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. --- boards/adafruit-feather-rp2040/Cargo.toml | 3 ++- boards/adafruit-itsy-bitsy-rp2040/Cargo.toml | 3 ++- boards/adafruit-kb2040/Cargo.toml | 3 ++- boards/adafruit-macropad/Cargo.toml | 3 ++- boards/adafruit-qt-py-rp2040/Cargo.toml | 3 ++- boards/adafruit-trinkey-qt2040/Cargo.toml | 3 ++- boards/arduino_nano_connect/Cargo.toml | 3 ++- boards/pimoroni-badger2040/Cargo.toml | 3 ++- boards/pimoroni-pico-explorer/Cargo.toml | 3 ++- boards/pimoroni-pico-lipo-16mb/Cargo.toml | 3 ++- boards/pimoroni-plasma-2040/Cargo.toml | 3 ++- boards/pimoroni-tiny2040/Cargo.toml | 3 ++- boards/rp-pico/Cargo.toml | 3 ++- boards/seeeduino-xiao-rp2040/Cargo.toml | 3 ++- boards/solderparty-rp2040-stamp/Cargo.toml | 3 ++- boards/sparkfun-pro-micro-rp2040/Cargo.toml | 3 ++- boards/sparkfun-thing-plus-rp2040/Cargo.toml | 3 ++- boards/vcc-gnd-yd-rp2040/Cargo.toml | 3 ++- rp2040-hal/Cargo.toml | 1 - 19 files changed, 36 insertions(+), 19 deletions(-) diff --git a/boards/adafruit-feather-rp2040/Cargo.toml b/boards/adafruit-feather-rp2040/Cargo.toml index 873b8d1..5b525b8 100644 --- a/boards/adafruit-feather-rp2040/Cargo.toml +++ b/boards/adafruit-feather-rp2040/Cargo.toml @@ -25,6 +25,7 @@ smart-leds = "0.3.0" ws2812-pio = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml b/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml index cd25de4..6227212 100644 --- a/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml +++ b/boards/adafruit-itsy-bitsy-rp2040/Cargo.toml @@ -25,6 +25,7 @@ nb = "1.0.0" ws2812-pio = "0.3.0" [features] -default = ["rt", "boot2"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/adafruit-kb2040/Cargo.toml b/boards/adafruit-kb2040/Cargo.toml index d85a447..660fd7b 100644 --- a/boards/adafruit-kb2040/Cargo.toml +++ b/boards/adafruit-kb2040/Cargo.toml @@ -18,7 +18,8 @@ embedded-hal = { version = "0.2.4", features = ["unproven"] } rp2040-boot2 = { version = "0.2.0", optional = true } [features] -default = ["rt", "boot2"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/adafruit-macropad/Cargo.toml b/boards/adafruit-macropad/Cargo.toml index c63cfae..c0fe4e4 100644 --- a/boards/adafruit-macropad/Cargo.toml +++ b/boards/adafruit-macropad/Cargo.toml @@ -21,7 +21,8 @@ panic-halt= "0.2.0" embedded-hal ="0.2.5" [features] -default = ["rt", "boot2"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/adafruit-qt-py-rp2040/Cargo.toml b/boards/adafruit-qt-py-rp2040/Cargo.toml index 6f54a25..64bbe89 100644 --- a/boards/adafruit-qt-py-rp2040/Cargo.toml +++ b/boards/adafruit-qt-py-rp2040/Cargo.toml @@ -25,6 +25,7 @@ nb = "1.0.0" ws2812-pio = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/adafruit-trinkey-qt2040/Cargo.toml b/boards/adafruit-trinkey-qt2040/Cargo.toml index 4c1c32e..46f0e1a 100644 --- a/boards/adafruit-trinkey-qt2040/Cargo.toml +++ b/boards/adafruit-trinkey-qt2040/Cargo.toml @@ -24,6 +24,7 @@ nb = "1.0.0" ws2812-pio = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/arduino_nano_connect/Cargo.toml b/boards/arduino_nano_connect/Cargo.toml index 8ecbbc9..065987c 100644 --- a/boards/arduino_nano_connect/Cargo.toml +++ b/boards/arduino_nano_connect/Cargo.toml @@ -25,6 +25,7 @@ embedded-hal ="0.2.5" nb = "1.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/pimoroni-badger2040/Cargo.toml b/boards/pimoroni-badger2040/Cargo.toml index 2cba52b..a4d618a 100644 --- a/boards/pimoroni-badger2040/Cargo.toml +++ b/boards/pimoroni-badger2040/Cargo.toml @@ -27,6 +27,7 @@ defmt = "0.3.0" defmt-rtt = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/pimoroni-pico-explorer/Cargo.toml b/boards/pimoroni-pico-explorer/Cargo.toml index 1f4db6d..db55e24 100644 --- a/boards/pimoroni-pico-explorer/Cargo.toml +++ b/boards/pimoroni-pico-explorer/Cargo.toml @@ -28,6 +28,7 @@ arrayvec = { version="0.7.1", default-features=false } nb = "1.0.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/pimoroni-pico-lipo-16mb/Cargo.toml b/boards/pimoroni-pico-lipo-16mb/Cargo.toml index 2b3de2d..60905b9 100644 --- a/boards/pimoroni-pico-lipo-16mb/Cargo.toml +++ b/boards/pimoroni-pico-lipo-16mb/Cargo.toml @@ -23,6 +23,7 @@ embedded-hal ="0.2.5" nb = "1.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/pimoroni-plasma-2040/Cargo.toml b/boards/pimoroni-plasma-2040/Cargo.toml index 3707816..0421e59 100644 --- a/boards/pimoroni-plasma-2040/Cargo.toml +++ b/boards/pimoroni-plasma-2040/Cargo.toml @@ -28,6 +28,7 @@ defmt = "0.3.0" defmt-rtt = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/pimoroni-tiny2040/Cargo.toml b/boards/pimoroni-tiny2040/Cargo.toml index 5b20f70..f42f35d 100644 --- a/boards/pimoroni-tiny2040/Cargo.toml +++ b/boards/pimoroni-tiny2040/Cargo.toml @@ -26,6 +26,7 @@ defmt = "0.3.0" defmt-rtt = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/rp-pico/Cargo.toml b/boards/rp-pico/Cargo.toml index 782a218..57c5c5f 100644 --- a/boards/rp-pico/Cargo.toml +++ b/boards/rp-pico/Cargo.toml @@ -43,7 +43,8 @@ defmt = "0.3.0" defmt-rtt = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] rp2040-e5 = ["rp2040-hal/rp2040-e5"] diff --git a/boards/seeeduino-xiao-rp2040/Cargo.toml b/boards/seeeduino-xiao-rp2040/Cargo.toml index 256778a..2345437 100644 --- a/boards/seeeduino-xiao-rp2040/Cargo.toml +++ b/boards/seeeduino-xiao-rp2040/Cargo.toml @@ -23,6 +23,7 @@ embedded-hal ="0.2.5" nb = "1.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/solderparty-rp2040-stamp/Cargo.toml b/boards/solderparty-rp2040-stamp/Cargo.toml index f9c44f8..c26ec1f 100644 --- a/boards/solderparty-rp2040-stamp/Cargo.toml +++ b/boards/solderparty-rp2040-stamp/Cargo.toml @@ -17,7 +17,8 @@ rp2040-hal = { path = "../../rp2040-hal", version = "0.5.0" } cortex-m-rt = { version = "0.7", optional = true } [features] -default = ["rt", "boot2"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/sparkfun-pro-micro-rp2040/Cargo.toml b/boards/sparkfun-pro-micro-rp2040/Cargo.toml index 4451199..80620e5 100644 --- a/boards/sparkfun-pro-micro-rp2040/Cargo.toml +++ b/boards/sparkfun-pro-micro-rp2040/Cargo.toml @@ -26,6 +26,7 @@ pio = "0.1.0" ws2812-pio = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/sparkfun-thing-plus-rp2040/Cargo.toml b/boards/sparkfun-thing-plus-rp2040/Cargo.toml index 08022cd..8578090 100644 --- a/boards/sparkfun-thing-plus-rp2040/Cargo.toml +++ b/boards/sparkfun-thing-plus-rp2040/Cargo.toml @@ -26,6 +26,7 @@ pio = "0.1.0" ws2812-pio = "0.3.0" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/boards/vcc-gnd-yd-rp2040/Cargo.toml b/boards/vcc-gnd-yd-rp2040/Cargo.toml index adb91f9..3eedade 100644 --- a/boards/vcc-gnd-yd-rp2040/Cargo.toml +++ b/boards/vcc-gnd-yd-rp2040/Cargo.toml @@ -37,6 +37,7 @@ pio = "0.2.0" pio-proc = "0.2.1" [features] -default = ["boot2", "rt"] +default = ["boot2", "rt", "critical-section-impl"] +critical-section-impl = ["rp2040-hal/critical-section-impl"] boot2 = ["rp2040-boot2"] rt = ["cortex-m-rt","rp2040-hal/rt"] diff --git a/rp2040-hal/Cargo.toml b/rp2040-hal/Cargo.toml index a5ed3e2..9381e9a 100644 --- a/rp2040-hal/Cargo.toml +++ b/rp2040-hal/Cargo.toml @@ -44,7 +44,6 @@ pio-proc = "0.2.0" dht-sensor = "0.2.1" [features] -default = ["critical-section-impl"] rt = ["rp2040-pac/rt"] rom-func-cache = [] disable-intrinsics = []