Commit Graph

3556 Commits

Author SHA1 Message Date
bors[bot]
bd488ef0d5
Merge #740
740: Allow using separate page sizes for state and dfu r=lulf a=lulf

* Less generics on bootloader. Keep PAGE_SIZE as a common multiple of
DFU and ACTIVE page sizes.
* Document restriction
* Add unit tests for different page sizes

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-04-28 11:31:35 +00:00
Ulf Lilleengen
bd237a1f96 Allow using separate page sizes for state and dfu
* Less generics on bootloader. Keep PAGE_SIZE as a common multiple of
DFU and ACTIVE page sizes.
* Document restriction
* Add unit tests for different page sizes
2022-04-28 10:38:25 +02:00
bors[bot]
ba46df6825
Merge #739
739: net: Add support for packet pools with size 64 and 128 r=Dirbaio a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2022-04-27 19:58:42 +00:00
Matous Hybl
3a3ed27c30 net: Add support for packet pools with size 64 and 128 2022-04-27 21:27:28 +02:00
Zoey Riordan
2ebc1186e0
Add split method to UarteWithIdle 2022-04-27 20:33:41 +02:00
bors[bot]
5b3aaaaa9c
Merge #737
737: Remove unnecessary feature gating for giant transfers in DCMI r=Dirbaio a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2022-04-27 14:54:59 +00:00
Matous Hybl
7538f57d62 Remove unnecessary feature gating for giant transfers in DCMI 2022-04-27 16:53:20 +02:00
bors[bot]
663642eabb
Merge #724
724: STM32 Flash + Bootloader  r=Dirbaio a=lulf

Not working.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-04-27 13:43:15 +00:00
Ulf Lilleengen
93c17be32e Update stm32-data branch 2022-04-27 15:18:09 +02:00
Ulf Lilleengen
da61611f8f Add bootloader to CI 2022-04-27 15:17:18 +02:00
Ulf Lilleengen
484e0acc63 Add stm32 flash + bootloader support
* Add flash drivers for L0, L1, L4, WB and WL. Not tested for WB, but
should be similar to WL.
* Add embassy-boot-stm32 for bootloading on STM32.
* Add flash examples and bootloader examples
* Update stm32-data
2022-04-27 15:17:18 +02:00
bors[bot]
9c283cd445
Merge #736
736: executor: allow Send-spawning of tasks if their args are Send. r=Dirbaio a=Dirbaio

This allows send-spawning (spawning into an executor in another thread) tasks if their args are Send. Previously this would require the entire future to be Send.

--


When send-spawning a task, we construct the future in this thread, and effectively
"send" it to the executor thread by enqueuing it in its queue. Therefore, in theory,
send-spawning should require the future `F` to be `Send`.

The problem is this is more restrictive than needed. Once the future is executing,
it is never sent to another thread. It is only sent when spawning. It should be
enough for the task's arguments to be Send. (and in practice it's super easy to
accidentally make your futures !Send, for example by holding an `Rc` or a `&RefCell` across an `.await`.)

Luckily, an `async fn` future contains just the args when freshly constructed. So, if the
args are Send, it's OK to send a !Send future, as long as we do it before first polling it.


Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-04-27 12:21:25 +00:00
Dario Nieuwenhuis
1599009a4f executor: "send-spawn is OK if the args are Send" only holds for async fn futures.
The normal `spawn()` methods can be called directly by the user, with arbitrary hand-implemented futures.
We can't enforce they're only called with `async fn` futures. Therefore, make these
require `F: Send`, and add a "private" one only for use in the macro, which can enforce it.
2022-04-27 04:56:41 +02:00
Dario Nieuwenhuis
6f6c16f449 executor: make send-spawning only require the task args to be Send, not the whole future. 2022-04-27 04:56:41 +02:00
Dario Nieuwenhuis
293f54d134 executor: add raw::TaskPool.
This simplifies the macro code a bit.
2022-04-27 04:56:41 +02:00
bors[bot]
df814f9bbd
Merge #734 #735
734: executor: Add `Spawner::for_current_executor`. r=Dirbaio a=Dirbaio

This is needed to spawn non-Send tasks in an InterruptExecutor, after the fixes in #730 .

