Commit graph

1195 commits

Author SHA1 Message Date
Jorge Aparicio
3eac8b91cf book/resources: highlight that #[lock_free] includes a compile-time check
for the "same priority requirement"; this prevents data races
2021-07-22 10:35:09 +02:00
Alex Crawford
5f395658f0 Propogate the task attributes to the spawn handles
This allows tasks to be gated by `cfg` attributes when also using
monotonics. For example:

```rust
#[cfg(feature = "logging")]
#[task(shared = [logger])]
fn logger_init(mut cx: logger_init::Context) {
    /* ... */
}
```

Without this change, the reschedule_at() implementation is
unconditionally included even though it references the SpawnHandle from
its task module, which is _conditionally_ included. This resulted in
compiler errors like the following:

```
error[E0433]: failed to resolve: use of undeclared crate or module `logger_init`
   --> src/main.rs:243:8
    |
243 |     fn logger_init(mut cx: logger_init::Context) {
    |        ^^^^^^^^^^^ use of undeclared crate or module `logger_init`
```
2021-07-22 01:00:57 -07:00
bors[bot]
c62fd967d7
Merge #498
498: book: update the resources chapter r=AfoHT a=japaric

see individual commit messages for details.

what's still left to do is adjust the very last section about `#[task_local]` and `#[lock_free]` but I plan to do that as a follow up. I didn't find an in-tree example for those two attributes (are they field attributes? where do they fit in the syntax?); a quick scan of the rtic-syntax crate seems to indicate that `task_local` has been removed (?) and that `lock_free` still exists.

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2021-07-22 07:29:35 +00:00
Jorge Aparicio
a7ed040799 migration/0.5: cover #[lock_free]
I think this completes #488
2021-07-22 09:27:42 +02:00
Jorge Aparicio
5805a05fac book/resources: rm #[task_local] mention; add #[lock_free] example
the #[task_local] attribute was removed
2021-07-22 09:17:39 +02:00
Jorge Aparicio
f9a7efb235 update expected example output (take 2) 2021-07-22 08:58:17 +02:00
Jorge Aparicio
af631719f4 update expected example output 2021-07-22 08:42:44 +02:00
Jorge Aparicio
ae1f9008a4 comment out line that doesn't compile 2021-07-22 08:28:11 +02:00
Jorge Aparicio
cd4e8183f6 book/resources: remove mentions of the field attribute #[init(<expr>)]
it no longer exists. all resources are now late resources
2021-07-21 15:59:08 +02:00
Jorge Aparicio
6bf1c76d84 book/resources: do not use the lock API in the very first example
instead stick to `#[local]` resources
2021-07-21 15:55:14 +02:00
bors[bot]
2f3b5cba80
Merge #496
496: update the 0.5.x -> 0.6.0 migration guide r=AfoHT a=japaric

to use the new resources syntax
I also reordered the sections to cover all the resource API first before covering the spawn API
I've also added a section about the old `static mut` variable transform

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2021-07-21 08:40:21 +00:00
Jorge Aparicio
18880406cb use tuple struct syntax for Monotonics everywhere 2021-07-21 10:14:00 +02:00
Jorge Aparicio
5f7dc0b903 update the 0.5.x -> 0.6.0 migration guide
to use the new resources syntax
I also reordered the sections to cover all the resource API first before covering the spawn API
I've also added a section about the old `static mut` variable transform
2021-07-21 10:11:43 +02:00
bors[bot]
29aef36f67
Merge #497
497: Change misleading documentation left over by PR #464 r=AfoHT a=Cat-Ion



Co-authored-by: Valentin Ochs <a@0au.de>
2021-07-20 14:14:47 +00:00
Valentin Ochs
c4c964de7b Change misleading documentation left over by PR #464 2021-07-20 14:37:13 +02:00
bors[bot]
78f556f942
Merge #464
464: const generics r=AfoHT a=burrbull



