diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-02-09 15:27:35 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-02-09 15:27:35 +0000 |
| commit | 1d265b73b2f46baf60a481c8b8036e50c2b6583f (patch) | |
| tree | 862f3b9d41b38048d555e40e6e6425da29b0cf1d /.github/workflows | |
| parent | 3d6b8bd9832d5a29cab4aa21434663e6ea6f4488 (diff) | |
| parent | 8160af6af99573d3ef66aede8c4b0aac033b0ff3 (diff) | |
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](https://github.com/embassy-rs/embassy/blob/f50f3f0a73a41275e6ea21d8661081acad381e05/embassy-stm32/src/dma/bdma.rs#L26).
- Can't remove duplicates, so we had to fallback to [Rust code in build.rs](https://github.com/embassy-rs/embassy/blob/f50f3f0a73a41275e6ea21d8661081acad381e05/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 <[email protected]>
Diffstat (limited to '.github/workflows')
0 files changed, 0 insertions, 0 deletions
