From 0b49b588a2890096f95bef2f8c6d8644acdc5401 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 20 Mar 2023 02:11:22 +0100 Subject: [PATCH] stm32: use stm32-metapac from crates.io, remove stm32-data submodule. --- .github/workflows/doc.yml | 1 - .gitignore | 4 - .gitmodules | 3 - ci.sh | 20 +- .../ROOT/examples/layer-by-layer/Cargo.toml | 1 - .../layer-by-layer/blinky-pac/Cargo.toml | 2 +- embassy-stm32/Cargo.toml | 64 +- stm32-data | 1 - stm32-gen-features/.cargo/config.toml | 3 - stm32-gen-features/.gitignore | 1 - stm32-gen-features/Cargo.toml | 11 - stm32-gen-features/src/lib.rs | 169 --- stm32-gen-features/src/main.rs | 25 - stm32-metapac-gen/Cargo.toml | 15 - stm32-metapac-gen/src/data.rs | 124 -- stm32-metapac-gen/src/lib.rs | 380 ----- stm32-metapac-gen/src/main.rs | 36 - stm32-metapac/Cargo.toml | 1332 ----------------- stm32-metapac/build.rs | 77 - stm32-metapac/build_pregenerated.rs | 39 - stm32-metapac/src/lib.rs | 18 - stm32-metapac/src/metadata.rs | 106 -- xtask/.cargo/config.toml | 6 - xtask/Cargo.toml | 11 - xtask/src/main.rs | 221 --- 25 files changed, 34 insertions(+), 2636 deletions(-) delete mode 100644 .gitmodules delete mode 160000 stm32-data delete mode 100644 stm32-gen-features/.cargo/config.toml delete mode 100644 stm32-gen-features/.gitignore delete mode 100644 stm32-gen-features/Cargo.toml delete mode 100644 stm32-gen-features/src/lib.rs delete mode 100644 stm32-gen-features/src/main.rs delete mode 100644 stm32-metapac-gen/Cargo.toml delete mode 100644 stm32-metapac-gen/src/data.rs delete mode 100644 stm32-metapac-gen/src/lib.rs delete mode 100644 stm32-metapac-gen/src/main.rs delete mode 100644 stm32-metapac/Cargo.toml delete mode 100644 stm32-metapac/build.rs delete mode 100644 stm32-metapac/build_pregenerated.rs delete mode 100644 stm32-metapac/src/lib.rs delete mode 100644 stm32-metapac/src/metadata.rs delete mode 100644 xtask/.cargo/config.toml delete mode 100644 xtask/Cargo.toml delete mode 100644 xtask/src/main.rs diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 4bc73fdc..cb222803 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -54,7 +54,6 @@ jobs: run: | mkdir crates builder ./embassy-stm32 crates/embassy-stm32/git.zup - builder ./stm32-metapac crates/stm32-metapac/git.zup - name: build-rest if: ${{ matrix.crates=='rest' }} diff --git a/.gitignore b/.gitignore index 144dd703..1c221e87 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,4 @@ target_ci_stable Cargo.lock third_party /Cargo.toml -stm32-metapac-gen/out/ -stm32-metapac-backup -stm32-metapac/src/chips -stm32-metapac/src/peripherals out/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 8157e36e..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "stm32-data"] - path = stm32-data - url = https://github.com/embassy-rs/stm32-data.git diff --git a/ci.sh b/ci.sh index bbcb26bd..d86c9352 100755 --- a/ci.sh +++ b/ci.sh @@ -8,28 +8,12 @@ export DEFMT_LOG=trace TARGET=$(rustc -vV | sed -n 's|host: ||p') +BUILD_EXTRA="" if [ $TARGET = "x86_64-unknown-linux-gnu" ]; then BUILD_EXTRA="--- build --release --manifest-path examples/std/Cargo.toml --target $TARGET --out-dir out/examples/std" -else - BUILD_EXTRA="" fi -find . -name '*.rs' -not -path '*target*' -not -path '*stm32-metapac-gen/out/*' -not -path '*stm32-metapac/src/*' | xargs rustfmt --check --skip-children --unstable-features --edition 2018 - -# Generate stm32-metapac -if [ ! -d "stm32-metapac-backup" ] -then - cp -r stm32-metapac stm32-metapac-backup -fi - -rm -rf stm32-metapac -cp -r stm32-metapac-backup stm32-metapac - -# for some reason Cargo stomps the cache if we don't specify --target. -# This happens with vanilla Cargo, not just cargo-batch. Bug? -(cd stm32-metapac-gen; cargo run --release --target $TARGET) -rm -rf stm32-metapac -mv stm32-metapac-gen/out stm32-metapac +find . -name '*.rs' -not -path '*target*' | xargs rustfmt --check --skip-children --unstable-features --edition 2018 cargo batch \ --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly \ diff --git a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml index 9048d930..943249a1 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml +++ b/docs/modules/ROOT/examples/layer-by-layer/Cargo.toml @@ -10,7 +10,6 @@ members = [ [patch.crates-io] embassy-executor = { path = "../../../../../embassy-executor" } embassy-stm32 = { path = "../../../../../embassy-stm32" } -stm32-metapac = { path = "../../../../../stm32-metapac" } [profile.release] codegen-units = 1 diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml index a077f182..f872b94c 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" [dependencies] cortex-m = "0.7" cortex-m-rt = "0.7" -stm32-metapac = { version = "0.1.0", features = ["stm32l475vg", "memory-x"] } +stm32-metapac = { version = "1", features = ["stm32l475vg", "memory-x"] } defmt = "0.3.0" defmt-rtt = "0.3.0" diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 1f430c7c..b66d724d 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -60,7 +60,7 @@ sdio-host = "0.5.0" embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "46d1b1c2ff13e31e282ec1e352421721694f126a", optional = true } critical-section = "1.1" atomic-polyfill = "1.0.1" -stm32-metapac = { version = "0.1.0", path = "../stm32-metapac", features = ["rt"] } +stm32-metapac = { version = "1", features = ["rt"] } vcell = "0.1.3" bxcan = "0.7.0" nb = "1.0.0" @@ -72,7 +72,7 @@ embedded-io = { version = "0.4.0", features = ["async"], optional = true } [build-dependencies] proc-macro2 = "1.0.36" quote = "1.0.15" -stm32-metapac = { version = "0.1.0", path = "../stm32-metapac", default-features = false, features = ["metadata"]} +stm32-metapac = { version = "1", default-features = false, features = ["metadata"]} [features] defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy-sync/defmt", "embassy-executor/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt", "embedded-io?/defmt", "embassy-usb-driver?/defmt", "embassy-net-driver/defmt"] @@ -107,8 +107,7 @@ unstable-pac = [] # Implement embedded-hal-async traits if `nightly` is set as well. unstable-traits = ["embedded-hal-1", "dep:embedded-hal-nb"] -# BEGIN GENERATED FEATURES -# Generated by stm32-gen-features. DO NOT EDIT. +# Chip-selection features stm32c011d6 = [ "stm32-metapac/stm32c011d6" ] stm32c011f4 = [ "stm32-metapac/stm32c011f4" ] stm32c011f6 = [ "stm32-metapac/stm32c011f6" ] @@ -1070,89 +1069,89 @@ stm32l083rz = [ "stm32-metapac/stm32l083rz" ] stm32l083v8 = [ "stm32-metapac/stm32l083v8" ] stm32l083vb = [ "stm32-metapac/stm32l083vb" ] stm32l083vz = [ "stm32-metapac/stm32l083vz" ] -stm32l100c6-a = [ "stm32-metapac/stm32l100c6-a" ] stm32l100c6 = [ "stm32-metapac/stm32l100c6" ] -stm32l100r8-a = [ "stm32-metapac/stm32l100r8-a" ] +stm32l100c6-a = [ "stm32-metapac/stm32l100c6-a" ] stm32l100r8 = [ "stm32-metapac/stm32l100r8" ] -stm32l100rb-a = [ "stm32-metapac/stm32l100rb-a" ] +stm32l100r8-a = [ "stm32-metapac/stm32l100r8-a" ] stm32l100rb = [ "stm32-metapac/stm32l100rb" ] +stm32l100rb-a = [ "stm32-metapac/stm32l100rb-a" ] stm32l100rc = [ "stm32-metapac/stm32l100rc" ] -stm32l151c6-a = [ "stm32-metapac/stm32l151c6-a" ] stm32l151c6 = [ "stm32-metapac/stm32l151c6" ] -stm32l151c8-a = [ "stm32-metapac/stm32l151c8-a" ] +stm32l151c6-a = [ "stm32-metapac/stm32l151c6-a" ] stm32l151c8 = [ "stm32-metapac/stm32l151c8" ] -stm32l151cb-a = [ "stm32-metapac/stm32l151cb-a" ] +stm32l151c8-a = [ "stm32-metapac/stm32l151c8-a" ] stm32l151cb = [ "stm32-metapac/stm32l151cb" ] +stm32l151cb-a = [ "stm32-metapac/stm32l151cb-a" ] stm32l151cc = [ "stm32-metapac/stm32l151cc" ] stm32l151qc = [ "stm32-metapac/stm32l151qc" ] stm32l151qd = [ "stm32-metapac/stm32l151qd" ] stm32l151qe = [ "stm32-metapac/stm32l151qe" ] -stm32l151r6-a = [ "stm32-metapac/stm32l151r6-a" ] stm32l151r6 = [ "stm32-metapac/stm32l151r6" ] -stm32l151r8-a = [ "stm32-metapac/stm32l151r8-a" ] +stm32l151r6-a = [ "stm32-metapac/stm32l151r6-a" ] stm32l151r8 = [ "stm32-metapac/stm32l151r8" ] -stm32l151rb-a = [ "stm32-metapac/stm32l151rb-a" ] +stm32l151r8-a = [ "stm32-metapac/stm32l151r8-a" ] stm32l151rb = [ "stm32-metapac/stm32l151rb" ] -stm32l151rc-a = [ "stm32-metapac/stm32l151rc-a" ] +stm32l151rb-a = [ "stm32-metapac/stm32l151rb-a" ] stm32l151rc = [ "stm32-metapac/stm32l151rc" ] +stm32l151rc-a = [ "stm32-metapac/stm32l151rc-a" ] stm32l151rd = [ "stm32-metapac/stm32l151rd" ] stm32l151re = [ "stm32-metapac/stm32l151re" ] stm32l151uc = [ "stm32-metapac/stm32l151uc" ] -stm32l151v8-a = [ "stm32-metapac/stm32l151v8-a" ] stm32l151v8 = [ "stm32-metapac/stm32l151v8" ] -stm32l151vb-a = [ "stm32-metapac/stm32l151vb-a" ] +stm32l151v8-a = [ "stm32-metapac/stm32l151v8-a" ] stm32l151vb = [ "stm32-metapac/stm32l151vb" ] -stm32l151vc-a = [ "stm32-metapac/stm32l151vc-a" ] +stm32l151vb-a = [ "stm32-metapac/stm32l151vb-a" ] stm32l151vc = [ "stm32-metapac/stm32l151vc" ] -stm32l151vd-x = [ "stm32-metapac/stm32l151vd-x" ] +stm32l151vc-a = [ "stm32-metapac/stm32l151vc-a" ] stm32l151vd = [ "stm32-metapac/stm32l151vd" ] +stm32l151vd-x = [ "stm32-metapac/stm32l151vd-x" ] stm32l151ve = [ "stm32-metapac/stm32l151ve" ] stm32l151zc = [ "stm32-metapac/stm32l151zc" ] stm32l151zd = [ "stm32-metapac/stm32l151zd" ] stm32l151ze = [ "stm32-metapac/stm32l151ze" ] -stm32l152c6-a = [ "stm32-metapac/stm32l152c6-a" ] stm32l152c6 = [ "stm32-metapac/stm32l152c6" ] -stm32l152c8-a = [ "stm32-metapac/stm32l152c8-a" ] +stm32l152c6-a = [ "stm32-metapac/stm32l152c6-a" ] stm32l152c8 = [ "stm32-metapac/stm32l152c8" ] -stm32l152cb-a = [ "stm32-metapac/stm32l152cb-a" ] +stm32l152c8-a = [ "stm32-metapac/stm32l152c8-a" ] stm32l152cb = [ "stm32-metapac/stm32l152cb" ] +stm32l152cb-a = [ "stm32-metapac/stm32l152cb-a" ] stm32l152cc = [ "stm32-metapac/stm32l152cc" ] stm32l152qc = [ "stm32-metapac/stm32l152qc" ] stm32l152qd = [ "stm32-metapac/stm32l152qd" ] stm32l152qe = [ "stm32-metapac/stm32l152qe" ] -stm32l152r6-a = [ "stm32-metapac/stm32l152r6-a" ] stm32l152r6 = [ "stm32-metapac/stm32l152r6" ] -stm32l152r8-a = [ "stm32-metapac/stm32l152r8-a" ] +stm32l152r6-a = [ "stm32-metapac/stm32l152r6-a" ] stm32l152r8 = [ "stm32-metapac/stm32l152r8" ] -stm32l152rb-a = [ "stm32-metapac/stm32l152rb-a" ] +stm32l152r8-a = [ "stm32-metapac/stm32l152r8-a" ] stm32l152rb = [ "stm32-metapac/stm32l152rb" ] -stm32l152rc-a = [ "stm32-metapac/stm32l152rc-a" ] +stm32l152rb-a = [ "stm32-metapac/stm32l152rb-a" ] stm32l152rc = [ "stm32-metapac/stm32l152rc" ] +stm32l152rc-a = [ "stm32-metapac/stm32l152rc-a" ] stm32l152rd = [ "stm32-metapac/stm32l152rd" ] stm32l152re = [ "stm32-metapac/stm32l152re" ] stm32l152uc = [ "stm32-metapac/stm32l152uc" ] -stm32l152v8-a = [ "stm32-metapac/stm32l152v8-a" ] stm32l152v8 = [ "stm32-metapac/stm32l152v8" ] -stm32l152vb-a = [ "stm32-metapac/stm32l152vb-a" ] +stm32l152v8-a = [ "stm32-metapac/stm32l152v8-a" ] stm32l152vb = [ "stm32-metapac/stm32l152vb" ] -stm32l152vc-a = [ "stm32-metapac/stm32l152vc-a" ] +stm32l152vb-a = [ "stm32-metapac/stm32l152vb-a" ] stm32l152vc = [ "stm32-metapac/stm32l152vc" ] -stm32l152vd-x = [ "stm32-metapac/stm32l152vd-x" ] +stm32l152vc-a = [ "stm32-metapac/stm32l152vc-a" ] stm32l152vd = [ "stm32-metapac/stm32l152vd" ] +stm32l152vd-x = [ "stm32-metapac/stm32l152vd-x" ] stm32l152ve = [ "stm32-metapac/stm32l152ve" ] stm32l152zc = [ "stm32-metapac/stm32l152zc" ] stm32l152zd = [ "stm32-metapac/stm32l152zd" ] stm32l152ze = [ "stm32-metapac/stm32l152ze" ] stm32l162qc = [ "stm32-metapac/stm32l162qc" ] stm32l162qd = [ "stm32-metapac/stm32l162qd" ] -stm32l162rc-a = [ "stm32-metapac/stm32l162rc-a" ] stm32l162rc = [ "stm32-metapac/stm32l162rc" ] +stm32l162rc-a = [ "stm32-metapac/stm32l162rc-a" ] stm32l162rd = [ "stm32-metapac/stm32l162rd" ] stm32l162re = [ "stm32-metapac/stm32l162re" ] -stm32l162vc-a = [ "stm32-metapac/stm32l162vc-a" ] stm32l162vc = [ "stm32-metapac/stm32l162vc" ] -stm32l162vd-x = [ "stm32-metapac/stm32l162vd-x" ] +stm32l162vc-a = [ "stm32-metapac/stm32l162vc-a" ] stm32l162vd = [ "stm32-metapac/stm32l162vd" ] +stm32l162vd-x = [ "stm32-metapac/stm32l162vd-x" ] stm32l162ve = [ "stm32-metapac/stm32l162ve" ] stm32l162zc = [ "stm32-metapac/stm32l162zc" ] stm32l162zd = [ "stm32-metapac/stm32l162zd" ] @@ -1370,4 +1369,3 @@ stm32wle5cc = [ "stm32-metapac/stm32wle5cc" ] stm32wle5j8 = [ "stm32-metapac/stm32wle5j8" ] stm32wle5jb = [ "stm32-metapac/stm32wle5jb" ] stm32wle5jc = [ "stm32-metapac/stm32wle5jc" ] -# END GENERATED FEATURES diff --git a/stm32-data b/stm32-data deleted file mode 160000 index 66252982..00000000 --- a/stm32-data +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 66252982939014e94fc4a1b7423c30c3d108ae0b diff --git a/stm32-gen-features/.cargo/config.toml b/stm32-gen-features/.cargo/config.toml deleted file mode 100644 index 17d81c14..00000000 --- a/stm32-gen-features/.cargo/config.toml +++ /dev/null @@ -1,3 +0,0 @@ -[profile.dev] -opt-level = 3 -lto = false diff --git a/stm32-gen-features/.gitignore b/stm32-gen-features/.gitignore deleted file mode 100644 index ea8c4bf7..00000000 --- a/stm32-gen-features/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/stm32-gen-features/Cargo.toml b/stm32-gen-features/Cargo.toml deleted file mode 100644 index f4aa08eb..00000000 --- a/stm32-gen-features/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "gen_features" -version = "0.1.0" -edition = "2021" -license = "MIT OR Apache-2.0" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -glob = "0.3.0" -yaml-rust = "0.4.5" diff --git a/stm32-gen-features/src/lib.rs b/stm32-gen-features/src/lib.rs deleted file mode 100644 index 7aaad9da..00000000 --- a/stm32-gen-features/src/lib.rs +++ /dev/null @@ -1,169 +0,0 @@ -//! FIXME discuss about which errors to print and when to panic - -use std::path::Path; - -const SEPARATOR_START: &str = "# BEGIN GENERATED FEATURES\n"; -const SEPARATOR_END: &str = "# END GENERATED FEATURES\n"; -const HELP: &str = "# Generated by stm32-gen-features. DO NOT EDIT.\n"; - -/// Get the list of all the chips and their supported cores -/// -/// Print errors to `stderr` when something is returned by the glob but is not in the returned -/// [`Vec`] -/// -/// This function is slow because all the yaml files are parsed. -pub fn chip_names_and_cores() -> Vec<(String, Vec)> { - glob::glob("../stm32-data/data/chips/*.json") - .unwrap() - .filter_map(|entry| entry.map_err(|e| eprintln!("{:?}", e)).ok()) - .filter_map(|entry| { - if let Some(name) = entry.file_stem().and_then(|stem| stem.to_str()) { - Some((name.to_lowercase(), chip_cores(&entry))) - } else { - eprintln!("{:?} is not a regular file", entry); - None - } - }) - .collect() -} - -/// Get the list of the cores of a chip by its associated file -/// -/// # Panic -/// Panics if the file does not exist or if it contains yaml syntax errors. -/// Panics if "cores" is not an array. -fn chip_cores(path: &Path) -> Vec { - let file_contents = std::fs::read_to_string(path).unwrap(); - let doc = &yaml_rust::YamlLoader::load_from_str(&file_contents).unwrap()[0]; - doc["cores"] - .as_vec() - .unwrap_or_else(|| panic!("{:?}:[cores] is not an array", path)) - .iter() - .enumerate() - .map(|(i, core)| { - core["name"] - .as_str() - .unwrap_or_else(|| panic!("{:?}:[cores][{}][name] is not a string", path, i)) - .to_owned() - }) - .collect() -} - -/// Generate data needed in `../embassy-stm32/Cargo.toml` -/// -/// Print errors to `stderr` when something is returned by the glob but is not in the returned -/// [`Vec`] -/// -/// # Panic -/// Panics if a file contains yaml syntax errors or if a value does not have a consistent type -pub fn embassy_stm32_needed_data(names_and_cores: &[(String, Vec)]) -> String { - let mut result = String::new(); - for (chip_name, cores) in names_and_cores { - if cores.len() > 1 { - for core_name in cores.iter() { - result += &format!( - "{chip}-{core} = [ \"stm32-metapac/{chip}-{core}\" ]\n", - chip = chip_name, - core = core_name - ); - } - } else { - result += &format!("{chip} = [ \"stm32-metapac/{chip}\" ]\n", chip = chip_name); - } - } - result -} - -/// Generate data needed in `../stm32-metapac/Cargo.toml` -/// -/// Print errors to `stderr` when something is returned by the glob but is not in the returned -/// [`Vec`] -/// -/// # Panic -/// Panics if a file contains yaml syntax errors or if a value does not have a consistent type -pub fn stm32_metapac_needed_data(names_and_cores: &[(String, Vec)]) -> String { - let mut result = String::new(); - for (chip_name, cores) in names_and_cores { - if cores.len() > 1 { - for core_name in cores { - result += &format!("{}-{} = []\n", chip_name, core_name); - } - } else { - result += &format!("{} = []\n", chip_name); - } - } - result -} - -/// Get contents before and after generated contents -/// -/// # Panic -/// Panics when a separator cound not be not found -fn split_cargo_toml_contents(contents: &str) -> (&str, &str) { - let (before, remainder) = contents - .split_once(SEPARATOR_START) - .unwrap_or_else(|| panic!("missing \"{}\" tag", SEPARATOR_START)); - let (_, after) = remainder - .split_once(SEPARATOR_END) - .unwrap_or_else(|| panic!("missing \"{}\" tag", SEPARATOR_END)); - - (before, after) -} - -/// Generates new contents for Cargo.toml -/// -/// # Panic -/// Panics when a separator cound not be not found -pub fn generate_cargo_toml_file(previous_text: &str, new_contents: &str) -> String { - let (before, after) = split_cargo_toml_contents(previous_text); - before.to_owned() + SEPARATOR_START + HELP + new_contents + SEPARATOR_END + after -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - #[ignore] - fn stm32f407vg_yaml_file_exists() { - assert!(chip_names_and_cores() - .as_slice() - .into_iter() - .any(|(name, _)| { name == "stm32f407vg" })) - } - - #[test] - fn keeps_text_around_separators() { - let initial = "\ -before -# BEGIN GENERATED FEATURES -# END GENERATED FEATURES -after -"; - - let expected = "\ -before -# BEGIN GENERATED FEATURES -# Generated by stm32-gen-features. DO NOT EDIT. -a = [\"b\"] -# END GENERATED FEATURES -after -"; - - let new_contents = String::from("a = [\"b\"]\n"); - assert_eq!(generate_cargo_toml_file(initial, &new_contents), expected); - } - - #[test] - #[should_panic] - fn does_not_generate_if_separators_are_missing() { - let initial = "\ -before -# END GENERATED FEATURES -after -"; - - let new_contents = String::from("a = [\"b\"]\n"); - generate_cargo_toml_file(initial, &new_contents); - } -} diff --git a/stm32-gen-features/src/main.rs b/stm32-gen-features/src/main.rs deleted file mode 100644 index f4092516..00000000 --- a/stm32-gen-features/src/main.rs +++ /dev/null @@ -1,25 +0,0 @@ -use gen_features::{ - chip_names_and_cores, embassy_stm32_needed_data, generate_cargo_toml_file, stm32_metapac_needed_data, -}; - -fn main() { - let names_and_cores = chip_names_and_cores(); - update_cargo_file( - "../embassy-stm32/Cargo.toml", - &embassy_stm32_needed_data(&names_and_cores), - ); - update_cargo_file( - "../stm32-metapac/Cargo.toml", - &stm32_metapac_needed_data(&names_and_cores), - ); -} - -/// Update a Cargo.toml file -/// -/// Update the content between "# BEGIN GENERATED FEATURES" and "# END GENERATED FEATURES" -/// with the given content -fn update_cargo_file(path: &str, new_contents: &str) { - let previous_text = std::fs::read_to_string(path).unwrap(); - let new_text = generate_cargo_toml_file(&previous_text, new_contents); - std::fs::write(path, new_text).unwrap(); -} diff --git a/stm32-metapac-gen/Cargo.toml b/stm32-metapac-gen/Cargo.toml deleted file mode 100644 index 6d136ba6..00000000 --- a/stm32-metapac-gen/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "stm32-metapac-gen" -version = "0.1.0" -edition = "2021" -license = "MIT OR Apache-2.0" - - -[dependencies] -regex = "1.5.4" -chiptool = { git = "https://github.com/embassy-rs/chiptool", rev = "1d9e0a39a6acc291e50cabc4ed617a87f06d5e89" } -serde = { version = "1.0.130", features = [ "derive" ] } -serde_json = "1.0.87" -serde_yaml = "0.8.21" -proc-macro2 = "1.0.29" - diff --git a/stm32-metapac-gen/src/data.rs b/stm32-metapac-gen/src/data.rs deleted file mode 100644 index 17eccfe9..00000000 --- a/stm32-metapac-gen/src/data.rs +++ /dev/null @@ -1,124 +0,0 @@ -use serde::Deserialize; - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct Chip { - pub name: String, - pub family: String, - pub line: String, - pub cores: Vec, - pub memory: Vec, - pub packages: Vec, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct MemoryRegion { - pub name: String, - pub kind: MemoryRegionKind, - pub address: u32, - pub size: u32, - pub settings: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct FlashSettings { - pub erase_size: u32, - pub write_size: u32, - pub erase_value: u8, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub enum MemoryRegionKind { - #[serde(rename = "flash")] - Flash, - #[serde(rename = "ram")] - Ram, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct Core { - pub name: String, - pub peripherals: Vec, - pub interrupts: Vec, - pub dma_channels: Vec, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct Interrupt { - pub name: String, - pub number: u32, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct Package { - pub name: String, - pub package: String, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct Peripheral { - pub name: String, - pub address: u64, - #[serde(default)] - pub registers: Option, - #[serde(default)] - pub rcc: Option, - #[serde(default)] - pub pins: Vec, - #[serde(default)] - pub dma_channels: Vec, - #[serde(default)] - pub interrupts: Vec, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct PeripheralInterrupt { - pub signal: String, - pub interrupt: String, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct PeripheralRcc { - pub clock: String, - #[serde(default)] - pub enable: Option, - #[serde(default)] - pub reset: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct PeripheralRccRegister { - pub register: String, - pub field: String, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct PeripheralPin { - pub pin: String, - pub signal: String, - pub af: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] -pub struct DmaChannel { - pub name: String, - pub dma: String, - pub channel: u32, - pub dmamux: Option, - pub dmamux_channel: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Hash)] -pub struct PeripheralDmaChannel { - pub signal: String, - pub channel: Option, - pub dmamux: Option, - pub dma: Option, - pub request: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Hash)] -pub struct PeripheralRegisters { - pub kind: String, - pub version: String, - pub block: String, -} diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs deleted file mode 100644 index 64045986..00000000 --- a/stm32-metapac-gen/src/lib.rs +++ /dev/null @@ -1,380 +0,0 @@ -use std::collections::{BTreeMap, HashMap, HashSet}; -use std::fmt::{Debug, Write as _}; -use std::fs; -use std::fs::File; -use std::io::Write; -use std::path::{Path, PathBuf}; -use std::str::FromStr; - -use chiptool::generate::CommonModule; -use chiptool::{generate, ir, transform}; -use proc_macro2::TokenStream; -use regex::Regex; - -mod data; -use data::*; - -#[derive(Debug, Eq, PartialEq, Clone)] -struct Metadata<'a> { - name: &'a str, - family: &'a str, - line: &'a str, - memory: &'a [MemoryRegion], - peripherals: &'a [Peripheral], - interrupts: &'a [Interrupt], - dma_channels: &'a [DmaChannel], -} - -pub struct Options { - pub chips: Vec, - pub out_dir: PathBuf, - pub data_dir: PathBuf, -} - -pub struct Gen { - opts: Options, - all_peripheral_versions: HashSet<(String, String)>, - metadata_dedup: HashMap, -} - -impl Gen { - pub fn new(opts: Options) -> Self { - Self { - opts, - all_peripheral_versions: HashSet::new(), - metadata_dedup: HashMap::new(), - } - } - - fn gen_chip(&mut self, chip_core_name: &str, chip: &Chip, core: &Core, core_index: usize) { - let mut ir = ir::IR::new(); - - let mut dev = ir::Device { - interrupts: Vec::new(), - peripherals: Vec::new(), - }; - - let mut peripheral_versions: BTreeMap = BTreeMap::new(); - - let gpio_base = core.peripherals.iter().find(|p| p.name == "GPIOA").unwrap().address as u32; - let gpio_stride = 0x400; - - for p in &core.peripherals { - let mut ir_peri = ir::Peripheral { - name: p.name.clone(), - array: None, - base_address: p.address, - block: None, - description: None, - interrupts: HashMap::new(), - }; - - if let Some(bi) = &p.registers { - if let Some(old_version) = peripheral_versions.insert(bi.kind.clone(), bi.version.clone()) { - if old_version != bi.version { - panic!( - "Peripheral {} has multiple versions: {} and {}", - bi.kind, old_version, bi.version - ); - } - } - ir_peri.block = Some(format!("{}::{}", bi.kind, bi.block)); - - if bi.kind == "gpio" { - assert_eq!(0, (p.address as u32 - gpio_base) % gpio_stride); - } - } - - dev.peripherals.push(ir_peri); - } - - for irq in &core.interrupts { - dev.interrupts.push(ir::Interrupt { - name: irq.name.clone(), - description: None, - value: irq.number, - }); - } - - ir.devices.insert("".to_string(), dev); - - let mut extra = format!( - "pub fn GPIO(n: usize) -> gpio::Gpio {{ - gpio::Gpio(({} + {}*n) as _) - }}", - gpio_base, gpio_stride, - ); - - for (module, version) in &peripheral_versions { - self.all_peripheral_versions.insert((module.clone(), version.clone())); - write!( - &mut extra, - "#[path=\"../../peripherals/{}_{}.rs\"] pub mod {};\n", - module, version, module - ) - .unwrap(); - } - write!(&mut extra, "pub const CORE_INDEX: usize = {};\n", core_index).unwrap(); - - let flash = chip.memory.iter().find(|r| r.name == "BANK_1").unwrap(); - let settings = flash.settings.as_ref().unwrap(); - write!(&mut extra, "pub const FLASH_BASE: usize = {};\n", flash.address).unwrap(); - write!(&mut extra, "pub const FLASH_SIZE: usize = {};\n", flash.size).unwrap(); - write!(&mut extra, "pub const ERASE_SIZE: usize = {};\n", settings.erase_size).unwrap(); - write!(&mut extra, "pub const WRITE_SIZE: usize = {};\n", settings.write_size).unwrap(); - write!(&mut extra, "pub const ERASE_VALUE: u8 = {};\n", settings.erase_value).unwrap(); - - // Cleanups! - transform::sort::Sort {}.run(&mut ir).unwrap(); - transform::Sanitize {}.run(&mut ir).unwrap(); - - // ============================== - // Setup chip dir - - let chip_dir = self - .opts - .out_dir - .join("src/chips") - .join(chip_core_name.to_ascii_lowercase()); - fs::create_dir_all(&chip_dir).unwrap(); - - // ============================== - // generate pac.rs - - let data = generate::render(&ir, &gen_opts()).unwrap().to_string(); - let data = data.replace("] ", "]\n"); - - // Remove inner attributes like #![no_std] - let data = Regex::new("# *! *\\[.*\\]").unwrap().replace_all(&data, ""); - - let mut file = File::create(chip_dir.join("pac.rs")).unwrap(); - file.write_all(data.as_bytes()).unwrap(); - file.write_all(extra.as_bytes()).unwrap(); - - let mut device_x = String::new(); - - for irq in &core.interrupts { - write!(&mut device_x, "PROVIDE({} = DefaultHandler);\n", irq.name).unwrap(); - } - - // ============================== - // generate metadata.rs - - // (peripherals, interrupts, dma_channels) are often equal across multiple chips. - // To reduce bloat, deduplicate them. - let mut data = String::new(); - write!( - &mut data, - " - const PERIPHERALS: &'static [Peripheral] = {}; - const INTERRUPTS: &'static [Interrupt] = {}; - const DMA_CHANNELS: &'static [DmaChannel] = {}; - ", - stringify(&core.peripherals), - stringify(&core.interrupts), - stringify(&core.dma_channels), - ) - .unwrap(); - - let out_dir = self.opts.out_dir.clone(); - let n = self.metadata_dedup.len(); - let deduped_file = self.metadata_dedup.entry(data.clone()).or_insert_with(|| { - let file = format!("metadata_{:04}.rs", n); - let path = out_dir.join("src/chips").join(&file); - fs::write(path, data).unwrap(); - - file - }); - - let data = format!( - "include!(\"../{}\"); - pub const METADATA: Metadata = Metadata {{ - name: {:?}, - family: {:?}, - line: {:?}, - memory: {}, - peripherals: PERIPHERALS, - interrupts: INTERRUPTS, - dma_channels: DMA_CHANNELS, - }};", - deduped_file, - &chip.name, - &chip.family, - &chip.line, - stringify(&chip.memory), - ); - - let mut file = File::create(chip_dir.join("metadata.rs")).unwrap(); - file.write_all(data.as_bytes()).unwrap(); - - // ============================== - // generate device.x - - File::create(chip_dir.join("device.x")) - .unwrap() - .write_all(device_x.as_bytes()) - .unwrap(); - - // ============================== - // generate default memory.x - gen_memory_x(&chip_dir, &chip); - } - - fn load_chip(&mut self, name: &str) -> Chip { - let chip_path = self.opts.data_dir.join("chips").join(&format!("{}.json", name)); - let chip = fs::read(chip_path).expect(&format!("Could not load chip {}", name)); - serde_json::from_slice(&chip).unwrap() - } - - pub fn gen(&mut self) { - fs::create_dir_all(self.opts.out_dir.join("src/peripherals")).unwrap(); - fs::create_dir_all(self.opts.out_dir.join("src/chips")).unwrap(); - - let mut chip_core_names: Vec = Vec::new(); - - for chip_name in &self.opts.chips.clone() { - println!("Generating {}...", chip_name); - - let mut chip = self.load_chip(chip_name); - - // Cleanup - for core in &mut chip.cores { - for irq in &mut core.interrupts { - irq.name = irq.name.to_ascii_uppercase(); - } - for p in &mut core.peripherals { - for irq in &mut p.interrupts { - irq.interrupt = irq.interrupt.to_ascii_uppercase(); - } - } - } - - // Generate - for (core_index, core) in chip.cores.iter().enumerate() { - let chip_core_name = match chip.cores.len() { - 1 => chip_name.clone(), - _ => format!("{}-{}", chip_name, core.name), - }; - - chip_core_names.push(chip_core_name.clone()); - self.gen_chip(&chip_core_name, &chip, core, core_index) - } - } - - for (module, version) in &self.all_peripheral_versions { - println!("loading {} {}", module, version); - - let regs_path = Path::new(&self.opts.data_dir) - .join("registers") - .join(&format!("{}_{}.yaml", module, version)); - - let mut ir: ir::IR = serde_yaml::from_reader(File::open(regs_path).unwrap()).unwrap(); - - transform::expand_extends::ExpandExtends {}.run(&mut ir).unwrap(); - - transform::map_names(&mut ir, |k, s| match k { - transform::NameKind::Block => *s = format!("{}", s), - transform::NameKind::Fieldset => *s = format!("regs::{}", s), - transform::NameKind::Enum => *s = format!("vals::{}", s), - _ => {} - }); - - transform::sort::Sort {}.run(&mut ir).unwrap(); - transform::Sanitize {}.run(&mut ir).unwrap(); - - let items = generate::render(&ir, &gen_opts()).unwrap(); - let mut file = File::create( - self.opts - .out_dir - .join("src/peripherals") - .join(format!("{}_{}.rs", module, version)), - ) - .unwrap(); - let data = items.to_string().replace("] ", "]\n"); - - // Remove inner attributes like #![no_std] - let re = Regex::new("# *! *\\[.*\\]").unwrap(); - let data = re.replace_all(&data, ""); - file.write_all(data.as_bytes()).unwrap(); - } - - // Generate Cargo.toml - const BUILDDEP_BEGIN: &[u8] = b"# BEGIN BUILD DEPENDENCIES"; - const BUILDDEP_END: &[u8] = b"# END BUILD DEPENDENCIES"; - - let mut contents = include_bytes!("../../stm32-metapac/Cargo.toml").to_vec(); - let begin = bytes_find(&contents, BUILDDEP_BEGIN).unwrap(); - let end = bytes_find(&contents, BUILDDEP_END).unwrap() + BUILDDEP_END.len(); - contents.drain(begin..end); - fs::write(self.opts.out_dir.join("Cargo.toml"), contents).unwrap(); - - // copy misc files - fs::write( - self.opts.out_dir.join("build.rs"), - include_bytes!("../../stm32-metapac/build_pregenerated.rs"), - ) - .unwrap(); - fs::write( - self.opts.out_dir.join("src/lib.rs"), - include_bytes!("../../stm32-metapac/src/lib.rs"), - ) - .unwrap(); - fs::write( - self.opts.out_dir.join("src/common.rs"), - chiptool::generate::COMMON_MODULE, - ) - .unwrap(); - fs::write( - self.opts.out_dir.join("src/metadata.rs"), - include_bytes!("../../stm32-metapac/src/metadata.rs"), - ) - .unwrap(); - } -} - -fn bytes_find(haystack: &[u8], needle: &[u8]) -> Option { - haystack.windows(needle.len()).position(|window| window == needle) -} - -fn stringify(metadata: T) -> String { - let mut metadata = format!("{:?}", metadata); - if metadata.starts_with('[') { - metadata = format!("&{}", metadata); - } - metadata = metadata.replace(": [", ": &["); - metadata = metadata.replace("kind: Ram", "kind: MemoryRegionKind::Ram"); - metadata = metadata.replace("kind: Flash", "kind: MemoryRegionKind::Flash"); - metadata -} - -fn gen_opts() -> generate::Options { - generate::Options { - common_module: CommonModule::External(TokenStream::from_str("crate::common").unwrap()), - } -} - -fn gen_memory_x(out_dir: &PathBuf, chip: &Chip) { - let mut memory_x = String::new(); - - let flash = chip.memory.iter().find(|r| r.name == "BANK_1").unwrap(); - let ram = chip.memory.iter().find(|r| r.name == "SRAM").unwrap(); - - write!(memory_x, "MEMORY\n{{\n").unwrap(); - write!( - memory_x, - " FLASH : ORIGIN = 0x{:x}, LENGTH = {}\n", - flash.address, flash.size, - ) - .unwrap(); - write!( - memory_x, - " RAM : ORIGIN = 0x{:x}, LENGTH = {}\n", - ram.address, ram.size, - ) - .unwrap(); - write!(memory_x, "}}").unwrap(); - - fs::create_dir_all(out_dir.join("memory_x")).unwrap(); - let mut file = File::create(out_dir.join("memory_x").join("memory.x")).unwrap(); - file.write_all(memory_x.as_bytes()).unwrap(); -} diff --git a/stm32-metapac-gen/src/main.rs b/stm32-metapac-gen/src/main.rs deleted file mode 100644 index 40a73adf..00000000 --- a/stm32-metapac-gen/src/main.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::env::args; -use std::path::PathBuf; - -use stm32_metapac_gen::*; - -fn main() { - let out_dir = PathBuf::from("out"); - let data_dir = PathBuf::from("../stm32-data/data"); - - let args: Vec = args().collect(); - - let mut chips = match &args[..] { - [_, chip] => { - vec![chip.clone()] - } - [_] => { - std::fs::read_dir(data_dir.join("chips")) - .unwrap() - .filter_map(|res| res.unwrap().file_name().to_str().map(|s| s.to_string())) - .filter(|s| s.ends_with(".json")) - .filter(|s| !s.starts_with("STM32GBK")) // cursed weird STM32G4 - .map(|s| s.strip_suffix(".json").unwrap().to_string()) - .collect() - } - _ => panic!("usage: stm32-metapac-gen [chip?]"), - }; - - chips.sort(); - - let opts = Options { - out_dir, - data_dir, - chips, - }; - Gen::new(opts).gen(); -} diff --git a/stm32-metapac/Cargo.toml b/stm32-metapac/Cargo.toml deleted file mode 100644 index 2605cf3d..00000000 --- a/stm32-metapac/Cargo.toml +++ /dev/null @@ -1,1332 +0,0 @@ -[package] -name = "stm32-metapac" -version = "0.1.0" -edition = "2021" -license = "MIT OR Apache-2.0" -repository = "https://github.com/embassy-rs/embassy" -description = "Peripheral Access Crate (PAC) for all STM32 chips, including metadata." - -# `cargo publish` is unable to figure out which .rs files are needed due to the include! magic. -include = [ - "**/*.rs", - "**/*.x", - "Cargo.toml", -] - -[package.metadata.docs.rs] -features = ["stm32h755zi-cm7", "pac", "metadata"] -default-target = "thumbv7em-none-eabihf" -targets = [] - -[package.metadata.embassy_docs] -features = ["pac", "metadata"] -flavors = [ - { regex_feature = "stm32f0.*", target = "thumbv6m-none-eabi" }, - { regex_feature = "stm32f1.*", target = "thumbv7m-none-eabi" }, - { regex_feature = "stm32f2.*", target = "thumbv7m-none-eabi" }, - { regex_feature = "stm32f3.*", target = "thumbv7em-none-eabi" }, - { regex_feature = "stm32f4.*", target = "thumbv7em-none-eabi" }, - { regex_feature = "stm32f7.*", target = "thumbv7em-none-eabi" }, - { regex_feature = "stm32c0.*", target = "thumbv6m-none-eabi" }, - { regex_feature = "stm32g0.*", target = "thumbv6m-none-eabi" }, - { regex_feature = "stm32g4.*", target = "thumbv7em-none-eabi" }, - { regex_feature = "stm32h7.*", target = "thumbv7em-none-eabi" }, - { regex_feature = "stm32l0.*", target = "thumbv6m-none-eabi" }, - { regex_feature = "stm32l1.*", target = "thumbv7m-none-eabi" }, - { regex_feature = "stm32l4.*", target = "thumbv7em-none-eabi" }, - { regex_feature = "stm32l5.*", target = "thumbv8m.main-none-eabihf" }, - { regex_feature = "stm32u5.*", target = "thumbv8m.main-none-eabihf" }, - { regex_feature = "stm32wb.*", target = "thumbv7em-none-eabi" }, - { regex_feature = "stm32wl.*", target = "thumbv7em-none-eabi" }, -] - -[dependencies] -cortex-m = "0.7.6" -cortex-m-rt = { version = ">=0.6.15,<0.8", optional = true } - -# BEGIN BUILD DEPENDENCIES -# These are removed when generating the pre-generated crate using the tool at gen/. -[build-dependencies] -stm32-metapac-gen = { path = "../stm32-metapac-gen" } -regex = "1.5.4" -# END BUILD DEPENDENCIES - -[features] -default = ["pac"] - -# Build the actual PAC. Set by default. -# If you just want the metadata, unset it with `default-features = false`. -pac = [] - -# Build the chip metadata. -# If set, a const `stm32_metapac::METADATA` will be exported, containing all the -# metadata for the currently selected chip. -metadata = [] - -rt = ["cortex-m-rt/device"] -memory-x = [] - -# BEGIN GENERATED FEATURES -# Generated by stm32-gen-features. DO NOT EDIT. -stm32c011d6 = [] -stm32c011f4 = [] -stm32c011f6 = [] -stm32c011j4 = [] -stm32c011j6 = [] -stm32c031c4 = [] -stm32c031c6 = [] -stm32c031f4 = [] -stm32c031f6 = [] -stm32c031g4 = [] -stm32c031g6 = [] -stm32c031k4 = [] -stm32c031k6 = [] -stm32f030c6 = [] -stm32f030c8 = [] -stm32f030cc = [] -stm32f030f4 = [] -stm32f030k6 = [] -stm32f030r8 = [] -stm32f030rc = [] -stm32f031c4 = [] -stm32f031c6 = [] -stm32f031e6 = [] -stm32f031f4 = [] -stm32f031f6 = [] -stm32f031g4 = [] -stm32f031g6 = [] -stm32f031k4 = [] -stm32f031k6 = [] -stm32f038c6 = [] -stm32f038e6 = [] -stm32f038f6 = [] -stm32f038g6 = [] -stm32f038k6 = [] -stm32f042c4 = [] -stm32f042c6 = [] -stm32f042f4 = [] -stm32f042f6 = [] -stm32f042g4 = [] -stm32f042g6 = [] -stm32f042k4 = [] -stm32f042k6 = [] -stm32f042t6 = [] -stm32f048c6 = [] -stm32f048g6 = [] -stm32f048t6 = [] -stm32f051c4 = [] -stm32f051c6 = [] -stm32f051c8 = [] -stm32f051k4 = [] -stm32f051k6 = [] -stm32f051k8 = [] -stm32f051r4 = [] -stm32f051r6 = [] -stm32f051r8 = [] -stm32f051t8 = [] -stm32f058c8 = [] -stm32f058r8 = [] -stm32f058t8 = [] -stm32f070c6 = [] -stm32f070cb = [] -stm32f070f6 = [] -stm32f070rb = [] -stm32f071c8 = [] -stm32f071cb = [] -stm32f071rb = [] -stm32f071v8 = [] -stm32f071vb = [] -stm32f072c8 = [] -stm32f072cb = [] -stm32f072r8 = [] -stm32f072rb = [] -stm32f072v8 = [] -stm32f072vb = [] -stm32f078cb = [] -stm32f078rb = [] -stm32f078vb = [] -stm32f091cb = [] -stm32f091cc = [] -stm32f091rb = [] -stm32f091rc = [] -stm32f091vb = [] -stm32f091vc = [] -stm32f098cc = [] -stm32f098rc = [] -stm32f098vc = [] -stm32f100c4 = [] -stm32f100c6 = [] -stm32f100c8 = [] -stm32f100cb = [] -stm32f100r4 = [] -stm32f100r6 = [] -stm32f100r8 = [] -stm32f100rb = [] -stm32f100rc = [] -stm32f100rd = [] -stm32f100re = [] -stm32f100v8 = [] -stm32f100vb = [] -stm32f100vc = [] -stm32f100vd = [] -stm32f100ve = [] -stm32f100zc = [] -stm32f100zd = [] -stm32f100ze = [] -stm32f101c4 = [] -stm32f101c6 = [] -stm32f101c8 = [] -stm32f101cb = [] -stm32f101r4 = [] -stm32f101r6 = [] -stm32f101r8 = [] -stm32f101rb = [] -stm32f101rc = [] -stm32f101rd = [] -stm32f101re = [] -stm32f101rf = [] -stm32f101rg = [] -stm32f101t4 = [] -stm32f101t6 = [] -stm32f101t8 = [] -stm32f101tb = [] -stm32f101v8 = [] -stm32f101vb = [] -stm32f101vc = [] -stm32f101vd = [] -stm32f101ve = [] -stm32f101vf = [] -stm32f101vg = [] -stm32f101zc = [] -stm32f101zd = [] -stm32f101ze = [] -stm32f101zf = [] -stm32f101zg = [] -stm32f102c4 = [] -stm32f102c6 = [] -stm32f102c8 = [] -stm32f102cb = [] -stm32f102r4 = [] -stm32f102r6 = [] -stm32f102r8 = [] -stm32f102rb = [] -stm32f103c4 = [] -stm32f103c6 = [] -stm32f103c8 = [] -stm32f103cb = [] -stm32f103r4 = [] -stm32f103r6 = [] -stm32f103r8 = [] -stm32f103rb = [] -stm32f103rc = [] -stm32f103rd = [] -stm32f103re = [] -stm32f103rf = [] -stm32f103rg = [] -stm32f103t4 = [] -stm32f103t6 = [] -stm32f103t8 = [] -stm32f103tb = [] -stm32f103v8 = [] -stm32f103vb = [] -stm32f103vc = [] -stm32f103vd = [] -stm32f103ve = [] -stm32f103vf = [] -stm32f103vg = [] -stm32f103zc = [] -stm32f103zd = [] -stm32f103ze = [] -stm32f103zf = [] -stm32f103zg = [] -stm32f105r8 = [] -stm32f105rb = [] -stm32f105rc = [] -stm32f105v8 = [] -stm32f105vb = [] -stm32f105vc = [] -stm32f107rb = [] -stm32f107rc = [] -stm32f107vb = [] -stm32f107vc = [] -stm32f205rb = [] -stm32f205rc = [] -stm32f205re = [] -stm32f205rf = [] -stm32f205rg = [] -stm32f205vb = [] -stm32f205vc = [] -stm32f205ve = [] -stm32f205vf = [] -stm32f205vg = [] -stm32f205zc = [] -stm32f205ze = [] -stm32f205zf = [] -stm32f205zg = [] -stm32f207ic = [] -stm32f207ie = [] -stm32f207if = [] -stm32f207ig = [] -stm32f207vc = [] -stm32f207ve = [] -stm32f207vf = [] -stm32f207vg = [] -stm32f207zc = [] -stm32f207ze = [] -stm32f207zf = [] -stm32f207zg = [] -stm32f215re = [] -stm32f215rg = [] -stm32f215ve = [] -stm32f215vg = [] -stm32f215ze = [] -stm32f215zg = [] -stm32f217ie = [] -stm32f217ig = [] -stm32f217ve = [] -stm32f217vg = [] -stm32f217ze = [] -stm32f217zg = [] -stm32f301c6 = [] -stm32f301c8 = [] -stm32f301k6 = [] -stm32f301k8 = [] -stm32f301r6 = [] -stm32f301r8 = [] -stm32f302c6 = [] -stm32f302c8 = [] -stm32f302cb = [] -stm32f302cc = [] -stm32f302k6 = [] -stm32f302k8 = [] -stm32f302r6 = [] -stm32f302r8 = [] -stm32f302rb = [] -stm32f302rc = [] -stm32f302rd = [] -stm32f302re = [] -stm32f302vb = [] -stm32f302vc = [] -stm32f302vd = [] -stm32f302ve = [] -stm32f302zd = [] -stm32f302ze = [] -stm32f303c6 = [] -stm32f303c8 = [] -stm32f303cb = [] -stm32f303cc = [] -stm32f303k6 = [] -stm32f303k8 = [] -stm32f303r6 = [] -stm32f303r8 = [] -stm32f303rb = [] -stm32f303rc = [] -stm32f303rd = [] -stm32f303re = [] -stm32f303vb = [] -stm32f303vc = [] -stm32f303vd = [] -stm32f303ve = [] -stm32f303zd = [] -stm32f303ze = [] -stm32f318c8 = [] -stm32f318k8 = [] -stm32f328c8 = [] -stm32f334c4 = [] -stm32f334c6 = [] -stm32f334c8 = [] -stm32f334k4 = [] -stm32f334k6 = [] -stm32f334k8 = [] -stm32f334r6 = [] -stm32f334r8 = [] -stm32f358cc = [] -stm32f358rc = [] -stm32f358vc = [] -stm32f373c8 = [] -stm32f373cb = [] -stm32f373cc = [] -stm32f373r8 = [] -stm32f373rb = [] -stm32f373rc = [] -stm32f373v8 = [] -stm32f373vb = [] -stm32f373vc = [] -stm32f378cc = [] -stm32f378rc = [] -stm32f378vc = [] -stm32f398ve = [] -stm32f401cb = [] -stm32f401cc = [] -stm32f401cd = [] -stm32f401ce = [] -stm32f401rb = [] -stm32f401rc = [] -stm32f401rd = [] -stm32f401re = [] -stm32f401vb = [] -stm32f401vc = [] -stm32f401vd = [] -stm32f401ve = [] -stm32f405oe = [] -stm32f405og = [] -stm32f405rg = [] -stm32f405vg = [] -stm32f405zg = [] -stm32f407ie = [] -stm32f407ig = [] -stm32f407ve = [] -stm32f407vg = [] -stm32f407ze = [] -stm32f407zg = [] -stm32f410c8 = [] -stm32f410cb = [] -stm32f410r8 = [] -stm32f410rb = [] -stm32f410t8 = [] -stm32f410tb = [] -stm32f411cc = [] -stm32f411ce = [] -stm32f411rc = [] -stm32f411re = [] -stm32f411vc = [] -stm32f411ve = [] -stm32f412ce = [] -stm32f412cg = [] -stm32f412re = [] -stm32f412rg = [] -stm32f412ve = [] -stm32f412vg = [] -stm32f412ze = [] -stm32f412zg = [] -stm32f413cg = [] -stm32f413ch = [] -stm32f413mg = [] -stm32f413mh = [] -stm32f413rg = [] -stm32f413rh = [] -stm32f413vg = [] -stm32f413vh = [] -stm32f413zg = [] -stm32f413zh = [] -stm32f415og = [] -stm32f415rg = [] -stm32f415vg = [] -stm32f415zg = [] -stm32f417ie = [] -stm32f417ig = [] -stm32f417ve = [] -stm32f417vg = [] -stm32f417ze = [] -stm32f417zg = [] -stm32f423ch = [] -stm32f423mh = [] -stm32f423rh = [] -stm32f423vh = [] -stm32f423zh = [] -stm32f427ag = [] -stm32f427ai = [] -stm32f427ig = [] -stm32f427ii = [] -stm32f427vg = [] -stm32f427vi = [] -stm32f427zg = [] -stm32f427zi = [] -stm32f429ag = [] -stm32f429ai = [] -stm32f429be = [] -stm32f429bg = [] -stm32f429bi = [] -stm32f429ie = [] -stm32f429ig = [] -stm32f429ii = [] -stm32f429ne = [] -stm32f429ng = [] -stm32f429ni = [] -stm32f429ve = [] -stm32f429vg = [] -stm32f429vi = [] -stm32f429ze = [] -stm32f429zg = [] -stm32f429zi = [] -stm32f437ai = [] -stm32f437ig = [] -stm32f437ii = [] -stm32f437vg = [] -stm32f437vi = [] -stm32f437zg = [] -stm32f437zi = [] -stm32f439ai = [] -stm32f439bg = [] -stm32f439bi = [] -stm32f439ig = [] -stm32f439ii = [] -stm32f439ng = [] -stm32f439ni = [] -stm32f439vg = [] -stm32f439vi = [] -stm32f439zg = [] -stm32f439zi = [] -stm32f446mc = [] -stm32f446me = [] -stm32f446rc = [] -stm32f446re = [] -stm32f446vc = [] -stm32f446ve = [] -stm32f446zc = [] -stm32f446ze = [] -stm32f469ae = [] -stm32f469ag = [] -stm32f469ai = [] -stm32f469be = [] -stm32f469bg = [] -stm32f469bi = [] -stm32f469ie = [] -stm32f469ig = [] -stm32f469ii = [] -stm32f469ne = [] -stm32f469ng = [] -stm32f469ni = [] -stm32f469ve = [] -stm32f469vg = [] -stm32f469vi = [] -stm32f469ze = [] -stm32f469zg = [] -stm32f469zi = [] -stm32f479ag = [] -stm32f479ai = [] -stm32f479bg = [] -stm32f479bi = [] -stm32f479ig = [] -stm32f479ii = [] -stm32f479ng = [] -stm32f479ni = [] -stm32f479vg = [] -stm32f479vi = [] -stm32f479zg = [] -stm32f479zi = [] -stm32f722ic = [] -stm32f722ie = [] -stm32f722rc = [] -stm32f722re = [] -stm32f722vc = [] -stm32f722ve = [] -stm32f722zc = [] -stm32f722ze = [] -stm32f723ic = [] -stm32f723ie = [] -stm32f723vc = [] -stm32f723ve = [] -stm32f723zc = [] -stm32f723ze = [] -stm32f730i8 = [] -stm32f730r8 = [] -stm32f730v8 = [] -stm32f730z8 = [] -stm32f732ie = [] -stm32f732re = [] -stm32f732ve = [] -stm32f732ze = [] -stm32f733ie = [] -stm32f733ve = [] -stm32f733ze = [] -stm32f745ie = [] -stm32f745ig = [] -stm32f745ve = [] -stm32f745vg = [] -stm32f745ze = [] -stm32f745zg = [] -stm32f746be = [] -stm32f746bg = [] -stm32f746ie = [] -stm32f746ig = [] -stm32f746ne = [] -stm32f746ng = [] -stm32f746ve = [] -stm32f746vg = [] -stm32f746ze = [] -stm32f746zg = [] -stm32f750n8 = [] -stm32f750v8 = [] -stm32f750z8 = [] -stm32f756bg = [] -stm32f756ig = [] -stm32f756ng = [] -stm32f756vg = [] -stm32f756zg = [] -stm32f765bg = [] -stm32f765bi = [] -stm32f765ig = [] -stm32f765ii = [] -stm32f765ng = [] -stm32f765ni = [] -stm32f765vg = [] -stm32f765vi = [] -stm32f765zg = [] -stm32f765zi = [] -stm32f767bg = [] -stm32f767bi = [] -stm32f767ig = [] -stm32f767ii = [] -stm32f767ng = [] -stm32f767ni = [] -stm32f767vg = [] -stm32f767vi = [] -stm32f767zg = [] -stm32f767zi = [] -stm32f768ai = [] -stm32f769ag = [] -stm32f769ai = [] -stm32f769bg = [] -stm32f769bi = [] -stm32f769ig = [] -stm32f769ii = [] -stm32f769ng = [] -stm32f769ni = [] -stm32f777bi = [] -stm32f777ii = [] -stm32f777ni = [] -stm32f777vi = [] -stm32f777zi = [] -stm32f778ai = [] -stm32f779ai = [] -stm32f779bi = [] -stm32f779ii = [] -stm32f779ni = [] -stm32g030c6 = [] -stm32g030c8 = [] -stm32g030f6 = [] -stm32g030j6 = [] -stm32g030k6 = [] -stm32g030k8 = [] -stm32g031c4 = [] -stm32g031c6 = [] -stm32g031c8 = [] -stm32g031f4 = [] -stm32g031f6 = [] -stm32g031f8 = [] -stm32g031g4 = [] -stm32g031g6 = [] -stm32g031g8 = [] -stm32g031j4 = [] -stm32g031j6 = [] -stm32g031k4 = [] -stm32g031k6 = [] -stm32g031k8 = [] -stm32g031y8 = [] -stm32g041c6 = [] -stm32g041c8 = [] -stm32g041f6 = [] -stm32g041f8 = [] -stm32g041g6 = [] -stm32g041g8 = [] -stm32g041j6 = [] -stm32g041k6 = [] -stm32g041k8 = [] -stm32g041y8 = [] -stm32g050c6 = [] -stm32g050c8 = [] -stm32g050f6 = [] -stm32g050k6 = [] -stm32g050k8 = [] -stm32g051c6 = [] -stm32g051c8 = [] -stm32g051f6 = [] -stm32g051f8 = [] -stm32g051g6 = [] -stm32g051g8 = [] -stm32g051k6 = [] -stm32g051k8 = [] -stm32g061c6 = [] -stm32g061c8 = [] -stm32g061f6 = [] -stm32g061f8 = [] -stm32g061g6 = [] -stm32g061g8 = [] -stm32g061k6 = [] -stm32g061k8 = [] -stm32g070cb = [] -stm32g070kb = [] -stm32g070rb = [] -stm32g071c6 = [] -stm32g071c8 = [] -stm32g071cb = [] -stm32g071eb = [] -stm32g071g6 = [] -stm32g071g8 = [] -stm32g071gb = [] -stm32g071k6 = [] -stm32g071k8 = [] -stm32g071kb = [] -stm32g071r6 = [] -stm32g071r8 = [] -stm32g071rb = [] -stm32g081cb = [] -stm32g081eb = [] -stm32g081gb = [] -stm32g081kb = [] -stm32g081rb = [] -stm32g0b0ce = [] -stm32g0b0ke = [] -stm32g0b0re = [] -stm32g0b0ve = [] -stm32g0b1cb = [] -stm32g0b1cc = [] -stm32g0b1ce = [] -stm32g0b1kb = [] -stm32g0b1kc = [] -stm32g0b1ke = [] -stm32g0b1mb = [] -stm32g0b1mc = [] -stm32g0b1me = [] -stm32g0b1ne = [] -stm32g0b1rb = [] -stm32g0b1rc = [] -stm32g0b1re = [] -stm32g0b1vb = [] -stm32g0b1vc = [] -stm32g0b1ve = [] -stm32g0c1cc = [] -stm32g0c1ce = [] -stm32g0c1kc = [] -stm32g0c1ke = [] -stm32g0c1mc = [] -stm32g0c1me = [] -stm32g0c1ne = [] -stm32g0c1rc = [] -stm32g0c1re = [] -stm32g0c1vc = [] -stm32g0c1ve = [] -stm32g431c6 = [] -stm32g431c8 = [] -stm32g431cb = [] -stm32g431k6 = [] -stm32g431k8 = [] -stm32g431kb = [] -stm32g431m6 = [] -stm32g431m8 = [] -stm32g431mb = [] -stm32g431r6 = [] -stm32g431r8 = [] -stm32g431rb = [] -stm32g431v6 = [] -stm32g431v8 = [] -stm32g431vb = [] -stm32g441cb = [] -stm32g441kb = [] -stm32g441mb = [] -stm32g441rb = [] -stm32g441vb = [] -stm32g471cc = [] -stm32g471ce = [] -stm32g471mc = [] -stm32g471me = [] -stm32g471qc = [] -stm32g471qe = [] -stm32g471rc = [] -stm32g471re = [] -stm32g471vc = [] -stm32g471ve = [] -stm32g473cb = [] -stm32g473cc = [] -stm32g473ce = [] -stm32g473mb = [] -stm32g473mc = [] -stm32g473me = [] -stm32g473pb = [] -stm32g473pc = [] -stm32g473pe = [] -stm32g473qb = [] -stm32g473qc = [] -stm32g473qe = [] -stm32g473rb = [] -stm32g473rc = [] -stm32g473re = [] -stm32g473vb = [] -stm32g473vc = [] -stm32g473ve = [] -stm32g474cb = [] -stm32g474cc = [] -stm32g474ce = [] -stm32g474mb = [] -stm32g474mc = [] -stm32g474me = [] -stm32g474pb = [] -stm32g474pc = [] -stm32g474pe = [] -stm32g474qb = [] -stm32g474qc = [] -stm32g474qe = [] -stm32g474rb = [] -stm32g474rc = [] -stm32g474re = [] -stm32g474vb = [] -stm32g474vc = [] -stm32g474ve = [] -stm32g483ce = [] -stm32g483me = [] -stm32g483pe = [] -stm32g483qe = [] -stm32g483re = [] -stm32g483ve = [] -stm32g484ce = [] -stm32g484me = [] -stm32g484pe = [] -stm32g484qe = [] -stm32g484re = [] -stm32g484ve = [] -stm32g491cc = [] -stm32g491ce = [] -stm32g491kc = [] -stm32g491ke = [] -stm32g491mc = [] -stm32g491me = [] -stm32g491rc = [] -stm32g491re = [] -stm32g491vc = [] -stm32g491ve = [] -stm32g4a1ce = [] -stm32g4a1ke = [] -stm32g4a1me = [] -stm32g4a1re = [] -stm32g4a1ve = [] -stm32h723ve = [] -stm32h723vg = [] -stm32h723ze = [] -stm32h723zg = [] -stm32h725ae = [] -stm32h725ag = [] -stm32h725ie = [] -stm32h725ig = [] -stm32h725re = [] -stm32h725rg = [] -stm32h725ve = [] -stm32h725vg = [] -stm32h725ze = [] -stm32h725zg = [] -stm32h730ab = [] -stm32h730ib = [] -stm32h730vb = [] -stm32h730zb = [] -stm32h733vg = [] -stm32h733zg = [] -stm32h735ag = [] -stm32h735ig = [] -stm32h735rg = [] -stm32h735vg = [] -stm32h735zg = [] -stm32h742ag = [] -stm32h742ai = [] -stm32h742bg = [] -stm32h742bi = [] -stm32h742ig = [] -stm32h742ii = [] -stm32h742vg = [] -stm32h742vi = [] -stm32h742xg = [] -stm32h742xi = [] -stm32h742zg = [] -stm32h742zi = [] -stm32h743ag = [] -stm32h743ai = [] -stm32h743bg = [] -stm32h743bi = [] -stm32h743ig = [] -stm32h743ii = [] -stm32h743vg = [] -stm32h743vi = [] -stm32h743xg = [] -stm32h743xi = [] -stm32h743zg = [] -stm32h743zi = [] -stm32h745bg-cm7 = [] -stm32h745bg-cm4 = [] -stm32h745bi-cm7 = [] -stm32h745bi-cm4 = [] -stm32h745ig-cm7 = [] -stm32h745ig-cm4 = [] -stm32h745ii-cm7 = [] -stm32h745ii-cm4 = [] -stm32h745xg-cm7 = [] -stm32h745xg-cm4 = [] -stm32h745xi-cm7 = [] -stm32h745xi-cm4 = [] -stm32h745zg-cm7 = [] -stm32h745zg-cm4 = [] -stm32h745zi-cm7 = [] -stm32h745zi-cm4 = [] -stm32h747ag-cm7 = [] -stm32h747ag-cm4 = [] -stm32h747ai-cm7 = [] -stm32h747ai-cm4 = [] -stm32h747bg-cm7 = [] -stm32h747bg-cm4 = [] -stm32h747bi-cm7 = [] -stm32h747bi-cm4 = [] -stm32h747ig-cm7 = [] -stm32h747ig-cm4 = [] -stm32h747ii-cm7 = [] -stm32h747ii-cm4 = [] -stm32h747xg-cm7 = [] -stm32h747xg-cm4 = [] -stm32h747xi-cm7 = [] -stm32h747xi-cm4 = [] -stm32h747zi-cm7 = [] -stm32h747zi-cm4 = [] -stm32h750ib = [] -stm32h750vb = [] -stm32h750xb = [] -stm32h750zb = [] -stm32h753ai = [] -stm32h753bi = [] -stm32h753ii = [] -stm32h753vi = [] -stm32h753xi = [] -stm32h753zi = [] -stm32h755bi-cm7 = [] -stm32h755bi-cm4 = [] -stm32h755ii-cm7 = [] -stm32h755ii-cm4 = [] -stm32h755xi-cm7 = [] -stm32h755xi-cm4 = [] -stm32h755zi-cm7 = [] -stm32h755zi-cm4 = [] -stm32h757ai-cm7 = [] -stm32h757ai-cm4 = [] -stm32h757bi-cm7 = [] -stm32h757bi-cm4 = [] -stm32h757ii-cm7 = [] -stm32h757ii-cm4 = [] -stm32h757xi-cm7 = [] -stm32h757xi-cm4 = [] -stm32h757zi-cm7 = [] -stm32h757zi-cm4 = [] -stm32h7a3ag = [] -stm32h7a3ai = [] -stm32h7a3ig = [] -stm32h7a3ii = [] -stm32h7a3lg = [] -stm32h7a3li = [] -stm32h7a3ng = [] -stm32h7a3ni = [] -stm32h7a3qi = [] -stm32h7a3rg = [] -stm32h7a3ri = [] -stm32h7a3vg = [] -stm32h7a3vi = [] -stm32h7a3zg = [] -stm32h7a3zi = [] -stm32h7b0ab = [] -stm32h7b0ib = [] -stm32h7b0rb = [] -stm32h7b0vb = [] -stm32h7b0zb = [] -stm32h7b3ai = [] -stm32h7b3ii = [] -stm32h7b3li = [] -stm32h7b3ni = [] -stm32h7b3qi = [] -stm32h7b3ri = [] -stm32h7b3vi = [] -stm32h7b3zi = [] -stm32l010c6 = [] -stm32l010f4 = [] -stm32l010k4 = [] -stm32l010k8 = [] -stm32l010r8 = [] -stm32l010rb = [] -stm32l011d3 = [] -stm32l011d4 = [] -stm32l011e3 = [] -stm32l011e4 = [] -stm32l011f3 = [] -stm32l011f4 = [] -stm32l011g3 = [] -stm32l011g4 = [] -stm32l011k3 = [] -stm32l011k4 = [] -stm32l021d4 = [] -stm32l021f4 = [] -stm32l021g4 = [] -stm32l021k4 = [] -stm32l031c4 = [] -stm32l031c6 = [] -stm32l031e4 = [] -stm32l031e6 = [] -stm32l031f4 = [] -stm32l031f6 = [] -stm32l031g4 = [] -stm32l031g6 = [] -stm32l031k4 = [] -stm32l031k6 = [] -stm32l041c4 = [] -stm32l041c6 = [] -stm32l041e6 = [] -stm32l041f6 = [] -stm32l041g6 = [] -stm32l041k6 = [] -stm32l051c6 = [] -stm32l051c8 = [] -stm32l051k6 = [] -stm32l051k8 = [] -stm32l051r6 = [] -stm32l051r8 = [] -stm32l051t6 = [] -stm32l051t8 = [] -stm32l052c6 = [] -stm32l052c8 = [] -stm32l052k6 = [] -stm32l052k8 = [] -stm32l052r6 = [] -stm32l052r8 = [] -stm32l052t6 = [] -stm32l052t8 = [] -stm32l053c6 = [] -stm32l053c8 = [] -stm32l053r6 = [] -stm32l053r8 = [] -stm32l062c8 = [] -stm32l062k8 = [] -stm32l063c8 = [] -stm32l063r8 = [] -stm32l071c8 = [] -stm32l071cb = [] -stm32l071cz = [] -stm32l071k8 = [] -stm32l071kb = [] -stm32l071kz = [] -stm32l071rb = [] -stm32l071rz = [] -stm32l071v8 = [] -stm32l071vb = [] -stm32l071vz = [] -stm32l072cb = [] -stm32l072cz = [] -stm32l072kb = [] -stm32l072kz = [] -stm32l072rb = [] -stm32l072rz = [] -stm32l072v8 = [] -stm32l072vb = [] -stm32l072vz = [] -stm32l073cb = [] -stm32l073cz = [] -stm32l073rb = [] -stm32l073rz = [] -stm32l073v8 = [] -stm32l073vb = [] -stm32l073vz = [] -stm32l081cb = [] -stm32l081cz = [] -stm32l081kz = [] -stm32l082cz = [] -stm32l082kb = [] -stm32l082kz = [] -stm32l083cb = [] -stm32l083cz = [] -stm32l083rb = [] -stm32l083rz = [] -stm32l083v8 = [] -stm32l083vb = [] -stm32l083vz = [] -stm32l100c6-a = [] -stm32l100c6 = [] -stm32l100r8-a = [] -stm32l100r8 = [] -stm32l100rb-a = [] -stm32l100rb = [] -stm32l100rc = [] -stm32l151c6-a = [] -stm32l151c6 = [] -stm32l151c8-a = [] -stm32l151c8 = [] -stm32l151cb-a = [] -stm32l151cb = [] -stm32l151cc = [] -stm32l151qc = [] -stm32l151qd = [] -stm32l151qe = [] -stm32l151r6-a = [] -stm32l151r6 = [] -stm32l151r8-a = [] -stm32l151r8 = [] -stm32l151rb-a = [] -stm32l151rb = [] -stm32l151rc-a = [] -stm32l151rc = [] -stm32l151rd = [] -stm32l151re = [] -stm32l151uc = [] -stm32l151v8-a = [] -stm32l151v8 = [] -stm32l151vb-a = [] -stm32l151vb = [] -stm32l151vc-a = [] -stm32l151vc = [] -stm32l151vd-x = [] -stm32l151vd = [] -stm32l151ve = [] -stm32l151zc = [] -stm32l151zd = [] -stm32l151ze = [] -stm32l152c6-a = [] -stm32l152c6 = [] -stm32l152c8-a = [] -stm32l152c8 = [] -stm32l152cb-a = [] -stm32l152cb = [] -stm32l152cc = [] -stm32l152qc = [] -stm32l152qd = [] -stm32l152qe = [] -stm32l152r6-a = [] -stm32l152r6 = [] -stm32l152r8-a = [] -stm32l152r8 = [] -stm32l152rb-a = [] -stm32l152rb = [] -stm32l152rc-a = [] -stm32l152rc = [] -stm32l152rd = [] -stm32l152re = [] -stm32l152uc = [] -stm32l152v8-a = [] -stm32l152v8 = [] -stm32l152vb-a = [] -stm32l152vb = [] -stm32l152vc-a = [] -stm32l152vc = [] -stm32l152vd-x = [] -stm32l152vd = [] -stm32l152ve = [] -stm32l152zc = [] -stm32l152zd = [] -stm32l152ze = [] -stm32l162qc = [] -stm32l162qd = [] -stm32l162rc-a = [] -stm32l162rc = [] -stm32l162rd = [] -stm32l162re = [] -stm32l162vc-a = [] -stm32l162vc = [] -stm32l162vd-x = [] -stm32l162vd = [] -stm32l162ve = [] -stm32l162zc = [] -stm32l162zd = [] -stm32l162ze = [] -stm32l412c8 = [] -stm32l412cb = [] -stm32l412k8 = [] -stm32l412kb = [] -stm32l412r8 = [] -stm32l412rb = [] -stm32l412t8 = [] -stm32l412tb = [] -stm32l422cb = [] -stm32l422kb = [] -stm32l422rb = [] -stm32l422tb = [] -stm32l431cb = [] -stm32l431cc = [] -stm32l431kb = [] -stm32l431kc = [] -stm32l431rb = [] -stm32l431rc = [] -stm32l431vc = [] -stm32l432kb = [] -stm32l432kc = [] -stm32l433cb = [] -stm32l433cc = [] -stm32l433rb = [] -stm32l433rc = [] -stm32l433vc = [] -stm32l442kc = [] -stm32l443cc = [] -stm32l443rc = [] -stm32l443vc = [] -stm32l451cc = [] -stm32l451ce = [] -stm32l451rc = [] -stm32l451re = [] -stm32l451vc = [] -stm32l451ve = [] -stm32l452cc = [] -stm32l452ce = [] -stm32l452rc = [] -stm32l452re = [] -stm32l452vc = [] -stm32l452ve = [] -stm32l462ce = [] -stm32l462re = [] -stm32l462ve = [] -stm32l471qe = [] -stm32l471qg = [] -stm32l471re = [] -stm32l471rg = [] -stm32l471ve = [] -stm32l471vg = [] -stm32l471ze = [] -stm32l471zg = [] -stm32l475rc = [] -stm32l475re = [] -stm32l475rg = [] -stm32l475vc = [] -stm32l475ve = [] -stm32l475vg = [] -stm32l476je = [] -stm32l476jg = [] -stm32l476me = [] -stm32l476mg = [] -stm32l476qe = [] -stm32l476qg = [] -stm32l476rc = [] -stm32l476re = [] -stm32l476rg = [] -stm32l476vc = [] -stm32l476ve = [] -stm32l476vg = [] -stm32l476ze = [] -stm32l476zg = [] -stm32l486jg = [] -stm32l486qg = [] -stm32l486rg = [] -stm32l486vg = [] -stm32l486zg = [] -stm32l496ae = [] -stm32l496ag = [] -stm32l496qe = [] -stm32l496qg = [] -stm32l496re = [] -stm32l496rg = [] -stm32l496ve = [] -stm32l496vg = [] -stm32l496wg = [] -stm32l496ze = [] -stm32l496zg = [] -stm32l4a6ag = [] -stm32l4a6qg = [] -stm32l4a6rg = [] -stm32l4a6vg = [] -stm32l4a6zg = [] -stm32l4p5ae = [] -stm32l4p5ag = [] -stm32l4p5ce = [] -stm32l4p5cg = [] -stm32l4p5qe = [] -stm32l4p5qg = [] -stm32l4p5re = [] -stm32l4p5rg = [] -stm32l4p5ve = [] -stm32l4p5vg = [] -stm32l4p5ze = [] -stm32l4p5zg = [] -stm32l4q5ag = [] -stm32l4q5cg = [] -stm32l4q5qg = [] -stm32l4q5rg = [] -stm32l4q5vg = [] -stm32l4q5zg = [] -stm32l4r5ag = [] -stm32l4r5ai = [] -stm32l4r5qg = [] -stm32l4r5qi = [] -stm32l4r5vg = [] -stm32l4r5vi = [] -stm32l4r5zg = [] -stm32l4r5zi = [] -stm32l4r7ai = [] -stm32l4r7vi = [] -stm32l4r7zi = [] -stm32l4r9ag = [] -stm32l4r9ai = [] -stm32l4r9vg = [] -stm32l4r9vi = [] -stm32l4r9zg = [] -stm32l4r9zi = [] -stm32l4s5ai = [] -stm32l4s5qi = [] -stm32l4s5vi = [] -stm32l4s5zi = [] -stm32l4s7ai = [] -stm32l4s7vi = [] -stm32l4s7zi = [] -stm32l4s9ai = [] -stm32l4s9vi = [] -stm32l4s9zi = [] -stm32l552cc = [] -stm32l552ce = [] -stm32l552me = [] -stm32l552qc = [] -stm32l552qe = [] -stm32l552rc = [] -stm32l552re = [] -stm32l552vc = [] -stm32l552ve = [] -stm32l552zc = [] -stm32l552ze = [] -stm32l562ce = [] -stm32l562me = [] -stm32l562qe = [] -stm32l562re = [] -stm32l562ve = [] -stm32l562ze = [] -stm32u575ag = [] -stm32u575ai = [] -stm32u575cg = [] -stm32u575ci = [] -stm32u575og = [] -stm32u575oi = [] -stm32u575qg = [] -stm32u575qi = [] -stm32u575rg = [] -stm32u575ri = [] -stm32u575vg = [] -stm32u575vi = [] -stm32u575zg = [] -stm32u575zi = [] -stm32u585ai = [] -stm32u585ci = [] -stm32u585oi = [] -stm32u585qi = [] -stm32u585ri = [] -stm32u585vi = [] -stm32u585zi = [] -stm32wb10cc = [] -stm32wb15cc = [] -stm32wb30ce = [] -stm32wb35cc = [] -stm32wb35ce = [] -stm32wb50cg = [] -stm32wb55cc = [] -stm32wb55ce = [] -stm32wb55cg = [] -stm32wb55rc = [] -stm32wb55re = [] -stm32wb55rg = [] -stm32wb55vc = [] -stm32wb55ve = [] -stm32wb55vg = [] -stm32wb55vy = [] -stm32wl54cc-cm4 = [] -stm32wl54cc-cm0p = [] -stm32wl54jc-cm4 = [] -stm32wl54jc-cm0p = [] -stm32wl55cc-cm4 = [] -stm32wl55cc-cm0p = [] -stm32wl55jc-cm4 = [] -stm32wl55jc-cm0p = [] -stm32wle4c8 = [] -stm32wle4cb = [] -stm32wle4cc = [] -stm32wle4j8 = [] -stm32wle4jb = [] -stm32wle4jc = [] -stm32wle5c8 = [] -stm32wle5cb = [] -stm32wle5cc = [] -stm32wle5j8 = [] -stm32wle5jb = [] -stm32wle5jc = [] -# END GENERATED FEATURES diff --git a/stm32-metapac/build.rs b/stm32-metapac/build.rs deleted file mode 100644 index 0c183fa2..00000000 --- a/stm32-metapac/build.rs +++ /dev/null @@ -1,77 +0,0 @@ -use std::env; -use std::path::PathBuf; - -use stm32_metapac_gen::*; - -fn parse_chip_core(chip_and_core: &str) -> (String, Option) { - let mut s = chip_and_core.split('-'); - let chip_name: String = s.next().unwrap().to_string(); - if let Some(c) = s.next() { - if c.starts_with("cm") { - return (chip_name, Some(c.to_ascii_lowercase())); - } - } - - (chip_and_core.to_string(), None) -} - -fn main() { - let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); - let data_dir = PathBuf::from("../stm32-data/data"); - - let chip_core_name = env::vars_os() - .map(|(a, _)| a.to_string_lossy().to_string()) - .find(|x| x.starts_with("CARGO_FEATURE_STM32")) - .expect("No stm32xx Cargo feature enabled") - .strip_prefix("CARGO_FEATURE_") - .unwrap() - .to_ascii_lowercase() - .replace('_', "-"); - - let (chip_name, _) = parse_chip_core(&chip_core_name); - - let opts = Options { - out_dir: out_dir.clone(), - data_dir: data_dir.clone(), - chips: vec![chip_name.to_ascii_uppercase()], - }; - Gen::new(opts).gen(); - - println!( - "cargo:rustc-link-search={}/src/chips/{}", - out_dir.display(), - chip_core_name, - ); - - #[cfg(feature = "memory-x")] - println!( - "cargo:rustc-link-search={}/src/chips/{}/memory_x/", - out_dir.display(), - chip_core_name - ); - println!( - "cargo:rustc-env=STM32_METAPAC_PAC_PATH={}/src/chips/{}/pac.rs", - out_dir.display(), - chip_core_name - ); - println!( - "cargo:rustc-env=STM32_METAPAC_METADATA_PATH={}/src/chips/{}/metadata.rs", - out_dir.display(), - chip_core_name - ); - println!( - "cargo:rustc-env=STM32_METAPAC_COMMON_PATH={}/src/common.rs", - out_dir.display(), - ); - - println!("cargo:rerun-if-changed=build.rs"); - - // When the stm32-data chip's JSON changes, we must rebuild - println!( - "cargo:rerun-if-changed={}/chips/{}.json", - data_dir.display(), - chip_name.to_uppercase() - ); - - println!("cargo:rerun-if-changed={}/registers", data_dir.display()); -} diff --git a/stm32-metapac/build_pregenerated.rs b/stm32-metapac/build_pregenerated.rs deleted file mode 100644 index 0f035807..00000000 --- a/stm32-metapac/build_pregenerated.rs +++ /dev/null @@ -1,39 +0,0 @@ -use std::env; -use std::path::PathBuf; - -fn main() { - let crate_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - - let chip_core_name = env::vars_os() - .map(|(a, _)| a.to_string_lossy().to_string()) - .find(|x| x.starts_with("CARGO_FEATURE_STM32")) - .expect("No stm32xx Cargo feature enabled") - .strip_prefix("CARGO_FEATURE_") - .unwrap() - .to_ascii_lowercase() - .replace('_', "-"); - - println!( - "cargo:rustc-link-search={}/src/chips/{}", - crate_dir.display(), - chip_core_name, - ); - - #[cfg(feature = "memory-x")] - println!( - "cargo:rustc-link-search={}/src/chips/{}/memory_x/", - crate_dir.display(), - chip_core_name - ); - println!("cargo:rustc-env=STM32_METAPAC_PAC_PATH=chips/{}/pac.rs", chip_core_name); - println!( - "cargo:rustc-env=STM32_METAPAC_METADATA_PATH=chips/{}/metadata.rs", - chip_core_name - ); - println!( - "cargo:rustc-env=STM32_METAPAC_COMMON_PATH={}/src/common.rs", - crate_dir.display(), - ); - - println!("cargo:rerun-if-changed=build.rs"); -} diff --git a/stm32-metapac/src/lib.rs b/stm32-metapac/src/lib.rs deleted file mode 100644 index 58a1c5e4..00000000 --- a/stm32-metapac/src/lib.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![no_std] -#![allow(non_snake_case)] -#![allow(unused)] -#![allow(non_camel_case_types)] -#![doc(html_no_source)] - -pub mod common { - include!(env!("STM32_METAPAC_COMMON_PATH")); -} - -#[cfg(feature = "pac")] -include!(env!("STM32_METAPAC_PAC_PATH")); - -#[cfg(feature = "metadata")] -pub mod metadata { - include!("metadata.rs"); - include!(env!("STM32_METAPAC_METADATA_PATH")); -} diff --git a/stm32-metapac/src/metadata.rs b/stm32-metapac/src/metadata.rs deleted file mode 100644 index d05830e9..00000000 --- a/stm32-metapac/src/metadata.rs +++ /dev/null @@ -1,106 +0,0 @@ -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct Metadata { - pub name: &'static str, - pub family: &'static str, - pub line: &'static str, - pub memory: &'static [MemoryRegion], - pub peripherals: &'static [Peripheral], - pub interrupts: &'static [Interrupt], - pub dma_channels: &'static [DmaChannel], -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct MemoryRegion { - pub name: &'static str, - pub kind: MemoryRegionKind, - pub address: u32, - pub size: u32, - pub settings: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct FlashSettings { - pub erase_size: u32, - pub write_size: u32, - pub erase_value: u8, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub enum MemoryRegionKind { - Flash, - Ram, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct Interrupt { - pub name: &'static str, - pub number: u32, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct Package { - pub name: &'static str, - pub package: &'static str, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct Peripheral { - pub name: &'static str, - pub address: u64, - pub registers: Option, - pub rcc: Option, - pub pins: &'static [PeripheralPin], - pub dma_channels: &'static [PeripheralDmaChannel], - pub interrupts: &'static [PeripheralInterrupt], -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct PeripheralRegisters { - pub kind: &'static str, - pub version: &'static str, - pub block: &'static str, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct PeripheralInterrupt { - pub signal: &'static str, - pub interrupt: &'static str, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct PeripheralRcc { - pub clock: &'static str, - pub enable: Option, - pub reset: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct PeripheralRccRegister { - pub register: &'static str, - pub field: &'static str, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct PeripheralPin { - pub pin: &'static str, - pub signal: &'static str, - pub af: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct DmaChannel { - pub name: &'static str, - pub dma: &'static str, - pub channel: u32, - pub dmamux: Option<&'static str>, - pub dmamux_channel: Option, -} - -#[derive(Debug, Eq, PartialEq, Clone)] -pub struct PeripheralDmaChannel { - pub signal: &'static str, - pub channel: Option<&'static str>, - pub dmamux: Option<&'static str>, - pub dma: Option<&'static str>, - pub request: Option, -} diff --git a/xtask/.cargo/config.toml b/xtask/.cargo/config.toml deleted file mode 100644 index 919ec05a..00000000 --- a/xtask/.cargo/config.toml +++ /dev/null @@ -1,6 +0,0 @@ -[alias] -xtask = "run --package xtask --" -ci = "run --package xtask -- ci" -core = "run --package xtask -- core" -examples = "run --package xtask -- examples" -fmt = "run --package xtask -- fmt" diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml deleted file mode 100644 index 696cfdaf..00000000 --- a/xtask/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -edition = "2021" -name = "xtask" -version = "0.1.0" -license = "MIT OR Apache-2.0" - -[dependencies] -anyhow = "1.0.43" -xshell = "0.1.17" -yaml-rust = "0.4.5" -walkdir = "2.3.2" diff --git a/xtask/src/main.rs b/xtask/src/main.rs deleted file mode 100644 index b8b453fd..00000000 --- a/xtask/src/main.rs +++ /dev/null @@ -1,221 +0,0 @@ -#![allow(dead_code)] -#![deny(unused_must_use)] - -use std::path::{Path, PathBuf}; -use std::{env, format, fs}; - -use walkdir::WalkDir; -use xshell::{cmd, Cmd}; -use yaml_rust::YamlLoader; - -extern crate yaml_rust; - -fn main() -> Result<(), anyhow::Error> { - let args = env::args().skip(1).collect::>(); - let args = args.iter().map(|s| &**s).collect::>(); - - match &args[..] { - ["ci"] => task_ci()?, - ["core"] => task_check(Realm::Core)?, - ["metapac"] => task_metapac_gen()?, - ["examples"] => task_check(Realm::Examples)?, - ["fmt-check"] => task_cargo_fmt_check()?, - ["fmt"] => task_cargo_fmt()?, - _ => { - println!(""); - println!("USAGE: cargo xtask [command]"); - println!(""); - println!("Commands:"); - println!(" ci :: Runs entire CI"); - println!(" core :: Builds the core"); - println!(" metapac :: Builds the metapac"); - println!(" examples :: Builds the examples"); - println!(" fmt-check :: Checks rustfmt"); - println!(" fmt :: Performs rustfmt"); - println!(""); - } - } - Ok(()) -} - -fn task_ci() -> Result<(), anyhow::Error> { - task_check(Realm::Core)?; - task_check(Realm::Examples)?; - task_metapac_gen()?; - task_cargo_fmt_check()?; - Ok(()) -} - -#[derive(Copy, Clone)] -enum Realm { - All, - Core, - Examples, -} - -impl Realm { - fn accepts(&self, package: &str) -> bool { - match self { - Realm::All => true, - Realm::Core => !package.contains("examples"), - Realm::Examples => package.contains("examples"), - } - } -} - -fn task_check(realm: Realm) -> Result<(), anyhow::Error> { - let _e = xshell::pushenv("CI", "true"); - - let matrix_yaml = root_dir().join(".github").join("workflows").join("rust.yml"); - - let matrix = YamlLoader::load_from_str(&*fs::read_to_string(matrix_yaml).unwrap()).unwrap(); - - let matrix = &matrix.get(0).unwrap()["jobs"]["ci"]["strategy"]["matrix"]["include"]; - - let entries = matrix.as_vec().unwrap(); - - for entry in entries { - let package = entry["package"].as_str().unwrap(); - if !realm.accepts(package) { - continue; - } - let target = entry["target"].as_str().unwrap(); - let features = entry["features"].as_str(); - let package_dir = root_dir().join(entry["package"].as_str().unwrap()); - let _p = xshell::pushd(package_dir)?; - banner(&*format!( - "Building {} [target={}] [features={}]", - package, - target, - features.unwrap_or("default-features") - )); - - let root_cargo_dir = root_dir().join(".cargo"); - fs::create_dir_all(root_cargo_dir.clone()).unwrap(); - fs::write( - root_cargo_dir.join("config"), - "[target.\"cfg(all())\"]\nrustflags = [\"-D\", \"warnings\"]", - ) - .unwrap(); - - let mut args = Vec::new(); - args.push("check"); - args.push("--target"); - args.push(target); - - if let Some(features) = features { - args.push("--features"); - args.push(features); - } - - let command = Cmd::new(PathBuf::from("cargo")); - let command = command.args(args); - let result = command.run(); - - fs::remove_file(root_cargo_dir.join("config")).unwrap(); - - result?; - } - - Ok(()) -} - -fn task_metapac_gen() -> Result<(), anyhow::Error> { - banner("Building metapac"); - let _p = xshell::pushd(root_dir().join("stm32-metapac-gen")); - cmd!("cargo run").run()?; - Ok(()) -} - -fn task_cargo_fmt() -> Result<(), anyhow::Error> { - for entry in WalkDir::new(root_dir()) - .follow_links(false) - .into_iter() - .filter_map(|e| e.ok()) - { - let f_name = entry.file_name().to_string_lossy(); - - if f_name.ends_with(".rs") { - if !is_primary_source(entry.path()) { - continue; - } - let mut args = Vec::new(); - args.push("--skip-children"); - args.push("--unstable-features"); - args.push("--edition=2018"); - args.push(&*entry.path().to_str().unwrap()); - let command = Cmd::new("rustfmt"); - command.args(args).run()?; - } - } - - Ok(()) -} - -fn task_cargo_fmt_check() -> Result<(), anyhow::Error> { - let mut actual_result = Ok(()); - for entry in WalkDir::new(root_dir()) - .follow_links(false) - .into_iter() - .filter_map(|e| e.ok()) - { - let f_name = entry.file_name().to_string_lossy(); - - if f_name.ends_with(".rs") { - if !is_primary_source(entry.path()) { - continue; - } - let mut args = Vec::new(); - args.push("--check"); - args.push("--skip-children"); - args.push("--unstable-features"); - args.push("--edition=2018"); - args.push(&*entry.path().to_str().unwrap()); - let command = Cmd::new("rustfmt"); - if let Err(result) = command.args(args).run() { - actual_result = Err(result.into()); - } - } - } - - actual_result -} - -fn root_dir() -> PathBuf { - let mut xtask_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - xtask_dir.pop(); - xtask_dir -} - -fn examples_dir() -> PathBuf { - root_dir().join("examples") -} - -fn is_primary_source(path: &Path) -> bool { - let mut current = path; - - loop { - let current_file_name = current.file_name().unwrap().to_str().unwrap(); - if current_file_name == "target" - || current_file_name == "stm32-metapac-gen" - || current_file_name == "stm32-data" - { - return false; - } - - if let Some(path) = current.parent() { - current = path.into(); - if current == root_dir() { - return true; - } - } else { - return false; - } - } -} - -fn banner(text: &str) { - println!("------------------------------------------------------------------------------------------------------------------------------------------------"); - println!("== {}", text); - println!("------------------------------------------------------------------------------------------------------------------------------------------------"); -}