move dispatchers to app argument

This commit is contained in:
Per Lindgren 2020-10-23 10:35:56 +02:00
parent 86699039e9
commit 1c244a995d
37 changed files with 124 additions and 287 deletions

View file

@ -8,7 +8,7 @@
use panic_semihosting as _;
// NOTE: does NOT properly work on QEMU
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
mod app {
use cortex_m_semihosting::{debug, hprintln};
use lm3s6965::Interrupt;
@ -47,11 +47,4 @@ mod app {
// `foo` inherits the baseline of `UART0`: its `start` time
foo::spawn().unwrap();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
mod app {
use cortex_m_semihosting::{debug, hprintln};
use lm3s6965::Interrupt;
@ -40,11 +40,4 @@ mod app {
debug::exit(debug::EXIT_SUCCESS);
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
mod app {
use cortex_m_semihosting::debug;
#[cfg(debug_assertions)]
@ -83,12 +83,4 @@ mod app {
)
.ok();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
fn QEI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
mod app {
use cortex_m_semihosting::debug;
#[cfg(debug_assertions)]
@ -62,12 +62,4 @@ mod app {
)
.ok();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
fn QEI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
mod app {
use rtic::cyccnt::U32Ext;
@ -32,8 +32,4 @@ mod app {
fn task2(_cx: task2::Context) {
task1::schedule(_cx.scheduled + 100.cycles()).ok();
}
extern "C" {
fn SSI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
mod app {
use cortex_m_semihosting::{debug, hprintln};
@ -45,11 +45,4 @@ mod app {
foo::spawn().unwrap();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -12,7 +12,7 @@ pub struct NotSync {
_0: PhantomData<*const ()>,
}
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
mod app {
use super::NotSync;
use core::marker::PhantomData;
@ -40,11 +40,4 @@ mod app {
fn bar(c: bar::Context) {
let _: &NotSync = c.resources.shared;
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -8,7 +8,7 @@
use panic_semihosting as _;
// NOTE: does NOT work on QEMU!
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
mod app {
use cortex_m_semihosting::hprintln;
use rtic::cyccnt::{Instant, U32Ext};
@ -31,11 +31,4 @@ mod app {
foo::schedule(cx.scheduled + PERIOD.cycles()).unwrap();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -15,7 +15,7 @@ use rtic::app;
// Declare a pool of 128-byte memory blocks
pool!(P: [u8; 128]);
#[app(device = lm3s6965)]
#[app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
mod app {
use crate::{Box, Pool};
use cortex_m_semihosting::{debug, hprintln};
@ -65,12 +65,4 @@ mod app {
// this is done automatically so we can omit the call to `drop`
// drop(x);
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
fn QEI0();
}
}

View file

@ -7,7 +7,14 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(
device = lm3s6965,
dispatchers = [
UART0,
#[link_section = ".data.UART1"]
UART1
])
]
mod app {
use cortex_m_semihosting::{debug, hprintln};
@ -33,12 +40,4 @@ mod app {
fn bar(_: bar::Context) {
foo::spawn().unwrap();
}
extern "C" {
fn UART0();
// run the task dispatcher from RAM
#[link_section = ".data.UART1"]
fn UART1();
}
}

View file

@ -8,7 +8,7 @@
use panic_halt as _;
// NOTE: does NOT work on QEMU!
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
mod app {
use cortex_m::peripheral::DWT;
use cortex_m_semihosting::hprintln;
@ -46,11 +46,4 @@ mod app {
fn bar(_: bar::Context) {
hprintln!("bar @ {:?}", Instant::now()).unwrap();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
mod app {
use cortex_m_semihosting::{debug, hprintln};
@ -26,11 +26,4 @@ mod app {
}
foo::spawn(2, 3).unwrap();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
mod app {
use cortex_m_semihosting::{debug, hprintln};
@ -32,11 +32,4 @@ mod app {
hprintln!("foo2 {}", x).unwrap();
foo::spawn(x, 0).unwrap();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -5,7 +5,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0, QEI0])]
mod app {
#[resources]
struct Resources {
@ -47,12 +47,4 @@ mod app {
#[cfg(never)]
#[task]
fn quux(_: quux::Context) {}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
fn QEI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
mod app {
#[init]
fn init(c: init::Context) -> init::LateResources {
@ -18,11 +18,4 @@ mod app {
#[task]
fn some_task(_: some_task::Context) {}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
mod app {
use rtic::cyccnt::{Instant, U32Ext as _};
@ -57,11 +57,4 @@ mod app {
#[task]
fn baz(_: baz::Context, _x: u32, _y: u32) {}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
mod app {
#[init]
fn init(_: init::Context) -> init::LateResources {
@ -55,11 +55,4 @@ mod app {
#[task]
fn baz(_: baz::Context, _x: u32, _y: u32) {}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -5,7 +5,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
mod app {
use cortex_m_semihosting::debug;
@ -20,11 +20,4 @@ mod app {
fn taskmain(_: taskmain::Context) {
debug::exit(debug::EXIT_SUCCESS);
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
mod app {
use cortex_m_semihosting::{debug, hprintln};
@ -47,12 +47,4 @@ mod app {
fn baz(_: baz::Context) {
hprintln!("baz").unwrap();
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
fn QEI0();
}
}

View file

@ -7,7 +7,7 @@
use panic_semihosting as _;
#[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)]
#[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])]
mod app {
use cortex_m_semihosting::debug;
use rtic::cyccnt;
@ -48,11 +48,4 @@ mod app {
let _: &mut u32 = cx.resources.shared;
let _: foo::Resources = cx.resources;
}
// RTIC requires that unused interrupts are declared in an extern block when
// using software tasks; these free interrupts will be used to dispatch the
// software tasks.
extern "C" {
fn SSI0();
}
}