summaryrefslogtreecommitdiff
path: root/stm32-metapac
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2021-05-25 04:17:24 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2021-05-31 02:40:58 +0200
commitd8e4421fc6d3b037672e347fe09b0e419ccd3c2a (patch)
treea0e91ee907a314e4d0246e0e919fa950906daded /stm32-metapac
parentfb85850492083fb686cc38dcba529508ba1ac27d (diff)
downloadembassy-d8e4421fc6d3b037672e347fe09b0e419ccd3c2a.zip
Add stm32-metapac crate, with codegen in rust
Diffstat (limited to 'stm32-metapac')
-rw-r--r--stm32-metapac/Cargo.toml1227
-rw-r--r--stm32-metapac/build.rs294
-rw-r--r--stm32-metapac/gen_features.py37
-rw-r--r--stm32-metapac/src/lib.rs6
4 files changed, 1564 insertions, 0 deletions
diff --git a/stm32-metapac/Cargo.toml b/stm32-metapac/Cargo.toml
new file mode 100644
index 00000000..c32c6690
--- /dev/null
+++ b/stm32-metapac/Cargo.toml
@@ -0,0 +1,1227 @@
+[package]
+name = "stm32-metapac"
+version = "0.1.0"
+edition = "2018"
+links = "stm32-metapac-v0.1"
+
+[dependencies]
+cortex-m = "0.7.2"
+
+[build-dependencies]
+regex = "1.4.6"
+chiptool = { git = "https://github.com/embassy-rs/chiptool", rev = "86b77165078065058098e981d49d2dd213b2feba" }
+serde = { version = "1.0.123", features = [ "derive" ]}
+serde_yaml = "0.8.15"
+cortex-m-rt = { version = "0.6.8", optional = true }
+
+[features]
+rt = ["cortex-m-rt/device"]
+
+
+# BEGIN GENERATED FEATURES
+# Generated by gen_features.py. DO NOT EDIT.
+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 = []
+stm32gbk1cb = []
+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 = []
+stm32h745bi = []
+stm32h745ig = []
+stm32h745ii = []
+stm32h745xg = []
+stm32h745xi = []
+stm32h745zg = []
+stm32h745zi = []
+stm32h747ag = []
+stm32h747ai = []
+stm32h747bg = []
+stm32h747bi = []
+stm32h747ig = []
+stm32h747ii = []
+stm32h747xg = []
+stm32h747xi = []
+stm32h747zi = []
+stm32h750ib = []
+stm32h750vb = []
+stm32h750xb = []
+stm32h750zb = []
+stm32h753ai = []
+stm32h753bi = []
+stm32h753ii = []
+stm32h753vi = []
+stm32h753xi = []
+stm32h753zi = []
+stm32h755bi = []
+stm32h755ii = []
+stm32h755xi = []
+stm32h755zi = []
+stm32h757ai = []
+stm32h757bi = []
+stm32h757ii = []
+stm32h757xi = []
+stm32h757zi = []
+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 = []
+stm32l485jc = []
+stm32l485je = []
+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 = []
+stm32wb10cc = []
+stm32wb15cc = []
+stm32wb30ce = []
+stm32wb35cc = []
+stm32wb35ce = []
+stm32wb50cg = []
+stm32wb55cc = []
+stm32wb55ce = []
+stm32wb55cg = []
+stm32wb55rc = []
+stm32wb55re = []
+stm32wb55rg = []
+stm32wb55vc = []
+stm32wb55ve = []
+stm32wb55vg = []
+stm32wb55vy = []
+stm32wb5mmg = []
+stm32wl54cc = []
+stm32wl54jc = []
+stm32wl55cc = []
+stm32wl55jc = []
+stm32wl55uc = []
+stm32wle4c8 = []
+stm32wle4cb = []
+stm32wle4cc = []
+stm32wle4j8 = []
+stm32wle4jb = []
+stm32wle4jc = []
+stm32wle5c8 = []
+stm32wle5cb = []
+stm32wle5cc = []
+stm32wle5j8 = []
+stm32wle5jb = []
+stm32wle5jc = []
+stm32wle5u8 = []
+stm32wle5ub = []
+# END GENERATED FEATURES
diff --git a/stm32-metapac/build.rs b/stm32-metapac/build.rs
new file mode 100644
index 00000000..ffea82d5
--- /dev/null
+++ b/stm32-metapac/build.rs
@@ -0,0 +1,294 @@
+use regex::Regex;
+use serde::Deserialize;
+use std::collections::{HashMap, HashSet};
+use std::env;
+use std::fmt::Write as _;
+use std::fs;
+use std::fs::File;
+use std::io::Write;
+use std::path::Path;
+use std::path::PathBuf;
+
+use chiptool::{generate, ir, transform};
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
+pub struct Chip {
+ pub name: String,
+ pub family: String,
+ pub line: String,
+ pub core: String,
+ pub flash: u32,
+ pub ram: u32,
+ pub gpio_af: String,
+ pub packages: Vec<Package>,
+ pub peripherals: HashMap<String, Peripheral>,
+ pub interrupts: HashMap<String, 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 address: u32,
+ #[serde(default)]
+ pub kind: Option<String>,
+ #[serde(default)]
+ pub block: Option<String>,
+ #[serde(default)]
+ pub clock: Option<String>,
+}
+
+struct BlockInfo {
+ module: String, // usart_v1/USART -> usart
+ version: String, // usart_v1/USART -> v1
+ block: String, // usart_v1/USART -> USART
+}
+
+impl BlockInfo {
+ fn parse(s: &str) -> Self {
+ let mut s = s.split("/");
+ let module = s.next().unwrap();
+ let block = s.next().unwrap();
+ assert!(s.next().is_none());
+ let mut s = module.split("_");
+ let module = s.next().unwrap();
+ let version = s.next().unwrap();
+ assert!(s.next().is_none());
+ Self {
+ module: module.to_string(),
+ version: version.to_string(),
+ block: block.to_string(),
+ }
+ }
+}
+
+fn make_table(out: &mut String, name: &str, data: &Vec<Vec<String>>) {
+ write!(
+ out,
+ "#[macro_export]
+macro_rules! {} {{
+ ($($pat:tt => $code:tt;)*) => {{
+ macro_rules! __{}_inner {{
+ $(($pat) => $code;)*
+ ($_:tt) => {{}}
+ }}
+",
+ name, name
+ )
+ .unwrap();
+
+ for row in data {
+ write!(out, " __{}_inner!(({}));\n", name, row.join(",")).unwrap();
+ }
+
+ write!(
+ out,
+ " }};
+}}"
+ )
+ .unwrap();
+}
+
+fn main() {
+ let dir = "../stm32-data/data";
+
+ println!("cwd: {:?}", env::current_dir());
+
+ let chip_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_uppercase();
+
+ let chip_path = Path::new(&dir)
+ .join("chips")
+ .join(&format!("{}.yaml", chip_name));
+ let chip = fs::read(chip_path).unwrap();
+ let chip: Chip = serde_yaml::from_slice(&chip).unwrap();
+
+ let mut ir = ir::IR::new();
+
+ let mut dev = ir::Device {
+ interrupts: Vec::new(),
+ peripherals: Vec::new(),
+ };
+
+ let mut peripheral_versions: HashMap<String, String> = HashMap::new();
+ let mut cfgs: HashSet<String> = HashSet::new();
+ let mut pin_table: Vec<Vec<String>> = Vec::new();
+ let mut interrupt_table: Vec<Vec<String>> = Vec::new();
+
+ let dma_base = chip
+ .peripherals
+ .get(&"DMA".to_string())
+ .unwrap_or_else(|| chip.peripherals.get(&"DMA1".to_string()).unwrap())
+ .address;
+ let dma_stride = 0x400;
+
+ let gpio_base = chip.peripherals.get(&"GPIOA".to_string()).unwrap().address;
+ let gpio_stride = 0x400;
+
+ cfgs.insert(chip.family.to_ascii_lowercase());
+
+ for (name, p) in &chip.peripherals {
+ let mut ir_peri = ir::Peripheral {
+ name: name.clone(),
+ array: None,
+ base_address: p.address,
+ block: None,
+ description: None,
+ interrupts: HashMap::new(),
+ };
+
+ if let Some(block) = &p.block {
+ let bi = BlockInfo::parse(block);
+
+ cfgs.insert(bi.module.clone());
+ cfgs.insert(format!("{}_{}", bi.module, bi.version));
+
+ if let Some(old_version) =
+ peripheral_versions.insert(bi.module.clone(), bi.version.clone())
+ {
+ if old_version != bi.version {
+ panic!(
+ "Peripheral {} has multiple versions: {} and {}",
+ bi.module, old_version, bi.version
+ );
+ }
+ }
+ ir_peri.block = Some(format!("{}::{}", bi.module, bi.block));
+
+ match bi.module.as_str() {
+ "gpio" => {
+ let port_letter = name.chars().skip(4).next().unwrap();
+ let port_num = port_letter as u32 - 'A' as u32;
+ assert_eq!(p.address, gpio_base + gpio_stride * port_num);
+
+ for pin_num in 0..16 {
+ let pin_name = format!("P{}{}", port_letter, pin_num);
+ pin_table.push(vec![
+ pin_name.clone(),
+ name.clone(),
+ port_num.to_string(),
+ pin_num.to_string(),
+ format!("EXTI{}", pin_num),
+ ]);
+ }
+ }
+ "dma" => {
+ let dma_num = if name == "DMA" {
+ 0
+ } else {
+ let dma_letter = name.chars().skip(3).next().unwrap();
+ dma_letter as u32 - '1' as u32
+ };
+ assert_eq!(p.address, dma_base + dma_stride * dma_num);
+ }
+ _ => {}
+ }
+ }
+
+ dev.peripherals.push(ir_peri);
+ }
+
+ for (name, &num) in &chip.interrupts {
+ dev.interrupts.push(ir::Interrupt {
+ name: name.clone(),
+ description: None,
+ value: num,
+ });
+
+ interrupt_table.push(vec![name.to_ascii_uppercase()]);
+ }
+
+ ir.devices.insert("".to_string(), dev);
+
+ let mut extra = format!(
+ "pub fn GPIO(n: usize) -> gpio::Gpio {{
+ gpio::Gpio(({} + {}*n) as _)
+ }}
+ pub fn DMA(n: usize) -> dma::Dma {{
+ dma::Dma(({} + {}*n) as _)
+ }}",
+ gpio_base, gpio_stride, dma_base, dma_stride,
+ );
+
+ let peripheral_version_table = peripheral_versions
+ .iter()
+ .map(|(kind, version)| vec![kind.clone(), version.clone()])
+ .collect();
+
+ make_table(&mut extra, "pins", &pin_table);
+ make_table(&mut extra, "interrupts", &interrupt_table);
+ make_table(&mut extra, "peripheral_versions", &peripheral_version_table);
+
+ for (module, version) in peripheral_versions {
+ println!("loading {} {}", module, version);
+
+ let regs_path = Path::new(&dir)
+ .join("registers")
+ .join(&format!("{}_{}.yaml", module, version));
+
+ let mut peri: ir::IR = serde_yaml::from_reader(File::open(regs_path).unwrap()).unwrap();
+
+ transform::expand_extends::ExpandExtends {}
+ .run(&mut peri)
+ .unwrap();
+
+ let prefix = module;
+ transform::map_names(&mut peri, |s, k| match k {
+ transform::NameKind::Block => format!("{}::{}", prefix, s),
+ transform::NameKind::Fieldset => format!("{}::regs::{}", prefix, s),
+ transform::NameKind::Enum => format!("{}::vals::{}", prefix, s),
+ _ => s.to_string(),
+ })
+ .unwrap();
+
+ ir.merge(peri);
+ }
+
+ // Cleanups!
+ transform::sort::Sort {}.run(&mut ir).unwrap();
+ transform::Sanitize {}.run(&mut ir).unwrap();
+
+ let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
+
+ let items = generate::render(&ir).unwrap();
+ let mut file = File::create(out.join("pac.rs")).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();
+ file.write_all(extra.as_bytes()).unwrap();
+
+ let mut device_x = String::new();
+
+ for (name, _) in &chip.interrupts {
+ write!(
+ &mut device_x,
+ "PROVIDE({} = DefaultHandler);\n",
+ name.to_ascii_uppercase()
+ )
+ .unwrap();
+ }
+
+ File::create(out.join("device.x"))
+ .unwrap()
+ .write_all(device_x.as_bytes())
+ .unwrap();
+ println!("cargo:rustc-link-search={}", out.display());
+ println!("cargo:rerun-if-changed=build.rs");
+
+ println!(
+ "cargo:cfgs={}",
+ cfgs.into_iter().collect::<Vec<_>>().join(",")
+ );
+}
diff --git a/stm32-metapac/gen_features.py b/stm32-metapac/gen_features.py
new file mode 100644
index 00000000..ee92bd76
--- /dev/null
+++ b/stm32-metapac/gen_features.py
@@ -0,0 +1,37 @@
+import xmltodict
+import yaml
+import re
+import json
+import os
+import re
+import toml
+from collections import OrderedDict
+from glob import glob
+
+abspath = os.path.abspath(__file__)
+dname = os.path.dirname(abspath)
+os.chdir(dname)
+
+# ======= load chip list
+
+features = {}
+
+for f in sorted(glob('../stm32-data/data/chips/*.yaml')):
+ # Use the filename to get the chip name. Ultra fast, we don't have to read YAML!
+ name = os.path.splitext(os.path.basename(f))[0].lower()
+ features[name] = []
+
+
+# ========= Update Cargo features
+
+SEPARATOR_START = '# BEGIN GENERATED FEATURES\n'
+SEPARATOR_END = '# END GENERATED FEATURES\n'
+HELP = '# Generated by gen_features.py. DO NOT EDIT.\n'
+with open('Cargo.toml', 'r') as f:
+ cargo = f.read()
+before, cargo = cargo.split(SEPARATOR_START, maxsplit=1)
+_, after = cargo.split(SEPARATOR_END, maxsplit=1)
+cargo = before + SEPARATOR_START + HELP + \
+ toml.dumps(features) + SEPARATOR_END + after
+with open('Cargo.toml', 'w') as f:
+ f.write(cargo)
diff --git a/stm32-metapac/src/lib.rs b/stm32-metapac/src/lib.rs
new file mode 100644
index 00000000..cf8ff378
--- /dev/null
+++ b/stm32-metapac/src/lib.rs
@@ -0,0 +1,6 @@
+#![no_std]
+#![allow(non_snake_case)]
+#![allow(unused)]
+#![allow(non_camel_case_types)]
+
+include!(concat!(env!("OUT_DIR"), "/pac.rs"));