Commit graph

1142 commits

Author SHA1 Message Date
Emil Fresk
46a3f2befd Fix UB in the access of Priority for asyc executors
The `Priority` was generated on the stack in the dispatcher
which caused it to be dropped after usage. This is now fixed
by having the `Priority` being a static variable for executors
2022-08-05 11:37:16 +02:00
Emil Fresk
b48a95e879 Fix codegen when having executor at multiple priorities
The codegen generated code for all executors in all
dispatchers, which caused some weird bugs.
Also the definition of an executor was not generated
globally, this caused use after free errors when having
multiple priority levels.
2022-08-05 09:00:46 +02:00
Emil Fresk
4488ac0421 Revert async idle 2022-08-03 20:49:32 +02:00
Emil Fresk
561bef45e7 async idle working 2022-08-03 11:30:32 +02:00
Emil Fresk
4a349653b4 Fix error based on retry queue 2022-08-03 11:30:32 +02:00
Emil Fresk
07bd57a20f Fix style 2022-08-03 11:30:32 +02:00
Emil Fresk
43f7484e81 Add "async task with infinite loop" example 2022-08-03 11:30:32 +02:00
Emil Fresk
9bf8c5f58d Add timeout and delay example 2022-08-03 11:30:32 +02:00
Emil Fresk
27b8aca673 Added intrusive linked list for the waker queue 2022-08-03 11:30:32 +02:00
Emil Fresk
dd563e3cee Cleanup example 2022-08-03 11:30:32 +02:00
Emil Fresk
2e9dba7c81 Fix use of parameters in async task 2022-08-03 11:30:32 +02:00
Emil Fresk
952bb5c431 Restart executor on finish if there are retries 2022-08-03 11:30:32 +02:00
Emil Fresk
b2ec1fa651 Example running, timeout and delay futures available 2022-08-03 11:30:32 +02:00
Emil Fresk
13ccd92e63 Starting to implement async task codgen 2022-08-03 11:30:32 +02:00
Emil Fresk
e2e7948411 Async examples working, manual codegen 2022-08-03 11:30:32 +02:00
bors[bot]
b87fca3d21
Merge #652
652: Remove use of basepri register on thumbv8m.base r=AfoHT a=neonquill

The basepri register appears to be aviable on thumbv8m.main but not thumbv8m.base. At the very least, attempting to compile against a Cortex-M23 based Microchip ATSAML10E16A generates an error:

```
error[E0432]: unresolved import `cortex_m::register::basepri`
  --> /Users/dwatson/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rtic-1.1.3/src/export.rs:25:5
   |
25 | use cortex_m::register::basepri;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `basepri` in `register`
```

I wasn't sure if it made more sense to replace the `armv7m` config flag with something related to basepri availability or to get closer to matching the cortex-m use of several architecture specific flags. In the end i chose to make the minimal change possible and just narrowed the existing `thumbv8m` check.

Context:
[cortex-m:src/register/mod.rs](4e90862520/src/register/mod.rs (L33)):
```
#[cfg(all(not(armv6m), not(armv8m_base)))]
pub mod basepri;
```

[cortex-m:build.rs](4e90862520/build.rs (L21)):
```
    } else if target.starts_with("thumbv8m.base") {
        println!("cargo:rustc-cfg=cortex_m");
        println!("cargo:rustc-cfg=armv8m");
        println!("cargo:rustc-cfg=armv8m_base");
```

Co-authored-by: David Watson <david@neonquill.com>
2022-07-27 19:15:09 +00:00
David Watson
368ab1d4fb Remove use of basepri register on thumbv8m.base
The basepri register appears to be aviable on thumbv8m.main but not
thumbv8m.base. At the very least, attempting to compile against a
Cortex-M23 based Microchip ATSAML10E16A generates an error:

```
error[E0432]: unresolved import `cortex_m::register::basepri`
  --> /Users/dwatson/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rtic-1.1.3/src/export.rs:25:5
   |
25 | use cortex_m::register::basepri;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `basepri` in `register`
```

This is an attempt to account for the fact that thumbv8m.base (M23)
MCUs don't have the BASEPRI register but have more than 32
interrupts. This moves away from the architecture specific config
flags and switches to a more functional flag.

Make the mask size depend on the max interrupt id

Rather than assuming a fixed interrupt count of 32 this code uses an
array of u32 bitmasks to calculate the priority mask. The size of this
array is calculated at compile time based on the size of the largest
interrupt id being used in the target code. For thumbv6m this should
be equivalent to the previous version that used a single u32 mask. For
thumbv8m.base it will be larger depending on the interrupts used.

Don't write 0s to the ISER and ICER registers

Writing 0s to these registers is a no-op. Since these masks should be
calculated at compile time, this conditional should result in writes
being optimized out of the code.

Prevent panic on non-arm targets

Panicking on unknown targets was breaking things like the doc build on
linux. This change should only panic when building on unknown arm
targets.
2022-07-27 21:04:24 +02:00
bors[bot]
d4816e054b
Merge #653
653: Allow custom `link_section` attributes for late resources r=AfoHT a=vccggorski

This commit makes RTIC aware of user-provided `link_section` attributes,
letting user override default section mapping.

