Commit Graph

732 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
355761fd68 stm32: add stm32c0 examples. 2023-01-17 21:28:16 +01:00
bors[bot]
b6c8505697
Merge #1142
1142: More rp2040 BufferedUart fixes r=Dirbaio a=timokroeger

* Refactor init code
* Make it possible to drop RX without breaking TX (or vice versa)
* Correctly handle RX buffer full scenario

Co-authored-by: Timo Kröger <timokroeger93@gmail.com>
2023-01-14 00:07:02 +00:00
bors[bot]
b0c8c688c7
Merge #1147
1147: Support codesigning in the firmware updater r=lulf a=huntc

This PR provides a method to verify that firmware has been SHA-512 hashed and signed with a private key given its public key. The implementation provides both [`ed25519-dalek`](https://github.com/dalek-cryptography/ed25519-dalek/blob/main/Cargo.toml) and [`salty`](https://github.com/ycrypto/salty) as the signature verifiers. Either of the `ed25519-dalek` and `ed25519-salty` features is required to enable the functionality from `embassy-boot`.

The `verify_and_mark_updated` method is used in place of `mark_updated` when signing is used via its feature. This avoids the accidental omission of validation where it has been declared as required at compile time. It also keeps the parity of calls at the same number to the previous situation.

The PR permits other types of signature verifiers in the future on the proviso that the [Signature trait](https://github.com/RustCrypto/traits/tree/master/signature) is supported.

Finally, I've updated the CI to include testing `embassy-boot`, which it was doing before. In addition, I've included a unit test for verification based on a `ed25519-dalek` documentation example. This tests both the `dalek` and `salty` implementations.

In terms of code size comparisons, `dalek` adds about 68KiB and `salty` adds about 20KiB. I'm using `salty` myself. I've also tested this out by signing my code with the OpenBSD `signify` utility and then verify it during firmware upload using `salty`.


Co-authored-by: huntc <huntchr@gmail.com>
2023-01-12 20:43:24 +00:00
huntc
b0529bc943 Support codesigning in the firmware updater
This commit provides a method to verify that firmware has been signed with a private key given its public key. The implementation uses ed25519-dalek as the signature verifier. An "ed25519" feature is required to enable the functionality. When disabled (the default), calling the firmware updater's verify method will return a failure.
2023-01-12 13:30:58 +11:00
chemicstry
1af102a1aa stm32 otg: add examples. 2023-01-11 17:58:15 +01:00
Dominik Boehi
2baebabf4d Reduce amount of samples for nrf5340 2023-01-09 22:57:40 +01:00
Dominik Boehi
0a27b6cedb Rename examples/nrf to examples/nrf52840 2023-01-09 22:30:02 +01:00
Dominik Boehi
401185b1d9 Change UART pins for nRF5340 DK 2023-01-08 16:25:51 +01:00
Dominik Boehi
f8afc3c882 Add samples for nrf5340 2023-01-08 15:36:35 +01:00
bors[bot]
3fbedd7c09
Merge #1141
1141: feat: compile bootloader examples for nRF91 r=lulf a=lulf

* Add nRF91 as target in CI builds
* Add example linker scripts for nrf91
* Make less nRF52 assumptions example config
* Add llvm-tools-preview required for cargo objcopy example

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2023-01-05 14:06:45 +00:00
Pedro Ferreira
6d4c6e0481 rp2040: add {tx,rx}-only constructors to UART 2023-01-04 21:11:19 +01:00
Timo Kröger
a24037edf9 rp: Fix BufferedUart drop code
Only unregister the interrupt handler when both parts are inactive
2023-01-04 15:59:03 +01:00
Ulf Lilleengen
2332d8cd23
feat: compile bootloader examples for nRF91
* Add nRF91 as target in CI builds
* Add example linker scripts for nrf91
* Make less nRF52 assumptions example config
* Add llvm-tools-preview required for cargo objcopy example
2023-01-04 13:38:43 +01:00
bors[bot]
bf4c0de16a
Merge #1139
1139: Wdt config changes r=lulf a=huntc

Per commits:

* By passing WDT config around we can control it more easily and promote sharing it between files.

* The memory layout of the s140 crept into a number of memory files, which can cause confusion (well, it did for me!).

* Obtaining the current WDT config is useful so that we do not have to duplicate configurations around the place. A constructor method has been introduced that attempts to return the current running WDT config from the WDT peripheral. The bootloader example has also been updated to show how the watchdog can be obtained and used.

Co-authored-by: huntc <huntchr@gmail.com>
2023-01-04 07:44:23 +00:00
huntc
8497f98de2 Provides a means of obtaining the current WDT config
Obtaining the current WDT config is important so that we do not have to duplication configuration around the place. A constructor method has been introduced that returns WDT config in accordance with how the register is presently configured. The bootloader example has also been updated to show the watchdog can be obtained and used.
2023-01-04 12:13:44 +11:00
huntc
6e6c3cbebc Cleaned up some doc and memory layout
The memory layout of the s140 crept into a number of memory files, which can cause confusion.
2023-01-04 10:27:16 +11:00
huntc
651eec0242 Pass WDT config around
By passing WDT config around we can control it more easily and promote sharing it between files.
2023-01-04 10:19:39 +11:00
kalkyl
413f339489 Cleanup 2023-01-03 23:34:50 +01:00
kalkyl
9428c40c8d embassy-boot (rp): Add WatchdogFlash 2023-01-03 22:58:56 +01:00
bors[bot]
0aa2a9ac27
Merge #1093 #1127
1093: Add random example r=Dirbaio a=miathedev

Thanks Lulf for the help!

This should be added as example so other people can look it up easily.

With love,
Mia



1127: clean up doc comment generation r=Dirbaio a=Weshnaw

I noticed that when I created doc comments for my tasks that the doc comments got included on the inner function but not the outer functions, I personally prefer keeping the documentation as clean as possible so this PR aims to hide the inner function and then add doc comments to the outer function.

The actual changes include:
* adding #[doc(hidden)] onto the `task_inner` function
  * I flip flopped on this one because I could imagine someone may want this in their docs, but decided to include but I think arguments could be made either way
* copy the attributes from `task_inner` to `task_outer`
  * I don't work with proc_macros often so I am not entirely sure if the way I went about it is correct but it seems to work fine
    * specifically: using `parse_quote` to create the `task_outer` as a `ItemFn` then duplicating the attributes from `task_inner` to `task_outer`
  * I also am not sure if it's a good idea to duplicate all attributes over, but I honestly wasn't sure how to just get the just doc comment attributes

![OLD doc](https://user-images.githubusercontent.com/3748858/209456006-bfa6d40d-d3bf-4c1d-a2de-cf40828b58e5.png)
![NEW doc](https://user-images.githubusercontent.com/3748858/209456011-995363a3-f5b1-4ea3-9db9-1c566643efcb.png)


Co-authored-by: miathedev <mia@metzler.systems>
Co-authored-by: Brendon Fallquist <bfallquist@gmail.com>
2023-01-02 23:13:41 +00:00
Dario Nieuwenhuis
41d6316984 rp: switch to released 0.2.1 pio crate. 2022-12-26 22:30:22 +01:00
Dario Nieuwenhuis
1f033d509a net: split driver trait to a separate crate. 2022-12-26 04:49:08 +01:00
Dario Nieuwenhuis
72bb9b53a2 net: remove unused pool-x features 2022-12-26 03:34:05 +01:00
kalkyl
e090ab1915 Remove lifetime, use pac fields 2022-12-24 03:22:51 +01:00
kalkyl
eaad0cc1dc embassy-rp: Add Watchdog 2022-12-24 02:51:06 +01:00
kalkyl
787745188c Change log level to debug 2022-12-23 23:14:58 +01:00
kalkyl
aa92ce6dc7 embassy-rp: Add split() to BufferedUart 2022-12-22 23:03:05 +01:00
@imrank03
55d9af71e3 enabled interrupt feature 2022-12-21 11:56:30 +05:30
@imrank03
395b5fed64 added watchdog example 2022-12-21 11:55:09 +05:30
@imrank03
0db3837dcc added priority based example 2022-12-21 11:54:36 +05:30
@imrank03
c0f3610581 added interrupt example 2022-12-21 11:53:55 +05:30
@imrank03
63122f6d7e button controlled example 2022-12-21 11:52:40 +05:30
Aaron Tsui
5ae91ed3b6 cargo fmt 2022-12-20 14:59:49 +08:00
Aaron Tsui
849a0e174f add convert_to_celsius function in the adc module
modify RP2040 adc example to get inside biased bipolar diode voltage,
    then convert this temperature sensor data into Celsius degree,
    according to chapter 4.9.5. Temperature Sensor in RP2040 datasheet.
2022-12-20 09:12:01 +08:00
Dario Nieuwenhuis
790e4e1594 examples/std: update to new embassy-net trait. 2022-12-13 16:43:25 +01:00
Dario Nieuwenhuis
5eae295c8a stm32: rename feature net to embassy-net.
The eth code is always built and available, but has no own API (other
than the embassy-net Device impl) to rx/tx packets. We could add this
API in the future, so the feature only means "embassy-net support".
2022-12-13 16:43:25 +01:00
Dario Nieuwenhuis
3005ee0178 stm32/eth_v2: update to new embassy-net trait, remove PeripheralMutex. 2022-12-13 16:43:25 +01:00
Dario Nieuwenhuis
8f30652109 stm32/eth_v1: update to new embassy-net trait, remove PeripheralMutex. 2022-12-13 16:43:25 +01:00
Dario Nieuwenhuis
e9219405ca usb/cdc-ncm: add embassy-net Device implementation. 2022-12-13 16:43:25 +01:00
Henrik Alsér
3d68c0400b
Merge branch 'master' into multicore 2022-12-13 13:51:48 +01:00
kalkyl
13d9d8fde1 Refactor after review 2022-12-13 13:49:51 +01:00
bors[bot]
36639e5262
Merge #1043 #1103
1043: Rpi Pico PIO driver r=Dirbaio a=fluffware

This is a driver for the two PIOs in the Pico. I've tried using the type system to get as much compile time checks as possible. There is asynchronous support for FIFOs an Irqs. No DMA support yet. There's an example that shows how to use the driver asynchronously.

1103: embassy-stm32: add rs485 driver enable to uart r=Dirbaio a=FrozenDroid



Co-authored-by: Simon Berg <ksb@fluffware.se>
Co-authored-by: Vincent Stakenburg <v.stakenburg@sinewave.nl>
2022-12-13 11:47:27 +00:00
kalkyl
96d6c7243b Cleanup 2022-12-10 13:43:29 +01:00
kalkyl
d8821cfd41 Feature gate critical-section-impl 2022-12-10 12:57:45 +01:00
kalkyl
34eaade14f fmt 2022-12-10 08:33:09 +01:00
kalkyl
1ee58492fb embassy-rp: Add multicore support 2022-12-10 08:26:35 +01:00
Dario Nieuwenhuis
5d4f09156a nrf: add manually_create_executor example. 2022-12-09 23:33:53 +01:00
Simon Berg
cd59046e6c Added RelocateProgram class for adjusting PIO-programs for different origins. 2022-12-09 20:18:41 +01:00
Simon Berg
35db6e639b PIO support for RPi Pico 2022-12-09 20:18:41 +01:00
bors[bot]
58ab829049
Merge #1049
1049: embassy-nrf: Add I2S module r=lulf a=chris-zen

This PR adds I2S support for the nrf52 series (`nrf52832`, `nrf52833`, `nrf52840`).

We could only test it in a `nrf52840` in master mode for an output stream (see `i2s_waveform` example), using a clone of the [Adafruit I2S Stereo Decoder - UDA1334A](https://learn.adafruit.com/adafruit-i2s-stereo-decoder-uda1334a/overview).

We were wondering if this could be a welcome addition to embassy, as we are working on this very informally and don't have much free time for it.

<img src="https://user-images.githubusercontent.com/932644/202316127-a8cf90ef-1e1a-4e1d-b796-961b8ad6cef5.png" width="600">

https://user-images.githubusercontent.com/932644/202316609-e53cd912-e463-4e01-839e-0bbdf37020da.mp4


Co-authored-by: `@brainstorm` <brainstorm@nopcode.org>

Co-authored-by: Christian Perez Llamas <932644+chris-zen@users.noreply.github.com>
Co-authored-by: Roman Valls Guimera <brainstorm@users.noreply.github.com>
2022-12-09 07:49:40 +00:00