Commit Graph

784 Commits

Author SHA1 Message Date
Paweł Jan Czochański
8f4fae9b36 Add smoltcp dhcp socket configuration 2023-01-19 14:44:01 +01:00
chemicstry
7d34f4f538 stm32/usb_otg: Add F4 usb_ethernet example 2023-01-18 02:37:02 +02:00
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
Christian Perez Llamas
5fdd521a76 Move the responsibility to manage buffers to the I2S stream 2022-12-08 20:22:50 +01:00
bors[bot]
5e94b8060b
Merge #1089
1089: feat: embassy-boot for rp2040 r=Dirbaio a=lulf

Add embassy-boot support for RP2040, with examples for the Raspberry Pi Pico.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-12-04 19:58:57 +00:00
miathedev
a2712caab1 Add random example 2022-12-04 09:38:57 +01:00
Ulf Lilleengen
bb89a2341c
feat: embassy-boot for rp2040
Add embassy-boot support for RP2040, with examples for the Raspberry Pi
Pico.

Co-authored-by: Mathias Koch <mk@blackbird.online>
2022-12-02 11:28:33 +01:00
bors[bot]
f109e73c6d
Merge #1074
1074: Added blinky example for stm32f0 r=lulf a=imrank03

Hi, I have added **blinky** example for `stm32f0` and tested with Nucleo board `STM32F091RC`.

- Can I add more example for stm32f0?

Co-authored-by: @imrank03 <immu0396@gmail.com>
2022-12-02 08:10:12 +00:00
Dario Nieuwenhuis
1dcb0ea1f5 Bump defmt-rtt to 0.4 2022-11-29 21:15:24 +01:00
Dario Nieuwenhuis
3135ad016d Bump embedded-nal-async to 0.3.0 2022-11-29 12:05:46 +01:00
Christian Perez Llamas
199504be56 Optimization to be able to work with only 2 buffers 2022-11-29 01:09:47 +01:00
Dario Nieuwenhuis
1e2fb0459d Switch to async-fn-in-trait 2022-11-25 21:02:06 +01:00
@imrank03
5aad2129ef added the runner for stm32f091rc 2022-11-23 17:51:43 +05:30
@imrank03
28991d7794 added blinky example for stm32f0 2022-11-23 17:30:58 +05:30
bors[bot]
83b199a874
Merge #1056
1056: embassy-nrf: Add TWIS module r=Dirbaio a=kalkyl

Verified to be working on nrf9160

Co-authored-by: kalkyl <henrik.alser@me.com>
Co-authored-by: Henrik Alsér <henrik.alser@me.com>
2022-11-22 21:50:42 +00:00
Henrik Alsér
cf900a8a3f Rename write to respond_to_read 2022-11-22 22:10:04 +01:00
bors[bot]
97cb95bbf4
Merge #1042
1042: embassy-nrf: Add SPIS module r=Dirbaio a=kalkyl

Verified to be working on nrf9160

Co-authored-by: Henrik Alsér <henrik.alser@me.com>
Co-authored-by: Henrik Alsér <henrik.alser@ucsmindbite.se>
Co-authored-by: kalkyl <henrik.alser@me.com>
2022-11-22 11:20:14 +00:00
bors[bot]
f13639e78c
Merge #1059
1059: embassy-rp: Add basic ADC module r=kalkyl a=kalkyl

Oneshot ADC

Co-authored-by: Henrik Alsér <henrik.alser@me.com>
2022-11-22 01:06:25 +00:00
Christian Perez Llamas
15a93246d6 Buffer management in line with other peripherals. Constructor and config redesign 2022-11-19 19:18:20 +01:00
Christian Perez Llamas
16838f8a66 Fix format 2022-11-19 00:32:09 +01:00
Christian Perez Llamas
6b88057aef Add missing parts and Cleanup 2022-11-19 00:29:05 +01:00
Ulf Lilleengen
a444a65ebf feat: embassy-usb-logger and example for rpi pico
* Add embassy-usb-logger which allows logging over USB for any device
  implementing embassy-usb
