diff --git a/ci/expected/cfg-monotonic.run b/ci/expected/cfg-monotonic.run deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/examples/cfg-monotonic.rs b/examples/cfg-monotonic.rs deleted file mode 100644 index 88c0d6f009..0000000000 --- a/examples/cfg-monotonic.rs +++ /dev/null @@ -1,121 +0,0 @@ -//! examples/cfg-monotonic.rs - -#![deny(unsafe_code)] -#![deny(warnings)] -#![deny(missing_docs)] -#![no_main] -#![no_std] - -use panic_semihosting as _; - -#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])] -mod app { - use cortex_m_semihosting::{debug, hprintln}; - use systick_monotonic::*; // Implements the `Monotonic` trait - - // A monotonic timer to enable scheduling in RTIC - #[cfg(feature = "killmono")] - #[monotonic(binds = SysTick, default = true)] - type MyMono = Systick<100>; // 100 Hz / 10 ms granularity - - // Not allowed by current rtic-syntax: - // error: `#[monotonic(...)]` on a specific type must appear at most once - // --> examples/cfg-monotonic.rs:23:10 - // | - // 23 | type MyMono = Systick<100>; // 100 Hz / 10 ms granularity - // | ^^^^^^ - // #[monotonic(binds = SysTick, default = true)] - // type MyMono = Systick<100>; // 100 Hz / 10 ms granularity - - // Not allowed by current rtic-syntax: - // error: this interrupt is already bound - // --> examples/cfg-monotonic.rs:31:25 - // | - // 31 | #[monotonic(binds = SysTick, default = true)] - // | ^^^^^^^ - // #[monotonic(binds = SysTick, default = true)] - // type MyMono2 = DwtSystick<100>; // 100 Hz / 10 ms granularity - - // Resources shared between tasks - #[shared] - struct Shared { - s1: u32, - s2: i32, - } - - // Local resources to specific tasks (cannot be shared) - #[local] - struct Local { - l1: u8, - l2: i8, - } - - #[init] - fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { - let _systick = cx.core.SYST; - - // Initialize the monotonic (SysTick rate in QEMU is 12 MHz) - #[cfg(feature = "killmono")] - let mono = Systick::new(systick, 12_000_000); - - // Spawn the task `foo` directly after `init` finishes - foo::spawn().unwrap(); - - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - - ( - // Initialization of shared resources - Shared { s1: 0, s2: 1 }, - // Initialization of task local resources - Local { l1: 2, l2: 3 }, - // Move the monotonic timer to the RTIC run-time, this enables - // scheduling - #[cfg(feature = "killmono")] - init::Monotonics(mono), - init::Monotonics(), - ) - } - - // Background task, runs whenever no other tasks are running - #[idle] - fn idle(_: idle::Context) -> ! { - loop { - continue; - } - } - - // Software task, not bound to a hardware interrupt. - // This task takes the task local resource `l1` - // The resources `s1` and `s2` are shared between all other tasks. - #[task(shared = [s1, s2], local = [l1])] - fn foo(_: foo::Context) { - // This task is only spawned once in `init`, hence this task will run - // only once - - hprintln!("foo"); - } - - // Software task, also not bound to a hardware interrupt - // This task takes the task local resource `l2` - // The resources `s1` and `s2` are shared between all other tasks. - #[task(shared = [s1, s2], local = [l2])] - fn bar(_: bar::Context) { - hprintln!("bar"); - - // Run `bar` once per second - // bar::spawn_after(1.secs()).unwrap(); - } - - // Hardware task, bound to a hardware interrupt - // The resources `s1` and `s2` are shared between all other tasks. - #[task(binds = UART0, priority = 3, shared = [s1, s2])] - fn uart0_interrupt(_: uart0_interrupt::Context) { - // This task is bound to the interrupt `UART0` and will run - // whenever the interrupt fires - - // Note that RTIC does NOT clear the interrupt flag, this is up to the - // user - - hprintln!("UART0 interrupt!"); - } -} diff --git a/macros/src/tests.rs b/macros/src/tests.rs deleted file mode 100644 index e9e3326ee9..0000000000 --- a/macros/src/tests.rs +++ /dev/null @@ -1,4 +0,0 @@ -// NOTE these tests are specific to the Cortex-M port; `rtic-syntax` has a more extensive test suite -// that tests functionality common to all the RTIC ports - -mod single; diff --git a/macros/src/tests/single.rs b/macros/src/tests/single.rs deleted file mode 100644 index f20c9ccbb3..0000000000 --- a/macros/src/tests/single.rs +++ /dev/null @@ -1,40 +0,0 @@ -use quote::quote; -use rtic_syntax::Settings; - -#[test] -fn analyze() { - let mut settings = Settings::default(); - settings.parse_extern_interrupt = true; - let (app, analysis) = rtic_syntax::parse2( - // First interrupt is assigned to the highest priority dispatcher - quote!(device = pac, dispatchers = [B, A]), - quote!( - mod app { - #[shared] - struct Shared {} - - #[local] - struct Local {} - - #[init] - fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { - (Shared {}, Local {}, init::Monotonics()) - } - - #[task(priority = 1)] - fn a(_: a::Context) {} - - #[task(priority = 2)] - fn b(_: b::Context) {} - } - ), - settings, - ) - .unwrap(); - - let analysis = crate::analyze::app(analysis, &app); - let interrupts = &analysis.interrupts; - assert_eq!(interrupts.len(), 2); - assert_eq!(interrupts[&2].0.to_string(), "B"); - assert_eq!(interrupts[&1].0.to_string(), "A"); -} diff --git a/rtic-monotonics/.gitignore b/rtic-monotonics/.gitignore new file mode 100644 index 0000000000..c4002562d3 --- /dev/null +++ b/rtic-monotonics/.gitignore @@ -0,0 +1,6 @@ +**/*.rs.bk +.#* +.gdb_history +/target +Cargo.lock +*.hex diff --git a/rtic-monotonics/Cargo.toml b/rtic-monotonics/Cargo.toml new file mode 100644 index 0000000000..24448fb29e --- /dev/null +++ b/rtic-monotonics/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "rtic-timer" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +cortex-m = { version = "0.7.6" } +embedded-hal-async = "0.2.0-alpha.0" +fugit = { version = "0.3.6", features = ["defmt"] } +rtic-timer = { version = "1.0.0", path = "../rtic-timer" } diff --git a/rust-toolchain.toml b/rtic-monotonics/rust-toolchain.toml similarity index 100% rename from rust-toolchain.toml rename to rtic-monotonics/rust-toolchain.toml diff --git a/rtic-monotonics/src/lib.rs b/rtic-monotonics/src/lib.rs new file mode 100644 index 0000000000..88398cad3a --- /dev/null +++ b/rtic-monotonics/src/lib.rs @@ -0,0 +1,11 @@ +//! Crate + +#![no_std] +#![no_main] +#![deny(missing_docs)] +#![allow(incomplete_features)] +#![feature(async_fn_in_trait)] + +pub use rtic_timer::{Monotonic, TimeoutError, TimerQueue}; + +pub mod systick_monotonic; diff --git a/rtic-monotonics/src/systick_monotonic.rs b/rtic-monotonics/src/systick_monotonic.rs new file mode 100644 index 0000000000..491cf81c58 --- /dev/null +++ b/rtic-monotonics/src/systick_monotonic.rs @@ -0,0 +1 @@ +//! ... diff --git a/rtic-timer/.gitignore b/rtic-timer/.gitignore new file mode 100644 index 0000000000..c4002562d3 --- /dev/null +++ b/rtic-timer/.gitignore @@ -0,0 +1,6 @@ +**/*.rs.bk +.#* +.gdb_history +/target +Cargo.lock +*.hex diff --git a/rtic-timer/Cargo.toml b/rtic-timer/Cargo.toml index 8e2e2ad602..b7b3a5fba3 100644 --- a/rtic-timer/Cargo.toml +++ b/rtic-timer/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "rtic-timer" -version = "0.1.0" +version = "1.0.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cortex-m = "0.7.6" -rtic-monotonic = "1.0.0" -fugit = "0.3.6" \ No newline at end of file +critical-section = "1" +futures-util = { version = "0.3.25", default-features = false } diff --git a/rtic-timer/rust-toolchain.toml b/rtic-timer/rust-toolchain.toml new file mode 100644 index 0000000000..e28b55de64 --- /dev/null +++ b/rtic-timer/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly" +components = [ "rust-src", "rustfmt", "llvm-tools-preview" ] +targets = [ "thumbv6m-none-eabi", "thumbv7m-none-eabi" ] diff --git a/rtic-timer/src/lib.rs b/rtic-timer/src/lib.rs index e7051d2779..d7faa07ff7 100644 --- a/rtic-timer/src/lib.rs +++ b/rtic-timer/src/lib.rs @@ -1,138 +1,336 @@ +//! Crate + #![no_std] +#![no_main] +#![deny(missing_docs)] +#![allow(incomplete_features)] +#![feature(async_fn_in_trait)] -use core::sync::atomic::{AtomicU32, Ordering}; -use core::{cmp::Ordering, task::Waker}; -use cortex_m::peripheral::{syst::SystClkSource, SYST}; -pub use fugit::{self, ExtU64}; -pub use rtic_monotonic::Monotonic; +pub mod monotonic; -mod sll; -use sll::{IntrusiveSortedLinkedList, Min as IsslMin, Node as IntrusiveNode}; +use core::future::{poll_fn, Future}; +use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use core::task::{Poll, Waker}; +use futures_util::{ + future::{select, Either}, + pin_mut, +}; +pub use monotonic::Monotonic; -pub struct Timer { - cnt: AtomicU32, - // queue: IntrusiveSortedLinkedList<'static, WakerNotReady, IsslMin>, +mod linked_list; + +use linked_list::{Link, LinkedList}; + +/// Holds a waker and at which time instant this waker shall be awoken. +struct WaitingWaker { + waker: Waker, + release_at: Mono::Instant, } -#[allow(non_snake_case)] -#[no_mangle] -fn SysTick() { - // .. - let cnt = unsafe { - static mut CNT: u32 = 0; - &mut CNT - }; - - *cnt = cnt.wrapping_add(1); -} - -/// Systick implementing `rtic_monotonic::Monotonic` which runs at a -/// settable rate using the `TIMER_HZ` parameter. -pub struct Systick { - systick: SYST, - cnt: u64, -} - -impl Systick { - /// Provide a new `Monotonic` based on SysTick. - /// - /// The `sysclk` parameter is the speed at which SysTick runs at. This value should come from - /// the clock generation function of the used HAL. - /// - /// Notice that the actual rate of the timer is a best approximation based on the given - /// `sysclk` and `TIMER_HZ`. - pub fn new(mut systick: SYST, sysclk: u32) -> Self { - // + TIMER_HZ / 2 provides round to nearest instead of round to 0. - // - 1 as the counter range is inclusive [0, reload] - let reload = (sysclk + TIMER_HZ / 2) / TIMER_HZ - 1; - - assert!(reload <= 0x00ff_ffff); - assert!(reload > 0); - - systick.disable_counter(); - systick.set_clock_source(SystClkSource::Core); - systick.set_reload(reload); - - Systick { systick, cnt: 0 } - } -} - -impl Monotonic for Systick { - const DISABLE_INTERRUPT_ON_EMPTY_QUEUE: bool = false; - - type Instant = fugit::TimerInstantU64; - type Duration = fugit::TimerDurationU64; - - fn now(&mut self) -> Self::Instant { - if self.systick.has_wrapped() { - self.cnt = self.cnt.wrapping_add(1); - } - - Self::Instant::from_ticks(self.cnt) - } - - unsafe fn reset(&mut self) { - self.systick.clear_current(); - self.systick.enable_counter(); - } - - #[inline(always)] - fn set_compare(&mut self, _val: Self::Instant) { - // No need to do something here, we get interrupts anyway. - } - - #[inline(always)] - fn clear_compare_flag(&mut self) { - // NOOP with SysTick interrupt - } - - #[inline(always)] - fn zero() -> Self::Instant { - Self::Instant::from_ticks(0) - } - - #[inline(always)] - fn on_interrupt(&mut self) { - if self.systick.has_wrapped() { - self.cnt = self.cnt.wrapping_add(1); +impl Clone for WaitingWaker { + fn clone(&self) -> Self { + Self { + waker: self.waker.clone(), + release_at: self.release_at, } } } -struct WakerNotReady -where - Mono: Monotonic, -{ - pub waker: Waker, - pub instant: Mono::Instant, - pub marker: u32, -} - -impl Eq for WakerNotReady where Mono: Monotonic {} - -impl Ord for WakerNotReady -where - Mono: Monotonic, -{ - fn cmp(&self, other: &Self) -> Ordering { - self.instant.cmp(&other.instant) - } -} - -impl PartialEq for WakerNotReady -where - Mono: Monotonic, -{ +impl PartialEq for WaitingWaker { fn eq(&self, other: &Self) -> bool { - self.instant == other.instant + self.release_at == other.release_at } } -impl PartialOrd for WakerNotReady -where - Mono: Monotonic, -{ - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) +impl PartialOrd for WaitingWaker { + fn partial_cmp(&self, other: &Self) -> Option { + self.release_at.partial_cmp(&other.release_at) } } + +/// A generic timer queue for async executors. +/// +/// # Blocking +/// +/// The internal priority queue uses global critical sections to manage access. This means that +/// `await`ing a delay will cause a lock of the entire system for O(n) time. In practice the lock +/// duration is ~10 clock cycles per element in the queue. +/// +/// # Safety +/// +/// This timer queue is based on an intrusive linked list, and by extension the links are strored +/// on the async stacks of callers. The links are deallocated on `drop` or when the wait is +/// complete. +/// +/// Do not call `mem::forget` on an awaited future, or there will be dragons! +pub struct TimerQueue { + queue: LinkedList>, + initialized: AtomicBool, +} + +/// This indicates that there was a timeout. +pub struct TimeoutError; + +impl TimerQueue { + /// Make a new queue. + pub const fn new() -> Self { + Self { + queue: LinkedList::new(), + initialized: AtomicBool::new(false), + } + } + + /// Forwards the `Monotonic::now()` method. + #[inline(always)] + pub fn now(&self) -> Mono::Instant { + Mono::now() + } + + /// Takes the initialized monotonic to initialize the TimerQueue. + pub fn initialize(&self, monotonic: Mono) { + self.initialized.store(true, Ordering::SeqCst); + + // Don't run drop on `Mono` + core::mem::forget(monotonic); + } + + /// Call this in the interrupt handler of the hardware timer supporting the `Monotonic` + /// + /// # Safety + /// + /// It's always safe to call, but it must only be called from the interrupt of the + /// monotonic timer for correct operation. + pub unsafe fn on_monotonic_interrupt(&self) { + Mono::clear_compare_flag(); + Mono::on_interrupt(); + + loop { + let mut release_at = None; + let head = self.queue.pop_if(|head| { + release_at = Some(head.release_at); + + Mono::now() >= head.release_at + }); + + match (head, release_at) { + (Some(link), _) => { + link.waker.wake(); + } + (None, Some(instant)) => { + Mono::enable_timer(); + Mono::set_compare(instant); + + if Mono::now() >= instant { + // The time for the next instant passed while handling it, + // continue dequeueing + continue; + } + + break; + } + (None, None) => { + // Queue is empty + Mono::disable_timer(); + + break; + } + } + } + } + + /// Timeout at a specific time. + pub async fn timeout_at( + &self, + instant: Mono::Instant, + future: F, + ) -> Result { + let delay = self.delay_until(instant); + + pin_mut!(future); + pin_mut!(delay); + + match select(future, delay).await { + Either::Left((r, _)) => Ok(r), + Either::Right(_) => Err(TimeoutError), + } + } + + /// Timeout after a specific duration. + #[inline] + pub async fn timeout_after( + &self, + duration: Mono::Duration, + future: F, + ) -> Result { + self.timeout_at(Mono::now() + duration, future).await + } + + /// Delay for some duration of time. + #[inline] + pub async fn delay(&self, duration: Mono::Duration) { + let now = Mono::now(); + + self.delay_until(now + duration).await; + } + + /// Delay to some specific time instant. + pub async fn delay_until(&self, instant: Mono::Instant) { + if !self.initialized.load(Ordering::Relaxed) { + panic!( + "The timer queue is not initialized with a monotonic, you need to run `initialize`" + ); + } + + let mut first_run = true; + let queue = &self.queue; + let mut link = Link::new(WaitingWaker { + waker: poll_fn(|cx| Poll::Ready(cx.waker().clone())).await, + release_at: instant, + }); + + let marker = &AtomicUsize::new(0); + + let dropper = OnDrop::new(|| { + queue.delete(marker.load(Ordering::Relaxed)); + }); + + poll_fn(|_| { + if Mono::now() >= instant { + return Poll::Ready(()); + } + + if first_run { + first_run = false; + let (was_empty, addr) = queue.insert(&mut link); + marker.store(addr, Ordering::Relaxed); + + if was_empty { + // Pend the monotonic handler if the queue was empty to setup the timer. + Mono::pend_interrupt(); + } + } + + Poll::Pending + }) + .await; + + // Make sure that our link is deleted from the list before we drop this stack + drop(dropper); + } +} + +struct OnDrop { + f: core::mem::MaybeUninit, +} + +impl OnDrop { + pub fn new(f: F) -> Self { + Self { + f: core::mem::MaybeUninit::new(f), + } + } + + #[allow(unused)] + pub fn defuse(self) { + core::mem::forget(self) + } +} + +impl Drop for OnDrop { + fn drop(&mut self) { + unsafe { self.f.as_ptr().read()() } + } +} + +// -------- Test program --------- +// +// +// use systick_monotonic::{Systick, TimerQueue}; +// +// // same panicking *behavior* as `panic-probe` but doesn't print a panic message +// // this prevents the panic message being printed *twice* when `defmt::panic` is invoked +// #[defmt::panic_handler] +// fn panic() -> ! { +// cortex_m::asm::udf() +// } +// +// /// Terminates the application and makes `probe-run` exit with exit-code = 0 +// pub fn exit() -> ! { +// loop { +// cortex_m::asm::bkpt(); +// } +// } +// +// defmt::timestamp!("{=u64:us}", { +// let time_us: fugit::MicrosDurationU32 = MONO.now().duration_since_epoch().convert(); +// +// time_us.ticks() as u64 +// }); +// +// make_systick_timer_queue!(MONO, Systick<1_000>); +// +// #[rtic::app( +// device = nrf52832_hal::pac, +// dispatchers = [SWI0_EGU0, SWI1_EGU1, SWI2_EGU2, SWI3_EGU3, SWI4_EGU4, SWI5_EGU5], +// )] +// mod app { +// use super::{Systick, MONO}; +// use fugit::ExtU32; +// +// #[shared] +// struct Shared {} +// +// #[local] +// struct Local {} +// +// #[init] +// fn init(cx: init::Context) -> (Shared, Local) { +// defmt::println!("init"); +// +// let systick = Systick::start(cx.core.SYST, 64_000_000); +// +// defmt::println!("initializing monotonic"); +// +// MONO.initialize(systick); +// +// async_task::spawn().ok(); +// async_task2::spawn().ok(); +// async_task3::spawn().ok(); +// +// (Shared {}, Local {}) +// } +// +// #[idle] +// fn idle(_: idle::Context) -> ! { +// defmt::println!("idle"); +// +// loop { +// core::hint::spin_loop(); +// } +// } +// +// #[task] +// async fn async_task(_: async_task::Context) { +// loop { +// defmt::println!("async task waiting for 1 second"); +// MONO.delay(1.secs()).await; +// } +// } +// +// #[task] +// async fn async_task2(_: async_task2::Context) { +// loop { +// defmt::println!(" async task 2 waiting for 0.5 second"); +// MONO.delay(500.millis()).await; +// } +// } +// +// #[task] +// async fn async_task3(_: async_task3::Context) { +// loop { +// defmt::println!(" async task 3 waiting for 0.2 second"); +// MONO.delay(200.millis()).await; +// } +// } +// } +// diff --git a/rtic-timer/src/linked_list.rs b/rtic-timer/src/linked_list.rs new file mode 100644 index 0000000000..42ff8cb6f9 --- /dev/null +++ b/rtic-timer/src/linked_list.rs @@ -0,0 +1,173 @@ +//! ... + +use core::marker::PhantomPinned; +use core::sync::atomic::{AtomicPtr, Ordering}; +use critical_section as cs; + +/// A sorted linked list for the timer queue. +pub struct LinkedList { + head: AtomicPtr>, +} + +impl LinkedList { + /// Create a new linked list. + pub const fn new() -> Self { + Self { + head: AtomicPtr::new(core::ptr::null_mut()), + } + } +} + +impl LinkedList { + /// Pop the first element in the queue if the closure returns true. + pub fn pop_if bool>(&self, f: F) -> Option { + cs::with(|_| { + // Make sure all previous writes are visible + core::sync::atomic::fence(Ordering::SeqCst); + + let head = self.head.load(Ordering::Relaxed); + + // SAFETY: `as_ref` is safe as `insert` requires a valid reference to a link + if let Some(head) = unsafe { head.as_ref() } { + if f(&head.val) { + // Move head to the next element + self.head + .store(head.next.load(Ordering::Relaxed), Ordering::Relaxed); + + // We read the value at head + let head_val = head.val.clone(); + + return Some(head_val); + } + } + None + }) + } + + /// Delete a link at an address. + pub fn delete(&self, addr: usize) { + cs::with(|_| { + // Make sure all previous writes are visible + core::sync::atomic::fence(Ordering::SeqCst); + + let head = self.head.load(Ordering::Relaxed); + + // SAFETY: `as_ref` is safe as `insert` requires a valid reference to a link + let head_ref = if let Some(head_ref) = unsafe { head.as_ref() } { + head_ref + } else { + // 1. List is empty, do nothing + return; + }; + + if head as *const _ as usize == addr { + // 2. Replace head with head.next + self.head + .store(head_ref.next.load(Ordering::Relaxed), Ordering::Relaxed); + + return; + } + + // 3. search list for correct node + let mut curr = head_ref; + let mut next = head_ref.next.load(Ordering::Relaxed); + + // SAFETY: `as_ref` is safe as `insert` requires a valid reference to a link + while let Some(next_link) = unsafe { next.as_ref() } { + // Next is not null + + if next as *const _ as usize == addr { + curr.next + .store(next_link.next.load(Ordering::Relaxed), Ordering::Relaxed); + + return; + } + + // Continue searching + curr = next_link; + next = next_link.next.load(Ordering::Relaxed); + } + }) + } + + /// Insert a new link into the linked list. + /// The return is (was_empty, address), where the address of the link is for use with `delete`. + pub fn insert(&self, val: &mut Link) -> (bool, usize) { + cs::with(|_| { + let addr = val as *const _ as usize; + + // Make sure all previous writes are visible + core::sync::atomic::fence(Ordering::SeqCst); + + let head = self.head.load(Ordering::Relaxed); + + // 3 cases to handle + + // 1. List is empty, write to head + // SAFETY: `as_ref` is safe as `insert` requires a valid reference to a link + let head_ref = if let Some(head_ref) = unsafe { head.as_ref() } { + head_ref + } else { + self.head.store(val, Ordering::Relaxed); + return (true, addr); + }; + + // 2. val needs to go in first + if val.val < head_ref.val { + // Set current head as next of `val` + val.next.store(head, Ordering::Relaxed); + + // `val` is now first in the queue + self.head.store(val, Ordering::Relaxed); + + return (false, addr); + } + + // 3. search list for correct place + let mut curr = head_ref; + let mut next = head_ref.next.load(Ordering::Relaxed); + + // SAFETY: `as_ref` is safe as `insert` requires a valid reference to a link + while let Some(next_link) = unsafe { next.as_ref() } { + // Next is not null + + if val.val < next_link.val { + // Replace next with `val` + val.next.store(next, Ordering::Relaxed); + + // Insert `val` + curr.next.store(val, Ordering::Relaxed); + + return (false, addr); + } + + // Continue searching + curr = next_link; + next = next_link.next.load(Ordering::Relaxed); + } + + // No next, write link to last position in list + curr.next.store(val, Ordering::Relaxed); + + (false, addr) + }) + } +} + +/// A link in the linked list. +pub struct Link { + val: T, + next: AtomicPtr>, + _up: PhantomPinned, +} + +impl Link { + /// Create a new link. + pub const fn new(val: T) -> Self { + Self { + val, + next: AtomicPtr::new(core::ptr::null_mut()), + _up: PhantomPinned, + } + } +} diff --git a/rtic-timer/src/monotonic.rs b/rtic-timer/src/monotonic.rs new file mode 100644 index 0000000000..9b3742fa87 --- /dev/null +++ b/rtic-timer/src/monotonic.rs @@ -0,0 +1,60 @@ +//! ... + +/// # A monotonic clock / counter definition. +/// +/// ## Correctness +/// +/// The trait enforces that proper time-math is implemented between `Instant` and `Duration`. This +/// is a requirement on the time library that the user chooses to use. +pub trait Monotonic { + /// The time at time zero. + const ZERO: Self::Instant; + + /// The type for instant, defining an instant in time. + /// + /// **Note:** In all APIs in RTIC that use instants from this monotonic, this type will be used. + type Instant: Ord + + Copy + + core::ops::Add + + core::ops::Sub + + core::ops::Sub; + + /// The type for duration, defining an duration of time. + /// + /// **Note:** In all APIs in RTIC that use duration from this monotonic, this type will be used. + type Duration; + + /// Get the current time. + fn now() -> Self::Instant; + + /// Set the compare value of the timer interrupt. + /// + /// **Note:** This method does not need to handle race conditions of the monotonic, the timer + /// queue in RTIC checks this. + fn set_compare(instant: Self::Instant); + + /// Clear the compare interrupt flag. + fn clear_compare_flag(); + + /// Pend the timer's interrupt. + fn pend_interrupt(); + + /// Optional. Runs on interrupt before any timer queue handling. + fn on_interrupt() {} + + /// Optional. This is used to save power, this is called when the timer queue is not empty. + /// + /// Enabling and disabling the monotonic needs to propagate to `now` so that an instant + /// based of `now()` is still valid. + /// + /// NOTE: This may be called more than once. + fn enable_timer() {} + + /// Optional. This is used to save power, this is called when the timer queue is empty. + /// + /// Enabling and disabling the monotonic needs to propagate to `now` so that an instant + /// based of `now()` is still valid. + /// + /// NOTE: This may be called more than once. + fn disable_timer() {} +} diff --git a/rtic-timer/src/sll.rs b/rtic-timer/src/sll.rs deleted file mode 100644 index 43b53c1749..0000000000 --- a/rtic-timer/src/sll.rs +++ /dev/null @@ -1,421 +0,0 @@ -//! An intrusive sorted priority linked list, designed for use in `Future`s in RTIC. -use core::cmp::Ordering; -use core::fmt; -use core::marker::PhantomData; -use core::ops::{Deref, DerefMut}; -use core::ptr::NonNull; - -/// Marker for Min sorted [`IntrusiveSortedLinkedList`]. -pub struct Min; - -/// Marker for Max sorted [`IntrusiveSortedLinkedList`]. -pub struct Max; - -/// The linked list kind: min-list or max-list -pub trait Kind: private::Sealed { - #[doc(hidden)] - fn ordering() -> Ordering; -} - -impl Kind for Min { - fn ordering() -> Ordering { - Ordering::Less - } -} - -impl Kind for Max { - fn ordering() -> Ordering { - Ordering::Greater - } -} - -/// Sealed traits -mod private { - pub trait Sealed {} -} - -impl private::Sealed for Max {} -impl private::Sealed for Min {} - -/// A node in the [`IntrusiveSortedLinkedList`]. -pub struct Node { - pub val: T, - next: Option>>, -} - -impl Node { - pub fn new(val: T) -> Self { - Self { val, next: None } - } -} - -/// The linked list. -pub struct IntrusiveSortedLinkedList<'a, T, K> { - head: Option>>, - _kind: PhantomData, - _lt: PhantomData<&'a ()>, -} - -impl<'a, T, K> fmt::Debug for IntrusiveSortedLinkedList<'a, T, K> -where - T: Ord + core::fmt::Debug, - K: Kind, -{ - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut l = f.debug_list(); - let mut current = self.head; - - while let Some(head) = current { - let head = unsafe { head.as_ref() }; - current = head.next; - - l.entry(&head.val); - } - - l.finish() - } -} - -impl<'a, T, K> IntrusiveSortedLinkedList<'a, T, K> -where - T: Ord, - K: Kind, -{ - pub const fn new() -> Self { - Self { - head: None, - _kind: PhantomData, - _lt: PhantomData, - } - } - - // Push to the list. - pub fn push(&mut self, new: &'a mut Node) { - unsafe { - if let Some(head) = self.head { - if head.as_ref().val.cmp(&new.val) != K::ordering() { - // This is newer than head, replace head - new.next = self.head; - self.head = Some(NonNull::new_unchecked(new)); - } else { - // It's not head, search the list for the correct placement - let mut current = head; - - while let Some(next) = current.as_ref().next { - if next.as_ref().val.cmp(&new.val) != K::ordering() { - break; - } - - current = next; - } - - new.next = current.as_ref().next; - current.as_mut().next = Some(NonNull::new_unchecked(new)); - } - } else { - // List is empty, place at head - self.head = Some(NonNull::new_unchecked(new)) - } - } - } - - /// Get an iterator over the sorted list. - pub fn iter(&self) -> Iter<'_, T, K> { - Iter { - _list: self, - index: self.head, - } - } - - /// Find an element in the list that can be changed and resorted. - pub fn find_mut(&mut self, mut f: F) -> Option> - where - F: FnMut(&T) -> bool, - { - let head = self.head?; - - // Special-case, first element - if f(&unsafe { head.as_ref() }.val) { - return Some(FindMut { - is_head: true, - prev_index: None, - index: self.head, - list: self, - maybe_changed: false, - }); - } - - let mut current = head; - - while let Some(next) = unsafe { current.as_ref() }.next { - if f(&unsafe { next.as_ref() }.val) { - return Some(FindMut { - is_head: false, - prev_index: Some(current), - index: Some(next), - list: self, - maybe_changed: false, - }); - } - - current = next; - } - - None - } - - /// Peek at the first element. - pub fn peek(&self) -> Option<&T> { - self.head.map(|head| unsafe { &head.as_ref().val }) - } - - /// Pops the first element in the list. - /// - /// Complexity is worst-case `O(1)`. - pub fn pop(&mut self) -> Option<&'a Node> { - if let Some(head) = self.head { - let v = unsafe { head.as_ref() }; - self.head = v.next; - Some(v) - } else { - None - } - } - - /// Checks if the linked list is empty. - #[inline] - pub fn is_empty(&self) -> bool { - self.head.is_none() - } -} - -/// Iterator for the linked list. -pub struct Iter<'a, T, K> -where - T: Ord, - K: Kind, -{ - _list: &'a IntrusiveSortedLinkedList<'a, T, K>, - index: Option>>, -} - -impl<'a, T, K> Iterator for Iter<'a, T, K> -where - T: Ord, - K: Kind, -{ - type Item = &'a T; - - fn next(&mut self) -> Option { - let index = self.index?; - - let node = unsafe { index.as_ref() }; - self.index = node.next; - - Some(&node.val) - } -} - -/// Comes from [`IntrusiveSortedLinkedList::find_mut`]. -pub struct FindMut<'a, 'b, T, K> -where - T: Ord + 'b, - K: Kind, -{ - list: &'a mut IntrusiveSortedLinkedList<'b, T, K>, - is_head: bool, - prev_index: Option>>, - index: Option>>, - maybe_changed: bool, -} - -impl<'a, 'b, T, K> FindMut<'a, 'b, T, K> -where - T: Ord, - K: Kind, -{ - unsafe fn pop_internal(&mut self) -> &'b mut Node { - if self.is_head { - // If it is the head element, we can do a normal pop - let mut head = self.list.head.unwrap_unchecked(); - let v = head.as_mut(); - self.list.head = v.next; - v - } else { - // Somewhere in the list - let mut prev = self.prev_index.unwrap_unchecked(); - let mut curr = self.index.unwrap_unchecked(); - - // Re-point the previous index - prev.as_mut().next = curr.as_ref().next; - - curr.as_mut() - } - } - - /// This will pop the element from the list. - /// - /// Complexity is worst-case `O(1)`. - #[inline] - pub fn pop(mut self) -> &'b mut Node { - unsafe { self.pop_internal() } - } - - /// This will resort the element into the correct position in the list if needed. The resorting - /// will only happen if the element has been accessed mutably. - /// - /// Same as calling `drop`. - /// - /// Complexity is worst-case `O(N)`. - #[inline] - pub fn finish(self) { - drop(self) - } -} - -impl<'b, T, K> Drop for FindMut<'_, 'b, T, K> -where - T: Ord + 'b, - K: Kind, -{ - fn drop(&mut self) { - // Only resort the list if the element has changed - if self.maybe_changed { - unsafe { - let val = self.pop_internal(); - self.list.push(val); - } - } - } -} - -impl Deref for FindMut<'_, '_, T, K> -where - T: Ord, - K: Kind, -{ - type Target = T; - - fn deref(&self) -> &Self::Target { - unsafe { &self.index.unwrap_unchecked().as_ref().val } - } -} - -impl DerefMut for FindMut<'_, '_, T, K> -where - T: Ord, - K: Kind, -{ - fn deref_mut(&mut self) -> &mut Self::Target { - self.maybe_changed = true; - unsafe { &mut self.index.unwrap_unchecked().as_mut().val } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn const_new() { - static mut _V1: IntrusiveSortedLinkedList = IntrusiveSortedLinkedList::new(); - } - - #[test] - fn test_peek() { - let mut ll: IntrusiveSortedLinkedList = IntrusiveSortedLinkedList::new(); - - let mut a = Node { val: 1, next: None }; - ll.push(&mut a); - assert_eq!(ll.peek().unwrap(), &1); - - let mut a = Node { val: 2, next: None }; - ll.push(&mut a); - assert_eq!(ll.peek().unwrap(), &2); - - let mut a = Node { val: 3, next: None }; - ll.push(&mut a); - assert_eq!(ll.peek().unwrap(), &3); - - let mut ll: IntrusiveSortedLinkedList = IntrusiveSortedLinkedList::new(); - - let mut a = Node { val: 2, next: None }; - ll.push(&mut a); - assert_eq!(ll.peek().unwrap(), &2); - - let mut a = Node { val: 1, next: None }; - ll.push(&mut a); - assert_eq!(ll.peek().unwrap(), &1); - - let mut a = Node { val: 3, next: None }; - ll.push(&mut a); - assert_eq!(ll.peek().unwrap(), &1); - } - - #[test] - fn test_empty() { - let ll: IntrusiveSortedLinkedList = IntrusiveSortedLinkedList::new(); - - assert!(ll.is_empty()) - } - - #[test] - fn test_updating() { - let mut ll: IntrusiveSortedLinkedList = IntrusiveSortedLinkedList::new(); - - let mut a = Node { val: 1, next: None }; - ll.push(&mut a); - - let mut a = Node { val: 2, next: None }; - ll.push(&mut a); - - let mut a = Node { val: 3, next: None }; - ll.push(&mut a); - - let mut find = ll.find_mut(|v| *v == 2).unwrap(); - - *find += 1000; - find.finish(); - - assert_eq!(ll.peek().unwrap(), &1002); - - let mut find = ll.find_mut(|v| *v == 3).unwrap(); - - *find += 1000; - find.finish(); - - assert_eq!(ll.peek().unwrap(), &1003); - - // Remove largest element - ll.find_mut(|v| *v == 1003).unwrap().pop(); - - assert_eq!(ll.peek().unwrap(), &1002); - } - - #[test] - fn test_updating_1() { - let mut ll: IntrusiveSortedLinkedList = IntrusiveSortedLinkedList::new(); - - let mut a = Node { val: 1, next: None }; - ll.push(&mut a); - - let v = ll.pop().unwrap(); - - assert_eq!(v.val, 1); - } - - #[test] - fn test_updating_2() { - let mut ll: IntrusiveSortedLinkedList = IntrusiveSortedLinkedList::new(); - - let mut a = Node { val: 1, next: None }; - ll.push(&mut a); - - let mut find = ll.find_mut(|v| *v == 1).unwrap(); - - *find += 1000; - find.finish(); - - assert_eq!(ll.peek().unwrap(), &1001); - } -} diff --git a/.cargo/config.toml b/rtic/.cargo/config.toml similarity index 100% rename from .cargo/config.toml rename to rtic/.cargo/config.toml diff --git a/rtic/.gitignore b/rtic/.gitignore new file mode 100644 index 0000000000..c4002562d3 --- /dev/null +++ b/rtic/.gitignore @@ -0,0 +1,6 @@ +**/*.rs.bk +.#* +.gdb_history +/target +Cargo.lock +*.hex diff --git a/CHANGELOG.md b/rtic/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to rtic/CHANGELOG.md diff --git a/Cargo.toml b/rtic/Cargo.toml similarity index 100% rename from Cargo.toml rename to rtic/Cargo.toml diff --git a/build.rs b/rtic/build.rs similarity index 100% rename from build.rs rename to rtic/build.rs diff --git a/ci/expected/async-delay.run b/rtic/ci/expected/async-delay.run similarity index 100% rename from ci/expected/async-delay.run rename to rtic/ci/expected/async-delay.run diff --git a/ci/expected/async-infinite-loop.run b/rtic/ci/expected/async-infinite-loop.run similarity index 100% rename from ci/expected/async-infinite-loop.run rename to rtic/ci/expected/async-infinite-loop.run diff --git a/ci/expected/async-task-multiple-prios.run b/rtic/ci/expected/async-task-multiple-prios.run similarity index 100% rename from ci/expected/async-task-multiple-prios.run rename to rtic/ci/expected/async-task-multiple-prios.run diff --git a/ci/expected/async-task.run b/rtic/ci/expected/async-task.run similarity index 100% rename from ci/expected/async-task.run rename to rtic/ci/expected/async-task.run diff --git a/ci/expected/async-timeout.run b/rtic/ci/expected/async-timeout.run similarity index 100% rename from ci/expected/async-timeout.run rename to rtic/ci/expected/async-timeout.run diff --git a/ci/expected/big-struct-opt.run b/rtic/ci/expected/big-struct-opt.run similarity index 100% rename from ci/expected/big-struct-opt.run rename to rtic/ci/expected/big-struct-opt.run diff --git a/ci/expected/binds.run b/rtic/ci/expected/binds.run similarity index 100% rename from ci/expected/binds.run rename to rtic/ci/expected/binds.run diff --git a/ci/expected/cancel-reschedule.run b/rtic/ci/expected/cancel-reschedule.run similarity index 100% rename from ci/expected/cancel-reschedule.run rename to rtic/ci/expected/cancel-reschedule.run diff --git a/ci/expected/capacity.run b/rtic/ci/expected/capacity.run similarity index 100% rename from ci/expected/capacity.run rename to rtic/ci/expected/capacity.run diff --git a/ci/expected/cfg-whole-task.run b/rtic/ci/expected/cfg-whole-task.run similarity index 100% rename from ci/expected/cfg-whole-task.run rename to rtic/ci/expected/cfg-whole-task.run diff --git a/ci/expected/common.run b/rtic/ci/expected/common.run similarity index 100% rename from ci/expected/common.run rename to rtic/ci/expected/common.run diff --git a/ci/expected/complex.run b/rtic/ci/expected/complex.run similarity index 100% rename from ci/expected/complex.run rename to rtic/ci/expected/complex.run diff --git a/ci/expected/declared_locals.run b/rtic/ci/expected/declared_locals.run similarity index 100% rename from ci/expected/declared_locals.run rename to rtic/ci/expected/declared_locals.run diff --git a/ci/expected/destructure.run b/rtic/ci/expected/destructure.run similarity index 100% rename from ci/expected/destructure.run rename to rtic/ci/expected/destructure.run diff --git a/ci/expected/extern_binds.run b/rtic/ci/expected/extern_binds.run similarity index 100% rename from ci/expected/extern_binds.run rename to rtic/ci/expected/extern_binds.run diff --git a/ci/expected/extern_spawn.run b/rtic/ci/expected/extern_spawn.run similarity index 100% rename from ci/expected/extern_spawn.run rename to rtic/ci/expected/extern_spawn.run diff --git a/ci/expected/generics.run b/rtic/ci/expected/generics.run similarity index 100% rename from ci/expected/generics.run rename to rtic/ci/expected/generics.run diff --git a/ci/expected/hardware.run b/rtic/ci/expected/hardware.run similarity index 100% rename from ci/expected/hardware.run rename to rtic/ci/expected/hardware.run diff --git a/ci/expected/idle-wfi.run b/rtic/ci/expected/idle-wfi.run similarity index 100% rename from ci/expected/idle-wfi.run rename to rtic/ci/expected/idle-wfi.run diff --git a/ci/expected/idle.run b/rtic/ci/expected/idle.run similarity index 100% rename from ci/expected/idle.run rename to rtic/ci/expected/idle.run diff --git a/ci/expected/init.run b/rtic/ci/expected/init.run similarity index 100% rename from ci/expected/init.run rename to rtic/ci/expected/init.run diff --git a/ci/expected/locals.run b/rtic/ci/expected/locals.run similarity index 100% rename from ci/expected/locals.run rename to rtic/ci/expected/locals.run diff --git a/ci/expected/lock-free.run b/rtic/ci/expected/lock-free.run similarity index 100% rename from ci/expected/lock-free.run rename to rtic/ci/expected/lock-free.run diff --git a/ci/expected/lock.run b/rtic/ci/expected/lock.run similarity index 100% rename from ci/expected/lock.run rename to rtic/ci/expected/lock.run diff --git a/ci/expected/message.run b/rtic/ci/expected/message.run similarity index 100% rename from ci/expected/message.run rename to rtic/ci/expected/message.run diff --git a/ci/expected/message_passing.run b/rtic/ci/expected/message_passing.run similarity index 100% rename from ci/expected/message_passing.run rename to rtic/ci/expected/message_passing.run diff --git a/ci/expected/multilock.run b/rtic/ci/expected/multilock.run similarity index 100% rename from ci/expected/multilock.run rename to rtic/ci/expected/multilock.run diff --git a/ci/expected/not-sync.run b/rtic/ci/expected/not-sync.run similarity index 100% rename from ci/expected/not-sync.run rename to rtic/ci/expected/not-sync.run diff --git a/ci/expected/only-shared-access.run b/rtic/ci/expected/only-shared-access.run similarity index 100% rename from ci/expected/only-shared-access.run rename to rtic/ci/expected/only-shared-access.run diff --git a/ci/expected/periodic-at.run b/rtic/ci/expected/periodic-at.run similarity index 100% rename from ci/expected/periodic-at.run rename to rtic/ci/expected/periodic-at.run diff --git a/ci/expected/periodic-at2.run b/rtic/ci/expected/periodic-at2.run similarity index 100% rename from ci/expected/periodic-at2.run rename to rtic/ci/expected/periodic-at2.run diff --git a/ci/expected/periodic.run b/rtic/ci/expected/periodic.run similarity index 100% rename from ci/expected/periodic.run rename to rtic/ci/expected/periodic.run diff --git a/ci/expected/peripherals-taken.run b/rtic/ci/expected/peripherals-taken.run similarity index 100% rename from ci/expected/peripherals-taken.run rename to rtic/ci/expected/peripherals-taken.run diff --git a/ci/expected/pool.run b/rtic/ci/expected/pool.run similarity index 100% rename from ci/expected/pool.run rename to rtic/ci/expected/pool.run diff --git a/ci/expected/preempt.run b/rtic/ci/expected/preempt.run similarity index 100% rename from ci/expected/preempt.run rename to rtic/ci/expected/preempt.run diff --git a/ci/expected/ramfunc.run b/rtic/ci/expected/ramfunc.run similarity index 100% rename from ci/expected/ramfunc.run rename to rtic/ci/expected/ramfunc.run diff --git a/ci/expected/ramfunc.run.grep.bar b/rtic/ci/expected/ramfunc.run.grep.bar similarity index 100% rename from ci/expected/ramfunc.run.grep.bar rename to rtic/ci/expected/ramfunc.run.grep.bar diff --git a/ci/expected/ramfunc.run.grep.foo b/rtic/ci/expected/ramfunc.run.grep.foo similarity index 100% rename from ci/expected/ramfunc.run.grep.foo rename to rtic/ci/expected/ramfunc.run.grep.foo diff --git a/ci/expected/resource-user-struct.run b/rtic/ci/expected/resource-user-struct.run similarity index 100% rename from ci/expected/resource-user-struct.run rename to rtic/ci/expected/resource-user-struct.run diff --git a/ci/expected/schedule.run b/rtic/ci/expected/schedule.run similarity index 100% rename from ci/expected/schedule.run rename to rtic/ci/expected/schedule.run diff --git a/ci/expected/shared.run b/rtic/ci/expected/shared.run similarity index 100% rename from ci/expected/shared.run rename to rtic/ci/expected/shared.run diff --git a/ci/expected/smallest.run b/rtic/ci/expected/smallest.run similarity index 100% rename from ci/expected/smallest.run rename to rtic/ci/expected/smallest.run diff --git a/ci/expected/spawn.run b/rtic/ci/expected/spawn.run similarity index 100% rename from ci/expected/spawn.run rename to rtic/ci/expected/spawn.run diff --git a/ci/expected/static.run b/rtic/ci/expected/static.run similarity index 100% rename from ci/expected/static.run rename to rtic/ci/expected/static.run diff --git a/ci/expected/t-binds.run b/rtic/ci/expected/t-binds.run similarity index 100% rename from ci/expected/t-binds.run rename to rtic/ci/expected/t-binds.run diff --git a/ci/expected/t-cfg-resources.run b/rtic/ci/expected/t-cfg-resources.run similarity index 100% rename from ci/expected/t-cfg-resources.run rename to rtic/ci/expected/t-cfg-resources.run diff --git a/ci/expected/t-htask-main.run b/rtic/ci/expected/t-htask-main.run similarity index 100% rename from ci/expected/t-htask-main.run rename to rtic/ci/expected/t-htask-main.run diff --git a/ci/expected/t-idle-main.run b/rtic/ci/expected/t-idle-main.run similarity index 100% rename from ci/expected/t-idle-main.run rename to rtic/ci/expected/t-idle-main.run diff --git a/ci/expected/t-late-not-send.run b/rtic/ci/expected/t-late-not-send.run similarity index 100% rename from ci/expected/t-late-not-send.run rename to rtic/ci/expected/t-late-not-send.run diff --git a/ci/expected/t-schedule.run b/rtic/ci/expected/t-schedule.run similarity index 100% rename from ci/expected/t-schedule.run rename to rtic/ci/expected/t-schedule.run diff --git a/ci/expected/t-spawn.run b/rtic/ci/expected/t-spawn.run similarity index 100% rename from ci/expected/t-spawn.run rename to rtic/ci/expected/t-spawn.run diff --git a/ci/expected/task.run b/rtic/ci/expected/task.run similarity index 100% rename from ci/expected/task.run rename to rtic/ci/expected/task.run diff --git a/ci/expected/zero-prio-task.run b/rtic/ci/expected/zero-prio-task.run similarity index 100% rename from ci/expected/zero-prio-task.run rename to rtic/ci/expected/zero-prio-task.run diff --git a/examples/async-delay.no_rs b/rtic/examples/async-delay.no_rs similarity index 100% rename from examples/async-delay.no_rs rename to rtic/examples/async-delay.no_rs diff --git a/examples/async-infinite-loop.no_rs b/rtic/examples/async-infinite-loop.no_rs similarity index 100% rename from examples/async-infinite-loop.no_rs rename to rtic/examples/async-infinite-loop.no_rs diff --git a/examples/async-task-multiple-prios.rs b/rtic/examples/async-task-multiple-prios.rs similarity index 100% rename from examples/async-task-multiple-prios.rs rename to rtic/examples/async-task-multiple-prios.rs diff --git a/examples/async-task.rs b/rtic/examples/async-task.rs similarity index 100% rename from examples/async-task.rs rename to rtic/examples/async-task.rs diff --git a/examples/async-timeout.no_rs b/rtic/examples/async-timeout.no_rs similarity index 100% rename from examples/async-timeout.no_rs rename to rtic/examples/async-timeout.no_rs diff --git a/examples/big-struct-opt.rs b/rtic/examples/big-struct-opt.rs similarity index 100% rename from examples/big-struct-opt.rs rename to rtic/examples/big-struct-opt.rs diff --git a/examples/binds.rs b/rtic/examples/binds.rs similarity index 100% rename from examples/binds.rs rename to rtic/examples/binds.rs diff --git a/examples/cancel-reschedule.no_rs b/rtic/examples/cancel-reschedule.no_rs similarity index 100% rename from examples/cancel-reschedule.no_rs rename to rtic/examples/cancel-reschedule.no_rs diff --git a/examples/capacity.no_rs b/rtic/examples/capacity.no_rs similarity index 100% rename from examples/capacity.no_rs rename to rtic/examples/capacity.no_rs diff --git a/examples/cfg-whole-task.no_rs b/rtic/examples/cfg-whole-task.no_rs similarity index 100% rename from examples/cfg-whole-task.no_rs rename to rtic/examples/cfg-whole-task.no_rs diff --git a/examples/common.no_rs b/rtic/examples/common.no_rs similarity index 100% rename from examples/common.no_rs rename to rtic/examples/common.no_rs diff --git a/examples/complex.rs b/rtic/examples/complex.rs similarity index 100% rename from examples/complex.rs rename to rtic/examples/complex.rs diff --git a/examples/declared_locals.rs b/rtic/examples/declared_locals.rs similarity index 100% rename from examples/declared_locals.rs rename to rtic/examples/declared_locals.rs diff --git a/examples/destructure.rs b/rtic/examples/destructure.rs similarity index 100% rename from examples/destructure.rs rename to rtic/examples/destructure.rs diff --git a/examples/extern_binds.rs b/rtic/examples/extern_binds.rs similarity index 100% rename from examples/extern_binds.rs rename to rtic/examples/extern_binds.rs diff --git a/examples/extern_spawn.rs b/rtic/examples/extern_spawn.rs similarity index 100% rename from examples/extern_spawn.rs rename to rtic/examples/extern_spawn.rs diff --git a/examples/generics.rs b/rtic/examples/generics.rs similarity index 100% rename from examples/generics.rs rename to rtic/examples/generics.rs diff --git a/examples/hardware.rs b/rtic/examples/hardware.rs similarity index 100% rename from examples/hardware.rs rename to rtic/examples/hardware.rs diff --git a/examples/idle-wfi.rs b/rtic/examples/idle-wfi.rs similarity index 100% rename from examples/idle-wfi.rs rename to rtic/examples/idle-wfi.rs diff --git a/examples/idle.rs b/rtic/examples/idle.rs similarity index 100% rename from examples/idle.rs rename to rtic/examples/idle.rs diff --git a/examples/init.rs b/rtic/examples/init.rs similarity index 100% rename from examples/init.rs rename to rtic/examples/init.rs diff --git a/examples/locals.rs b/rtic/examples/locals.rs similarity index 100% rename from examples/locals.rs rename to rtic/examples/locals.rs diff --git a/examples/lock-free.no_rs b/rtic/examples/lock-free.no_rs similarity index 100% rename from examples/lock-free.no_rs rename to rtic/examples/lock-free.no_rs diff --git a/examples/lock.rs b/rtic/examples/lock.rs similarity index 100% rename from examples/lock.rs rename to rtic/examples/lock.rs diff --git a/examples/message.no_rs b/rtic/examples/message.no_rs similarity index 100% rename from examples/message.no_rs rename to rtic/examples/message.no_rs diff --git a/examples/message_passing.no_rs b/rtic/examples/message_passing.no_rs similarity index 100% rename from examples/message_passing.no_rs rename to rtic/examples/message_passing.no_rs diff --git a/examples/multilock.rs b/rtic/examples/multilock.rs similarity index 100% rename from examples/multilock.rs rename to rtic/examples/multilock.rs diff --git a/examples/not-sync.rs b/rtic/examples/not-sync.rs similarity index 100% rename from examples/not-sync.rs rename to rtic/examples/not-sync.rs diff --git a/examples/only-shared-access.rs b/rtic/examples/only-shared-access.rs similarity index 100% rename from examples/only-shared-access.rs rename to rtic/examples/only-shared-access.rs diff --git a/examples/periodic-at.no_rs b/rtic/examples/periodic-at.no_rs similarity index 100% rename from examples/periodic-at.no_rs rename to rtic/examples/periodic-at.no_rs diff --git a/examples/periodic-at2.no_rs b/rtic/examples/periodic-at2.no_rs similarity index 100% rename from examples/periodic-at2.no_rs rename to rtic/examples/periodic-at2.no_rs diff --git a/examples/periodic.no_rs b/rtic/examples/periodic.no_rs similarity index 100% rename from examples/periodic.no_rs rename to rtic/examples/periodic.no_rs diff --git a/examples/peripherals-taken.rs b/rtic/examples/peripherals-taken.rs similarity index 100% rename from examples/peripherals-taken.rs rename to rtic/examples/peripherals-taken.rs diff --git a/examples/pool.no_rs b/rtic/examples/pool.no_rs similarity index 100% rename from examples/pool.no_rs rename to rtic/examples/pool.no_rs diff --git a/examples/preempt.rs b/rtic/examples/preempt.rs similarity index 100% rename from examples/preempt.rs rename to rtic/examples/preempt.rs diff --git a/examples/ramfunc.rs b/rtic/examples/ramfunc.rs similarity index 100% rename from examples/ramfunc.rs rename to rtic/examples/ramfunc.rs diff --git a/examples/resource-user-struct.rs b/rtic/examples/resource-user-struct.rs similarity index 100% rename from examples/resource-user-struct.rs rename to rtic/examples/resource-user-struct.rs diff --git a/examples/schedule.no_rs b/rtic/examples/schedule.no_rs similarity index 100% rename from examples/schedule.no_rs rename to rtic/examples/schedule.no_rs diff --git a/examples/shared.rs b/rtic/examples/shared.rs similarity index 100% rename from examples/shared.rs rename to rtic/examples/shared.rs diff --git a/examples/smallest.rs b/rtic/examples/smallest.rs similarity index 100% rename from examples/smallest.rs rename to rtic/examples/smallest.rs diff --git a/examples/spawn.rs b/rtic/examples/spawn.rs similarity index 100% rename from examples/spawn.rs rename to rtic/examples/spawn.rs diff --git a/examples/static.rs b/rtic/examples/static.rs similarity index 100% rename from examples/static.rs rename to rtic/examples/static.rs diff --git a/examples/t-binds.rs b/rtic/examples/t-binds.rs similarity index 100% rename from examples/t-binds.rs rename to rtic/examples/t-binds.rs diff --git a/examples/t-cfg-resources.rs b/rtic/examples/t-cfg-resources.rs similarity index 100% rename from examples/t-cfg-resources.rs rename to rtic/examples/t-cfg-resources.rs diff --git a/examples/t-htask-main.rs b/rtic/examples/t-htask-main.rs similarity index 100% rename from examples/t-htask-main.rs rename to rtic/examples/t-htask-main.rs diff --git a/examples/t-idle-main.rs b/rtic/examples/t-idle-main.rs similarity index 100% rename from examples/t-idle-main.rs rename to rtic/examples/t-idle-main.rs diff --git a/examples/t-late-not-send.rs b/rtic/examples/t-late-not-send.rs similarity index 100% rename from examples/t-late-not-send.rs rename to rtic/examples/t-late-not-send.rs diff --git a/examples/t-schedule.no_rs b/rtic/examples/t-schedule.no_rs similarity index 100% rename from examples/t-schedule.no_rs rename to rtic/examples/t-schedule.no_rs diff --git a/examples/t-spawn.no_rs b/rtic/examples/t-spawn.no_rs similarity index 100% rename from examples/t-spawn.no_rs rename to rtic/examples/t-spawn.no_rs diff --git a/examples/task.rs b/rtic/examples/task.rs similarity index 100% rename from examples/task.rs rename to rtic/examples/task.rs diff --git a/examples/zero-prio-task.rs b/rtic/examples/zero-prio-task.rs similarity index 100% rename from examples/zero-prio-task.rs rename to rtic/examples/zero-prio-task.rs diff --git a/macros/.gitignore b/rtic/macros/.gitignore similarity index 100% rename from macros/.gitignore rename to rtic/macros/.gitignore diff --git a/macros/Cargo.toml b/rtic/macros/Cargo.toml similarity index 99% rename from macros/Cargo.toml rename to rtic/macros/Cargo.toml index 1cc955657b..2041d37c8a 100644 --- a/macros/Cargo.toml +++ b/rtic/macros/Cargo.toml @@ -21,7 +21,7 @@ version = "2.0.0-alpha.0" [lib] proc-macro = true -[feature] +[features] default = [] debugprint = [] # list of supported codegen backends diff --git a/macros/src/analyze.rs b/rtic/macros/src/analyze.rs similarity index 100% rename from macros/src/analyze.rs rename to rtic/macros/src/analyze.rs diff --git a/macros/src/bindings.rs b/rtic/macros/src/bindings.rs similarity index 100% rename from macros/src/bindings.rs rename to rtic/macros/src/bindings.rs diff --git a/macros/src/check.rs b/rtic/macros/src/check.rs similarity index 100% rename from macros/src/check.rs rename to rtic/macros/src/check.rs diff --git a/macros/src/codegen.rs b/rtic/macros/src/codegen.rs similarity index 100% rename from macros/src/codegen.rs rename to rtic/macros/src/codegen.rs diff --git a/macros/src/codegen/assertions.rs b/rtic/macros/src/codegen/assertions.rs similarity index 100% rename from macros/src/codegen/assertions.rs rename to rtic/macros/src/codegen/assertions.rs diff --git a/macros/src/codegen/async_dispatchers.rs b/rtic/macros/src/codegen/async_dispatchers.rs similarity index 100% rename from macros/src/codegen/async_dispatchers.rs rename to rtic/macros/src/codegen/async_dispatchers.rs diff --git a/macros/src/codegen/hardware_tasks.rs b/rtic/macros/src/codegen/hardware_tasks.rs similarity index 100% rename from macros/src/codegen/hardware_tasks.rs rename to rtic/macros/src/codegen/hardware_tasks.rs diff --git a/macros/src/codegen/idle.rs b/rtic/macros/src/codegen/idle.rs similarity index 100% rename from macros/src/codegen/idle.rs rename to rtic/macros/src/codegen/idle.rs diff --git a/macros/src/codegen/init.rs b/rtic/macros/src/codegen/init.rs similarity index 100% rename from macros/src/codegen/init.rs rename to rtic/macros/src/codegen/init.rs diff --git a/macros/src/codegen/local_resources.rs b/rtic/macros/src/codegen/local_resources.rs similarity index 100% rename from macros/src/codegen/local_resources.rs rename to rtic/macros/src/codegen/local_resources.rs diff --git a/macros/src/codegen/local_resources_struct.rs b/rtic/macros/src/codegen/local_resources_struct.rs similarity index 100% rename from macros/src/codegen/local_resources_struct.rs rename to rtic/macros/src/codegen/local_resources_struct.rs diff --git a/macros/src/codegen/main.rs b/rtic/macros/src/codegen/main.rs similarity index 100% rename from macros/src/codegen/main.rs rename to rtic/macros/src/codegen/main.rs diff --git a/macros/src/codegen/module.rs b/rtic/macros/src/codegen/module.rs similarity index 100% rename from macros/src/codegen/module.rs rename to rtic/macros/src/codegen/module.rs diff --git a/macros/src/codegen/post_init.rs b/rtic/macros/src/codegen/post_init.rs similarity index 100% rename from macros/src/codegen/post_init.rs rename to rtic/macros/src/codegen/post_init.rs diff --git a/macros/src/codegen/pre_init.rs b/rtic/macros/src/codegen/pre_init.rs similarity index 100% rename from macros/src/codegen/pre_init.rs rename to rtic/macros/src/codegen/pre_init.rs diff --git a/macros/src/codegen/shared_resources.rs b/rtic/macros/src/codegen/shared_resources.rs similarity index 100% rename from macros/src/codegen/shared_resources.rs rename to rtic/macros/src/codegen/shared_resources.rs diff --git a/macros/src/codegen/shared_resources_struct.rs b/rtic/macros/src/codegen/shared_resources_struct.rs similarity index 100% rename from macros/src/codegen/shared_resources_struct.rs rename to rtic/macros/src/codegen/shared_resources_struct.rs diff --git a/macros/src/codegen/software_tasks.rs b/rtic/macros/src/codegen/software_tasks.rs similarity index 100% rename from macros/src/codegen/software_tasks.rs rename to rtic/macros/src/codegen/software_tasks.rs diff --git a/macros/src/codegen/util.rs b/rtic/macros/src/codegen/util.rs similarity index 100% rename from macros/src/codegen/util.rs rename to rtic/macros/src/codegen/util.rs diff --git a/macros/src/lib.rs b/rtic/macros/src/lib.rs similarity index 100% rename from macros/src/lib.rs rename to rtic/macros/src/lib.rs diff --git a/macros/src/syntax.rs b/rtic/macros/src/syntax.rs similarity index 100% rename from macros/src/syntax.rs rename to rtic/macros/src/syntax.rs diff --git a/macros/src/syntax/.github/bors.toml b/rtic/macros/src/syntax/.github/bors.toml similarity index 100% rename from macros/src/syntax/.github/bors.toml rename to rtic/macros/src/syntax/.github/bors.toml diff --git a/macros/src/syntax/.github/workflows/build.yml b/rtic/macros/src/syntax/.github/workflows/build.yml similarity index 100% rename from macros/src/syntax/.github/workflows/build.yml rename to rtic/macros/src/syntax/.github/workflows/build.yml diff --git a/macros/src/syntax/.github/workflows/changelog.yml b/rtic/macros/src/syntax/.github/workflows/changelog.yml similarity index 100% rename from macros/src/syntax/.github/workflows/changelog.yml rename to rtic/macros/src/syntax/.github/workflows/changelog.yml diff --git a/macros/src/syntax/.github/workflows/properties/build.properties.json b/rtic/macros/src/syntax/.github/workflows/properties/build.properties.json similarity index 100% rename from macros/src/syntax/.github/workflows/properties/build.properties.json rename to rtic/macros/src/syntax/.github/workflows/properties/build.properties.json diff --git a/macros/src/syntax/.gitignore b/rtic/macros/src/syntax/.gitignore similarity index 100% rename from macros/src/syntax/.gitignore rename to rtic/macros/src/syntax/.gitignore diff --git a/macros/src/syntax/.travis.yml b/rtic/macros/src/syntax/.travis.yml similarity index 100% rename from macros/src/syntax/.travis.yml rename to rtic/macros/src/syntax/.travis.yml diff --git a/macros/src/syntax/accessors.rs b/rtic/macros/src/syntax/accessors.rs similarity index 100% rename from macros/src/syntax/accessors.rs rename to rtic/macros/src/syntax/accessors.rs diff --git a/macros/src/syntax/analyze.rs b/rtic/macros/src/syntax/analyze.rs similarity index 100% rename from macros/src/syntax/analyze.rs rename to rtic/macros/src/syntax/analyze.rs diff --git a/macros/src/syntax/ast.rs b/rtic/macros/src/syntax/ast.rs similarity index 100% rename from macros/src/syntax/ast.rs rename to rtic/macros/src/syntax/ast.rs diff --git a/macros/src/syntax/check.rs b/rtic/macros/src/syntax/check.rs similarity index 100% rename from macros/src/syntax/check.rs rename to rtic/macros/src/syntax/check.rs diff --git a/macros/src/syntax/optimize.rs b/rtic/macros/src/syntax/optimize.rs similarity index 100% rename from macros/src/syntax/optimize.rs rename to rtic/macros/src/syntax/optimize.rs diff --git a/macros/src/syntax/parse.rs b/rtic/macros/src/syntax/parse.rs similarity index 100% rename from macros/src/syntax/parse.rs rename to rtic/macros/src/syntax/parse.rs diff --git a/macros/src/syntax/parse/app.rs b/rtic/macros/src/syntax/parse/app.rs similarity index 100% rename from macros/src/syntax/parse/app.rs rename to rtic/macros/src/syntax/parse/app.rs diff --git a/macros/src/syntax/parse/hardware_task.rs b/rtic/macros/src/syntax/parse/hardware_task.rs similarity index 100% rename from macros/src/syntax/parse/hardware_task.rs rename to rtic/macros/src/syntax/parse/hardware_task.rs diff --git a/macros/src/syntax/parse/idle.rs b/rtic/macros/src/syntax/parse/idle.rs similarity index 100% rename from macros/src/syntax/parse/idle.rs rename to rtic/macros/src/syntax/parse/idle.rs diff --git a/macros/src/syntax/parse/init.rs b/rtic/macros/src/syntax/parse/init.rs similarity index 100% rename from macros/src/syntax/parse/init.rs rename to rtic/macros/src/syntax/parse/init.rs diff --git a/macros/src/syntax/parse/resource.rs b/rtic/macros/src/syntax/parse/resource.rs similarity index 100% rename from macros/src/syntax/parse/resource.rs rename to rtic/macros/src/syntax/parse/resource.rs diff --git a/macros/src/syntax/parse/software_task.rs b/rtic/macros/src/syntax/parse/software_task.rs similarity index 100% rename from macros/src/syntax/parse/software_task.rs rename to rtic/macros/src/syntax/parse/software_task.rs diff --git a/macros/src/syntax/parse/util.rs b/rtic/macros/src/syntax/parse/util.rs similarity index 100% rename from macros/src/syntax/parse/util.rs rename to rtic/macros/src/syntax/parse/util.rs diff --git a/macros/tests/ui.rs b/rtic/macros/tests/ui.rs similarity index 100% rename from macros/tests/ui.rs rename to rtic/macros/tests/ui.rs diff --git a/macros/ui/extern-interrupt-used.rs b/rtic/macros/ui/extern-interrupt-used.rs similarity index 100% rename from macros/ui/extern-interrupt-used.rs rename to rtic/macros/ui/extern-interrupt-used.rs diff --git a/macros/ui/extern-interrupt-used.stderr b/rtic/macros/ui/extern-interrupt-used.stderr similarity index 100% rename from macros/ui/extern-interrupt-used.stderr rename to rtic/macros/ui/extern-interrupt-used.stderr diff --git a/macros/ui/idle-double-local.rs b/rtic/macros/ui/idle-double-local.rs similarity index 100% rename from macros/ui/idle-double-local.rs rename to rtic/macros/ui/idle-double-local.rs diff --git a/macros/ui/idle-double-local.stderr b/rtic/macros/ui/idle-double-local.stderr similarity index 100% rename from macros/ui/idle-double-local.stderr rename to rtic/macros/ui/idle-double-local.stderr diff --git a/macros/ui/idle-double-shared.rs b/rtic/macros/ui/idle-double-shared.rs similarity index 100% rename from macros/ui/idle-double-shared.rs rename to rtic/macros/ui/idle-double-shared.rs diff --git a/macros/ui/idle-double-shared.stderr b/rtic/macros/ui/idle-double-shared.stderr similarity index 100% rename from macros/ui/idle-double-shared.stderr rename to rtic/macros/ui/idle-double-shared.stderr diff --git a/macros/ui/idle-input.rs b/rtic/macros/ui/idle-input.rs similarity index 100% rename from macros/ui/idle-input.rs rename to rtic/macros/ui/idle-input.rs diff --git a/macros/ui/idle-input.stderr b/rtic/macros/ui/idle-input.stderr similarity index 100% rename from macros/ui/idle-input.stderr rename to rtic/macros/ui/idle-input.stderr diff --git a/macros/ui/idle-no-context.rs b/rtic/macros/ui/idle-no-context.rs similarity index 100% rename from macros/ui/idle-no-context.rs rename to rtic/macros/ui/idle-no-context.rs diff --git a/macros/ui/idle-no-context.stderr b/rtic/macros/ui/idle-no-context.stderr similarity index 100% rename from macros/ui/idle-no-context.stderr rename to rtic/macros/ui/idle-no-context.stderr diff --git a/macros/ui/idle-not-divergent.rs b/rtic/macros/ui/idle-not-divergent.rs similarity index 100% rename from macros/ui/idle-not-divergent.rs rename to rtic/macros/ui/idle-not-divergent.rs diff --git a/macros/ui/idle-not-divergent.stderr b/rtic/macros/ui/idle-not-divergent.stderr similarity index 100% rename from macros/ui/idle-not-divergent.stderr rename to rtic/macros/ui/idle-not-divergent.stderr diff --git a/macros/ui/idle-output.rs b/rtic/macros/ui/idle-output.rs similarity index 100% rename from macros/ui/idle-output.rs rename to rtic/macros/ui/idle-output.rs diff --git a/macros/ui/idle-output.stderr b/rtic/macros/ui/idle-output.stderr similarity index 100% rename from macros/ui/idle-output.stderr rename to rtic/macros/ui/idle-output.stderr diff --git a/macros/ui/idle-pub.rs b/rtic/macros/ui/idle-pub.rs similarity index 100% rename from macros/ui/idle-pub.rs rename to rtic/macros/ui/idle-pub.rs diff --git a/macros/ui/idle-pub.stderr b/rtic/macros/ui/idle-pub.stderr similarity index 100% rename from macros/ui/idle-pub.stderr rename to rtic/macros/ui/idle-pub.stderr diff --git a/macros/ui/idle-unsafe.rs b/rtic/macros/ui/idle-unsafe.rs similarity index 100% rename from macros/ui/idle-unsafe.rs rename to rtic/macros/ui/idle-unsafe.rs diff --git a/macros/ui/idle-unsafe.stderr b/rtic/macros/ui/idle-unsafe.stderr similarity index 100% rename from macros/ui/idle-unsafe.stderr rename to rtic/macros/ui/idle-unsafe.stderr diff --git a/macros/ui/init-divergent.rs b/rtic/macros/ui/init-divergent.rs similarity index 100% rename from macros/ui/init-divergent.rs rename to rtic/macros/ui/init-divergent.rs diff --git a/macros/ui/init-divergent.stderr b/rtic/macros/ui/init-divergent.stderr similarity index 100% rename from macros/ui/init-divergent.stderr rename to rtic/macros/ui/init-divergent.stderr diff --git a/macros/ui/init-double-local.rs b/rtic/macros/ui/init-double-local.rs similarity index 100% rename from macros/ui/init-double-local.rs rename to rtic/macros/ui/init-double-local.rs diff --git a/macros/ui/init-double-local.stderr b/rtic/macros/ui/init-double-local.stderr similarity index 100% rename from macros/ui/init-double-local.stderr rename to rtic/macros/ui/init-double-local.stderr diff --git a/macros/ui/init-double-shared.rs b/rtic/macros/ui/init-double-shared.rs similarity index 100% rename from macros/ui/init-double-shared.rs rename to rtic/macros/ui/init-double-shared.rs diff --git a/macros/ui/init-double-shared.stderr b/rtic/macros/ui/init-double-shared.stderr similarity index 100% rename from macros/ui/init-double-shared.stderr rename to rtic/macros/ui/init-double-shared.stderr diff --git a/macros/ui/init-input.rs b/rtic/macros/ui/init-input.rs similarity index 100% rename from macros/ui/init-input.rs rename to rtic/macros/ui/init-input.rs diff --git a/macros/ui/init-input.stderr b/rtic/macros/ui/init-input.stderr similarity index 100% rename from macros/ui/init-input.stderr rename to rtic/macros/ui/init-input.stderr diff --git a/macros/ui/init-no-context.rs b/rtic/macros/ui/init-no-context.rs similarity index 100% rename from macros/ui/init-no-context.rs rename to rtic/macros/ui/init-no-context.rs diff --git a/macros/ui/init-no-context.stderr b/rtic/macros/ui/init-no-context.stderr similarity index 100% rename from macros/ui/init-no-context.stderr rename to rtic/macros/ui/init-no-context.stderr diff --git a/macros/ui/init-output.rs b/rtic/macros/ui/init-output.rs similarity index 100% rename from macros/ui/init-output.rs rename to rtic/macros/ui/init-output.rs diff --git a/macros/ui/init-output.stderr b/rtic/macros/ui/init-output.stderr similarity index 100% rename from macros/ui/init-output.stderr rename to rtic/macros/ui/init-output.stderr diff --git a/macros/ui/init-pub.rs b/rtic/macros/ui/init-pub.rs similarity index 100% rename from macros/ui/init-pub.rs rename to rtic/macros/ui/init-pub.rs diff --git a/macros/ui/init-pub.stderr b/rtic/macros/ui/init-pub.stderr similarity index 100% rename from macros/ui/init-pub.stderr rename to rtic/macros/ui/init-pub.stderr diff --git a/macros/ui/init-unsafe.rs b/rtic/macros/ui/init-unsafe.rs similarity index 100% rename from macros/ui/init-unsafe.rs rename to rtic/macros/ui/init-unsafe.rs diff --git a/macros/ui/init-unsafe.stderr b/rtic/macros/ui/init-unsafe.stderr similarity index 100% rename from macros/ui/init-unsafe.stderr rename to rtic/macros/ui/init-unsafe.stderr diff --git a/macros/ui/interrupt-double.rs b/rtic/macros/ui/interrupt-double.rs similarity index 100% rename from macros/ui/interrupt-double.rs rename to rtic/macros/ui/interrupt-double.rs diff --git a/macros/ui/interrupt-double.stderr b/rtic/macros/ui/interrupt-double.stderr similarity index 100% rename from macros/ui/interrupt-double.stderr rename to rtic/macros/ui/interrupt-double.stderr diff --git a/macros/ui/local-collision-2.rs b/rtic/macros/ui/local-collision-2.rs similarity index 100% rename from macros/ui/local-collision-2.rs rename to rtic/macros/ui/local-collision-2.rs diff --git a/macros/ui/local-collision-2.stderr b/rtic/macros/ui/local-collision-2.stderr similarity index 100% rename from macros/ui/local-collision-2.stderr rename to rtic/macros/ui/local-collision-2.stderr diff --git a/macros/ui/local-collision.rs b/rtic/macros/ui/local-collision.rs similarity index 100% rename from macros/ui/local-collision.rs rename to rtic/macros/ui/local-collision.rs diff --git a/macros/ui/local-collision.stderr b/rtic/macros/ui/local-collision.stderr similarity index 100% rename from macros/ui/local-collision.stderr rename to rtic/macros/ui/local-collision.stderr diff --git a/macros/ui/local-malformed-1.rs b/rtic/macros/ui/local-malformed-1.rs similarity index 100% rename from macros/ui/local-malformed-1.rs rename to rtic/macros/ui/local-malformed-1.rs diff --git a/macros/ui/local-malformed-1.stderr b/rtic/macros/ui/local-malformed-1.stderr similarity index 100% rename from macros/ui/local-malformed-1.stderr rename to rtic/macros/ui/local-malformed-1.stderr diff --git a/macros/ui/local-malformed-2.rs b/rtic/macros/ui/local-malformed-2.rs similarity index 100% rename from macros/ui/local-malformed-2.rs rename to rtic/macros/ui/local-malformed-2.rs diff --git a/macros/ui/local-malformed-2.stderr b/rtic/macros/ui/local-malformed-2.stderr similarity index 100% rename from macros/ui/local-malformed-2.stderr rename to rtic/macros/ui/local-malformed-2.stderr diff --git a/macros/ui/local-malformed-3.rs b/rtic/macros/ui/local-malformed-3.rs similarity index 100% rename from macros/ui/local-malformed-3.rs rename to rtic/macros/ui/local-malformed-3.rs diff --git a/macros/ui/local-malformed-3.stderr b/rtic/macros/ui/local-malformed-3.stderr similarity index 100% rename from macros/ui/local-malformed-3.stderr rename to rtic/macros/ui/local-malformed-3.stderr diff --git a/macros/ui/local-malformed-4.rs b/rtic/macros/ui/local-malformed-4.rs similarity index 100% rename from macros/ui/local-malformed-4.rs rename to rtic/macros/ui/local-malformed-4.rs diff --git a/macros/ui/local-malformed-4.stderr b/rtic/macros/ui/local-malformed-4.stderr similarity index 100% rename from macros/ui/local-malformed-4.stderr rename to rtic/macros/ui/local-malformed-4.stderr diff --git a/macros/ui/local-not-declared.rs b/rtic/macros/ui/local-not-declared.rs similarity index 100% rename from macros/ui/local-not-declared.rs rename to rtic/macros/ui/local-not-declared.rs diff --git a/macros/ui/local-not-declared.stderr b/rtic/macros/ui/local-not-declared.stderr similarity index 100% rename from macros/ui/local-not-declared.stderr rename to rtic/macros/ui/local-not-declared.stderr diff --git a/macros/ui/local-pub.rs b/rtic/macros/ui/local-pub.rs similarity index 100% rename from macros/ui/local-pub.rs rename to rtic/macros/ui/local-pub.rs diff --git a/macros/ui/local-pub.stderr b/rtic/macros/ui/local-pub.stderr similarity index 100% rename from macros/ui/local-pub.stderr rename to rtic/macros/ui/local-pub.stderr diff --git a/macros/ui/local-shared-attribute.rs b/rtic/macros/ui/local-shared-attribute.rs similarity index 100% rename from macros/ui/local-shared-attribute.rs rename to rtic/macros/ui/local-shared-attribute.rs diff --git a/macros/ui/local-shared-attribute.stderr b/rtic/macros/ui/local-shared-attribute.stderr similarity index 100% rename from macros/ui/local-shared-attribute.stderr rename to rtic/macros/ui/local-shared-attribute.stderr diff --git a/macros/ui/local-shared.rs b/rtic/macros/ui/local-shared.rs similarity index 100% rename from macros/ui/local-shared.rs rename to rtic/macros/ui/local-shared.rs diff --git a/macros/ui/local-shared.stderr b/rtic/macros/ui/local-shared.stderr similarity index 100% rename from macros/ui/local-shared.stderr rename to rtic/macros/ui/local-shared.stderr diff --git a/macros/ui/shared-lock-free.rs b/rtic/macros/ui/shared-lock-free.rs similarity index 100% rename from macros/ui/shared-lock-free.rs rename to rtic/macros/ui/shared-lock-free.rs diff --git a/macros/ui/shared-lock-free.stderr b/rtic/macros/ui/shared-lock-free.stderr similarity index 100% rename from macros/ui/shared-lock-free.stderr rename to rtic/macros/ui/shared-lock-free.stderr diff --git a/macros/ui/shared-not-declared.rs b/rtic/macros/ui/shared-not-declared.rs similarity index 100% rename from macros/ui/shared-not-declared.rs rename to rtic/macros/ui/shared-not-declared.rs diff --git a/macros/ui/shared-not-declared.stderr b/rtic/macros/ui/shared-not-declared.stderr similarity index 100% rename from macros/ui/shared-not-declared.stderr rename to rtic/macros/ui/shared-not-declared.stderr diff --git a/macros/ui/shared-pub.rs b/rtic/macros/ui/shared-pub.rs similarity index 100% rename from macros/ui/shared-pub.rs rename to rtic/macros/ui/shared-pub.rs diff --git a/macros/ui/shared-pub.stderr b/rtic/macros/ui/shared-pub.stderr similarity index 100% rename from macros/ui/shared-pub.stderr rename to rtic/macros/ui/shared-pub.stderr diff --git a/macros/ui/task-divergent.rs b/rtic/macros/ui/task-divergent.rs similarity index 100% rename from macros/ui/task-divergent.rs rename to rtic/macros/ui/task-divergent.rs diff --git a/macros/ui/task-divergent.stderr b/rtic/macros/ui/task-divergent.stderr similarity index 100% rename from macros/ui/task-divergent.stderr rename to rtic/macros/ui/task-divergent.stderr diff --git a/macros/ui/task-double-local.rs b/rtic/macros/ui/task-double-local.rs similarity index 100% rename from macros/ui/task-double-local.rs rename to rtic/macros/ui/task-double-local.rs diff --git a/macros/ui/task-double-local.stderr b/rtic/macros/ui/task-double-local.stderr similarity index 100% rename from macros/ui/task-double-local.stderr rename to rtic/macros/ui/task-double-local.stderr diff --git a/macros/ui/task-double-priority.rs b/rtic/macros/ui/task-double-priority.rs similarity index 100% rename from macros/ui/task-double-priority.rs rename to rtic/macros/ui/task-double-priority.rs diff --git a/macros/ui/task-double-priority.stderr b/rtic/macros/ui/task-double-priority.stderr similarity index 100% rename from macros/ui/task-double-priority.stderr rename to rtic/macros/ui/task-double-priority.stderr diff --git a/macros/ui/task-double-shared.rs b/rtic/macros/ui/task-double-shared.rs similarity index 100% rename from macros/ui/task-double-shared.rs rename to rtic/macros/ui/task-double-shared.rs diff --git a/macros/ui/task-double-shared.stderr b/rtic/macros/ui/task-double-shared.stderr similarity index 100% rename from macros/ui/task-double-shared.stderr rename to rtic/macros/ui/task-double-shared.stderr diff --git a/macros/ui/task-idle.rs b/rtic/macros/ui/task-idle.rs similarity index 100% rename from macros/ui/task-idle.rs rename to rtic/macros/ui/task-idle.rs diff --git a/macros/ui/task-idle.stderr b/rtic/macros/ui/task-idle.stderr similarity index 100% rename from macros/ui/task-idle.stderr rename to rtic/macros/ui/task-idle.stderr diff --git a/macros/ui/task-init.rs b/rtic/macros/ui/task-init.rs similarity index 100% rename from macros/ui/task-init.rs rename to rtic/macros/ui/task-init.rs diff --git a/macros/ui/task-init.stderr b/rtic/macros/ui/task-init.stderr similarity index 100% rename from macros/ui/task-init.stderr rename to rtic/macros/ui/task-init.stderr diff --git a/macros/ui/task-interrupt.rs b/rtic/macros/ui/task-interrupt.rs similarity index 100% rename from macros/ui/task-interrupt.rs rename to rtic/macros/ui/task-interrupt.rs diff --git a/macros/ui/task-interrupt.stderr b/rtic/macros/ui/task-interrupt.stderr similarity index 100% rename from macros/ui/task-interrupt.stderr rename to rtic/macros/ui/task-interrupt.stderr diff --git a/macros/ui/task-no-context.rs b/rtic/macros/ui/task-no-context.rs similarity index 100% rename from macros/ui/task-no-context.rs rename to rtic/macros/ui/task-no-context.rs diff --git a/macros/ui/task-no-context.stderr b/rtic/macros/ui/task-no-context.stderr similarity index 100% rename from macros/ui/task-no-context.stderr rename to rtic/macros/ui/task-no-context.stderr diff --git a/macros/ui/task-priority-too-high.rs b/rtic/macros/ui/task-priority-too-high.rs similarity index 100% rename from macros/ui/task-priority-too-high.rs rename to rtic/macros/ui/task-priority-too-high.rs diff --git a/macros/ui/task-priority-too-high.stderr b/rtic/macros/ui/task-priority-too-high.stderr similarity index 100% rename from macros/ui/task-priority-too-high.stderr rename to rtic/macros/ui/task-priority-too-high.stderr diff --git a/macros/ui/task-priority-too-low.rs b/rtic/macros/ui/task-priority-too-low.rs similarity index 100% rename from macros/ui/task-priority-too-low.rs rename to rtic/macros/ui/task-priority-too-low.rs diff --git a/macros/ui/task-priority-too-low.stderr b/rtic/macros/ui/task-priority-too-low.stderr similarity index 100% rename from macros/ui/task-priority-too-low.stderr rename to rtic/macros/ui/task-priority-too-low.stderr diff --git a/macros/ui/task-pub.rs b/rtic/macros/ui/task-pub.rs similarity index 100% rename from macros/ui/task-pub.rs rename to rtic/macros/ui/task-pub.rs diff --git a/macros/ui/task-pub.stderr b/rtic/macros/ui/task-pub.stderr similarity index 100% rename from macros/ui/task-pub.stderr rename to rtic/macros/ui/task-pub.stderr diff --git a/macros/ui/task-unsafe.rs b/rtic/macros/ui/task-unsafe.rs similarity index 100% rename from macros/ui/task-unsafe.rs rename to rtic/macros/ui/task-unsafe.rs diff --git a/macros/ui/task-unsafe.stderr b/rtic/macros/ui/task-unsafe.stderr similarity index 100% rename from macros/ui/task-unsafe.stderr rename to rtic/macros/ui/task-unsafe.stderr diff --git a/macros/ui/task-zero-prio.rs b/rtic/macros/ui/task-zero-prio.rs similarity index 100% rename from macros/ui/task-zero-prio.rs rename to rtic/macros/ui/task-zero-prio.rs diff --git a/macros/ui/task-zero-prio.stderr b/rtic/macros/ui/task-zero-prio.stderr similarity index 100% rename from macros/ui/task-zero-prio.stderr rename to rtic/macros/ui/task-zero-prio.stderr diff --git a/rtic/rust-toolchain.toml b/rtic/rust-toolchain.toml new file mode 100644 index 0000000000..e28b55de64 --- /dev/null +++ b/rtic/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly" +components = [ "rust-src", "rustfmt", "llvm-tools-preview" ] +targets = [ "thumbv6m-none-eabi", "thumbv7m-none-eabi" ] diff --git a/src/export.rs b/rtic/src/export.rs similarity index 100% rename from src/export.rs rename to rtic/src/export.rs diff --git a/src/export/executor.rs b/rtic/src/export/executor.rs similarity index 100% rename from src/export/executor.rs rename to rtic/src/export/executor.rs diff --git a/src/lib.rs b/rtic/src/lib.rs similarity index 100% rename from src/lib.rs rename to rtic/src/lib.rs diff --git a/tests/tests.rs b/rtic/tests/tests.rs similarity index 100% rename from tests/tests.rs rename to rtic/tests/tests.rs diff --git a/ui/exception-invalid.rs b/rtic/ui/exception-invalid.rs similarity index 100% rename from ui/exception-invalid.rs rename to rtic/ui/exception-invalid.rs diff --git a/ui/exception-invalid.stderr b/rtic/ui/exception-invalid.stderr similarity index 100% rename from ui/exception-invalid.stderr rename to rtic/ui/exception-invalid.stderr diff --git a/ui/extern-interrupt-not-enough.rs b/rtic/ui/extern-interrupt-not-enough.rs similarity index 100% rename from ui/extern-interrupt-not-enough.rs rename to rtic/ui/extern-interrupt-not-enough.rs diff --git a/ui/extern-interrupt-not-enough.stderr b/rtic/ui/extern-interrupt-not-enough.stderr similarity index 100% rename from ui/extern-interrupt-not-enough.stderr rename to rtic/ui/extern-interrupt-not-enough.stderr diff --git a/ui/extern-interrupt-used.rs b/rtic/ui/extern-interrupt-used.rs similarity index 100% rename from ui/extern-interrupt-used.rs rename to rtic/ui/extern-interrupt-used.rs diff --git a/ui/extern-interrupt-used.stderr b/rtic/ui/extern-interrupt-used.stderr similarity index 100% rename from ui/extern-interrupt-used.stderr rename to rtic/ui/extern-interrupt-used.stderr diff --git a/ui/task-priority-too-high.rs b/rtic/ui/task-priority-too-high.rs similarity index 100% rename from ui/task-priority-too-high.rs rename to rtic/ui/task-priority-too-high.rs diff --git a/ui/task-priority-too-high.stderr b/rtic/ui/task-priority-too-high.stderr similarity index 100% rename from ui/task-priority-too-high.stderr rename to rtic/ui/task-priority-too-high.stderr diff --git a/ui/unknown-interrupt.rs b/rtic/ui/unknown-interrupt.rs similarity index 100% rename from ui/unknown-interrupt.rs rename to rtic/ui/unknown-interrupt.rs diff --git a/ui/unknown-interrupt.stderr b/rtic/ui/unknown-interrupt.stderr similarity index 100% rename from ui/unknown-interrupt.stderr rename to rtic/ui/unknown-interrupt.stderr diff --git a/ui/v6m-interrupt-not-enough.rs_no b/rtic/ui/v6m-interrupt-not-enough.rs_no similarity index 100% rename from ui/v6m-interrupt-not-enough.rs_no rename to rtic/ui/v6m-interrupt-not-enough.rs_no diff --git a/xtask/Cargo.toml b/rtic/xtask/Cargo.toml similarity index 100% rename from xtask/Cargo.toml rename to rtic/xtask/Cargo.toml diff --git a/xtask/src/build.rs b/rtic/xtask/src/build.rs similarity index 100% rename from xtask/src/build.rs rename to rtic/xtask/src/build.rs diff --git a/xtask/src/command.rs b/rtic/xtask/src/command.rs similarity index 100% rename from xtask/src/command.rs rename to rtic/xtask/src/command.rs diff --git a/xtask/src/main.rs b/rtic/xtask/src/main.rs similarity index 100% rename from xtask/src/main.rs rename to rtic/xtask/src/main.rs