diff options
| author | kalkyl <[email protected]> | 2022-12-10 12:57:45 +0100 |
|---|---|---|
| committer | kalkyl <[email protected]> | 2022-12-10 12:57:45 +0100 |
| commit | d8821cfd41eb1776b904a5766be43f242af938f7 (patch) | |
| tree | 63c5c9609dfde3ea82dd98db8b8f4ed167ff9fc5 | |
| parent | cc0248d83ad34941480cd71d0255054d5317ab74 (diff) | |
Feature gate critical-section-impl
| -rw-r--r-- | embassy-rp/Cargo.toml | 5 | ||||
| -rw-r--r-- | embassy-rp/src/lib.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/multicore.rs | 4 | ||||
| -rw-r--r-- | examples/rp/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/rp/Cargo.toml | 2 |
5 files changed, 11 insertions, 4 deletions
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index 07cd1bc1b..694f0dc7b 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml | |||
| @@ -15,6 +15,9 @@ flavors = [ | |||
| 15 | [features] | 15 | [features] |
| 16 | defmt = ["dep:defmt", "embassy-usb-driver?/defmt", "embassy-hal-common/defmt"] | 16 | defmt = ["dep:defmt", "embassy-usb-driver?/defmt", "embassy-hal-common/defmt"] |
| 17 | 17 | ||
| 18 | # critical section that is safe for multicore use | ||
| 19 | critical-section-impl = ["critical-section/restore-state-u8"] | ||
| 20 | |||
| 18 | # Reexport the PAC for the currently enabled chip at `embassy_rp::pac`. | 21 | # Reexport the PAC for the currently enabled chip at `embassy_rp::pac`. |
| 19 | # This is unstable because semver-minor (non-breaking) releases of embassy-rp may major-bump (breaking) the PAC version. | 22 | # This is unstable because semver-minor (non-breaking) releases of embassy-rp may major-bump (breaking) the PAC version. |
| 20 | # If this is an issue for you, you're encouraged to directly depend on a fixed version of the PAC. | 23 | # If this is an issue for you, you're encouraged to directly depend on a fixed version of the PAC. |
| @@ -50,7 +53,7 @@ nb = "1.0.0" | |||
| 50 | cfg-if = "1.0.0" | 53 | cfg-if = "1.0.0" |
| 51 | cortex-m-rt = ">=0.6.15,<0.8" | 54 | cortex-m-rt = ">=0.6.15,<0.8" |
| 52 | cortex-m = "0.7.6" | 55 | cortex-m = "0.7.6" |
| 53 | critical-section = { version = "1.1", features = ["restore-state-u8"] } | 56 | critical-section = "1.1" |
| 54 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 57 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
| 55 | chrono = { version = "0.4", default-features = false, optional = true } | 58 | chrono = { version = "0.4", default-features = false, optional = true } |
| 56 | embedded-io = { version = "0.4.0", features = ["async"], optional = true } | 59 | embedded-io = { version = "0.4.0", features = ["async"], optional = true } |
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs index 9a2fb7fc3..2cd99f456 100644 --- a/embassy-rp/src/lib.rs +++ b/embassy-rp/src/lib.rs | |||
| @@ -5,7 +5,9 @@ | |||
| 5 | // This mod MUST go first, so that the others see its macros. | 5 | // This mod MUST go first, so that the others see its macros. |
| 6 | pub(crate) mod fmt; | 6 | pub(crate) mod fmt; |
| 7 | 7 | ||
| 8 | #[cfg(feature = "critical-section-impl")] | ||
| 8 | mod critical_section_impl; | 9 | mod critical_section_impl; |
| 10 | |||
| 9 | mod intrinsics; | 11 | mod intrinsics; |
| 10 | 12 | ||
| 11 | pub mod adc; | 13 | pub mod adc; |
diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs index dd3b70a67..cc5c192b1 100644 --- a/embassy-rp/src/multicore.rs +++ b/embassy-rp/src/multicore.rs | |||
| @@ -4,6 +4,9 @@ | |||
| 4 | //! It provides functionality for setting up the stack, and starting core1. | 4 | //! It provides functionality for setting up the stack, and starting core1. |
| 5 | //! | 5 | //! |
| 6 | //! The entrypoint for core1 can be any function that never returns, including closures. | 6 | //! The entrypoint for core1 can be any function that never returns, including closures. |
| 7 | //! | ||
| 8 | //! Enable the `critical-section-impl` feature in embassy-rp when sharing data across cores using | ||
| 9 | //! the `embassy-sync` primitives and `CriticalSectionRawMutex`. | ||
| 7 | 10 | ||
| 8 | use core::mem::ManuallyDrop; | 11 | use core::mem::ManuallyDrop; |
| 9 | use core::sync::atomic::{compiler_fence, Ordering}; | 12 | use core::sync::atomic::{compiler_fence, Ordering}; |
| @@ -57,7 +60,6 @@ fn install_stack_guard(stack_bottom: *mut usize) { | |||
| 57 | #[inline(always)] | 60 | #[inline(always)] |
| 58 | fn core1_setup(stack_bottom: *mut usize) { | 61 | fn core1_setup(stack_bottom: *mut usize) { |
| 59 | install_stack_guard(stack_bottom); | 62 | install_stack_guard(stack_bottom); |
| 60 | // TODO: irq priorities | ||
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | /// Multicore execution management. | 65 | /// Multicore execution management. |
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index bd624a329..34a2d36d8 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" | |||
| 9 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } | 9 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } |
| 10 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } | 10 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } |
| 11 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 11 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 12 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver"] } | 12 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] } |
| 13 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 13 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 14 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } | 14 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } |
| 15 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 15 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index ffde4c7fe..572a9ce88 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } | 8 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } |
| 9 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } | 9 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } |
| 10 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt"] } | 10 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt"] } |
| 11 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["nightly", "defmt", "unstable-pac", "unstable-traits", "time-driver"] } | 11 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["nightly", "defmt", "unstable-pac", "unstable-traits", "time-driver", "critical-section-impl"] } |
| 12 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 12 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 13 | 13 | ||
| 14 | defmt = "0.3.0" | 14 | defmt = "0.3.0" |
