Skip to content

Commit 9544dd2

Browse files
committed
Add PAC readme, add banner directing to docs.embassy.dev.
1 parent 91fc4f2 commit 9544dd2

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

stm32-metapac-gen/res/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ include = [
1111
"**/*.rs",
1212
"**/*.x",
1313
"Cargo.toml",
14+
"README.md",
1415
]
1516

1617
[package.metadata.docs.rs]
1718
features = ["stm32h755zi-cm7", "pac", "metadata"]
1819
default-target = "thumbv7em-none-eabihf"
1920
targets = []
21+
rustdoc-args = ["--cfg", "docsrs"]
2022

2123
[package.metadata.embassy_docs]
2224
features = ["pac", "metadata"]

stm32-metapac-gen/res/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# stm32-metapac
2+
3+
This is a [Peripheral Access Crate](https://rust-embedded.github.io/book/start/registers.html) for STMicroelectronics STM32 microcontrollers.
4+
5+
This crate has been automatically generated based on data in the [`stm32-data` project](https://github.com/embassy-rs/stm32-data), and is used for the [`embassy-stm32`](github.com/embassy-rs/embassy/) Rust Hardware Abstraction Layer (HAL) for the STM32 microcontrollers.
6+
7+
## Metadata
8+
9+
This PAC additionally exports "metadata" about the chips. To use it, enable the `metadata` feature and access it at `stm32_metapac::METADATA`. It is intended to be consumed from `build.rs` scripts or code-generation tools running on PCs, not from the firmware itself.
10+
11+
The metadata includes the following info:
12+
13+
- Memory maps for RAM, flash.
14+
- Interrupts
15+
- GPIO Alternate Function mappings
16+
- Interrupt -> peripheral mappings
17+
- DMA channel -> peripehral mappings
18+
- RCC clock tree information for each peripheral (what clocks does it receive, which RCC registers to poke to enable, reset, or choose the clock)
19+
20+
## Supported chips
21+
22+
This PAC aims to support all STM32 chip families:
23+
24+
- STM32F0
25+
- STM32F1
26+
- STM32F2
27+
- STM32F3
28+
- STM32F4
29+
- STM32F7
30+
- STM32C0
31+
- STM32G0
32+
- STM32G4
33+
- STM32H5
34+
- STM32H7
35+
- STM32H7RS
36+
- STM32L0
37+
- STM32L1
38+
- STM32L4
39+
- STM32L5
40+
- STM32U0
41+
- STM32U5
42+
- STM32WB
43+
- STM32WBA
44+
- STM32WL

stm32-metapac-gen/res/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
#![allow(unused)]
44
#![allow(non_camel_case_types)]
55
#![doc(html_no_source)]
6+
#![cfg_attr(
7+
docsrs,
8+
doc = "<div style='padding:30px;background:#810;color:#fff;text-align:center;'><p>You might want to <a href='https://docs.embassy.dev/stm32-metapac'>browse the `embassy-nrf` documentation on the Embassy website</a> instead.</p><p>The documentation here on `docs.rs` is built for a single chip only (stm32h755zi-cm7 in particular), while on the Embassy website you can pick your exact chip from the top menu. Available peripherals and their APIs change depending on the chip.</p></div>\n\n"
9+
)]
10+
#![doc = include_str!("../README.md")]
611

712
pub mod common;
813

stm32-metapac-gen/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ impl Gen {
336336
}
337337

338338
// copy misc files
339+
fs::write(self.opts.out_dir.join("README.md"), include_bytes!("../res/README.md")).unwrap();
339340
fs::write(self.opts.out_dir.join("build.rs"), include_bytes!("../res/build.rs")).unwrap();
340341
fs::write(
341342
self.opts.out_dir.join("src/lib.rs"),

0 commit comments

Comments
 (0)