aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-05-29 20:07:28 +0000
committerGitHub <[email protected]>2023-05-29 20:07:28 +0000
commitf8a835be2788aab1c32c4171d584f1182b4c3ace (patch)
tree749f504d7df34d6c3152c53e21a8550bd063746e
parent3b38079490b0c283899cab42308c4feab4c47fdc (diff)
parent1a31b03976d73496f649165d9f92c4e19bef93fc (diff)
Merge pull request #1506 from embassy-rs/ci-fixes
ci: fix nrf, rp tests.
-rwxr-xr-x.github/ci/test.sh4
-rw-r--r--embassy-boot/nrf/Cargo.toml2
-rw-r--r--embassy-nrf/Cargo.toml33
-rw-r--r--embassy-nrf/README.md2
-rw-r--r--embassy-nrf/src/qdec.rs13
-rw-r--r--embassy-nrf/src/temp.rs13
-rw-r--r--embassy-rp/Cargo.toml8
-rw-r--r--embassy-rp/src/flash.rs1
-rw-r--r--embassy-rp/src/intrinsics.rs19
-rw-r--r--embassy-rp/src/multicore.rs25
-rw-r--r--embassy-rp/src/rtc/mod.rs2
-rw-r--r--examples/boot/bootloader/nrf/Cargo.toml4
-rw-r--r--examples/boot/bootloader/rp/Cargo.toml4
-rw-r--r--examples/boot/bootloader/stm32/Cargo.toml4
14 files changed, 98 insertions, 36 deletions
diff --git a/.github/ci/test.sh b/.github/ci/test.sh
index a7140cfd9..d014e4bd7 100755
--- a/.github/ci/test.sh
+++ b/.github/ci/test.sh
@@ -21,7 +21,9 @@ cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly
21cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly,ed25519-dalek 21cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly,ed25519-dalek
22cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly,ed25519-salty 22cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly,ed25519-salty
23 23
24#cargo test --manifest-path ./embassy-nrf/Cargo.toml --no-default-features --features nightly,nrf52840,time-driver-rtc1 ## broken doctests 24cargo test --manifest-path ./embassy-nrf/Cargo.toml --no-default-features --features nightly,nrf52840,time-driver-rtc1,gpiote
25
26cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features nightly,time-driver
25 27
26cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f429vg,exti,time-driver-any,exti 28cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f429vg,exti,time-driver-any,exti
27cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f732ze,exti,time-driver-any,exti 29cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f732ze,exti,time-driver-any,exti
diff --git a/embassy-boot/nrf/Cargo.toml b/embassy-boot/nrf/Cargo.toml
index e46736889..8186a9958 100644
--- a/embassy-boot/nrf/Cargo.toml
+++ b/embassy-boot/nrf/Cargo.toml
@@ -17,7 +17,7 @@ target = "thumbv7em-none-eabi"
17defmt = { version = "0.3", optional = true } 17defmt = { version = "0.3", optional = true }
18 18
19embassy-sync = { path = "../../embassy-sync" } 19embassy-sync = { path = "../../embassy-sync" }
20embassy-nrf = { path = "../../embassy-nrf", default-features = false } 20embassy-nrf = { path = "../../embassy-nrf" }
21embassy-boot = { path = "../boot", default-features = false } 21embassy-boot = { path = "../boot", default-features = false }
22cortex-m = { version = "0.7.6" } 22cortex-m = { version = "0.7.6" }
23cortex-m-rt = { version = "0.7" } 23cortex-m-rt = { version = "0.7" }
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml
index 15d0f6872..83900d4d0 100644
--- a/embassy-nrf/Cargo.toml
+++ b/embassy-nrf/Cargo.toml
@@ -16,6 +16,18 @@ flavors = [
16] 16]
17 17
18[features] 18[features]
19default = [
20 "nrf52805-pac?/rt",
21 "nrf52810-pac?/rt",
22 "nrf52811-pac?/rt",
23 "nrf52820-pac?/rt",
24 "nrf52832-pac?/rt",
25 "nrf52833-pac?/rt",
26 "nrf52840-pac?/rt",
27 "nrf5340-app-pac?/rt",
28 "nrf5340-net-pac?/rt",
29 "nrf9160-pac?/rt",
30]
19 31
20time = ["dep:embassy-time"] 32time = ["dep:embassy-time"]
21 33
@@ -103,13 +115,14 @@ embedded-storage = "0.3.0"
103embedded-storage-async = { version = "0.4.0", optional = true } 115embedded-storage-async = { version = "0.4.0", optional = true }
104cfg-if = "1.0.0" 116cfg-if = "1.0.0"
105 117
106nrf52805-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 118nrf52805-pac = { version = "0.12.0", optional = true }
107nrf52810-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 119nrf52810-pac = { version = "0.12.0", optional = true }
108nrf52811-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 120nrf52811-pac = { version = "0.12.0", optional = true }
109nrf52820-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 121nrf52820-pac = { version = "0.12.0", optional = true }
110nrf52832-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 122nrf52832-pac = { version = "0.12.0", optional = true }
111nrf52833-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 123nrf52833-pac = { version = "0.12.0", optional = true }
112nrf52840-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 124nrf52840-pac = { version = "0.12.0", optional = true }
113nrf5340-app-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 125nrf5340-app-pac = { version = "0.12.0", optional = true }
114nrf5340-net-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 126nrf5340-net-pac = { version = "0.12.0", optional = true }
115nrf9160-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 127nrf9160-pac = { version = "0.12.0", optional = true }
128
diff --git a/embassy-nrf/README.md b/embassy-nrf/README.md
index a31cfae68..129ec0c01 100644
--- a/embassy-nrf/README.md
+++ b/embassy-nrf/README.md
@@ -13,7 +13,7 @@ with peripherals. It takes care of sending/receiving data over a variety of bus
13However, EasyDMA requires the buffers used to transmit and receive data to reside in RAM. Unfortunately, Rust 13However, EasyDMA requires the buffers used to transmit and receive data to reside in RAM. Unfortunately, Rust
14slices will not always do so. The following example using the SPI peripheral shows a common situation where this might happen: 14slices will not always do so. The following example using the SPI peripheral shows a common situation where this might happen:
15 15
16```no_run 16```rust,ignore
17// As we pass a slice to the function whose contents will not ever change, 17// As we pass a slice to the function whose contents will not ever change,
18// the compiler writes it into the flash and thus the pointer to it will 18// the compiler writes it into the flash and thus the pointer to it will
19// reference static memory. Since EasyDMA requires slices to reside in RAM, 19// reference static memory. Since EasyDMA requires slices to reside in RAM,
diff --git a/embassy-nrf/src/qdec.rs b/embassy-nrf/src/qdec.rs
index 4d2a09198..c845492fc 100644
--- a/embassy-nrf/src/qdec.rs
+++ b/embassy-nrf/src/qdec.rs
@@ -154,10 +154,19 @@ impl<'d, T: Instance> Qdec<'d, T> {
154 /// # Example 154 /// # Example
155 /// 155 ///
156 /// ```no_run 156 /// ```no_run
157 /// let irq = interrupt::take!(QDEC); 157 /// use embassy_nrf::qdec::{self, Qdec};
158 /// use embassy_nrf::{bind_interrupts, peripherals};
159 ///
160 /// bind_interrupts!(struct Irqs {
161 /// QDEC => qdec::InterruptHandler<peripherals::QDEC>;
162 /// });
163 ///
164 /// # async {
165 /// # let p: embassy_nrf::Peripherals = todo!();
158 /// let config = qdec::Config::default(); 166 /// let config = qdec::Config::default();
159 /// let mut q = Qdec::new(p.QDEC, p.P0_31, p.P0_30, config); 167 /// let mut q = Qdec::new(p.QDEC, Irqs, p.P0_31, p.P0_30, config);
160 /// let delta = q.read().await; 168 /// let delta = q.read().await;
169 /// # };
161 /// ``` 170 /// ```
162 pub async fn read(&mut self) -> i16 { 171 pub async fn read(&mut self) -> i16 {
163 let t = T::regs(); 172 let t = T::regs();
diff --git a/embassy-nrf/src/temp.rs b/embassy-nrf/src/temp.rs
index 3a75ec629..0653710af 100644
--- a/embassy-nrf/src/temp.rs
+++ b/embassy-nrf/src/temp.rs
@@ -56,8 +56,19 @@ impl<'d> Temp<'d> {
56 /// # Example 56 /// # Example
57 /// 57 ///
58 /// ```no_run 58 /// ```no_run
59 /// let mut t = Temp::new(p.TEMP, interrupt::take!(TEMP)); 59 /// use embassy_nrf::{bind_interrupts, temp};
60 /// use embassy_nrf::temp::Temp;
61 /// use embassy_time::{Duration, Timer};
62 ///
63 /// bind_interrupts!(struct Irqs {
64 /// TEMP => temp::InterruptHandler;
65 /// });
66 ///
67 /// # async {
68 /// # let p: embassy_nrf::Peripherals = todo!();
69 /// let mut t = Temp::new(p.TEMP, Irqs);
60 /// let v: u16 = t.read().await.to_num::<u16>(); 70 /// let v: u16 = t.read().await.to_num::<u16>();
71 /// # };
61 /// ``` 72 /// ```
62 pub async fn read(&mut self) -> I30F2 { 73 pub async fn read(&mut self) -> I30F2 {
63 // In case the future is dropped, stop the task and reset events. 74 // In case the future is dropped, stop the task and reset events.
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml
index e395a994f..e032dfdae 100644
--- a/embassy-rp/Cargo.toml
+++ b/embassy-rp/Cargo.toml
@@ -13,6 +13,8 @@ flavors = [
13] 13]
14 14
15[features] 15[features]
16default = [ "rp-pac/rt" ]
17
16defmt = ["dep:defmt", "embassy-usb-driver?/defmt", "embassy-hal-common/defmt"] 18defmt = ["dep:defmt", "embassy-usb-driver?/defmt", "embassy-hal-common/defmt"]
17 19
18# critical section that is safe for multicore use 20# critical section that is safe for multicore use
@@ -70,7 +72,7 @@ embedded-storage = { version = "0.3" }
70rand_core = "0.6.4" 72rand_core = "0.6.4"
71fixed = "1.23.1" 73fixed = "1.23.1"
72 74
73rp-pac = { version = "4", features = ["rt"] } 75rp-pac = { version = "4" }
74 76
75embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 77embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
76embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10", optional = true} 78embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10", optional = true}
@@ -81,3 +83,7 @@ paste = "1.0"
81pio-proc = {version= "0.2" } 83pio-proc = {version= "0.2" }
82pio = {version= "0.2.1" } 84pio = {version= "0.2.1" }
83rp2040-boot2 = "0.3" 85rp2040-boot2 = "0.3"
86
87[dev-dependencies]
88embassy-executor = { version = "0.2.0", path = "../embassy-executor", features = ["arch-std", "executor-thread"] }
89static_cell = "1.0"
diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs
index 929bd028c..0410429e0 100644
--- a/embassy-rp/src/flash.rs
+++ b/embassy-rp/src/flash.rs
@@ -575,6 +575,7 @@ mod ram_helpers {
575 #[inline(never)] 575 #[inline(never)]
576 #[link_section = ".data.ram_func"] 576 #[link_section = ".data.ram_func"]
577 unsafe fn read_flash_inner(cmd: FlashCommand, ptrs: *const FlashFunctionPointers) { 577 unsafe fn read_flash_inner(cmd: FlashCommand, ptrs: *const FlashFunctionPointers) {
578 #[cfg(target_arch = "arm")]
578 core::arch::asm!( 579 core::arch::asm!(
579 "mov r10, r0", // cmd 580 "mov r10, r0", // cmd
580 "mov r5, r1", // ptrs 581 "mov r5, r1", // ptrs
diff --git a/embassy-rp/src/intrinsics.rs b/embassy-rp/src/intrinsics.rs
index 3baabb287..5b9c127ba 100644
--- a/embassy-rp/src/intrinsics.rs
+++ b/embassy-rp/src/intrinsics.rs
@@ -61,16 +61,17 @@ macro_rules! intrinsics_aliases {
61/// Like the compiler-builtins macro, it accepts a series of functions that 61/// Like the compiler-builtins macro, it accepts a series of functions that
62/// looks like normal Rust code: 62/// looks like normal Rust code:
63/// 63///
64/// intrinsics! { 64/// ```rust,ignore
65/// extern "C" fn foo(a: i32) -> u32 { 65/// intrinsics! {
66/// // ... 66/// extern "C" fn foo(a: i32) -> u32 {
67/// } 67/// // ...
68/// 68/// }
69/// #[nonstandard_attribute] 69/// #[nonstandard_attribute]
70/// extern "C" fn bar(a: i32) -> u32 { 70/// extern "C" fn bar(a: i32) -> u32 {
71/// // ... 71/// // ...
72/// }
73/// } 72/// }
73/// }
74/// ```
74/// 75///
75/// Each function can also be decorated with nonstandard attributes to control 76/// Each function can also be decorated with nonstandard attributes to control
76/// additional behaviour: 77/// additional behaviour:
diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs
index bbc775105..a13209f74 100644
--- a/embassy-rp/src/multicore.rs
+++ b/embassy-rp/src/multicore.rs
@@ -9,22 +9,41 @@
9//! the `embassy-sync` primitives and `CriticalSectionRawMutex`. 9//! the `embassy-sync` primitives and `CriticalSectionRawMutex`.
10//! 10//!
11//! # Usage 11//! # Usage
12//!
12//! ```no_run 13//! ```no_run
14//! # #![feature(type_alias_impl_trait)]
15//! use embassy_rp::multicore::Stack;
16//! use static_cell::StaticCell;
17//! use embassy_executor::Executor;
18//!
13//! static mut CORE1_STACK: Stack<4096> = Stack::new(); 19//! static mut CORE1_STACK: Stack<4096> = Stack::new();
14//! static EXECUTOR0: StaticCell<Executor> = StaticCell::new(); 20//! static EXECUTOR0: StaticCell<Executor> = StaticCell::new();
15//! static EXECUTOR1: StaticCell<Executor> = StaticCell::new(); 21//! static EXECUTOR1: StaticCell<Executor> = StaticCell::new();
16//! 22//!
23//! # // workaround weird error: `main` function not found in crate `rust_out`
24//! # let _ = ();
25//!
26//! #[embassy_executor::task]
27//! async fn core0_task() {
28//! // ...
29//! }
30//!
31//! #[embassy_executor::task]
32//! async fn core1_task() {
33//! // ...
34//! }
35//!
17//! #[cortex_m_rt::entry] 36//! #[cortex_m_rt::entry]
18//! fn main() -> ! { 37//! fn main() -> ! {
19//! let p = embassy_rp::init(Default::default()); 38//! let p = embassy_rp::init(Default::default());
20//! 39//!
21//! spawn_core1(p.CORE1, unsafe { &mut CORE1_STACK }, move || { 40//! embassy_rp::multicore::spawn_core1(p.CORE1, unsafe { &mut CORE1_STACK }, move || {
22//! let executor1 = EXECUTOR1.init(Executor::new()); 41//! let executor1 = EXECUTOR1.init(Executor::new());
23//! executor1.run(|spawner| unwrap!(spawner.spawn(core1_task()))); 42//! executor1.run(|spawner| spawner.spawn(core1_task()).unwrap());
24//! }); 43//! });
25//! 44//!
26//! let executor0 = EXECUTOR0.init(Executor::new()); 45//! let executor0 = EXECUTOR0.init(Executor::new());
27//! executor0.run(|spawner| unwrap!(spawner.spawn(core0_task()))); 46//! executor0.run(|spawner| spawner.spawn(core0_task()).unwrap())
28//! } 47//! }
29//! ``` 48//! ```
30 49
diff --git a/embassy-rp/src/rtc/mod.rs b/embassy-rp/src/rtc/mod.rs
index c213ad174..e1d886d4a 100644
--- a/embassy-rp/src/rtc/mod.rs
+++ b/embassy-rp/src/rtc/mod.rs
@@ -121,7 +121,7 @@ impl<'d, T: Instance> RealTimeClock<'d, T> {
121 /// # #[cfg(not(feature = "chrono"))] 121 /// # #[cfg(not(feature = "chrono"))]
122 /// # fn main() { 122 /// # fn main() {
123 /// # use embassy_rp::rtc::{RealTimeClock, DateTimeFilter}; 123 /// # use embassy_rp::rtc::{RealTimeClock, DateTimeFilter};
124 /// # let mut real_time_clock: RealTimeClock = unsafe { core::mem::zeroed() }; 124 /// # let mut real_time_clock: RealTimeClock<embassy_rp::peripherals::RTC> = unsafe { core::mem::zeroed() };
125 /// let now = real_time_clock.now().unwrap(); 125 /// let now = real_time_clock.now().unwrap();
126 /// real_time_clock.schedule_alarm( 126 /// real_time_clock.schedule_alarm(
127 /// DateTimeFilter::default() 127 /// DateTimeFilter::default()
diff --git a/examples/boot/bootloader/nrf/Cargo.toml b/examples/boot/bootloader/nrf/Cargo.toml
index cd0be5b48..8c2fb4c5f 100644
--- a/examples/boot/bootloader/nrf/Cargo.toml
+++ b/examples/boot/bootloader/nrf/Cargo.toml
@@ -9,8 +9,8 @@ license = "MIT OR Apache-2.0"
9defmt = { version = "0.3", optional = true } 9defmt = { version = "0.3", optional = true }
10defmt-rtt = { version = "0.4", optional = true } 10defmt-rtt = { version = "0.4", optional = true }
11 11
12embassy-nrf = { path = "../../../../embassy-nrf", default-features = false, features = ["nightly"] } 12embassy-nrf = { path = "../../../../embassy-nrf", features = ["nightly"] }
13embassy-boot-nrf = { path = "../../../../embassy-boot/nrf", default-features = false } 13embassy-boot-nrf = { path = "../../../../embassy-boot/nrf" }
14cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 14cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
15cortex-m-rt = { version = "0.7" } 15cortex-m-rt = { version = "0.7" }
16cfg-if = "1.0.0" 16cfg-if = "1.0.0"
diff --git a/examples/boot/bootloader/rp/Cargo.toml b/examples/boot/bootloader/rp/Cargo.toml
index b4167bcd8..bf9226993 100644
--- a/examples/boot/bootloader/rp/Cargo.toml
+++ b/examples/boot/bootloader/rp/Cargo.toml
@@ -9,8 +9,8 @@ license = "MIT OR Apache-2.0"
9defmt = { version = "0.3", optional = true } 9defmt = { version = "0.3", optional = true }
10defmt-rtt = { version = "0.4", optional = true } 10defmt-rtt = { version = "0.4", optional = true }
11 11
12embassy-rp = { path = "../../../../embassy-rp", default-features = false, features = ["nightly"] } 12embassy-rp = { path = "../../../../embassy-rp", features = ["nightly"] }
13embassy-boot-rp = { path = "../../../../embassy-boot/rp", default-features = false } 13embassy-boot-rp = { path = "../../../../embassy-boot/rp" }
14embassy-time = { path = "../../../../embassy-time", features = ["nightly"] } 14embassy-time = { path = "../../../../embassy-time", features = ["nightly"] }
15 15
16cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 16cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
diff --git a/examples/boot/bootloader/stm32/Cargo.toml b/examples/boot/bootloader/stm32/Cargo.toml
index f2675aa73..fbc80b34c 100644
--- a/examples/boot/bootloader/stm32/Cargo.toml
+++ b/examples/boot/bootloader/stm32/Cargo.toml
@@ -9,8 +9,8 @@ license = "MIT OR Apache-2.0"
9defmt = { version = "0.3", optional = true } 9defmt = { version = "0.3", optional = true }
10defmt-rtt = { version = "0.4", optional = true } 10defmt-rtt = { version = "0.4", optional = true }
11 11
12embassy-stm32 = { path = "../../../../embassy-stm32", default-features = false, features = ["nightly"] } 12embassy-stm32 = { path = "../../../../embassy-stm32", features = ["nightly"] }
13embassy-boot-stm32 = { path = "../../../../embassy-boot/stm32", default-features = false } 13embassy-boot-stm32 = { path = "../../../../embassy-boot/stm32" }
14cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 14cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
15cortex-m-rt = { version = "0.7" } 15cortex-m-rt = { version = "0.7" }
16embedded-storage = "0.3.0" 16embedded-storage = "0.3.0"