`@matoushybl` could you check if this works for your use case?

735: stm32: add stm32u5 GPDMA, SPIv4 support, add HIL tests. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-04-26 23:32:30 +00:00
Dario Nieuwenhuis
009bb8e4e1 stm32: add stm32u5 GPDMA, SPIv4 support, add HIL tests. 2022-04-27 01:16:14 +02:00
bors[bot]
3b0200daec
Merge #731
731: Update to released lorawan crates r=Dirbaio a=lulf



Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-04-26 17:35:23 +00:00
Dario Nieuwenhuis
9e897cbea9 executor: Add Spawner::for_current_executor. 2022-04-26 19:08:18 +02:00
Ulf Lilleengen
2c0e28aa0c Update to released lorawan crates 2022-04-26 19:06:15 +02:00
bors[bot]
3131510f4c
Merge #732
732: macros: simplify task macro using "TAIT laundering". r=Dirbaio a=Dirbaio

This brings the macro to the state before the nightly update #729 #730, with a much cleaner workaround for the opaque type error, from https://github.com/rust-lang/rust/issues/96406

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-04-26 17:03:06 +00:00
Dario Nieuwenhuis
96d917992c macros: simplify task macro using "TAIT laundering". 2022-04-26 18:40:45 +02:00
bors[bot]
a39d796c3d
Merge #730
730: Executor and task macro fixes. r=Dirbaio a=Dirbaio

See individual commits.

bors r+

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-04-25 20:21:32 +00:00
Dario Nieuwenhuis
2b0e8a330b examples/nrf: add self_spawn example.
This serves as a compile-test of possible typecheck loops due to
TAIT shenanigans.
2022-04-25 22:19:40 +02:00
Dario Nieuwenhuis
c4cecec10c macros: isolate the TAIT into its own mod.
This fixes type inference issues due to the TAIT's defining scope
being the whole parent mod.
2022-04-25 22:18:52 +02:00
Dario Nieuwenhuis
b27feb0619 executor: fix unsoundness in InterruptExecutor::start.
The initial closure is not actually called in the interrupt, so this is
illegally sending non-Send futures to the interrupt.

Remove the closure, and return a SendSpawner instead.
2022-04-25 22:09:04 +02:00
Dario Nieuwenhuis
52ed08cf95 executor: remove useless not_send in SendSpwaner. 2022-04-25 16:38:56 +02:00
bors[bot]
97e24b0568
Merge #716
716: Implement giant (chunked) DMA transfers r=Dirbaio a=matoushybl

There is a breaking change in the Channel trait in the method `remaining_transfers()`, this method however hasn't been used anywhere in the codebase and the return type changed from u16 to u32, so all of the previous use cases should work.

Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2022-04-25 12:32:04 +00:00
Matous Hybl
945fa0871f Implement giant (chunked) DMA transfers for DCMI. 2022-04-25 14:30:43 +02:00
bors[bot]
a1746f4dda
Merge #717
717: WIP: USB CDC NCM (Ethernet over USB) r=Dirbaio a=Dirbaio

TODO:

- [x] Add support for string handling in `embassy-usb`, remove the MAC addr string hax
- [x] Harden parsing of incoming NTBs to avoid panics.
- [ ] Parse all datagrams in a NDP, not just the first. -- tricky, I've made it tell the host we support only one packet per NTB instead.
- [ ] Add support for all required control transfers. -- WONTFIX, seems no OS cares about those.
- [x] Works on Linux
- [x] Doesn't work on Android, make it work
- [x] Check if it works in Windows (Win10 has some sort of CDC NCM support afaict?) -- works on Win11, CDC-NCM not supported on Win10
- [x] Check if it works in MacOS (I don't know if it's supposed to) - WORKS

