Commit Graph

61 Commits

Author SHA1 Message Date
Dummyc0m
9e6e09a8d7 executor/spin: introduce an architecture agnostic executor
Spin polls the raw executor and never sleeps. It is useful for disabling
any power features associated with wfi/wfe-like instructions.

When implementing support for the CH32V30x MCU, the wfi instruction
had issues interacting with the USB OTG peripheral and appeared to be
non-spec-compliant.

1. When sending a USB Data-in packet, the USB peripheral appears to be
unable to read the system main memory while in WFI. This manifests in
the USB peripheral sending all or partially zeroed DATA packets.
Disabling WFI works around this issue.

2. The WFI instruction does not wake up the processor when MIE is
disabled. The MCU provides a WFITOWFE bit to emulate the WFE instruction
on arm, which, when enabled, ignores the MIE and allows the processor to
wake up. This works around the non-compliant WFI implementation.

Co-authored-by: Codetector <codetector@codetector.org>
Co-authored-by: Dummyc0m <y@types.moe>
2024-10-06 23:33:34 -07:00
Samuel Maier
db00f3f5ec Enable critical-section/std on wasm
Without that feature one will find import errors on opening the webpage, that are hard to debug.
The feature was indirectly enabled in the wasm example, however the reason wasn't documented and thus it was easy to miss.
2024-09-05 11:45:49 +02:00
Ulf Lilleengen
37d7b0cd06 prepare release embassy-executor 2024-08-05 08:56:29 +02:00
Zheng Li
2c42463205 executor: remove portable-atomic for riscv. 2024-03-02 00:21:56 +01:00
Dario Nieuwenhuis
31fa0aebd8 executor: update remove portable-atomic comment.
Fixes #2481
2024-01-26 14:26:19 +01:00
Dario Nieuwenhuis
35f09374b5
Merge pull request #2273 from djdisodo/main
initial support for avr
2024-01-19 23:26:55 +01:00
Dario Nieuwenhuis
6a1c415a4c Complete cargo.tomls more. 2024-01-12 00:32:47 +01:00
Dario Nieuwenhuis
22197320ff bump embassy-time 0.3, embassy-executor 0.5, embassy-net 0.4. 2024-01-11 23:01:24 +01:00
Dario Nieuwenhuis
f0606da9ad time: split queue driver too, don't reexport drivers. 2024-01-11 23:01:24 +01:00
sodo
6ee153a3e2 Merge remote-tracking branch 'origin' 2024-01-02 13:34:22 +09:00
sodo
b7cd7952c8 avr: support sleep 2024-01-01 21:23:57 +09:00
Barnaby Walters
6bbc316312 [embassy-executor] improved documentation
* Feature auto-documentation
* Task arena sizes in a <details> list
* Non-documented comment explaining turbowakers with see-also link

Further improvements:

* Are the task-arena-size-* numbers sizes in bytes? or something else?
* Task arena section could benefit from advice about how to choose a
  suitable size
2023-12-22 19:05:16 +01:00
Dario Nieuwenhuis
8b36a32ed5 ci: use beta, add secondary nightly ci. 2023-12-21 15:03:57 +01:00
sodo
58d503a77d add avr support 2023-12-10 01:45:24 +09:00
Dario Nieuwenhuis
ac2aec4e7a executor: rename macro crate to embassy-executor-macros, bump it. 2023-12-07 00:48:30 +01:00
Jesse Braham
c5e8a2e834 embassy-executor 0.4 2023-12-06 11:59:22 +01:00
Scott Mabin
334900752a update release version in examples and other crates 2023-12-04 13:15:10 +00:00
Dario Nieuwenhuis
ca3891bb8c executor: remove arch-xtensa.
It's been broken for months and nobody has noticed. The `esp*-hal` crates have
much better support.

