Commit graph

106 commits

Author SHA1 Message Date
bors[bot]
1fb1dd466b
Merge #186
186: [backport] unlock the DWT, if locked, when using the timer queue r=korken89 a=japaric

**HEADS UP** this PR targets the branch v0.4.x

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2019-10-23 20:49:30 +00:00
bors[bot]
34a2767bdf
Merge #225
225: A fix that stops panics from the old MaybeUninit impl r=korken89 a=korken89

Sometimes when running in debug mode the current implementation of `MaybeUninit` would panic, an example can be found here: 2bb89427fa/examples/rtfm-uarte-interrupts/src/main.rs (L106)
On debug this line will always panic, on release all is fine.

The issue seemed to be the manual `MaybeUninit` implementation, so I have merged the two implementations together.
Please have a look and see if my fix is unsound (it does however work, but not sure on UB).

cc @japaric @TeXitoi 

Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2019-10-23 20:28:50 +00:00
Emil Fresk
15005f45e0
Merge branch 'v0.4.x' into v0.4.x-gh184 2019-10-23 22:22:41 +02:00
Emil Fresk
a1abbbbea7 Fixed mem::uninitialized warnings 2019-10-23 20:33:50 +02:00
Josh Gao
ec1d508040 Enable the DWT unit before poking at its registers.
On cold boot, the DWT unit is off, which means our attempts to clear and
disable the cycle counter in pre-init don't work. This seems to result
in access to CYCCNT always returning 1073741824, which delays tasks
scheduled in init by that many cycles (~15s at 72 MHz).

Fixes #196.
2019-07-26 03:23:44 -07:00
Jorge Aparicio
f5de8307b2 unlock the DWT, if locked, when using the timer queue 2019-05-01 23:32:22 +02:00
Jorge Aparicio
7da8463980 backport: fix ceiling analysis bug
This commit fixes a ceiling bug where the ceiling of a ready queue will be
incorrectly computed. The analysis was not including the priority of the system
timer interrupt (`SysTick`) in the analysis resulting in a priority ceiling
lower than what's required for memory safety which led to data races.

The bug can be observed in the following program:

``` rust
 #[rtfm::app(device = /* .. */)]
const APP: () = {
    #[init]
    fn init() {
        // ..
    }

    #[task(priority = 2)]
    fn foo(x: i32) {
        // ..
    }

    #[task(priority = 1, spawn = [foo], schedule = [foo])]
    fn bar() {
        // ..
    }

    extern "C" {
        fn EXTI0();
        fn EXTI1();
    }
};
```

Here the framework chooses a priority of `2` for the `SysTick` interrupt
(because it matches the priority of the `schedule`-able task `foo`).

Both `SysTick` and `bar::Spawn.foo` need to access the ready queue (which, in
this case, stores the messages sent to task `foo`) but the framework doesn't
account for the priority of `SysTick` (`2`) and chooses a priority ceiling of
`1` for the ready queue (because it matches the priority of task `bar` which can
spawn `foo`).

The result is that `bar::Spawn.foo` modifies the ready queue *without* a
critical section (because `bar`'s priority matches the priority ceiling of the
ready queue) which is wrong because `SysTick` (priority = `3`) can also modify
the ready queue.
2019-05-01 20:19:22 +02:00
Jorge Aparicio
a562fb3232 v0.4.3 2019-04-21 18:20:57 +02:00
bors[bot]
77def32454 Merge #170
170: check task priority at compile time r=TeXitoi a=japaric

before we were checking the priority at runtime. The compile time error message
when the priority is too high is kind of awful though.

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2019-04-16 22:54:18 +00:00
Jorge Aparicio
210921e06c now fix the fix 2019-04-17 00:18:02 +02:00
Jorge Aparicio
53f0ca1504 more nightly fixes 2019-04-16 23:41:00 +02:00
Jorge Aparicio
10d2638488 [NFC] fix nightly ci 2019-04-16 23:17:28 +02:00
Jorge Aparicio
aa7eec0299 check task priority at compile time
before we were checking the priority at runtime. The compile time error message
when the priority is too high is kind of awful though.
2019-04-16 23:04:24 +02:00
Jorge Aparicio
3310f507c0 v0.4.2 2019-02-27 00:56:56 +01:00
Jorge Aparicio
8eccef7d9c refactor: make binds harder to misuse 2019-02-26 23:25:16 +01:00
Jorge Aparicio
2fd6ae69d1 binds can only appear once in the argument list 2019-02-26 23:22:34 +01:00
Jorge Aparicio
11f795aaf6 add binds example and make it work 2019-02-26 23:22:34 +01:00
Jorge Aparicio
72f0cc505a make cfail test actually fail 2019-02-26 23:22:34 +01:00
Jorge Aparicio
d0f33add0a add binds argument to the interrupt and exception attributes 2019-02-26 23:22:31 +01:00
Jorge Aparicio
73529ea650 reject duplicate arguments in #[interrupt] and #[exception]
This program was being accepted:

``` rust
 #[task(
    capacity = 1,
    capacity = 2,
    priority = 1,
    priority = 2,
)]
fn foo() {}
```

now it will trigger a compiler error
2019-02-23 22:35:29 +01:00
Jorge Aparicio
88078e7770 add "nightly" feature 2019-02-19 12:37:25 +01:00
Jorge Aparicio
e5e54ee8f1 rebase fix 2019-02-16 00:28:12 +01:00
Jorge Aparicio
7ce052be37 cargo fmt 2019-02-16 00:26:07 +01:00
Jorge Aparicio
2b8e743f35 make debug builds reproducible 2019-02-16 00:25:48 +01:00
Hugo van der Wijst
577d188f72 Make generated names stable when sorting. 2019-02-16 00:23:01 +01:00
Hugo van der Wijst
a654d13eef Seed RNG with package name and prepend string to full random name. 2019-02-16 00:23:01 +01:00
Hugo van der Wijst
be8a5e89b8 Make identifiers deterministic. 2019-02-16 00:23:01 +01:00
Hugo van der Wijst
2f89688ca9 Make builds reproducible
This is done by using `BTreeMap`s and `BTreeSet`s to get deterministic
ordering.

Also updated the CI job to check reproducibility of all examples.
2019-02-16 00:22:22 +01:00
Jorge Aparicio
5f7e831d27 fix non_camel_case_types warnings 2019-02-13 15:37:24 +01:00
Jorge Aparicio
aadd00c068 bump macros version 2019-02-12 17:29:50 +01:00
Jorge Aparicio
88599780e0 accept init: fn() -> init::LateResources 2019-02-12 14:53:49 +01:00
Jorge Aparicio
557a51ede1 forbid early returns in init 2019-02-12 11:07:15 +01:00
Hugo van der Wijst
45e98afbc1 Fix build on recent nightlies. 2019-01-17 10:55:21 -08:00
Jorge Aparicio
d98f6c9a61 v0.4.0 2018-12-16 21:19:19 +01:00
Jorge Aparicio
56d09a12dd move macros crate to the 2018 edition 2018-12-16 19:14:58 +01:00
Jorge Aparicio
8e9a91d0b0 properly handle #[cfg] (conditional compilation) on tasks 2018-12-16 19:10:36 +01:00
Jorge Aparicio
4345c10596 properly handle #[cfg] (conditional compilation) on resources 2018-12-16 18:37:36 +01:00
Jorge Aparicio
9757c33b00 use the single core variant of spsc::Queue 2018-12-16 01:11:54 +01:00
Jorge Aparicio
4f00d8bd78 codegen/statics: forward #[cfg] attributes
fixes #110
2018-12-15 22:04:30 +01:00
Jorge Aparicio
d14e25d72d move some interrupt configuration to pre_init 2018-12-15 20:35:00 +01:00
Jorge Aparicio
f7ac71ab22 codegen: merge dictionaries related to task dispatchers 2018-12-15 19:17:08 +01:00
Jorge Aparicio
0b3f0b2eb5 codegen: merge dictionaries related to tasks 2018-12-15 19:07:09 +01:00
Jorge Aparicio
35bb76ef5f codegen: stop using export_name
`export_name` creates external symbols that won't be removed when using `-Z
emit-stack-sizes`
2018-12-02 17:43:36 +01:00
Jorge Aparicio
9d0227bfeb 0.4.0-beta.2 2018-11-04 20:12:31 +01:00
Jorge Aparicio
22d758ddac fix codegen 2018-11-04 19:46:49 +01:00
Jorge Aparicio
37a0692a0f impl Mutex on all shared resources
document how to write generic code that operates on resources
2018-11-04 18:50:42 +01:00
Jorge Aparicio
3a867e70c3 update macros/Cargo.toml 2018-11-03 17:24:45 +01:00
Jorge Aparicio
c631049efc v0.4.0
closes #32
closes #33
2018-11-03 17:16:55 +01:00
Jorge Aparicio
2ec5d59ee9 v0.3.3 2018-08-24 16:49:03 +02:00
Jorge Aparicio
abca829926 more fixes 2018-08-24 16:31:04 +02:00