* Add example using logger for rpi pico.
2022-11-18 11:22:58 +01:00
Christian Perez Llamas
1ed260b105 Fix buffer overruns 2022-11-17 00:19:22 +01:00
Henrik Alsér
eb149a0bd4 embassy-rp: Add basic ADC module 2022-11-15 16:12:07 +01:00
kalkyl
43c1afb6a6 Return number of bytes written, add address match getter 2022-11-14 11:22:14 +01:00
kalkyl
eba42cb5f4 embassy-nrf: Add TWIS module 2022-11-13 22:15:19 +01:00
Christian Perez Llamas
4fe834db2f Mono channels 2022-11-13 02:48:07 +01:00
Christian Perez Llamas
17857bc18f Minor changes 2022-11-13 02:12:58 +01:00
Henrik Alsér
dca11095e2 Disable UARTE in embassy-nrf::init 2022-11-13 01:49:55 +01:00
Christian Perez Llamas
d2e8794f29 Investigating discontinuities in the signal 2022-11-13 01:41:32 +01:00
Christian Perez Llamas
122a31d208 Interrupts, async, sine oscillator 2022-11-12 18:48:57 +01:00
Christian Perez Llamas
4a2e810485 Restrict to pacs supporting i2s 2022-11-10 23:13:01 +01:00
Matous Hybl
cbc97758e3 stm32: Fix watchdog division by zero for 256 prescaler, add watchdog example for H7 2022-11-10 15:56:28 +01:00
Christian Perez Llamas
5a64bf651c Buffer trait. Simpler config. 2022-11-10 00:10:42 +01:00
Christian Perez Llamas
356beabc3b Apply config 2022-11-09 23:08:09 +01:00
Roman Valls Guimera
3760b60db3 Make bors grin ;) 2022-11-09 22:31:19 +01:00
Christian Perez Llamas
cecd77938c Draft: Initial support for I2S with a working example.
Co-authored-by: @brainstorm <brainstorm@nopcode.org>
2022-11-09 19:19:01 +01:00
Henrik Alsér
af34fc4ccc rustfmt 2022-11-05 01:40:20 +01:00
Henrik Alsér
7da18e194a Add status checks 2022-11-05 01:12:25 +01:00
Henrik Alsér
1920e90dcd embassy-nrf: Add SPIS module 2022-11-05 00:15:43 +01:00
miathedev
fc086fd4ba Add uart async example 2022-11-01 10:38:02 +01:00
Mathias
c871fe0848 Rebase on master 2022-10-27 07:12:34 +02:00
Mathias
3c6c382465 Remove random delay from example, and move flash functions to allow using without embedded-storage in scope 2022-10-27 07:10:35 +02:00
bors[bot]
7f499f3edc
Merge #1024
1024: stm32/adc: Remove voltage and temperature conversions r=Dirbaio a=GrantM11235

The current conversion utilities are confusing and a bit of a footgun. (Two out of the three examples got it wrong! They didn't measure vref at all, so all the conversions are completely wrong if vcca isn't 3.3v)

I think we should eventually have some sort of conversion utilities in the HAL, but for now I think it is best to just remove it and let the users do their own math.

cc `@chemicstry` 

Co-authored-by: Grant Miller <GrantM11235@gmail.com>
2022-10-26 19:44:06 +00:00
bors[bot]
01e23bf9dd
Merge #1025
1025: Implement I2C timeouts, second attempt r=Dirbaio a=chemicstry

This is an alterrnative to #1022 as discussed there.

Timeouts are implemented using suggested `check_timeout: impl Fn() -> Result<(), Error>` function, which does not depend on `embassy-time` by default and is a noop for regular I2C.

This also adds `time` feature like in `embassy-nrf` to enable `embassy-time` dependencies. While at it, I also gated some other peripherals that depend on `embassy-time`, notably `usb` and (partially) `subghz`.

`TimeoutI2c` is currently only implemented for i2cv1, because i2cv2 has additional complications:
- Async methods still use a lot of busy waiting code in between DMA transfers, so simple `with_timeout()` will not work and it will have to use both types of timeouts. It could probably be rewritten to replace busy waits with IRQs, but that's outside the scope of this PR.
- I2C definition `I2c<'d, T, TXDMA, RXDMA>` is different from i2cv1 `I2c<'d, T>` making it hard to share single `TimeoutI2c` wrapper. A couple of options here:
  - Duplicate `TimeoutI2c` code
  - Add dummy `TXDMA`, `RXDMA` types to i2cv1 considering that in the future it should also support DMA

Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-10-26 19:34:43 +00:00
Guillaume MICHEL
9cac649fcf stm32: Add support for read_until_idle on UART 2022-10-26 19:06:18 +02:00
Dario Nieuwenhuis
eeb072d9cb Update Rust nightly. 2022-10-26 16:47:29 +02:00
Mathias
1669e39565 Buffer data to be written to flash in ram if it does not already reside in ram 2022-10-26 15:02:39 +02:00
Mathias
80e58426fc Add flash example & flash HIL test 2022-10-26 12:24:04 +02:00
Grant Miller
7a6732adcf Improve examples 2022-10-24 15:27:12 -05:00
chemicstry
52c03cf0a4 Add more docs 2022-10-24 22:48:40 +03:00