Fixes #2234
Closes  #1912
2023-12-03 22:33:27 +01:00
Dario Nieuwenhuis
996c3c1f7e executor: make task arena size configurable. 2023-11-24 23:52:09 +01:00
Dario Nieuwenhuis
171cdb94c7 executor: add support for main/task macros in stable (allocates tasks in an arena) 2023-11-24 23:52:09 +01:00
Dario Nieuwenhuis
1fbc150fd6 executor: add some tests. 2023-11-24 23:52:09 +01:00
Dario Nieuwenhuis
259cf6192b executor: Remove non-functional rtos-trace-interrupt. 2023-11-24 23:52:09 +01:00
Dario Nieuwenhuis
1f9b649f80 executor: release v0.3.3 2023-11-15 18:44:01 +01:00
Dario Nieuwenhuis
bef9b7a853 executor: remove atomic-polyfill. 2023-11-15 18:43:27 +01:00
Dániel Buga
b8f9341edc Prepare embassy-executor 0.3.2 2023-11-06 21:50:40 +01:00
Dániel Buga
8d8d50cc7a Yeet core::sync::atomic, remove futures-util dep 2023-11-06 17:35:02 +01:00
Dario Nieuwenhuis
1f51367eb9 Upgrade static-cell to v2.0 2023-11-02 21:52:07 +01:00
Dario Nieuwenhuis
dd6a29adb2 Release embassy-executor v0.3.1 2023-11-01 00:17:44 +01:00
Dario Nieuwenhuis
213b4c9dca time: add links key, release v0.1.5. 2023-10-16 20:11:35 +02:00
Dániel Buga
02d2c06b23 Release embassy-time 0.1.4 2023-10-12 18:14:33 +02:00
Jesse Braham
1f63bf4153 Release embassy-time v0.1.3 2023-08-28 08:00:18 -07:00
Dániel Buga
f8299d10f7
Prepare executor and macros for release (#1825)
* Set release date, bump macros version

* Add pool_size change to changelog
2023-08-25 23:32:00 +02:00
Dániel Buga
a2c718f61c Bump executor crate version to 0.3.0 2023-08-23 20:34:37 +02:00
Dániel Buga
454a7cbf4c Remove pender-callback 2023-08-14 08:32:26 +02:00
Dániel Buga
ec6bd27df6 Remove thread-context feature 2023-08-14 08:22:22 +02:00
Dániel Buga
675b7fb605 POC: allow custom executors 2023-08-12 18:29:56 +02:00
Dániel Buga
baef856206 Bump version 2023-08-10 23:20:31 +02:00
Dario Nieuwenhuis
d137286981 Release embassy-time v0.1.2 2023-07-06 01:29:44 +02:00
Dario Nieuwenhuis
1d8321b821 Use make_static! from static-cell v1.1 2023-06-01 01:42:34 +02:00
Ulf Lilleengen
42a8f1671d Bump versions preparing for -macros and -executor release 2023-04-27 11:54:22 +02:00
Dario Nieuwenhuis
e2516bba09 executor: fix doc features. 2023-04-06 22:39:36 +02:00
Dario Nieuwenhuis
d3c4e4a20a executor: add Pender, rework Cargo features.
This introduces a `Pender` struct with enum cases for thread-mode, interrupt-mode and
custom callback executors. This avoids calls through function pointers when using only
the thread or interrupt executors. Faster, and friendlier to `cargo-call-stack`.

`embassy-executor` now has `arch-xxx` Cargo features to select the arch and to enable
the builtin executors (thread and interrupt).
2023-04-03 03:09:11 +02:00
Dario Nieuwenhuis
80972f1e0e executor,sync: add support for turbo-wakers.
This is a `core` patch to make wakers 1 word (the task pointer) instead of 2 (task pointer + vtable). It allows having the "waker optimization" we had a while back on `WakerRegistration/AtomicWaker`, but EVERYWHERE, without patching all crates.

Advantages:
- Less memory usage.
- Faster.
- `AtomicWaker` can actually use atomics to load/store the waker, No critical section needed.
- No `dyn` call, which means `cargo-call-stack` can now see through wakes.

Disadvantages:
- You have to patch `core`...
- Breaks all executors and other things that create wakers, unless they opt in to using the new `from_ptr` API.

How to use:

- Run this shell script to patch `core`. https://gist.github.com/Dirbaio/c67da7cf318515181539122c9d32b395
- Enable `build-std`
- Enable `build-std-features = core/turbowakers`
- Enable feature `turbowakers` in `embassy-executor`, `embassy-sync`.
- Make sure you have no other crate creating wakers other than `embassy-executor`. These will panic at runtime.

Note that the patched `core` is equivalent to the unpached one when the `turbowakers` feature is not enabled, so it should be fine to leave it there.
2023-03-30 17:55:55 +02:00
Dario Nieuwenhuis
758f5d7ea2 Release embassy-executor v0.1.1 2022-11-23 14:53:18 +01:00
Dario Nieuwenhuis
db7e153fc0 executor: enable features for docs.rs
Otherwise the non-raw executor and the macros don't show up.
2022-11-23 14:49:40 +01:00
Ulf Lilleengen
04a7d97673
refactor: autodetect macro variant
Export all main macro per target architecture from embassy-macros,
and select the appropriate macro in embassy-executor.
2022-11-23 13:54:59 +01:00
bors[bot]
2fa2c1a6fe
Merge #1054
1054: riscv fixes r=lulf a=swolix

With these changes I can run embassy on our RISC-V processor, please consider merging this, feedback is very welcome.

I don't fully understand the code in the executor, but I have implemented a critical section by globally disabling interrupts, which means the wfi inside the critical section will hang the whole thing.

Co-authored-by: Sijmen Woutersen <sijmen.woutersen@gmail.com>
2022-11-23 09:24:11 +00:00
Ulf Lilleengen
51233c0357 doc: update cargo manifests with keywords 2022-11-22 14:51:23 +01:00
Sijmen Woutersen
6e1120e17e riscv support 2022-11-10 17:39:41 +01:00
chrysn
6718ca3a94 all Cargo.toml: Add license to all crate Cargo.toml files
Closes: https://github.com/embassy-rs/embassy/issues/1002
2022-10-07 12:41:56 +02:00