aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkalkyl <[email protected]>2022-12-10 12:57:45 +0100
committerkalkyl <[email protected]>2022-12-10 12:57:45 +0100
commitd8821cfd41eb1776b904a5766be43f242af938f7 (patch)
tree63c5c9609dfde3ea82dd98db8b8f4ed167ff9fc5
parentcc0248d83ad34941480cd71d0255054d5317ab74 (diff)
Feature gate critical-section-impl
-rw-r--r--embassy-rp/Cargo.toml5
-rw-r--r--embassy-rp/src/lib.rs2
-rw-r--r--embassy-rp/src/multicore.rs4
-rw-r--r--examples/rp/Cargo.toml2
-rw-r--r--tests/rp/Cargo.toml2
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]
16defmt = ["dep:defmt", "embassy-usb-driver?/defmt", "embassy-hal-common/defmt"] 16defmt = ["dep:defmt", "embassy-usb-driver?/defmt", "embassy-hal-common/defmt"]
17 17
18# critical section that is safe for multicore use
19critical-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"
50cfg-if = "1.0.0" 53cfg-if = "1.0.0"
51cortex-m-rt = ">=0.6.15,<0.8" 54cortex-m-rt = ">=0.6.15,<0.8"
52cortex-m = "0.7.6" 55cortex-m = "0.7.6"
53critical-section = { version = "1.1", features = ["restore-state-u8"] } 56critical-section = "1.1"
54futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 57futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
55chrono = { version = "0.4", default-features = false, optional = true } 58chrono = { version = "0.4", default-features = false, optional = true }
56embedded-io = { version = "0.4.0", features = ["async"], optional = true } 59embedded-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.
6pub(crate) mod fmt; 6pub(crate) mod fmt;
7 7
8#[cfg(feature = "critical-section-impl")]
8mod critical_section_impl; 9mod critical_section_impl;
10
9mod intrinsics; 11mod intrinsics;
10 12
11pub mod adc; 13pub 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
8use core::mem::ManuallyDrop; 11use core::mem::ManuallyDrop;
9use core::sync::atomic::{compiler_fence, Ordering}; 12use core::sync::atomic::{compiler_fence, Ordering};
@@ -57,7 +60,6 @@ fn install_stack_guard(stack_bottom: *mut usize) {
57#[inline(always)] 60#[inline(always)]
58fn core1_setup(stack_bottom: *mut usize) { 61fn 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"
9embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 9embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
10embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } 10embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] }
11embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } 11embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
12embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver"] } 12embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] }
13embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } 13embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
14embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } 14embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
15embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 15embassy-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"
8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
9embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } 9embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] }
10embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt"] } 10embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt"] }
11embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["nightly", "defmt", "unstable-pac", "unstable-traits", "time-driver"] } 11embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["nightly", "defmt", "unstable-pac", "unstable-traits", "time-driver", "critical-section-impl"] }
12embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 12embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
13 13
14defmt = "0.3.0" 14defmt = "0.3.0"