Commit graph

360 commits

Author SHA1 Message Date
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
abcf9bf61d Docs updates 2019-10-23 21:48:44 +02:00
Emil Fresk
63a0c4a1e8 Updated MSRV due to fix 2019-10-23 21:41:27 +02:00
Emil Fresk
a1abbbbea7 Fixed mem::uninitialized warnings 2019-10-23 20:33:50 +02:00
Jorge Aparicio
8d28b536c9
Merge pull request #221 from jmgao/dwt_cold_boot_0.4.x
Enable the DWT unit before poking at its registers. (v0.4.x)
2019-08-20 11:11:36 +00:00
Emil Fresk
2e3a889991 Added get_mut and get_ref into the nightly as well 2019-08-09 14:57:12 +02:00
Emil Fresk
7de26409c2 Better impl of write 2019-08-09 14:56:40 +02:00
Emil Fresk
e9bc00bc9b Removed old flag 2019-08-09 14:28:04 +02:00
Emil Fresk
51a1aae17d Added maybe_uninit_extra for CI 2019-08-09 14:23:13 +02:00
Emil Fresk
d5b665e28f A fix that stops panics from the old MaybeUninit impl 2019-08-09 14:08:44 +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
eca12fecef tweak ci scripts 2019-05-02 11:15:30 +02:00
Jorge Aparicio
3a4f8b0ad5 tweak .travis.yml to build / update docs 2019-05-02 11:04:44 +02:00
Jorge Aparicio
4df6292e1e
Merge pull request #183 from japaric/tq-ceiling-bug
backport: fix ceiling analysis bug
2019-05-01 20:47:18 +02:00
Jorge Aparicio
7b18df53dd update .travis.yml 2019-05-01 20:26:46 +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
9b9a80d38e fix armv6-m build 2019-05-01 20:16:01 +02:00
Jorge Aparicio
4dc44594c9 book: indirection for faster message passing 2019-05-01 20:15:58 +02:00
bors[bot]
852337e03b Merge #174
174: v0.4.3 r=japaric a=japaric

prepares a new release

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2019-04-21 16:21:57 +00:00
Jorge Aparicio
a562fb3232 v0.4.3 2019-04-21 18:20:57 +02:00
Jorge Aparicio
b5a756bd7d
Merge pull request #169 from japaric/late-must-be-send
book: note that late resources must be Send
2019-04-21 18:20:15 +02:00
Jorge Aparicio
473a0e7bb5 add .run file 2019-04-21 18:05:24 +02:00
Jorge Aparicio
e865cbb2e5 book: resources shared with init must also be Send 2019-04-21 18:00:22 +02:00
Jorge Aparicio
c4bad51deb note that late resources must be Send 2019-04-21 18:00:22 +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
bors[bot]
e1e4c98cb9 Merge #171
171: [NFC] fix nightly ci r=japaric a=japaric



Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2019-04-16 22:18:27 +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
bors[bot]
8da925647e Merge #162
162: v0.4.2 r=TeXitoi a=japaric

this PR prepares a new release

r? @korken89 || @TeXitoi 

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2019-02-27 01:27:16 +00:00
Jorge Aparicio
3310f507c0 v0.4.2 2019-02-27 00:56:56 +01:00
bors[bot]
692876649c Merge #161
161: (ru) binds r=japaric a=japaric

resubmitting PR #160 

Co-authored-by: Andrey Zgarbul <zgarbul.andrey@gmail.com>
2019-02-26 23:28:02 +00:00
Andrey Zgarbul
028d5325ae (ru) binds 2019-02-27 00:27:05 +01:00
bors[bot]
6d1d84980a Merge #158
158: implement RFC #128: #[interrupt(binds = ..)] r=korken89 a=japaric

closes #128 

r? @korken89 or @TeXitoi 

suggestions for tests are welcome! (2 of the 3 tests I added hit bugs in my implementation)

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2019-02-26 22:26:52 +00: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
e167af01f0 document the binds feature
cc @burrbull
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
a233808280 fix warnings in cpass test 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
c749979c45 add some tests 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
bors[bot]
bbdc3221f6 Merge #159
159: reject duplicate arguments in #[interrupt] and #[exception] r=TeXitoi a=japaric

This program was being accepted:

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

now it will trigger a compiler error

r? @korken89 || @TeXitoi 

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2019-02-24 16:42:33 +00: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
bors[bot]
6b61cd2e3f Merge #153
153: add "nightly" feature; replace hint::unreachable_unchecked with a panic r=korken89 a=japaric

this implements the action plan described in #149

to give you a sense of the overhead of this change: it has increased the binary
size of some of our examples by up to 10% but this is mainly from pulling in a
panic handler that does formatting

r? @korken89

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2019-02-23 19:37:29 +00:00
Jorge Aparicio
c6f9b2c0aa fix ci 2019-02-23 20:35:54 +01:00
bors[bot]
43c2ffbdcf Merge #154
154: add Duration.as_cycles r=japaric a=japaric

cc @oni303

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2019-02-19 16:15:38 +00:00
Jorge Aparicio
3973b420ec add Duration.as_cycles 2019-02-19 17:14:34 +01:00
Jorge Aparicio
28ee83dfdd turn all potential UB into panics 2019-02-19 13:13:16 +01:00