Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stm327xx-hal benchmark #802

Merged
merged 4 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions collector/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ These are real programs that are important in some way, and worth tracking.
- **ripgrep**: A line-oriented search tool. A widely-used utility.
- **serde**: A serialization/deserialization crate. Used by many other
Rust programs.
- **stm32f4**: A crate that has many thousands of blanket impl blocks.
- **style-servo**: Servo's `style` crate. A large crate, and one used by
Firefox.
- **syn**: A library for parsing Rust code. An important part of the Rust
Expand Down
252 changes: 252 additions & 0 deletions collector/benchmarks/stm32f4/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions collector/benchmarks/stm32f4/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[package]
edition = "2018"
name = "stm32f4"
version = "0.12.1"
authors = ["Adam Greig <adam@adamgreig.com>", "stm32-rs Contributors"]
description = "Device support crates for STM32F4 devices"
repository = "https://github.com/stm32-rs/stm32-rs"
readme = "README.md"
keywords = ["stm32", "svd2rust", "no_std", "embedded"]
categories = ["embedded", "no-std"]
license = "MIT/Apache-2.0"

[dependencies]
bare-metal = "0.2.4"
vcell = "0.1.0"
cortex-m = ">=0.5.8,<0.7"

[dependencies.cortex-m-rt]
optional = true
version = "0.6.10"

[package.metadata.docs.rs]
features = ['rt', 'stm32f401', 'stm32f407', 'stm32f413', 'stm32f469']
default-target = "thumbv7em-none-eabihf"
targets = []

[features]
default = []
rt = ["cortex-m-rt/device"]
stm32f401 = []
stm32f405 = []
stm32f407 = []
stm32f410 = []
stm32f411 = []
stm32f412 = []
stm32f413 = []
stm32f427 = []
stm32f429 = []
stm32f446 = []
stm32f469 = []
51 changes: 51 additions & 0 deletions collector/benchmarks/stm32f4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# stm32f4
This crate provides an autogenerated API for access to STM32F4 peripherals.
The API is generated using [svd2rust] with patched svd files containing
extensive type-safe support. For more information please see the [main repo].

Refer to the [documentation] for full details.

[svd2rust]: https://github.com/japaric/svd2rust
[main repo]: https://github.com/stm32-rs/stm32-rs
[documentation]: https://docs.rs/stm32f4/latest/stm32f4/

## Usage
Each device supported by this crate is behind a feature gate so that you only
compile the device(s) you want. To use, in your Cargo.toml:

```toml
[dependencies.stm32f4]
version = "0.12.1"
features = ["stm32f401", "rt"]
```

The `rt` feature is optional and brings in support for `cortex-m-rt`.

In your code:

```rust
use stm32f4::stm32f401;

let mut peripherals = stm32f401::Peripherals::take().unwrap();
let gpioa = &peripherals.GPIOA;
gpioa.odr.modify(|_, w| w.odr0().set_bit());
```

For full details on the autogenerated API, please see:
https://docs.rs/svd2rust/0.17.0/svd2rust/#peripheral-api

## Supported Devices

| Module | Devices | Links |
|:------:|:-------:|:-----:|
| stm32f401 | STM32F401 | [RM0368](https://www.st.com/resource/en/reference_manual/dm00096844.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html) |
| 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) |
| 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) |
| stm32f410 | STM32F410 | [RM0401](https://www.st.com/resource/en/reference_manual/dm00180366.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f410.html) |
| stm32f411 | STM32F411 | [RM0383](https://www.st.com/resource/en/reference_manual/dm00119316.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f411.html) |
| stm32f412 | STM32F412 | [RM0402](https://www.st.com/resource/en/reference_manual/dm00180369.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f412.html) |
| 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) |
| 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) |
| 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) |
| stm32f446 | STM32F446 | [RM0390](https://www.st.com/resource/en/reference_manual/dm00135183.pdf), [st.com](https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html) |
| 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) |
35 changes: 35 additions & 0 deletions collector/benchmarks/stm32f4/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
if env::var_os("CARGO_FEATURE_RT").is_some() {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
println!("cargo:rustc-link-search={}", out.display());
let device_file = if env::var_os("CARGO_FEATURE_STM32F401").is_some() {
"src/stm32f401/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F405").is_some() {
"src/stm32f405/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F407").is_some() {
"src/stm32f407/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F410").is_some() {
"src/stm32f410/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F411").is_some() {
"src/stm32f411/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F412").is_some() {
"src/stm32f412/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F413").is_some() {
"src/stm32f413/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F427").is_some() {
"src/stm32f427/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F429").is_some() {
"src/stm32f429/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F446").is_some() {
"src/stm32f446/device.x"
} else if env::var_os("CARGO_FEATURE_STM32F469").is_some() {
"src/stm32f469/device.x"
} else { panic!("No device features selected"); };
fs::copy(device_file, out.join("device.x")).unwrap();
println!("cargo:rerun-if-changed={}", device_file);
}
println!("cargo:rerun-if-changed=build.rs");
}
3 changes: 3 additions & 0 deletions collector/benchmarks/stm32f4/perf-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cargo_opts": "--features=stm32f405"
}
Loading