diff options
| -rwxr-xr-x | .github/ci/build-stable.sh | 16 | ||||
| -rwxr-xr-x | .github/ci/build.sh (renamed from .github/ci/rust.sh) | 2 | ||||
| -rwxr-xr-x | .github/ci/test.sh | 28 | ||||
| -rwxr-xr-x | ci_stable.sh | 3 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/blocking/i2c.rs | 5 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/blocking/spi.rs | 5 | ||||
| -rw-r--r-- | embassy-hal-common/src/atomic_ring_buffer.rs | 2 | ||||
| -rw-r--r-- | embassy-nrf/src/time_driver.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/flash/common.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/pwm/complementary_pwm.rs | 14 | ||||
| -rw-r--r-- | embassy-time/Cargo.toml | 2 | ||||
| -rw-r--r-- | embassy-time/src/driver.rs | 2 | ||||
| -rw-r--r-- | embassy-time/src/queue_generic.rs | 15 | ||||
| -rw-r--r-- | embassy-time/src/timer.rs | 1 |
14 files changed, 68 insertions, 31 deletions
diff --git a/.github/ci/build-stable.sh b/.github/ci/build-stable.sh new file mode 100755 index 000000000..0dadd6102 --- /dev/null +++ b/.github/ci/build-stable.sh | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | ## on push branch~=gh-readonly-queue/main/.* | ||
| 3 | ## on pull_request | ||
| 4 | |||
| 5 | set -euo pipefail | ||
| 6 | |||
| 7 | export RUSTUP_HOME=/ci/cache/rustup | ||
| 8 | export CARGO_HOME=/ci/cache/cargo | ||
| 9 | export CARGO_TARGET_DIR=/ci/cache/target | ||
| 10 | |||
| 11 | hashtime restore /ci/cache/filetime.json || true | ||
| 12 | hashtime save /ci/cache/filetime.json | ||
| 13 | |||
| 14 | sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml | ||
| 15 | |||
| 16 | ./ci_stable.sh | ||
diff --git a/.github/ci/rust.sh b/.github/ci/build.sh index db1fc8538..1c3a7f3b0 100755 --- a/.github/ci/rust.sh +++ b/.github/ci/build.sh | |||
| @@ -4,8 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | set -euo pipefail | 5 | set -euo pipefail |
| 6 | 6 | ||
| 7 | echo Hello World! | ||
| 8 | |||
| 9 | export RUSTUP_HOME=/ci/cache/rustup | 7 | export RUSTUP_HOME=/ci/cache/rustup |
| 10 | export CARGO_HOME=/ci/cache/cargo | 8 | export CARGO_HOME=/ci/cache/cargo |
| 11 | export CARGO_TARGET_DIR=/ci/cache/target | 9 | export CARGO_TARGET_DIR=/ci/cache/target |
diff --git a/.github/ci/test.sh b/.github/ci/test.sh new file mode 100755 index 000000000..a7140cfd9 --- /dev/null +++ b/.github/ci/test.sh | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | ## on push branch~=gh-readonly-queue/main/.* | ||
| 3 | ## on pull_request | ||
| 4 | |||
| 5 | set -euo pipefail | ||
| 6 | |||
| 7 | export RUSTUP_HOME=/ci/cache/rustup | ||
| 8 | export CARGO_HOME=/ci/cache/cargo | ||
| 9 | export CARGO_TARGET_DIR=/ci/cache/target | ||
| 10 | |||
| 11 | hashtime restore /ci/cache/filetime.json || true | ||
| 12 | hashtime save /ci/cache/filetime.json | ||
| 13 | |||
| 14 | cargo test --manifest-path ./embassy-sync/Cargo.toml | ||
| 15 | cargo test --manifest-path ./embassy-embedded-hal/Cargo.toml | ||
| 16 | cargo test --manifest-path ./embassy-hal-common/Cargo.toml | ||
| 17 | cargo test --manifest-path ./embassy-time/Cargo.toml --features generic-queue | ||
| 18 | |||
| 19 | cargo test --manifest-path ./embassy-boot/boot/Cargo.toml | ||
| 20 | cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly | ||
| 21 | cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly,ed25519-dalek | ||
| 22 | cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly,ed25519-salty | ||
| 23 | |||
| 24 | #cargo test --manifest-path ./embassy-nrf/Cargo.toml --no-default-features --features nightly,nrf52840,time-driver-rtc1 ## broken doctests | ||
| 25 | |||
| 26 | cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f429vg,exti,time-driver-any,exti | ||
| 27 | cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f732ze,exti,time-driver-any,exti | ||
| 28 | cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f769ni,exti,time-driver-any,exti | ||
diff --git a/ci_stable.sh b/ci_stable.sh index 55a2f89a0..a67087ffb 100755 --- a/ci_stable.sh +++ b/ci_stable.sh | |||
| @@ -2,12 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | set -euo pipefail | 3 | set -euo pipefail |
| 4 | 4 | ||
| 5 | export CARGO_TARGET_DIR=$PWD/target_ci_stable | ||
| 6 | export RUSTFLAGS=-Dwarnings | 5 | export RUSTFLAGS=-Dwarnings |
| 7 | export DEFMT_LOG=trace | 6 | export DEFMT_LOG=trace |
| 8 | 7 | ||
| 9 | sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml | ||
| 10 | |||
| 11 | cargo batch \ | 8 | cargo batch \ |
| 12 | --- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ | 9 | --- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \ |
| 13 | --- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \ | 10 | --- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \ |
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs index 1fe520e6c..af73df059 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs | |||
| @@ -2,13 +2,12 @@ | |||
| 2 | //! | 2 | //! |
| 3 | //! # Example (nrf52) | 3 | //! # Example (nrf52) |
| 4 | //! | 4 | //! |
| 5 | //! ```rust | 5 | //! ```rust,ignore |
| 6 | //! use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice; | 6 | //! use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice; |
| 7 | //! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; | 7 | //! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; |
| 8 | //! | 8 | //! |
| 9 | //! static I2C_BUS: StaticCell<NoopMutex<RefCell<Twim<TWISPI0>>>> = StaticCell::new(); | 9 | //! static I2C_BUS: StaticCell<NoopMutex<RefCell<Twim<TWISPI0>>>> = StaticCell::new(); |
| 10 | //! let irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); | 10 | //! let i2c = Twim::new(p.TWISPI0, Irqs, p.P0_03, p.P0_04, Config::default()); |
| 11 | //! let i2c = Twim::new(p.TWISPI0, irq, p.P0_03, p.P0_04, Config::default()); | ||
| 12 | //! let i2c_bus = NoopMutex::new(RefCell::new(i2c)); | 11 | //! let i2c_bus = NoopMutex::new(RefCell::new(i2c)); |
| 13 | //! let i2c_bus = I2C_BUS.init(i2c_bus); | 12 | //! let i2c_bus = I2C_BUS.init(i2c_bus); |
| 14 | //! | 13 | //! |
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs index 7982ffb6e..22e013be9 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs | |||
| @@ -2,13 +2,12 @@ | |||
| 2 | //! | 2 | //! |
| 3 | //! # Example (nrf52) | 3 | //! # Example (nrf52) |
| 4 | //! | 4 | //! |
| 5 | //! ```rust | 5 | //! ```rust,ignore |
| 6 | //! use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice; | 6 | //! use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice; |
| 7 | //! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; | 7 | //! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex}; |
| 8 | //! | 8 | //! |
| 9 | //! static SPI_BUS: StaticCell<NoopMutex<RefCell<Spim<SPI3>>>> = StaticCell::new(); | 9 | //! static SPI_BUS: StaticCell<NoopMutex<RefCell<Spim<SPI3>>>> = StaticCell::new(); |
| 10 | //! let irq = interrupt::take!(SPIM3); | 10 | //! let spi = Spim::new_txonly(p.SPI3, Irqs, p.P0_15, p.P0_18, Config::default()); |
| 11 | //! let spi = Spim::new_txonly(p.SPI3, irq, p.P0_15, p.P0_18, Config::default()); | ||
| 12 | //! let spi_bus = NoopMutex::new(RefCell::new(spi)); | 11 | //! let spi_bus = NoopMutex::new(RefCell::new(spi)); |
| 13 | //! let spi_bus = SPI_BUS.init(spi_bus); | 12 | //! let spi_bus = SPI_BUS.init(spi_bus); |
| 14 | //! | 13 | //! |
diff --git a/embassy-hal-common/src/atomic_ring_buffer.rs b/embassy-hal-common/src/atomic_ring_buffer.rs index 0eb39cb33..ea84925c4 100644 --- a/embassy-hal-common/src/atomic_ring_buffer.rs +++ b/embassy-hal-common/src/atomic_ring_buffer.rs | |||
| @@ -458,8 +458,6 @@ mod tests { | |||
| 458 | 458 | ||
| 459 | #[test] | 459 | #[test] |
| 460 | fn push_slices() { | 460 | fn push_slices() { |
| 461 | init(); | ||
| 462 | |||
| 463 | let mut b = [0; 4]; | 461 | let mut b = [0; 4]; |
| 464 | let rb = RingBuffer::new(); | 462 | let rb = RingBuffer::new(); |
| 465 | unsafe { | 463 | unsafe { |
diff --git a/embassy-nrf/src/time_driver.rs b/embassy-nrf/src/time_driver.rs index bc2c8a3c1..c82c238cc 100644 --- a/embassy-nrf/src/time_driver.rs +++ b/embassy-nrf/src/time_driver.rs | |||
| @@ -67,7 +67,7 @@ fn compare_n(n: usize) -> u32 { | |||
| 67 | 1 << (n + 16) | 67 | 1 << (n + 16) |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | #[cfg(tests)] | 70 | #[cfg(test)] |
| 71 | mod test { | 71 | mod test { |
| 72 | use super::*; | 72 | use super::*; |
| 73 | 73 | ||
diff --git a/embassy-stm32/src/flash/common.rs b/embassy-stm32/src/flash/common.rs index 6c1912900..c6cdc574b 100644 --- a/embassy-stm32/src/flash/common.rs +++ b/embassy-stm32/src/flash/common.rs | |||
| @@ -163,7 +163,7 @@ pub(super) fn get_sector(address: u32, regions: &[&FlashRegion]) -> FlashSector | |||
| 163 | bank_offset = 0; | 163 | bank_offset = 0; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | if address < region.end() { | 166 | if address >= region.base && address < region.end() { |
| 167 | let index_in_region = (address - region.base) / region.erase_size; | 167 | let index_in_region = (address - region.base) / region.erase_size; |
| 168 | return FlashSector { | 168 | return FlashSector { |
| 169 | bank: region.bank, | 169 | bank: region.bank, |
diff --git a/embassy-stm32/src/pwm/complementary_pwm.rs b/embassy-stm32/src/pwm/complementary_pwm.rs index 3f8b43cfa..cfb79947c 100644 --- a/embassy-stm32/src/pwm/complementary_pwm.rs +++ b/embassy-stm32/src/pwm/complementary_pwm.rs | |||
| @@ -209,39 +209,39 @@ mod tests { | |||
| 209 | 209 | ||
| 210 | #[test] | 210 | #[test] |
| 211 | fn test_compute_dead_time_value() { | 211 | fn test_compute_dead_time_value() { |
| 212 | struct test_run { | 212 | struct TestRun { |
| 213 | value: u16, | 213 | value: u16, |
| 214 | ckd: Ckd, | 214 | ckd: Ckd, |
| 215 | bits: u8, | 215 | bits: u8, |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | let fn_results = [ | 218 | let fn_results = [ |
| 219 | test_run { | 219 | TestRun { |
| 220 | value: 1, | 220 | value: 1, |
| 221 | ckd: Ckd::DIV1, | 221 | ckd: Ckd::DIV1, |
| 222 | bits: 1, | 222 | bits: 1, |
| 223 | }, | 223 | }, |
| 224 | test_run { | 224 | TestRun { |
| 225 | value: 125, | 225 | value: 125, |
| 226 | ckd: Ckd::DIV1, | 226 | ckd: Ckd::DIV1, |
| 227 | bits: 125, | 227 | bits: 125, |
| 228 | }, | 228 | }, |
| 229 | test_run { | 229 | TestRun { |
| 230 | value: 245, | 230 | value: 245, |
| 231 | ckd: Ckd::DIV1, | 231 | ckd: Ckd::DIV1, |
| 232 | bits: 64 + 245 / 2, | 232 | bits: 64 + 245 / 2, |
| 233 | }, | 233 | }, |
| 234 | test_run { | 234 | TestRun { |
| 235 | value: 255, | 235 | value: 255, |
| 236 | ckd: Ckd::DIV2, | 236 | ckd: Ckd::DIV2, |
| 237 | bits: 127, | 237 | bits: 127, |
| 238 | }, | 238 | }, |
| 239 | test_run { | 239 | TestRun { |
| 240 | value: 400, | 240 | value: 400, |
| 241 | ckd: Ckd::DIV1, | 241 | ckd: Ckd::DIV1, |
| 242 | bits: 32 + (400u16 / 8) as u8, | 242 | bits: 32 + (400u16 / 8) as u8, |
| 243 | }, | 243 | }, |
| 244 | test_run { | 244 | TestRun { |
| 245 | value: 600, | 245 | value: 600, |
| 246 | ckd: Ckd::DIV4, | 246 | ckd: Ckd::DIV4, |
| 247 | bits: 64 + (600u16 / 8) as u8, | 247 | bits: 64 + (600u16 / 8) as u8, |
diff --git a/embassy-time/Cargo.toml b/embassy-time/Cargo.toml index c4edbd38a..857da5467 100644 --- a/embassy-time/Cargo.toml +++ b/embassy-time/Cargo.toml | |||
| @@ -169,4 +169,4 @@ wasm-timer = { version = "0.2.5", optional = true } | |||
| 169 | [dev-dependencies] | 169 | [dev-dependencies] |
| 170 | serial_test = "0.9" | 170 | serial_test = "0.9" |
| 171 | critical-section = { version = "1.1", features = ["std"] } | 171 | critical-section = { version = "1.1", features = ["std"] } |
| 172 | 172 | embassy-executor = { version = "0.2.0", path = "../embassy-executor", features = ["nightly"] } | |
diff --git a/embassy-time/src/driver.rs b/embassy-time/src/driver.rs index 5c2ad3b23..d6436369b 100644 --- a/embassy-time/src/driver.rs +++ b/embassy-time/src/driver.rs | |||
| @@ -49,7 +49,7 @@ | |||
| 49 | //! fn set_alarm_callback(&self, alarm: AlarmHandle, callback: fn(*mut ()), ctx: *mut ()) { | 49 | //! fn set_alarm_callback(&self, alarm: AlarmHandle, callback: fn(*mut ()), ctx: *mut ()) { |
| 50 | //! todo!() | 50 | //! todo!() |
| 51 | //! } | 51 | //! } |
| 52 | //! fn set_alarm(&self, alarm: AlarmHandle, timestamp: u64) { | 52 | //! fn set_alarm(&self, alarm: AlarmHandle, timestamp: u64) -> bool { |
| 53 | //! todo!() | 53 | //! todo!() |
| 54 | //! } | 54 | //! } |
| 55 | //! } | 55 | //! } |
diff --git a/embassy-time/src/queue_generic.rs b/embassy-time/src/queue_generic.rs index 64a8af4bc..4795eb2f3 100644 --- a/embassy-time/src/queue_generic.rs +++ b/embassy-time/src/queue_generic.rs | |||
| @@ -183,7 +183,6 @@ mod tests { | |||
| 183 | 183 | ||
| 184 | use serial_test::serial; | 184 | use serial_test::serial; |
| 185 | 185 | ||
| 186 | use super::InnerQueue; | ||
| 187 | use crate::driver::{AlarmHandle, Driver}; | 186 | use crate::driver::{AlarmHandle, Driver}; |
| 188 | use crate::queue_generic::QUEUE; | 187 | use crate::queue_generic::QUEUE; |
| 189 | use crate::Instant; | 188 | use crate::Instant; |
| @@ -317,14 +316,18 @@ mod tests { | |||
| 317 | 316 | ||
| 318 | fn setup() { | 317 | fn setup() { |
| 319 | DRIVER.reset(); | 318 | DRIVER.reset(); |
| 320 | 319 | critical_section::with(|cs| *QUEUE.inner.borrow_ref_mut(cs) = None); | |
| 321 | QUEUE.inner.lock(|inner| { | ||
| 322 | *inner.borrow_mut() = InnerQueue::new(); | ||
| 323 | }); | ||
| 324 | } | 320 | } |
| 325 | 321 | ||
| 326 | fn queue_len() -> usize { | 322 | fn queue_len() -> usize { |
| 327 | QUEUE.inner.lock(|inner| inner.borrow().queue.iter().count()) | 323 | critical_section::with(|cs| { |
| 324 | QUEUE | ||
| 325 | .inner | ||
| 326 | .borrow_ref(cs) | ||
| 327 | .as_ref() | ||
| 328 | .map(|inner| inner.queue.iter().count()) | ||
| 329 | .unwrap_or(0) | ||
| 330 | }) | ||
| 328 | } | 331 | } |
| 329 | 332 | ||
| 330 | #[test] | 333 | #[test] |
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index 52620d233..d3d1f9f5f 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs | |||
| @@ -109,7 +109,6 @@ impl Future for Timer { | |||
| 109 | /// # #![feature(type_alias_impl_trait)] | 109 | /// # #![feature(type_alias_impl_trait)] |
| 110 | /// # | 110 | /// # |
| 111 | /// use embassy_time::{Duration, Ticker}; | 111 | /// use embassy_time::{Duration, Ticker}; |
| 112 | /// use futures::StreamExt; | ||
| 113 | /// # fn foo(){} | 112 | /// # fn foo(){} |
| 114 | /// | 113 | /// |
| 115 | /// #[embassy_executor::task] | 114 | /// #[embassy_executor::task] |
