Commit Graph

2934 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
b99ab3d5d9 stm32: Add standard crate-wide macros for pin/dma traits, switch all drivers to use them. 2022-02-10 21:38:03 +01:00
bors[bot]
cbc7f620bd
Merge #606
606: Port multiprio example to stm32f3 and stm32f4 platforms r=Dirbaio a=ceigel

Example tested on stm32f303discovery and stm32f405 feather.

Co-authored-by: Cristian Eigel <cristian.eigel@esrlabs.com>
2022-02-10 18:26:56 +00:00
Cristian Eigel
898851ceeb Port multiprio example to stm32f3 and stm32f4 platforms 2022-02-10 19:22:32 +01:00
bors[bot]
9d682aa1fa
Merge #605
605: stm32: Remove OptionalPin r=Dirbaio a=Dirbaio

The idea behind OptionalPin has a few problems:

- you need to impl the signal traits for NoPin which is a bit weird https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L413-L416
- you can pass any combination of set/unset pins, which needs checking at runtime  https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L130

The replacement is to do multiple `new` constructors for each combination of pins you want to take.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-10 15:15:06 +00:00
Dario Nieuwenhuis
a8bd3ab952 Add missing + 'd on unborrows. 2022-02-10 16:06:42 +01:00
Dario Nieuwenhuis
550da471be stm32: Remove OptionalPin
The idea behind OptionalPin has a few problems:

- you need to impl the signal traits for NoPin which is a bit weird https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L413-L416
- you can pass any combination of set/unset pins, which needs checking at runtime  https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L130

The replacement is to do multiple `new` constructors for each combination of pins you want to take.
2022-02-10 02:38:10 +01:00
bors[bot]
1d265b73b2
Merge #601
601: [part 1/n] Change macrotables to build.rs codegen r=lulf a=Dirbaio

This PR replaces the "macrotables" (the macros like `stm32_data::peripherals!`) with a `const METADATA`.

Macrotables had some problems:

- Hard to debug
- Somewhat footgunny (typo the "pattern" and then nothing matches and the macro now expands to nothing, silently!)
- Limited power
  - Can't count, so we had to add a [special macrotable for that](f50f3f0a73/embassy-stm32/src/dma/bdma.rs (L26)).
  - Can't remove duplicates, so we had to fallback to [Rust code in build.rs](f50f3f0a73/embassy-stm32/build.rs (L105-L145))
  - Can't include the results as a listto another macro, so again [build.rs](https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/build.rs#L100-L101).

They work fine for the 95% of cases, but for the remaining 5% we need Rust code in build.rs. So we might as well do everything with Rust code, so everything is consistent.