Co-authored-by: Andrey Zgarbul <zgarbul.andrey@gmail.com>
Co-authored-by: mriise <mark.riise26@gmail.com>
Co-authored-by: Zgarbul Andrey <zgarbul.andrey@gmail.com>
2021-07-20 08:51:53 +00:00
Andrey Zgarbul
bf80035aef rustfmt 2021-07-20 11:44:03 +03:00
Zgarbul Andrey
5153ff1715
Merge pull request #1 from mriise/const
fix pool example
2021-07-20 11:38:06 +03:00
mriise
5e92715d8c fix pool example 2021-07-20 01:17:11 -07:00
Andrey Zgarbul
e4319de3d5 const generics 2021-07-09 18:44:19 +03:00
Emil Fresk
c67657371b Version fix 2021-07-09 13:08:37 +02:00
bors[bot]
e1a4d001f8
Merge #494
494: Resoures take 2 r=korken89 a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2021-07-09 11:00:11 +00:00
Emil Fresk
f3d9fd9b63 Update changelog and version 2021-07-09 12:54:19 +02:00
Emil Fresk
697ab31e6e Final versions 2021-07-08 23:22:23 +02:00
Emil Fresk
8f37043782 Cleanup from review (needs releases to compile) 2021-07-08 23:18:44 +02:00
Emil Fresk
98d2af9d73 Fixing tests 2021-07-07 23:07:09 +02:00
Emil Fresk
633012190b Use git deps 2021-07-07 21:10:06 +02:00
Emil Fresk
d7393c5b27 Full local resource syntax working 2021-07-07 21:04:31 +02:00
Emil Fresk
ef5307d83a Minimal app now compiles 2021-07-06 22:47:48 +02:00
Emil Fresk
3f85cb5caf Started work 2021-07-05 21:40:01 +02:00
bors[bot]
13dc3992e6
Merge #492
492: Fix syntax error in migration guide r=korken89 a=newAM

Minor problem with a minor fix.

Co-authored-by: Alex Martens <alexmgit@protonmail.com>
2021-07-02 05:13:09 +00:00
Alex Martens
1beeebd797 Fix syntax error in migration guide 2021-07-01 17:09:07 -07:00
bors[bot]
f0273d1c0f
Merge #491
491: Fix small typo in readme r=korken89 a=vladinator1000



Co-authored-by: Vlady Veselinov <vladkodmc@gmail.com>
2021-06-28 19:20:33 +00:00
Vlady Veselinov
f21af4607f
Fix small typo in readme 2021-06-28 18:38:33 +01:00
bors[bot]
9bea30b5a8
Merge #489
489: Allow zero sized LinkedList r=korken89 a=jhillyerd

If one configures a monotonic in alpha4, but doesn't use it, TimerQueue attempts to create a zero-sized LinkedList, which causes an underflow.

This PR allows for zero-sized linked lists.

Co-authored-by: James Hillyerd <james@hillyerd.com>
2021-06-07 21:28:02 +00:00
James Hillyerd
87c958da3b assert empty 2021-06-06 15:00:52 -07:00
James Hillyerd
064ff239f3 Allow zero sized LinkedList 2021-06-06 14:56:00 -07:00
bors[bot]
3fd3eea941
Merge #486
486: Fixed changelog r=korken89 a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2021-05-28 09:03:54 +00:00
Emil Fresk
e8676daeb9 Fixed changelog 2021-05-28 09:07:21 +02:00
bors[bot]
0b0bb1bfa9
Merge #485
485: New codegen structure to eliminate issues with paths r=korken89 a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2021-05-27 16:18:46 +00:00
Emil Fresk
c17348d290 Prepare release alpha.4 2021-05-27 18:10:24 +02:00
Emil Fresk
6155f1366a Minor cleanup 2021-05-23 14:11:51 +02:00
Emil Fresk
b4509bdbfe Flattened the _ out of it 2021-05-06 19:40:37 +02:00
bors[bot]
aad8f81991
Merge #469
469: Goodbye static mut r=AfoHT a=korken89

Squashed and updated version of @perlindgren branch.

In release there are 0 bytes difference for all examples 🎉 
For debug we see a bloat of ~1-2% worst case, commonly less.

Complete diff of sizes for all examples (first is goodbye static mut, second is master):

