diff --git a/heterogeneous/Cargo.toml b/heterogeneous/Cargo.toml deleted file mode 100644 index 54808a2fe3..0000000000 --- a/heterogeneous/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -authors = ["Jorge Aparicio "] -edition = "2018" -name = "heterogeneous" -# this crate is only used for testing -publish = false -version = "0.0.0-alpha.0" - -[dependencies] -bare-metal = "0.2.4" - -[dependencies.cortex-m-rtic] -path = ".." -features = ["heterogeneous"] - -[dev-dependencies] -panic-halt = "0.2.0" -microamp = "0.1.0-alpha.1" diff --git a/heterogeneous/README.md b/heterogeneous/README.md deleted file mode 100644 index 8e49ff8bea..0000000000 --- a/heterogeneous/README.md +++ /dev/null @@ -1 +0,0 @@ -This directory contains *heterogeneous* multi-core compile pass tests. diff --git a/heterogeneous/examples/smallest.rs b/heterogeneous/examples/smallest.rs deleted file mode 100644 index 2074e7dce2..0000000000 --- a/heterogeneous/examples/smallest.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = heterogeneous)] -const APP: () = {}; diff --git a/heterogeneous/examples/x-init-2.rs b/heterogeneous/examples/x-init-2.rs deleted file mode 100644 index e6ec7fcab3..0000000000 --- a/heterogeneous/examples/x-init-2.rs +++ /dev/null @@ -1,39 +0,0 @@ -//! [compile-pass] Cross initialization of late resources - -#![deny(unsafe_code)] -#![deny(warnings)] -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = heterogeneous)] -const APP: () = { - struct Resources { - // owned by core #1 but initialized by core #0 - x: u32, - - // owned by core #0 but initialized by core #1 - y: u32, - } - - #[init(core = 0, late = [x])] - fn a(_: a::Context) -> a::LateResources { - a::LateResources { x: 0 } - } - - #[idle(core = 0, resources = [y])] - fn b(_: b::Context) -> ! { - loop {} - } - - #[init(core = 1)] - fn c(_: c::Context) -> c::LateResources { - c::LateResources { y: 0 } - } - - #[idle(core = 1, resources = [x])] - fn d(_: d::Context) -> ! { - loop {} - } -}; diff --git a/heterogeneous/examples/x-init.rs b/heterogeneous/examples/x-init.rs deleted file mode 100644 index 20601b1a3f..0000000000 --- a/heterogeneous/examples/x-init.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! [compile-pass] Split initialization of late resources - -#![deny(unsafe_code)] -#![deny(warnings)] -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = heterogeneous)] -const APP: () = { - struct Resources { - x: u32, - y: u32, - } - - #[init(core = 0, late = [x])] - fn a(_: a::Context) -> a::LateResources { - a::LateResources { x: 0 } - } - - #[init(core = 1)] - fn b(_: b::Context) -> b::LateResources { - b::LateResources { y: 0 } - } -}; diff --git a/heterogeneous/examples/x-schedule.rs b/heterogeneous/examples/x-schedule.rs deleted file mode 100644 index 98a5f74122..0000000000 --- a/heterogeneous/examples/x-schedule.rs +++ /dev/null @@ -1,36 +0,0 @@ -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = heterogeneous, monotonic = heterogeneous::MT)] -const APP: () = { - #[init(core = 0, spawn = [ping])] - fn init(c: init::Context) { - c.spawn.ping().ok(); - } - - #[task(core = 0, schedule = [ping])] - fn pong(c: pong::Context) { - c.schedule.ping(c.scheduled + 1_000_000).ok(); - } - - #[task(core = 1, schedule = [pong])] - fn ping(c: ping::Context) { - c.schedule.pong(c.scheduled + 1_000_000).ok(); - } - - extern "C" { - #[core = 0] - fn I0(); - - #[core = 0] - fn I1(); - - #[core = 1] - fn I0(); - - #[core = 1] - fn I1(); - } -}; diff --git a/heterogeneous/examples/x-spawn.rs b/heterogeneous/examples/x-spawn.rs deleted file mode 100644 index e2586210d1..0000000000 --- a/heterogeneous/examples/x-spawn.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = heterogeneous)] -const APP: () = { - #[init(core = 0, spawn = [foo])] - fn init(c: init::Context) { - c.spawn.foo().ok(); - } - - #[task(core = 1)] - fn foo(_: foo::Context) {} - - extern "C" { - #[core = 1] - fn I0(); - } -}; diff --git a/heterogeneous/src/lib.rs b/heterogeneous/src/lib.rs deleted file mode 100644 index 1bda7c851b..0000000000 --- a/heterogeneous/src/lib.rs +++ /dev/null @@ -1,99 +0,0 @@ -//! Fake multi-core PAC - -#![no_std] - -use core::{ - cmp::Ordering, - ops::{Add, Sub}, -}; - -use bare_metal::Nr; -use rtic::{Fraction, Monotonic, MultiCore}; - -// both cores have the exact same interrupts -pub use Interrupt_0 as Interrupt_1; - -// Fake priority bits -pub const NVIC_PRIO_BITS: u8 = 3; - -pub fn xpend(_core: u8, _interrupt: impl Nr) {} - -/// Fake monotonic timer -pub struct MT; - -impl Monotonic for MT { - type Instant = Instant; - - fn ratio() -> Fraction { - Fraction { - numerator: 1, - denominator: 1, - } - } - - unsafe fn reset() { - (0xE0001004 as *mut u32).write_volatile(0) - } - - fn now() -> Instant { - unsafe { Instant((0xE0001004 as *const u32).read_volatile() as i32) } - } - - fn zero() -> Instant { - Instant(0) - } -} - -impl MultiCore for MT {} - -#[derive(Clone, Copy, Eq, PartialEq)] -pub struct Instant(i32); - -impl Add for Instant { - type Output = Instant; - - fn add(self, rhs: u32) -> Self { - Instant(self.0.wrapping_add(rhs as i32)) - } -} - -impl Sub for Instant { - type Output = u32; - - fn sub(self, rhs: Self) -> u32 { - self.0.checked_sub(rhs.0).unwrap() as u32 - } -} - -impl Ord for Instant { - fn cmp(&self, rhs: &Self) -> Ordering { - self.0.wrapping_sub(rhs.0).cmp(&0) - } -} - -impl PartialOrd for Instant { - fn partial_cmp(&self, rhs: &Self) -> Option { - Some(self.cmp(rhs)) - } -} - -// Fake interrupts -#[allow(non_camel_case_types)] -#[derive(Clone, Copy)] -#[repr(u8)] -pub enum Interrupt_0 { - I0 = 0, - I1 = 1, - I2 = 2, - I3 = 3, - I4 = 4, - I5 = 5, - I6 = 6, - I7 = 7, -} - -unsafe impl Nr for Interrupt_0 { - fn nr(&self) -> u8 { - *self as u8 - } -} diff --git a/homogeneous/Cargo.toml b/homogeneous/Cargo.toml deleted file mode 100644 index 111fe5dfb3..0000000000 --- a/homogeneous/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -authors = ["Jorge Aparicio "] -edition = "2018" -name = "homogeneous" -# this crate is only used for testing -publish = false -version = "0.0.0-alpha.0" - -[dependencies] -bare-metal = "0.2.4" - -[dependencies.cortex-m-rtic] -path = ".." -features = ["homogeneous"] - -[dev-dependencies] -panic-halt = "0.2.0" diff --git a/homogeneous/README.md b/homogeneous/README.md deleted file mode 100644 index 17e9c6e11a..0000000000 --- a/homogeneous/README.md +++ /dev/null @@ -1 +0,0 @@ -This directory contains *homogeneous* multi-core compile pass tests. diff --git a/homogeneous/examples/smallest.rs b/homogeneous/examples/smallest.rs deleted file mode 100644 index 913e489f43..0000000000 --- a/homogeneous/examples/smallest.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = homogeneous)] -const APP: () = {}; diff --git a/homogeneous/examples/x-init-2.rs b/homogeneous/examples/x-init-2.rs deleted file mode 100644 index 11caacd4d2..0000000000 --- a/homogeneous/examples/x-init-2.rs +++ /dev/null @@ -1,39 +0,0 @@ -//! [compile-pass] Cross initialization of late resources - -#![deny(unsafe_code)] -#![deny(warnings)] -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = homogeneous)] -const APP: () = { - struct Resources { - // owned by core #1 but initialized by core #0 - x: u32, - - // owned by core #0 but initialized by core #1 - y: u32, - } - - #[init(core = 0, late = [x])] - fn a(_: a::Context) -> a::LateResources { - a::LateResources { x: 0 } - } - - #[idle(core = 0, resources = [y])] - fn b(_: b::Context) -> ! { - loop {} - } - - #[init(core = 1)] - fn c(_: c::Context) -> c::LateResources { - c::LateResources { y: 0 } - } - - #[idle(core = 1, resources = [x])] - fn d(_: d::Context) -> ! { - loop {} - } -}; diff --git a/homogeneous/examples/x-init.rs b/homogeneous/examples/x-init.rs deleted file mode 100644 index 0574279cbd..0000000000 --- a/homogeneous/examples/x-init.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! [compile-pass] Split initialization of late resources - -#![deny(unsafe_code)] -#![deny(warnings)] -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = homogeneous)] -const APP: () = { - struct Resources { - x: u32, - y: u32, - } - - #[init(core = 0, late = [x])] - fn a(_: a::Context) -> a::LateResources { - a::LateResources { x: 0 } - } - - #[init(core = 1)] - fn b(_: b::Context) -> b::LateResources { - b::LateResources { y: 0 } - } -}; diff --git a/homogeneous/examples/x-schedule.rs b/homogeneous/examples/x-schedule.rs deleted file mode 100644 index 7c0b3840a8..0000000000 --- a/homogeneous/examples/x-schedule.rs +++ /dev/null @@ -1,36 +0,0 @@ -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = homogeneous, monotonic = homogeneous::MT)] -const APP: () = { - #[init(core = 0, spawn = [ping])] - fn init(c: init::Context) { - c.spawn.ping().ok(); - } - - #[task(core = 0, schedule = [ping])] - fn pong(c: pong::Context) { - c.schedule.ping(c.scheduled + 1_000_000).ok(); - } - - #[task(core = 1, schedule = [pong])] - fn ping(c: ping::Context) { - c.schedule.pong(c.scheduled + 1_000_000).ok(); - } - - extern "C" { - #[core = 0] - fn I0(); - - #[core = 0] - fn I1(); - - #[core = 1] - fn I0(); - - #[core = 1] - fn I1(); - } -}; diff --git a/homogeneous/examples/x-spawn.rs b/homogeneous/examples/x-spawn.rs deleted file mode 100644 index 45bc90030c..0000000000 --- a/homogeneous/examples/x-spawn.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![no_main] -#![no_std] - -use panic_halt as _; - -#[rtic::app(cores = 2, device = homogeneous)] -const APP: () = { - #[init(core = 0, spawn = [foo])] - fn init(c: init::Context) { - c.spawn.foo().ok(); - } - - #[task(core = 1)] - fn foo(_: foo::Context) {} - - extern "C" { - #[core = 1] - fn I0(); - } -}; diff --git a/homogeneous/src/lib.rs b/homogeneous/src/lib.rs deleted file mode 100644 index 1bda7c851b..0000000000 --- a/homogeneous/src/lib.rs +++ /dev/null @@ -1,99 +0,0 @@ -//! Fake multi-core PAC - -#![no_std] - -use core::{ - cmp::Ordering, - ops::{Add, Sub}, -}; - -use bare_metal::Nr; -use rtic::{Fraction, Monotonic, MultiCore}; - -// both cores have the exact same interrupts -pub use Interrupt_0 as Interrupt_1; - -// Fake priority bits -pub const NVIC_PRIO_BITS: u8 = 3; - -pub fn xpend(_core: u8, _interrupt: impl Nr) {} - -/// Fake monotonic timer -pub struct MT; - -impl Monotonic for MT { - type Instant = Instant; - - fn ratio() -> Fraction { - Fraction { - numerator: 1, - denominator: 1, - } - } - - unsafe fn reset() { - (0xE0001004 as *mut u32).write_volatile(0) - } - - fn now() -> Instant { - unsafe { Instant((0xE0001004 as *const u32).read_volatile() as i32) } - } - - fn zero() -> Instant { - Instant(0) - } -} - -impl MultiCore for MT {} - -#[derive(Clone, Copy, Eq, PartialEq)] -pub struct Instant(i32); - -impl Add for Instant { - type Output = Instant; - - fn add(self, rhs: u32) -> Self { - Instant(self.0.wrapping_add(rhs as i32)) - } -} - -impl Sub for Instant { - type Output = u32; - - fn sub(self, rhs: Self) -> u32 { - self.0.checked_sub(rhs.0).unwrap() as u32 - } -} - -impl Ord for Instant { - fn cmp(&self, rhs: &Self) -> Ordering { - self.0.wrapping_sub(rhs.0).cmp(&0) - } -} - -impl PartialOrd for Instant { - fn partial_cmp(&self, rhs: &Self) -> Option { - Some(self.cmp(rhs)) - } -} - -// Fake interrupts -#[allow(non_camel_case_types)] -#[derive(Clone, Copy)] -#[repr(u8)] -pub enum Interrupt_0 { - I0 = 0, - I1 = 1, - I2 = 2, - I3 = 3, - I4 = 4, - I5 = 5, - I6 = 6, - I7 = 7, -} - -unsafe impl Nr for Interrupt_0 { - fn nr(&self) -> u8 { - *self as u8 - } -}