Skip to content

Commit

Permalink
Initial WB55 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanarill authored and rubdos committed Feb 10, 2020
1 parent ea92699 commit a49dc67
Show file tree
Hide file tree
Showing 5 changed files with 36,993 additions and 4 deletions.
1 change: 1 addition & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ check-all:
DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4s7"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}"
DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4r9"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}"
DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32l4s9"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}"
DRONE_RUSTFLAGS='--cfg cortex_m_core="cortex_m4f_r0p1" --cfg stm32_mcu="stm32wbx5"' drone env thumbv7em-none-eabihf -- cargo check --package drone-stm32-map --features "{{features}}"

# 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 @@ -47,6 +47,7 @@ a drop-in replacement for it.
| `stm32l4s7` | ARM® Cortex®-M4F r0p1 | [RM0432](https://www.st.com/resource/en/reference_manual/dm00310109.pdf) | `adc` `dma` `exti` `gpio` `i2c` `rtc` `spi` `tim` `uart` |
| `stm32l4r9` | ARM® Cortex®-M4F r0p1 | [RM0432](https://www.st.com/resource/en/reference_manual/dm00310109.pdf) | `adc` `dma` `exti` `gpio` `i2c` `rtc` `spi` `tim` `uart` |
| `stm32l4s9` | ARM® Cortex®-M4F r0p1 | [RM0432](https://www.st.com/resource/en/reference_manual/dm00310109.pdf) | `adc` `dma` `exti` `gpio` `i2c` `rtc` `spi` `tim` `uart` |
| `stm32wbx5` | ARM® Cortex®-M4F r0p1 | [RM0434](https://www.st.com/resource/en/reference_manual/dm00318631.pdf) | |

`stm32_mcu` config flag should be set at the application level according to
this table.
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 @@ -51,7 +51,8 @@ periph! {
stm32_mcu = "stm32l4r9",
stm32_mcu = "stm32l4s5",
stm32_mcu = "stm32l4s7",
stm32_mcu = "stm32l4s9"
stm32_mcu = "stm32l4s9",
stm32_mcu = "stm32wbx5"
))]
BUSSMENR {
0x20 RwRegBitBand Shared;
Expand Down Expand Up @@ -82,7 +83,8 @@ periph! {
stm32_mcu = "stm32l4r9",
stm32_mcu = "stm32l4s5",
stm32_mcu = "stm32l4s7",
stm32_mcu = "stm32l4s9"
stm32_mcu = "stm32l4s9",
stm32_mcu = "stm32wbx5"
))]
AFRL {
0x20 RwReg;
Expand Down Expand Up @@ -117,7 +119,8 @@ periph! {
stm32_mcu = "stm32l4r9",
stm32_mcu = "stm32l4s5",
stm32_mcu = "stm32l4s7",
stm32_mcu = "stm32l4s9"
stm32_mcu = "stm32l4s9",
stm32_mcu = "stm32wbx5"
))]
AFRH {
0x20 RwReg;
Expand All @@ -132,7 +135,8 @@ periph! {
}
#[cfg(any(
stm32_mcu = "stm32l4x5",
stm32_mcu = "stm32l4x6"
stm32_mcu = "stm32l4x6",
stm32_mcu = "stm32wbx5"
))]
ASCR {
0x20 RwReg Option;
Expand Down
12 changes: 12 additions & 0 deletions svd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,16 @@ fn svd_deserialize() -> Result<Device> {
"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")?),
_ => bail!("invalid `stm32_mcu` cfg flag"),
}
}

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

fn patch_stm32f102(mut dev: Device) -> Result<Device> {
spi::fix_spi2_1(&mut dev)?;
Ok(dev)
Expand Down Expand Up @@ -199,6 +205,12 @@ fn patch_stm32f413(mut dev: Device) -> Result<Device> {
Ok(dev)
}

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

fn patch_stm32f427(mut dev: Device) -> Result<Device> {
rcc::fix_3(&mut dev)?;
dma::fix_dma2_1(&mut dev)?;
Expand Down
Loading

0 comments on commit a49dc67

Please sign in to comment.