```

<   27220	      0	     28	  27248	   6a70	spawn
---
>   27092	      0	     28	  27120	   69f0	spawn

<   16916	      0	     44	  16960	   4240	late
---
>   16836	      0	     44	  16880	   41f0	late

<   15952	      0	     12	  15964	   3e5c	type-usage
---
>   15872	      0	     12	  15884	   3e0c	type-usage

<   22068	      0	     44	  22112	   5660	cfg
---
>   21812	      0	     44	  21856	   5560	cfg

<   34784	      0	     40	  34824	   8808	periodic
---
>   34496	      0	     40	  34536	   86e8	periodic

<   22308	      0	     32	  22340	   5744	task
---
>   21972	      0	     32	  22004	   55f4	task

<   15076	      8	     24	  15108	   3b04	task-local
---
>   14980	      8	     24	  15012	   3aa4	task-local

<   12884	      0	     24	  12908	   326c	destructure
---
>   12820	      0	     24	  12844	   322c	destructure

<   10128	      0	     16	  10144	   27a0	init
---
>   10112	      0	     16	  10128	   2790	init

<   19044	      0	     20	  19064	   4a78	task_named_main
---
>   18916	      0	     20	  18936	   49f8	task_named_main

<   27252	      0	     28	  27280	   6a90	extern_spawn
---
>   27124	      0	     28	  27152	   6a10	extern_spawn

<   10176	      0	     16	  10192	   27d0	idle
---
>   10160	      0	     16	  10176	   27c0	idle

<   13972	      0	     16	  13988	   36a4	resource
---
>   13940	      0	     16	  13956	   3684	resource

<   16228	      0	     24	  16252	   3f7c	multilock
---
>   16116	      0	     24	  16140	   3f0c	multilock

<   14660	      0	     16	  14676	   3954	lock
---
>   14628	      0	     16	  14644	   3934	lock

<   10416	      0	     16	  10432	   28c0	task-local-minimal
---
>   10400	      0	     16	  10416	   28b0	task-local-minimal

<   14164	      0	     24	  14188	   376c	generics
---
>   14148	      0	     24	  14172	   375c	generics

<   30644	      0	     48	  30692	   77e4	message
---
>   30308	      0	     48	  30356	   7694	message

<   28964	      0	     36	  29000	   7148	spawn2
---
>   28724	      0	     36	  28760	   7058	spawn2

<   15952	      0	      8	  15960	   3e58	t-schedule-core-stable
---
>   15872	      0	      8	  15880	   3e08	t-schedule-core-stable

<   17408	      0	     20	  17428	   4414	t-cfg
---
>   17248	      0	     20	  17268	   4374	t-cfg

<   12948	      0	     16	  12964	   32a4	hardware
---
>   12932	      0	     16	  12948	   3294	hardware

<   54640	      0	    104	  54744	   d5d8	t-schedule
---
>   53696	      0	    104	  53800	   d228	t-schedule

<   26132	      0	    548	  26680	   6838	pool
---
>   25876	      0	    548	  26424	   6738	pool

<   22372	      0	     56	  22428	   579c	cfg-whole-task
---
>   22100	      0	     56	  22156	   568c	cfg-whole-task

<   38292	      0	     76	  38368	   95e0	schedule
---
>   37828	      0	     76	  37904	   9410	schedule

<   21216	      0	     32	  21248	   5300	t-spawn
---
>   20880	      0	     32	  20912	   51b0	t-spawn

<   22820	      0	     56	  22876	   595c	capacity
---
>   22580	      0	     56	  22636	   586c	capacity

<   17060	      0	     48	  17108	   42d4	static
---
>   16980	      0	     48	  17028	   4284	static

<   20288	      0	     24	  20312	   4f58	ramfunc
---
>   20096	      0	     24	  20120	   4e98	ramfunc

<   11760	      0	     20	  11780	   2e04	t-resource
---
>   11664	      0	     20	  11684	   2da4	t-resource

<   13028	      0	     16	  13044	   32f4	only-shared-access
---
>   13012	      0	     16	  13028	   32e4	only-shared-access

<   16576	      0	     16	  16592	   40d0	not-sync
---
>   16432	      0	     16	  16448	   4040	not-sync

<   13892	      0	     16	  13908	   3654	resource-user-struct
---
>   13860	      0	     16	  13876	   3634	resource-user-struct

<   37472	      0	     64	  37536	   92a0	double_schedule
---
>   36960	      0	     64	  37024	   90a0	double_schedule

<   17648	      0	      8	  17656	   44f8	t-stask-main
---
>   17520	      0	      8	  17528	   4478	t-stask-main

<    8816	      0	      4	   8820	   2274	t-late-not-send
---
>    8800	      0	      4	   8804	   2264	t-late-not-send

<   23280	      0	     32	  23312	   5b10	types
---
>   23120	      0	     32	  23152	   5a70	types
```

Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2021-04-22 16:42:45 +00:00
Emil Fresk
50f26e78ed Keep comments 2021-04-22 18:38:42 +02:00
bors[bot]
a320cacb29
Merge #481
481: use super::xx now works with monotonics r=AfoHT a=korken89



Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2021-04-22 15:54:17 +00:00
Emil Fresk
6fc7b96474 use super::xx now works with monotonics 2021-04-22 17:39:07 +02:00
bors[bot]
e6a22aa48e
Merge #479
479: book: detail import resolving for 0.6 migration r=korken89 a=tmplt

That is, answering the question of why imports are no longer resolving during compilation.

Co-authored-by: Viktor Sonesten <v@tmplt.dev>
2021-04-22 13:05:43 +00:00
bors[bot]
fecbe85381
Merge #480
480: book/migration/v5: update init signature, fix example syntax r=korken89 a=tmplt

From the comment in #478.

The example now migrates from v5 to v6 instead of an incorrect v6 syntax
to a another incorrect v6 syntax.

Co-authored-by: Viktor Sonesten <v@tmplt.dev>
2021-04-22 12:57:54 +00:00
Viktor Sonesten
1d5f129544 book/migration/v5: update init signature, fix example syntax
The example now migrates from v5 to v6 instead of an incorrect v6 syntax
to a another incorrect v6 syntax.
2021-04-21 15:38:00 +02:00