Co-authored-by: Gabriel Górski <gabriel.gorski@volvocars.com>
2022-07-27 18:36:56 +00:00
Gabriel Górski
f15614e7cb Update CHANGELOG.md 2022-07-27 20:29:14 +02:00
Gabriel Górski
b4cfc4db84 Fix missing formatting 2022-07-27 20:25:34 +02:00
Gabriel Górski
c6fd3cdd0a Allow custom link_section attributes for late resources
This commit makes RTIC aware of user-provided `link_section` attributes,
letting user override default section mapping.
2022-07-06 17:43:38 +02:00
bors[bot]
981fa1fb30
Merge #650
650: Release RTIC v1.1.3 r=korken89 a=AfoHT



Co-authored-by: Henrik Tjäder <henrik@grepit.se>
2022-06-23 12:01:45 +00:00
Henrik Tjäder
563a3c9d4c Release RTIC v1.1.3 2022-06-23 13:58:50 +02:00
bors[bot]
b9d7a113b6
Merge #649
649: Bump rtic-syntax to v1.0.2 and fix Changelog r=korken89 a=AfoHT

Use the latest rtic-syntax, update the changelog with the last few undocumented releases


Co-authored-by: Henrik Tjäder <henrik@grepit.se>
2022-06-23 11:39:22 +00:00
Henrik Tjäder
8af754fc72 Bump rtic-syntax to v1.0.2 and fix Changelog 2022-06-23 13:36:14 +02:00
bors[bot]
cffbfc7509
Merge #645
645: fix ci: use SYST::PTR r=korken89 a=japaric

SYST::ptr has been deprecated in cortex-m v0.7.5
SYST::PTR is available since cortex-m v0.7.0

CI was failing due to a warning turned into an error by `deny(warnings)`

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2022-06-07 10:47:14 +00:00
Jorge Aparicio
ab90426416 fix ci: use SYST::PTR
SYST::ptr has been deprecated in cortex-m v0.7.5
SYST::PTR is available since cortex-m v0.7.0
2022-06-07 12:37:42 +02:00
bors[bot]
8d3c803308
Merge #644
644: Fix macros to Rust 2021 r=perlindgren a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-05-24 17:43:19 +00:00
Emil Fresk
5c47aba1a1 Fix macros to Rust 2021 2022-05-24 19:42:02 +02:00
bors[bot]
5fe6350278
Merge #643
643: Fix clash with defmt r=AfoHT a=korken89

Fixes #642

Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-05-24 07:14:59 +00:00
Emil Fresk
b15bda2d39 Fix clash with defmt 2022-05-24 08:31:31 +02:00
bors[bot]
1a24c725d2
Merge #641
641: More ergonomic error from static asserts messages r=perlindgren a=korken89

Closes #634

Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-05-17 18:39:30 +00:00
Emil Fresk
cd445165c5 More ergonomic error from static asserts messages 2022-05-17 20:20:59 +02:00
bors[bot]
6896749f7b
Merge #638
638: Fixed warning from Rust Analyzer r=perlindgren a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-05-10 11:39:49 +00:00
Emil Fresk
e5643ee94e Fixed warning from Rust Analyzer 2022-05-10 13:38:23 +02:00
bors[bot]
e98ddeabeb
Merge #637
637: Prepare v1.1.2 r=perlindgren a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-05-09 11:36:18 +00:00
Emil Fresk
906abba71e Prepare v1.1.2 2022-05-09 13:33:49 +02:00
bors[bot]
06d2941d6f
Merge #636
636: Added matrix bot r=AfoHT a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-05-02 06:40:00 +00:00
Emil Fresk
2e5e7698b6 Added matrix bot 2022-05-02 08:35:49 +02:00
bors[bot]
f24e9264b1
Merge #626
626: Fix error in book, shared resource need only `Send` r=korken89 a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-04-20 11:42:36 +00:00
bors[bot]
d1aa20643d
Merge #635
635: Masks take 3 r=AfoHT a=korken89

This solves the `MASKS` generation issue by having `rtic::export` do the feature gating.

Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-04-20 11:35:08 +00:00
Emil Fresk
0f8bdbdd3f Added check for resource usage and to generate an compile error for thumbv6 exceptions 2022-04-20 13:05:22 +02:00
Emil Fresk
9f38a39377 Masks take 3 2022-04-20 10:56:13 +02:00
bors[bot]
8707418003
Merge #632
632: Fixed `macro` version r=AfoHT a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2022-04-13 17:29:04 +00:00
Emil Fresk
f247cc0b3a Fixed macro version 2022-04-13 19:28:04 +02:00
bors[bot]
09931ef94e
Merge #630
630: Release RTIC v1.1 r=korken89 a=AfoHT

Bump versions, including using using latest rtic-syntax


Co-authored-by: Henrik Tjäder <henrik@grepit.se>
2022-04-13 06:44:43 +00:00
Henrik Tjäder
4f99399e29 Release RTIC v1.1
Bump versions, including using using latest rtic-syntax
2022-04-13 08:27:17 +02:00
Emil Fresk
a7a8f9f4ed Fix error in book, shared resource need only Send 2022-03-20 12:40:30 +01:00
bors[bot]
c6231d81d8
Merge #624
624: Update software_tasks.md r=korken89 a=RCasatta



Co-authored-by: Riccardo Casatta <riccardo.casatta@gmail.com>
2022-03-08 18:11:23 +00:00
Riccardo Casatta
750b1853ad
Update software_tasks.md 2022-03-07 21:05:34 +01:00