The new approach generates a `const METADATA: Metadata = Metadata { ... }` with [these structs](https://github.com/embassy-rs/embassy/blob/unmacrotablize/stm32-metapac-gen/src/assets/metadata.rs) in `stm32-metapac`. `build.rs` can then read that and generate whatever code.


Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-09 15:27:35 +00:00
bors[bot]
3d6b8bd983
Merge #604
604: Add embassy-boot r=lulf a=lulf

Continuation of https://github.com/embassy-rs/embassy/pull/588

Embassy-boot is a simple bootloader that works together with an application to provide firmware update capabilities with a minimal risk.

The bootloader consists of a platform-independent part, which implements the swap algorithm, and a platform-dependent part (currently only for nRF) that provides addition functionality such as watchdog timers softdevice support.

The bootloader is intended to be configurable for different flash sizes and architectures, and only requires that embedded-storage flash traits are implemented.

The nRF version can be configured programatically as a library, or using linker scripts to set the partition locations for DFU, ACTIVE and STATE

* DFU: Where the next firmware version should be written. This is used by the FirmwareUpdater
* ACTIVE: Where the current firmware version resides. Written by bootloader when swap magic is set
* STATE: Contains the bootloader magic and the copy progress. Can be 1-N pages long (depending on how much flash you have which will determine the copy progress index size


Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-02-09 15:07:25 +00:00
Ulf Lilleengen
e990021b9a Address review comments 2022-02-09 12:46:46 +01:00
Ulf Lilleengen
ed2a87a262 Add embassy-boot
Embassy-boot is a simple bootloader that works together with an
application to provide firmware update capabilities with a minimal risk.

The bootloader consists of a platform-independent part, which implements
the swap algorithm, and a platform-dependent part (currently only for
nRF) that provides addition functionality such as watchdog timers
softdevice support.
2022-02-09 10:50:29 +01:00
bors[bot]
d91bd0b9a6
Merge #602
602: Add stm32 USB OTG peripherals r=Dirbaio a=chemicstry

Fixes #557. This is similar to #580, but for synopsys IP.

I could add examples to other chips, but I have no way of testing them. The F4 example is tested and working.

Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-02-09 00:29:00 +00:00
chemicstry
10981ee809 Cleanup 2022-02-09 02:10:54 +02:00
chemicstry
a766bf635d Fix function name 2022-02-09 02:04:31 +02:00
chemicstry
1f81a69347 Merge USB FS and HS peripherals. Add ULPI. 2022-02-09 02:02:23 +02:00
Dario Nieuwenhuis
8160af6af9 stm32: replace peripheral_rcc! macrotable with build.rs 2022-02-09 00:58:17 +01:00
Dario Nieuwenhuis
d1a9680422 stm32: change interrupt declarations from macrotables to build.rs. 2022-02-09 00:45:52 +01:00
Dario Nieuwenhuis
940412c034 stm32/build.rs: switch to using stm32-metapac metadata and quote. 2022-02-09 00:31:21 +01:00
Dario Nieuwenhuis
4d73d87b40 stm32-metapac: add option to generate chip metadata as a rust const. 2022-02-09 00:28:05 +01:00
bors[bot]
2cf79f6569
Merge #603
603: Add support for FMC r=Dirbaio a=matoushybl



Co-authored-by: Matous Hybl <hyblmatous@gmail.com>
2022-02-08 21:48:33 +00:00
Matous Hybl
d37d714314 stm32: Add support for FMC 2022-02-08 17:30:20 +01:00
Matous Hybl
fee1de109d Fix RCC configuration for H7. 2022-02-08 14:36:53 +01:00
chemicstry
db0d798b48 Add stm32 USB OTG peripherals 2022-02-08 01:46:32 +02:00
bors[bot]
a4b4a7bcf9
Merge #600
600: Update stm32-data r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-07 22:14:44 +00:00
Dario Nieuwenhuis
8ef5b404f1 Update stm32-data 2022-02-07 23:13:44 +01:00
bors[bot]
f50f3f0a73
Merge #599
599: Update stm32-data r=Dirbaio a=Dirbaio

Again!

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-07 19:41:15 +00:00
Dario Nieuwenhuis
aaf25bbac3 Update stm32-data 2022-02-07 20:40:35 +01:00
bors[bot]
965e3c436e
Merge #598
598: Upgrade to embedded-storage 0.3.0 r=lulf a=lulf



Co-authored-by: Ulf Lilleengen <ulf.lilleengen@gmail.com>
2022-02-07 12:14:01 +00:00
Ulf Lilleengen
f79624c3e6 Upgrade to embedded-storage 0.3.0 2022-02-07 12:35:58 +01:00
bors[bot]
d06b0628e0
Merge #597
597: Update stm32-data, update build scripts for new schema. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-07 01:23:35 +00:00
Dario Nieuwenhuis
de19fe5c05 Update stm32-data, update build scripts for new schema. 2022-02-07 02:23:02 +01:00
bors[bot]
a1d6077446
Merge #591
591: PWM WS2812B example and flexible sequence config r=Dirbaio a=huntc

I've permitted the PWM sequences to be mutated on stopping the PWM by associating them with a new  `SingleSequencer` structure. This is so that we can perform effects on the LEDs (and other use-cases, I'm sure!). The example has been updated to illustrate the use of this by flashing a WS2812B LED.

There's also a `Sequencer` structure for more sophisticated PWM interactions, along with a `pwm_double_sequence`  example to illustrate.

These changes should make it possible to attain all of the nRF PWM functionality available.

Co-authored-by: huntc <huntchr@gmail.com>
2022-02-05 02:20:13 +00:00
bors[bot]
def3283e44
Merge #596
596: Update stm32data r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-02-05 02:04:03 +00:00
Dario Nieuwenhuis
fbaa7e59d5 stm32/dma: fix interrupt codegen for new stm32-data 2022-02-05 03:03:32 +01:00
Dario Nieuwenhuis
f8507b5e78 update stm32-data 2022-02-05 03:03:24 +01:00
Dario Nieuwenhuis
f8b8872fa6
Merge pull request #593 from embassy-rs/remove-traits
traits: migrate Delay to embedded-hal 1.0+async, remove Rng and Flash.
2022-02-05 01:53:01 +01:00
huntc
df5ba727f2 Further API simplification for the single seq scenario 2022-02-05 08:05:23 +11:00
huntc
81d31e43eb Removed unrequired clone 2022-02-04 19:18:10 +11:00
huntc
3b2beddc7a Forgot to expose the stop method 2022-02-04 19:14:24 +11:00
huntc
965a5f2c3f Introduced the SingleSequencer and a more complex Sequencer 2022-02-04 19:11:15 +11:00
huntc
9e36ede363 Small correction to times 2022-02-04 16:48:26 +11:00
huntc
e9e4d058d1 Revert the use of forever 2022-02-04 16:39:14 +11:00
huntc
81f98c32aa Update another example 2022-02-04 16:34:25 +11:00
huntc
fe5501293f Expose PWM 2022-02-04 16:26:23 +11:00
huntc
25be00878c Doco correction 2022-02-04 15:55:04 +11:00
huntc
1af6b23f97 Introduces a Sequences struct 2022-02-04 13:04:55 +11:00
huntc
bc7266394d Clarify why we need the mut buffer 2022-02-04 11:48:08 +11:00
bors[bot]
abd21ad139
Merge #595
595: stm32f3: fix nonexistent cfg tests r=Dirbaio a=unrelentingtech

The rcc code was taken from stm32-rs which uses 'x' features, but embassy uses features with full chip names.

Add these 'x' wildcards as cfgs and use them in rcc. They will be useful for USB #580 too.

---

I don't have any F3 boards, so this is not tested. But the original cfg clearly doesn't look right…

Co-authored-by: Greg V <greg@unrelenting.technology>
2022-02-02 20:03:21 +00:00
Greg V
8bb41a3281 stm32f3: fix nonexistent cfg tests
The rcc code was taken from stm32-rs which uses 'x' features, but
embassy uses features with full chip names.

Add these 'x' wildcards as cfgs and use them in rcc.
They will be useful for USB too.
2022-02-02 22:53:03 +03:00
huntc
986295998a Some more doco 2022-01-30 16:26:09 +11:00
huntc
1c67bd4643 Revert "Own the sequence buffer"
This reverts commit 482389a691.
2022-01-30 16:21:23 +11:00