Skip to content

Commit

Permalink
Merge #51
Browse files Browse the repository at this point in the history
51: Resource handling take 2 implementation r=korken89 a=korken89

See rtic-rs/rfcs#46 for design

Co-authored-by: Emil Fresk <[email protected]>
  • Loading branch information
bors[bot] and korken89 authored Jul 8, 2021
2 parents bf4ada4 + 1dd4e79 commit b5389b4
Show file tree
Hide file tree
Showing 161 changed files with 1,415 additions and 1,194 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- [breaking-change] "Resource handling take 2" implemented

- [breaking-change] Move of dispatchers (interrupts) from `extern` to app arguments.
`app(..., dispatchers = [SSI0,...])`
`app(..., dispatchers = [SSI0,...])`
This should also work for ram functions and other attributes, see `examples/ramfunc.rs`.

- [breaking-change] Rework whole spawn/schedule, support `foo::spawn( ... )`,
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords = []
license = "MIT OR Apache-2.0"
name = "rtic-syntax"
repository = "https://github.com/rtic-rs/rtic-syntax"
version = "0.5.0-alpha.3"
version = "0.5.0-alpha.4"

[dependencies]
indexmap = "1.0.2"
Expand Down
10 changes: 7 additions & 3 deletions examples/dispatchers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
])
]
mod app {
#[shared]
struct Shared {}

#[local]
struct Local {}

#[init]
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
init::LateResources {}
}
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {}

#[idle]
fn idle(_: idle::Context) -> ! {}
Expand Down
24 changes: 12 additions & 12 deletions examples/extern_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
mod app {
// task externally implemented
use crate::{bar, foo};
#[resources]
struct Resources {

#[shared]
struct Shared {
a: u32,
}

#[init()]
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
init::LateResources {}
}
#[local]
struct Local {}

#[idle()]
fn idle(_: idle::Context) -> ! {
loop {}
}
#[init]
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {}

#[idle]
fn idle(_: idle::Context) -> ! {}

extern "Rust" {
// Software task
#[task(resources = [a], priority = 2)]
#[task(shared = [a], priority = 2)]
fn foo(_: foo::Context, _: u32);

// Hardware task
#[task(binds = UART0, resources = [a], priority = 2)]
#[task(binds = UART0, shared = [a], priority = 2)]
// #[inline(always)] // would be rejected
fn bar(_: bar::Context);
}
Expand Down
64 changes: 0 additions & 64 deletions examples/local.rs

This file was deleted.

58 changes: 0 additions & 58 deletions examples/single.rs

This file was deleted.

54 changes: 54 additions & 0 deletions examples/test_nr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//! Full syntax

#[mock::app(parse_binds,
dispatchers = [
#[link_section = ".data.UART1"]
A,
#[link_section = ".data.UART2"]
B
])
]
mod app {
#[shared]
struct Shared {
a: u32,
b: u32,
c: u32,
d: u32,
}

#[local]
struct Local {
a: u32,
b: u32,
c: u32,
d: u32,
}

#[init]
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
init::LateResources {}
}

#[idle]
fn idle(_: idle::Context) -> ! {
loop {}
}

#[task]
fn t1(_: t1::Context) {}

#[task(local = [
#[testing1]
#[testing2]
#[link_section = ".example_section"]
q: (u32, core::u8) = (4, 3),
])]
fn t2(_: t2::Context) {}

#[task(local = [ohno: u32 = 0])]
fn t3(_: t3::Context) {}

#[task(local = [ohno: u32 = 0])]
fn t4(_: t4::Context) {}
}
Loading

0 comments on commit b5389b4

Please sign in to comment.