I won't add the `embassy-net` driver to `embassy-usb-ncm` for now because `embassy-net` buffer management will likely be refactored soon, so there's not much point to it.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-04-24 20:47:37 +00:00
Dario Nieuwenhuis
d409026b95 examples/nrf: add product strings to all usb examples. 2022-04-24 22:46:45 +02:00
Dario Nieuwenhuis
d57fd87ba7 Add embassy-usb-ncm. Implements USBB CDC NCM (Ethernet over USB) 2022-04-24 22:44:52 +02:00
Dario Nieuwenhuis
50e1d257bd net: change listen() to accept(), which waits until the connection is established. 2022-04-24 04:35:29 +02:00
Dario Nieuwenhuis
b578e060d7
Merge pull request #729 from embassy-rs/update-nightly
Update Rust nightly.
2022-04-24 04:34:30 +02:00
Dario Nieuwenhuis
408617266e Update Rust nightly.
Fixes a new opaque type error in the task macro.
Full error is "opaque type's hidden type cannot be another opaque type from the same scope".
This got disallwed by the lazy-TAIT PR: https://github.com/rust-lang/rust/pull/94081

Sadly there's now some weird type inference errors with pre-lazy-TAIT
nightlies, so support for those is dropped.
2022-04-24 04:24:08 +02:00
Dario Nieuwenhuis
11143a1be1
Merge pull request #722 from embassy-rs/usb-altsettings
usb: builtin handling of interface alternate settings
2022-04-23 06:20:11 +02:00
Dario Nieuwenhuis
7778b79dc3 nrf: autoenable defmt in deps. 2022-04-23 06:03:38 +02:00
Dario Nieuwenhuis
0476f6b55b usb: add support for custom string descriptors. 2022-04-23 04:40:57 +02:00
Dario Nieuwenhuis
7c6a88f3dd usb: set the interface handler in InterfaceBuilder. 2022-04-23 01:29:19 +02:00
Dario Nieuwenhuis
092c2b7dfe usb: builtin handling of interface alternate settings
The stack reads its own descriptors to figure out which endpoints
are used in which alt settings, and enables/disables them as needed.

The ControlHandler has a callback so it can get notified of alternate
setting changes, which is purely informative (it doesn't have to do anything).
2022-04-23 01:11:10 +02:00
bors[bot]
afb4f8623b
Merge #727
727: Switch to crates.io embedded-hal, embedded-hal-async. r=Dirbaio a=Dirbaio

This temporarily removes support for the async UART trait, since it's
not yet in embedded-hal-async.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-04-22 18:15:05 +00:00
Dario Nieuwenhuis
3251a21fb7 Switch to crates.io embedded-hal, embedded-hal-async.
This temporarily removes support for the async UART trait, since it's
not yet in embedded-hal-async.
2022-04-22 19:58:24 +02:00
Dario Nieuwenhuis
ea0a701ebd
Merge pull request #725 from liigo/patch-1
remove description which not makes sense
2022-04-22 18:16:27 +02:00
Liigo Zhuang
b97592248a reword task finish and cancel 2022-04-22 15:10:59 +08:00
Dario Nieuwenhuis
f63813367b
Merge pull request #726 from danbev/time_driver_typo
Fix typo in driver.rs
2022-04-21 18:29:28 +02:00
Daniel Bevenius
db862a60ee Fix typo in driver.rs 2022-04-21 18:27:00 +02:00
Liigo Zhuang
a61daa9f7f
remove description which not makes sense 2022-04-21 17:17:01 +08:00
bors[bot]
de7dd59fa9
Merge #713
713: Bootloader external flash r=lulf a=lulf

Includes e-s and e-s-a impls for nrf QSPI

WIP: Working on testing it.

Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-04-20 06:21:51 +00:00
Ulf Lilleengen
2afff617f6 Support multiple flash instances in embassy-boot
* Add FlashProvider and FlashConfig traits to define flash
characteristics
* Use traits in bootloader to retrieve flash handles and for
copying data between flash instances
* Add convenience implementations for using a single flash instance.
2022-04-19 20:07:06 +02:00
bors[bot]
e2ed41b383
Merge #723
723: Add embedded-storage trait impls for QSPI r=Dirbaio a=lulf

* Adds implementations of embedded-storage and embedded-storage-async
for QSPI
* Add blocking implementations of QSPI
* Use blocking implementation in new() and embedded-storage impls
* Use async implementation in embedded-storage-async impls
* Add FLASH_SIZE const generic parameter
* Own IRQ in Qspi instance to disable it on drop.

Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-04-19 17:20:33 +00:00