Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app! macro take 2 #34

Merged
merged 49 commits into from
Jul 29, 2017
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
86a360a
rtfm! macro take 2
japaric Jul 4, 2017
4b0c3bf
rtfm!: remove init.resources and make idle.local optional
japaric Jul 6, 2017
3cebf49
syntax tweaks, relax check, add set_pending(), deal with imported types
japaric Jul 7, 2017
17b252a
rename rtfm-macros to cortex-m-rtfm-macros
japaric Jul 9, 2017
e18eb96
fix unused variable warning around interrupt::free
japaric Jul 9, 2017
b7e43c1
make the tasks and resources fields optional
japaric Jul 9, 2017
8485a24
make the init::Resources argument optional
japaric Jul 9, 2017
59afbf0
compiler plugin -> proc macro
japaric Jul 12, 2017
9859655
split macro parser into its own crate and improve error handling / re…
japaric Jul 14, 2017
e9788ff
rename rtfm! to app! and adapt to changes in rtfm-syntax
japaric Jul 15, 2017
1f1cf84
add cfail tests
japaric Jul 18, 2017
5824f83
adapt to changes in rtfm-syntax
japaric Jul 18, 2017
a2b0c9e
resources owned by idle have 'static lifetime
japaric Jul 19, 2017
97a7e38
tasks / idle have exclusive access to Threshold, but do not own the t…
japaric Jul 19, 2017
877a324
make compatible with the unsafe_code lint
japaric Jul 19, 2017
6577f4a
bump cortex-m version to v0.3.1
japaric Jul 20, 2017
23425f2
more cfail tests
japaric Jul 20, 2017
c7b9507
`Resource` trait, docs, examples and rtfm-syntax related changes
japaric Jul 21, 2017
0788a15
update CI
japaric Jul 21, 2017
c64e7de
doc tweaks
japaric Jul 21, 2017
bf4eabf
misc fixes
japaric Jul 21, 2017
e56ab13
add example about placing init, idle and tasks in modules
japaric Jul 23, 2017
03f373f
drop idle.locals
japaric Jul 24, 2017
f3b397f
drop rtfm::Cell
japaric Jul 24, 2017
05feb7b
update examples
japaric Jul 24, 2017
6ea9cda
update cfail tests
japaric Jul 24, 2017
f5a4d8e
don't wrap static references in a `Static`
japaric Jul 24, 2017
749ce81
bump the static-ref dependency
japaric Jul 24, 2017
4139b47
add cfail test: borrow can't escape critical sections
japaric Jul 24, 2017
74daa77
document `task!` more
japaric Jul 24, 2017
fb45428
task! is not needed if tasks.$T.path is specified
japaric Jul 25, 2017
a14b012
add another duplicated-handler cfail test
japaric Jul 25, 2017
0e05682
more "hygiene"
japaric Jul 25, 2017
8aa3621
fix errors around the use of `super` in relative paths
japaric Jul 26, 2017
6a2ff0a
inline claim
japaric Jul 26, 2017
4a1509c
fix around owned idle resource
japaric Jul 26, 2017
dee2fcd
provide a Threshold token even when all resources are lockless
japaric Jul 27, 2017
0b5afce
refactor Resource / Threshold into its own crate, drop task!, tweak r…
japaric Jul 27, 2017
aa22494
update tests and examples
japaric Jul 27, 2017
b37c45a
make task.$T.priority optional
japaric Jul 27, 2017
dd539d1
don't generate empty modules
japaric Jul 27, 2017
5e83dc2
fix warning on ARMv6-M
japaric Jul 27, 2017
7d0c07c
travis: install linker
japaric Jul 27, 2017
ad2a523
fix yet another warning on ARMv6-M
japaric Jul 27, 2017
d396da5
make task.$T.enabled optional
japaric Jul 27, 2017
b9f50e4
make task.$T.path mandatory
japaric Jul 28, 2017
271df39
`Send`-ness check is now in rtfm-core
japaric Jul 28, 2017
e85d6e5
update examples
japaric Jul 28, 2017
2d80f36
update examples
japaric Jul 29, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make task.$T.priority optional
default the value to 1 if omitted
  • Loading branch information
japaric committed Jul 27, 2017
commit b37c45ad2a295f067b6cacf9424ff9f68674f82b
28 changes: 8 additions & 20 deletions macros/src/check.rs
Original file line number Diff line number Diff line change
@@ -31,16 +31,8 @@ pub fn app(app: check::App) -> Result<App> {
resources: app.resources,
tasks: app.tasks
.into_iter()
.map(|(k, v)| {
let name = k.clone();
Ok((
k,
::check::task(v)
.chain_err(|| format!("checking task `{}`", name))?,
))
})
.collect::<Result<_>>()
.chain_err(|| "checking `tasks`")?,
.map(|(k, v)| (k, ::check::task(v)))
.collect(),
};

::check::resources(&app)
@@ -68,15 +60,11 @@ fn resources(app: &App) -> Result<()> {
Ok(())
}

fn task(task: syntax::check::Task) -> Result<Task> {
if let Some(priority) = task.priority {
Ok(Task {
enabled: task.enabled,
path: task.path,
priority,
resources: task.resources,
})
} else {
bail!("should contain a `priority` field")
fn task(task: syntax::check::Task) -> Task {
Task {
enabled: task.enabled,
path: task.path,
priority: task.priority.unwrap_or(1),
resources: task.resources,
}
}