Skip to content

Commit c52ee62

Browse files
Merge pull request #802 from jyn514/stm32
Add stm327xx-hal benchmark
2 parents 9830252 + 025b5ed commit c52ee62

File tree

7,122 files changed

+2035584
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,122 files changed

+2035584
-2
lines changed

collector/benchmarks/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ These are real programs that are important in some way, and worth tracking.
2626
- **ripgrep**: A line-oriented search tool. A widely-used utility.
2727
- **serde**: A serialization/deserialization crate. Used by many other
2828
Rust programs.
29+
- **stm32f4**: A crate that has many thousands of blanket impl blocks.
2930
- **style-servo**: Servo's `style` crate. A large crate, and one used by
3031
Firefox.
3132
- **syn**: A library for parsing Rust code. An important part of the Rust

collector/benchmarks/stm32f4/Cargo.lock

+252
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[package]
2+
edition = "2018"
3+
name = "stm32f4"
4+
version = "0.12.1"
5+
authors = ["Adam Greig <adam@adamgreig.com>", "stm32-rs Contributors"]
6+
description = "Device support crates for STM32F4 devices"
7+
repository = "https://github.com/stm32-rs/stm32-rs"
8+
readme = "README.md"
9+
keywords = ["stm32", "svd2rust", "no_std", "embedded"]
10+
categories = ["embedded", "no-std"]
11+
license = "MIT/Apache-2.0"
12+
13+
[dependencies]
14+
bare-metal = "0.2.4"
15+
vcell = "0.1.0"
16+
cortex-m = ">=0.5.8,<0.7"
17+
18+
[dependencies.cortex-m-rt]
19+
optional = true
20+
version = "0.6.10"
21+
22+
[package.metadata.docs.rs]
23+
features = ['rt', 'stm32f401', 'stm32f407', 'stm32f413', 'stm32f469']
24+
default-target = "thumbv7em-none-eabihf"
25+
targets = []
26+
27+
[features]
28+
default = []
29+
rt = ["cortex-m-rt/device"]
30+
stm32f401 = []
31+
stm32f405 = []
32+
stm32f407 = []
33+
stm32f410 = []
34+
stm32f411 = []
35+
stm32f412 = []
36+
stm32f413 = []
37+
stm32f427 = []
38+
stm32f429 = []
39+
stm32f446 = []
40+
stm32f469 = []
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# stm32f4
2+
This crate provides an autogenerated API for access to STM32F4 peripherals.
3+
The API is generated using [svd2rust] with patched svd files containing
4+
extensive type-safe support. For more information please see the [main repo].
5+
6+
Refer to the [documentation] for full details.
7+
8+
[svd2rust]: https://github.com/japaric/svd2rust
9+
[main repo]: https://github.com/stm32-rs/stm32-rs
10+
[documentation]: https://docs.rs/stm32f4/latest/stm32f4/
11+
12+
## Usage
13+
Each device supported by this crate is behind a feature gate so that you only
14+
compile the device(s) you want. To use, in your Cargo.toml:
15+
16+
```toml
17+
[dependencies.stm32f4]
18+
version = "0.12.1"
19+
features = ["stm32f401", "rt"]
20+
```
21+
22+
The `rt` feature is optional and brings in support for `cortex-m-rt`.
23+
24+
In your code:
25+
26+
```rust
27+
use stm32f4::stm32f401;
28+
29+
let mut peripherals = stm32f401::Peripherals::take().unwrap();
30+
let gpioa = &peripherals.GPIOA;
31+
gpioa.odr.modify(|_, w| w.odr0().set_bit());
32+
```
33+
34+
For full details on the autogenerated API, please see:
35+
https://docs.rs/svd2rust/0.17.0/svd2rust/#peripheral-api
36+
37+
## Supported Devices
38+
39+
| Module | Devices | Links |
40+
|:------:|:-------:|:-----:|
41+
| stm32f401 | STM32F401 | [RM0368](https://www.st.com/resource/en/reference_manual/dm00096844.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html) |
42+
| stm32f405 | STM32F405, STM32F415 | [RM0090](https://www.st.com/resource/en/reference_manual/dm00031020.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f405-415.html) |
43+
| stm32f407 | STM32F407, STM32F417 | [RM0090](https://www.st.com/resource/en/reference_manual/dm00031020.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f407-417.html) |
44+
| stm32f410 | STM32F410 | [RM0401](https://www.st.com/resource/en/reference_manual/dm00180366.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f410.html) |
45+
| stm32f411 | STM32F411 | [RM0383](https://www.st.com/resource/en/reference_manual/dm00119316.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f411.html) |
46+
| stm32f412 | STM32F412 | [RM0402](https://www.st.com/resource/en/reference_manual/dm00180369.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f412.html) |
47+
| stm32f413 | STM32F413, STM32F423 | [RM0430](https://www.st.com/resource/en/reference_manual/dm00305666.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f413-423.html) |
48+
| stm32f427 | STM32F427, STM32F437 | [RM0090](https://www.st.com/resource/en/reference_manual/dm00031020.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f427-437.html) |
49+
| stm32f429 | STM32F429, STM32F439 | [RM0090](https://www.st.com/resource/en/reference_manual/dm00031020.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f429-439.html) |
50+
| stm32f446 | STM32F446 | [RM0390](https://www.st.com/resource/en/reference_manual/dm00135183.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html) |
51+
| stm32f469 | STM32F469, STM32F479 | [RM0386](https://www.st.com/resource/en/reference_manual/dm00127514.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f469-479.html) |

collector/benchmarks/stm32f4/build.rs

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use std::env;
2+
use std::fs;
3+
use std::path::PathBuf;
4+
fn main() {
5+
if env::var_os("CARGO_FEATURE_RT").is_some() {
6+
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
7+
println!("cargo:rustc-link-search={}", out.display());
8+
let device_file = if env::var_os("CARGO_FEATURE_STM32F401").is_some() {
9+
"src/stm32f401/device.x"
10+
} else if env::var_os("CARGO_FEATURE_STM32F405").is_some() {
11+
"src/stm32f405/device.x"
12+
} else if env::var_os("CARGO_FEATURE_STM32F407").is_some() {
13+
"src/stm32f407/device.x"
14+
} else if env::var_os("CARGO_FEATURE_STM32F410").is_some() {
15+
"src/stm32f410/device.x"
16+
} else if env::var_os("CARGO_FEATURE_STM32F411").is_some() {
17+
"src/stm32f411/device.x"
18+
} else if env::var_os("CARGO_FEATURE_STM32F412").is_some() {
19+
"src/stm32f412/device.x"
20+
} else if env::var_os("CARGO_FEATURE_STM32F413").is_some() {
21+
"src/stm32f413/device.x"
22+
} else if env::var_os("CARGO_FEATURE_STM32F427").is_some() {
23+
"src/stm32f427/device.x"
24+
} else if env::var_os("CARGO_FEATURE_STM32F429").is_some() {
25+
"src/stm32f429/device.x"
26+
} else if env::var_os("CARGO_FEATURE_STM32F446").is_some() {
27+
"src/stm32f446/device.x"
28+
} else if env::var_os("CARGO_FEATURE_STM32F469").is_some() {
29+
"src/stm32f469/device.x"
30+
} else { panic!("No device features selected"); };
31+
fs::copy(device_file, out.join("device.x")).unwrap();
32+
println!("cargo:rerun-if-changed={}", device_file);
33+
}
34+
println!("cargo:rerun-if-changed=build.rs");
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cargo_opts": "--features=stm32f405"
3+
}

0 commit comments

Comments
 (0)