Skip to content

Commit

Permalink
Initial WB55 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
rubdos committed Sep 27, 2019
1 parent 6e70e3d commit e970a67
Show file tree
Hide file tree
Showing 28 changed files with 37,044 additions and 4 deletions.
13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,19 @@ stm32l4s9 = [
"drone-stm32-map-periph-tim/stm32l4s9",
"drone-stm32-map-periph-uart/stm32l4s9",
]
stm32wbx5 = [
"drone-cortex-m/cortex_m4f_r0p1",
"drone-stm32-map-pieces/stm32wbx5",
"drone-stm32-map-periph-adc/stm32wbx5",
"drone-stm32-map-periph-dma/stm32wbx5",
"drone-stm32-map-periph-exti/stm32wbx5",
"drone-stm32-map-periph-gpio/stm32wbx5",
"drone-stm32-map-periph-i2c/stm32wbx5",
"drone-stm32-map-periph-rtc/stm32wbx5",
"drone-stm32-map-periph-spi/stm32wbx5",
"drone-stm32-map-periph-tim/stm32wbx5",
"drone-stm32-map-periph-uart/stm32wbx5",
]

[dependencies.drone-cortex-m]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ check-all:
cargo check --package drone-stm32-map --features stm32l4s7 --target thumbv7em-none-eabihf
cargo check --package drone-stm32-map --features stm32l4r9 --target thumbv7em-none-eabihf
cargo check --package drone-stm32-map --features stm32l4s9 --target thumbv7em-none-eabihf
cargo check --package drone-stm32-map --features stm32wbx5 --target thumbv7em-none-eabihf

# Generate the docs
doc:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ a drop-in replacement for it.
| `stm32l4s7` | ARM® Cortex®-M4F r0p1 | [RM0432](https://www.st.com/resource/en/reference_manual/dm00310109.pdf) |
| `stm32l4r9` | ARM® Cortex®-M4F r0p1 | [RM0432](https://www.st.com/resource/en/reference_manual/dm00310109.pdf) |
| `stm32l4s9` | ARM® Cortex®-M4F r0p1 | [RM0432](https://www.st.com/resource/en/reference_manual/dm00310109.pdf) |
| `stm32wbx5` | ARM® Cortex®-M4F r0p1 | [RM0434](https://www.st.com/resource/en/reference_manual/dm00318631.pdf) |

**NOTE** Exactly one cargo feature should be selected based on the device
model.
Expand Down
1 change: 1 addition & 0 deletions src/periph/adc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/periph/dma/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/periph/exti/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/periph/gpio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
12 changes: 8 additions & 4 deletions src/periph/gpio/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ periph! {
feature = "stm32l4r9",
feature = "stm32l4s5",
feature = "stm32l4s7",
feature = "stm32l4s9"
feature = "stm32l4s9",
feature = "stm32wbx5",
))]
BUSSMENR {
0x20 RwRegBitBand Shared;
Expand All @@ -60,7 +61,8 @@ periph! {
feature = "stm32l4r9",
feature = "stm32l4s5",
feature = "stm32l4s7",
feature = "stm32l4s9"
feature = "stm32l4s9",
feature = "stm32wbx5",
))]
AFRL {
0x20 RwReg;
Expand All @@ -84,7 +86,8 @@ periph! {
feature = "stm32l4r9",
feature = "stm32l4s5",
feature = "stm32l4s7",
feature = "stm32l4s9"
feature = "stm32l4s9",
feature = "stm32wbx5",
))]
AFRH {
0x20 RwReg;
Expand All @@ -104,7 +107,8 @@ periph! {
feature = "stm32l4r9",
feature = "stm32l4s5",
feature = "stm32l4s7",
feature = "stm32l4s9"
feature = "stm32l4s9",
feature = "stm32wbx5",
))]
ASCR {
0x20 RwReg Option;
Expand Down
1 change: 1 addition & 0 deletions src/periph/i2c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/periph/rtc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/periph/spi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/periph/tim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/periph/uart/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4r9
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s5"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s7"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32l4s9"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1", "drone-stm32-map-pieces/stm32wbx5"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/10/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/11/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/12/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/6/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/7/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/8/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/pieces/9/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stm32l4r9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s5 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s7 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32l4s9 = ["drone-cortex-m/cortex_m4f_r0p1"]
stm32wbx5 = ["drone-cortex-m/cortex_m4f_r0p1"]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
15 changes: 15 additions & 0 deletions src/pieces/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,21 @@ stm32l4s9 = [
"drone-stm32-map-pieces-11/stm32l4s9",
"drone-stm32-map-pieces-12/stm32l4s9",
]
stm32wbx5 = [
"drone-cortex-m/cortex_m4f_r0p1",
"drone-stm32-map-pieces-1/stm32wbx5",
"drone-stm32-map-pieces-2/stm32wbx5",
"drone-stm32-map-pieces-3/stm32wbx5",
"drone-stm32-map-pieces-4/stm32wbx5",
"drone-stm32-map-pieces-5/stm32wbx5",
"drone-stm32-map-pieces-6/stm32wbx5",
"drone-stm32-map-pieces-7/stm32wbx5",
"drone-stm32-map-pieces-8/stm32wbx5",
"drone-stm32-map-pieces-9/stm32wbx5",
"drone-stm32-map-pieces-10/stm32wbx5",
"drone-stm32-map-pieces-11/stm32wbx5",
"drone-stm32-map-pieces-12/stm32wbx5",
]

[dependencies.drone-core]
version = "0.10.0"
Expand Down
14 changes: 14 additions & 0 deletions svd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ macro_rules! svd_feature {
"stm32l4s7"
} else if cfg!(feature = "stm32l4s9") {
"stm32l4s9"
} else if cfg!(feature = "stm32wbx5") {
"stm32wbx5"
} else {
""
}
Expand Down Expand Up @@ -122,10 +124,16 @@ fn svd_deserialize(feature: &str) -> Result<Device, Error> {
"stm32l4s5" => patch_stm32l4plus(parse_svd("STM32L4S5.svd")?),
"stm32l4s7" => patch_stm32l4plus(parse_svd("STM32L4S7.svd")?),
"stm32l4s9" => patch_stm32l4plus(parse_svd("STM32L4S9.svd")?),
"stm32wbx5" => patch_stm32wbx5(parse_svd("STM32WBxx_CM4.svd")?),
_ => Ok(Device::new("Generic STM32".to_string())),
}
}

fn patch_stm32wbx5(mut dev: Device) -> Result<Device, Error> {
fix_802154(&mut dev)?;
Ok(dev)
}

fn patch_stm32f102(mut dev: Device) -> Result<Device, Error> {
fix_spi2_1(&mut dev)?;
Ok(dev)
Expand Down Expand Up @@ -232,6 +240,12 @@ fn patch_stm32l4plus(mut dev: Device) -> Result<Device, Error> {
Ok(dev)
}

fn fix_802154(dev: &mut Device) -> Result<(), Error> {
dev.field_mut("PWR", "SR1", "802WUF").name = "IEEE802WUF".to_string();
dev.field_mut("PWR", "C2CR1", "802EWKUP").name = "IEEE802EWKUP".to_string();
Ok(())
}

fn add_dmamux(dev: &mut Device) -> Result<(), Error> {
dev.add_peripheral(serde_xml_rs::deserialize(
read_svd("patch/add_dmamux.xml")?.as_bytes(),
Expand Down
Loading

0 comments on commit e970a67

Please sign in to comment.