diff options
| author | Gerzain Mata <[email protected]> | 2025-07-23 09:48:59 -0700 |
|---|---|---|
| committer | Gerzain Mata <[email protected]> | 2025-07-23 09:48:59 -0700 |
| commit | d7625de4f5deb1a7be6949414dc87a9b11839a5f (patch) | |
| tree | 2b3f82588503c62827d87f2f834b96975d9b2102 | |
| parent | 378035aa9171b3ff6ab3b6b49f5970151a99115f (diff) | |
| parent | c361c82c41af1697d5c849b817554074e6dd6c8b (diff) | |
Merge branch 'main' into feat/stm32wba-usb-example
| -rwxr-xr-x | .github/ci/doc.sh | 1 | ||||
| -rwxr-xr-x | ci.sh | 6 | ||||
| -rw-r--r-- | embassy-imxrt/src/lib.rs | 8 | ||||
| -rw-r--r-- | embassy-mspm0/src/lib.rs | 10 | ||||
| -rw-r--r-- | embassy-nrf/src/lib.rs | 10 | ||||
| -rw-r--r-- | embassy-nxp/Cargo.toml | 10 | ||||
| -rw-r--r-- | embassy-rp/src/gpio.rs | 15 | ||||
| -rw-r--r-- | embassy-rp/src/lib.rs | 10 | ||||
| -rw-r--r-- | embassy-stm32/Cargo.toml | 45 | ||||
| -rw-r--r-- | embassy-stm32/build.rs | 6 | ||||
| -rw-r--r-- | embassy-stm32/src/flash/u5.rs | 26 | ||||
| -rw-r--r-- | embassy-stm32/src/lib.rs | 10 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/c0.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/hsi48.rs | 4 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/mco.rs | 2 | ||||
| -rw-r--r-- | tests/stm32/Cargo.toml | 1 | ||||
| -rw-r--r-- | tests/stm32/build.rs | 1 | ||||
| -rw-r--r-- | tests/stm32/src/common.rs | 10 |
18 files changed, 134 insertions, 43 deletions
diff --git a/.github/ci/doc.sh b/.github/ci/doc.sh index 06c61f8c0..90662af82 100755 --- a/.github/ci/doc.sh +++ b/.github/ci/doc.sh | |||
| @@ -26,6 +26,7 @@ docserver-builder -i ./embassy-futures -o webroot/crates/embassy-futures/git.zup | |||
| 26 | docserver-builder -i ./embassy-nrf -o webroot/crates/embassy-nrf/git.zup | 26 | docserver-builder -i ./embassy-nrf -o webroot/crates/embassy-nrf/git.zup |
| 27 | docserver-builder -i ./embassy-rp -o webroot/crates/embassy-rp/git.zup | 27 | docserver-builder -i ./embassy-rp -o webroot/crates/embassy-rp/git.zup |
| 28 | docserver-builder -i ./embassy-mspm0 -o webroot/crates/embassy-mspm0/git.zup | 28 | docserver-builder -i ./embassy-mspm0 -o webroot/crates/embassy-mspm0/git.zup |
| 29 | docserver-builder -i ./embassy-nxp -o webroot/crates/embassy-nxp/git.zup | ||
| 29 | docserver-builder -i ./embassy-sync -o webroot/crates/embassy-sync/git.zup | 30 | docserver-builder -i ./embassy-sync -o webroot/crates/embassy-sync/git.zup |
| 30 | docserver-builder -i ./cyw43 -o webroot/crates/cyw43/git.zup | 31 | docserver-builder -i ./cyw43 -o webroot/crates/cyw43/git.zup |
| 31 | docserver-builder -i ./cyw43-pio -o webroot/crates/cyw43-pio/git.zup | 32 | docserver-builder -i ./cyw43-pio -o webroot/crates/cyw43-pio/git.zup |
| @@ -102,6 +102,8 @@ cargo batch \ | |||
| 102 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,exti \ | 102 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,exti \ |
| 103 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt \ | 103 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt \ |
| 104 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,single-bank,defmt \ | 104 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,single-bank,defmt \ |
| 105 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32c071rb,defmt,exti,time-driver-any,time \ | ||
| 106 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32c051f6,defmt,exti,time-driver-any,time \ | ||
| 105 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f038f6,defmt,exti,time-driver-any,time \ | 107 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f038f6,defmt,exti,time-driver-any,time \ |
| 106 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f030c6,defmt,exti,time-driver-any,time \ | 108 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f030c6,defmt,exti,time-driver-any,time \ |
| 107 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f058t8,defmt,exti,time-driver-any,time \ | 109 | --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f058t8,defmt,exti,time-driver-any,time \ |
| @@ -303,6 +305,7 @@ cargo batch \ | |||
| 303 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g491re --artifact-dir out/tests/stm32g491re \ | 305 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g491re --artifact-dir out/tests/stm32g491re \ |
| 304 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32g071rb --artifact-dir out/tests/stm32g071rb \ | 306 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32g071rb --artifact-dir out/tests/stm32g071rb \ |
| 305 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32c031c6 --artifact-dir out/tests/stm32c031c6 \ | 307 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32c031c6 --artifact-dir out/tests/stm32c031c6 \ |
| 308 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32c071rb --artifact-dir out/tests/stm32c071rb \ | ||
| 306 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi --artifact-dir out/tests/stm32h755zi \ | 309 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi --artifact-dir out/tests/stm32h755zi \ |
| 307 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h753zi --artifact-dir out/tests/stm32h753zi \ | 310 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h753zi --artifact-dir out/tests/stm32h753zi \ |
| 308 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7a3zi --artifact-dir out/tests/stm32h7a3zi \ | 311 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7a3zi --artifact-dir out/tests/stm32h7a3zi \ |
| @@ -382,6 +385,9 @@ rm out/tests/pimoroni-pico-plus-2/pwm | |||
| 382 | rm out/tests/rpi-pico/pwm | 385 | rm out/tests/rpi-pico/pwm |
| 383 | rm out/tests/rpi-pico/cyw43-perf | 386 | rm out/tests/rpi-pico/cyw43-perf |
| 384 | 387 | ||
| 388 | # tests are implemented but the HIL test farm doesn't actually have this board yet | ||
| 389 | rm -rf out/tests/stm32c071rb | ||
| 390 | |||
| 385 | if [[ -z "${TELEPROBE_TOKEN-}" ]]; then | 391 | if [[ -z "${TELEPROBE_TOKEN-}" ]]; then |
| 386 | echo No teleprobe token found, skipping running HIL tests | 392 | echo No teleprobe token found, skipping running HIL tests |
| 387 | exit | 393 | exit |
diff --git a/embassy-imxrt/src/lib.rs b/embassy-imxrt/src/lib.rs index 5846afe5c..a3437c655 100644 --- a/embassy-imxrt/src/lib.rs +++ b/embassy-imxrt/src/lib.rs | |||
| @@ -76,9 +76,11 @@ macro_rules! bind_interrupts { | |||
| 76 | #[allow(non_snake_case)] | 76 | #[allow(non_snake_case)] |
| 77 | #[no_mangle] | 77 | #[no_mangle] |
| 78 | unsafe extern "C" fn $irq() { | 78 | unsafe extern "C" fn $irq() { |
| 79 | $( | 79 | unsafe { |
| 80 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | 80 | $( |
| 81 | )* | 81 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); |
| 82 | )* | ||
| 83 | } | ||
| 82 | } | 84 | } |
| 83 | 85 | ||
| 84 | $( | 86 | $( |
diff --git a/embassy-mspm0/src/lib.rs b/embassy-mspm0/src/lib.rs index bb8d91403..629ebfa1f 100644 --- a/embassy-mspm0/src/lib.rs +++ b/embassy-mspm0/src/lib.rs | |||
| @@ -111,11 +111,13 @@ macro_rules! bind_interrupts { | |||
| 111 | #[no_mangle] | 111 | #[no_mangle] |
| 112 | $(#[cfg($cond_irq)])? | 112 | $(#[cfg($cond_irq)])? |
| 113 | unsafe extern "C" fn $irq() { | 113 | unsafe extern "C" fn $irq() { |
| 114 | $( | 114 | unsafe { |
| 115 | $(#[cfg($cond_handler)])? | 115 | $( |
| 116 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | 116 | $(#[cfg($cond_handler)])? |
| 117 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | ||
| 117 | 118 | ||
| 118 | )* | 119 | )* |
| 120 | } | ||
| 119 | } | 121 | } |
| 120 | 122 | ||
| 121 | $(#[cfg($cond_irq)])? | 123 | $(#[cfg($cond_irq)])? |
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 8a88051b4..ba8206d13 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -240,11 +240,13 @@ macro_rules! bind_interrupts { | |||
| 240 | #[no_mangle] | 240 | #[no_mangle] |
| 241 | $(#[cfg($cond_irq)])? | 241 | $(#[cfg($cond_irq)])? |
| 242 | unsafe extern "C" fn $irq() { | 242 | unsafe extern "C" fn $irq() { |
| 243 | $( | 243 | unsafe { |
| 244 | $(#[cfg($cond_handler)])? | 244 | $( |
| 245 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | 245 | $(#[cfg($cond_handler)])? |
| 246 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | ||
| 246 | 247 | ||
| 247 | )* | 248 | )* |
| 249 | } | ||
| 248 | } | 250 | } |
| 249 | 251 | ||
| 250 | $(#[cfg($cond_irq)])? | 252 | $(#[cfg($cond_irq)])? |
diff --git a/embassy-nxp/Cargo.toml b/embassy-nxp/Cargo.toml index 293791d34..14fa7201d 100644 --- a/embassy-nxp/Cargo.toml +++ b/embassy-nxp/Cargo.toml | |||
| @@ -3,6 +3,16 @@ name = "embassy-nxp" | |||
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2021" |
| 5 | 5 | ||
| 6 | [package.metadata.embassy_docs] | ||
| 7 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-nxp-v$VERSION/embassy-nxp/src/" | ||
| 8 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-nxp/src/" | ||
| 9 | features = ["defmt", "unstable-pac" ] # TODO: Add time-driver-any, as both lpc55 and mimxrt1xxx use different drivers. | ||
| 10 | |||
| 11 | flavors = [ | ||
| 12 | { regex_feature = "lpc55", target = "thumbv8m.main-none-eabihf" }, | ||
| 13 | { regex_feature = "mimxrt.*", target = "thumbv7em-none-eabihf" }, | ||
| 14 | ] | ||
| 15 | |||
| 6 | [dependencies] | 16 | [dependencies] |
| 7 | cortex-m = "0.7.7" | 17 | cortex-m = "0.7.7" |
| 8 | cortex-m-rt = "0.7.0" | 18 | cortex-m-rt = "0.7.0" |
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 9b5faac15..f79bf8948 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs | |||
| @@ -26,6 +26,7 @@ static QSPI_WAKERS: [AtomicWaker; QSPI_PIN_COUNT] = [const { AtomicWaker::new() | |||
| 26 | 26 | ||
| 27 | /// Represents a digital input or output level. | 27 | /// Represents a digital input or output level. |
| 28 | #[derive(Debug, Eq, PartialEq, Clone, Copy)] | 28 | #[derive(Debug, Eq, PartialEq, Clone, Copy)] |
| 29 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 29 | pub enum Level { | 30 | pub enum Level { |
| 30 | /// Logical low. | 31 | /// Logical low. |
| 31 | Low, | 32 | Low, |
| @@ -53,6 +54,7 @@ impl From<Level> for bool { | |||
| 53 | 54 | ||
| 54 | /// Represents a pull setting for an input. | 55 | /// Represents a pull setting for an input. |
| 55 | #[derive(Debug, Clone, Copy, Eq, PartialEq)] | 56 | #[derive(Debug, Clone, Copy, Eq, PartialEq)] |
| 57 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 56 | pub enum Pull { | 58 | pub enum Pull { |
| 57 | /// No pull. | 59 | /// No pull. |
| 58 | None, | 60 | None, |
| @@ -64,6 +66,7 @@ pub enum Pull { | |||
| 64 | 66 | ||
| 65 | /// Drive strength of an output | 67 | /// Drive strength of an output |
| 66 | #[derive(Debug, Eq, PartialEq)] | 68 | #[derive(Debug, Eq, PartialEq)] |
| 69 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 67 | pub enum Drive { | 70 | pub enum Drive { |
| 68 | /// 2 mA drive. | 71 | /// 2 mA drive. |
| 69 | _2mA, | 72 | _2mA, |
| @@ -76,6 +79,7 @@ pub enum Drive { | |||
| 76 | } | 79 | } |
| 77 | /// Slew rate of an output | 80 | /// Slew rate of an output |
| 78 | #[derive(Debug, Eq, PartialEq)] | 81 | #[derive(Debug, Eq, PartialEq)] |
| 82 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 79 | pub enum SlewRate { | 83 | pub enum SlewRate { |
| 80 | /// Fast slew rate. | 84 | /// Fast slew rate. |
| 81 | Fast, | 85 | Fast, |
| @@ -85,6 +89,7 @@ pub enum SlewRate { | |||
| 85 | 89 | ||
| 86 | /// A GPIO bank with up to 32 pins. | 90 | /// A GPIO bank with up to 32 pins. |
| 87 | #[derive(Debug, Eq, PartialEq)] | 91 | #[derive(Debug, Eq, PartialEq)] |
| 92 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 88 | pub enum Bank { | 93 | pub enum Bank { |
| 89 | /// Bank 0. | 94 | /// Bank 0. |
| 90 | Bank0 = 0, | 95 | Bank0 = 0, |
| @@ -108,6 +113,8 @@ pub struct DormantWakeConfig { | |||
| 108 | } | 113 | } |
| 109 | 114 | ||
| 110 | /// GPIO input driver. | 115 | /// GPIO input driver. |
| 116 | #[derive(Debug)] | ||
| 117 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 111 | pub struct Input<'d> { | 118 | pub struct Input<'d> { |
| 112 | pin: Flex<'d>, | 119 | pin: Flex<'d>, |
| 113 | } | 120 | } |
| @@ -358,6 +365,8 @@ impl<'d> Future for InputFuture<'d> { | |||
| 358 | } | 365 | } |
| 359 | 366 | ||
| 360 | /// GPIO output driver. | 367 | /// GPIO output driver. |
| 368 | #[derive(Debug)] | ||
| 369 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 361 | pub struct Output<'d> { | 370 | pub struct Output<'d> { |
| 362 | pin: Flex<'d>, | 371 | pin: Flex<'d>, |
| 363 | } | 372 | } |
| @@ -445,6 +454,8 @@ impl<'d> Output<'d> { | |||
| 445 | } | 454 | } |
| 446 | 455 | ||
| 447 | /// GPIO output open-drain. | 456 | /// GPIO output open-drain. |
| 457 | #[derive(Debug)] | ||
| 458 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 448 | pub struct OutputOpenDrain<'d> { | 459 | pub struct OutputOpenDrain<'d> { |
| 449 | pin: Flex<'d>, | 460 | pin: Flex<'d>, |
| 450 | } | 461 | } |
| @@ -592,6 +603,8 @@ impl<'d> OutputOpenDrain<'d> { | |||
| 592 | /// This pin can be either an input or output pin. The output level register bit will remain | 603 | /// This pin can be either an input or output pin. The output level register bit will remain |
| 593 | /// set while not in output mode, so the pin's level will be 'remembered' when it is not in output | 604 | /// set while not in output mode, so the pin's level will be 'remembered' when it is not in output |
| 594 | /// mode. | 605 | /// mode. |
| 606 | #[derive(Debug)] | ||
| 607 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 595 | pub struct Flex<'d> { | 608 | pub struct Flex<'d> { |
| 596 | pin: Peri<'d, AnyPin>, | 609 | pin: Peri<'d, AnyPin>, |
| 597 | } | 610 | } |
| @@ -864,6 +877,8 @@ impl<'d> Drop for Flex<'d> { | |||
| 864 | } | 877 | } |
| 865 | 878 | ||
| 866 | /// Dormant wake driver. | 879 | /// Dormant wake driver. |
| 880 | #[derive(Debug)] | ||
| 881 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 867 | pub struct DormantWake<'w> { | 882 | pub struct DormantWake<'w> { |
| 868 | pin: Peri<'w, AnyPin>, | 883 | pin: Peri<'w, AnyPin>, |
| 869 | cfg: DormantWakeConfig, | 884 | cfg: DormantWakeConfig, |
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs index f3c5a35bb..9c450b6dc 100644 --- a/embassy-rp/src/lib.rs +++ b/embassy-rp/src/lib.rs | |||
| @@ -189,11 +189,13 @@ macro_rules! bind_interrupts { | |||
| 189 | #[no_mangle] | 189 | #[no_mangle] |
| 190 | $(#[cfg($cond_irq)])? | 190 | $(#[cfg($cond_irq)])? |
| 191 | unsafe extern "C" fn $irq() { | 191 | unsafe extern "C" fn $irq() { |
| 192 | $( | 192 | unsafe { |
| 193 | $(#[cfg($cond_handler)])? | 193 | $( |
| 194 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | 194 | $(#[cfg($cond_handler)])? |
| 195 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | ||
| 195 | 196 | ||
| 196 | )* | 197 | )* |
| 198 | } | ||
| 197 | } | 199 | } |
| 198 | 200 | ||
| 199 | $(#[cfg($cond_irq)])? | 201 | $(#[cfg($cond_irq)])? |
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 4590301b8..38254ee40 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml | |||
| @@ -81,7 +81,7 @@ futures-util = { version = "0.3.30", default-features = false } | |||
| 81 | sdio-host = "0.9.0" | 81 | sdio-host = "0.9.0" |
| 82 | critical-section = "1.1" | 82 | critical-section = "1.1" |
| 83 | #stm32-metapac = { version = "16" } | 83 | #stm32-metapac = { version = "16" } |
| 84 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-6201a7707ff38ac42ad50d5317dbd9e1e3686de3" } | 84 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-9fc86ca7b3a8bc05182bf1ce3045602df1f5dce3" } |
| 85 | 85 | ||
| 86 | vcell = "0.1.3" | 86 | vcell = "0.1.3" |
| 87 | nb = "1.0.0" | 87 | nb = "1.0.0" |
| @@ -110,7 +110,7 @@ proc-macro2 = "1.0.36" | |||
| 110 | quote = "1.0.15" | 110 | quote = "1.0.15" |
| 111 | 111 | ||
| 112 | #stm32-metapac = { version = "16", default-features = false, features = ["metadata"]} | 112 | #stm32-metapac = { version = "16", default-features = false, features = ["metadata"]} |
| 113 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-6201a7707ff38ac42ad50d5317dbd9e1e3686de3", default-features = false, features = ["metadata"] } | 113 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-9fc86ca7b3a8bc05182bf1ce3045602df1f5dce3", default-features = false, features = ["metadata"] } |
| 114 | 114 | ||
| 115 | [features] | 115 | [features] |
| 116 | default = ["rt"] | 116 | default = ["rt"] |
| @@ -237,6 +237,47 @@ stm32c031g4 = [ "stm32-metapac/stm32c031g4" ] | |||
| 237 | stm32c031g6 = [ "stm32-metapac/stm32c031g6" ] | 237 | stm32c031g6 = [ "stm32-metapac/stm32c031g6" ] |
| 238 | stm32c031k4 = [ "stm32-metapac/stm32c031k4" ] | 238 | stm32c031k4 = [ "stm32-metapac/stm32c031k4" ] |
| 239 | stm32c031k6 = [ "stm32-metapac/stm32c031k6" ] | 239 | stm32c031k6 = [ "stm32-metapac/stm32c031k6" ] |
| 240 | stm32c051c6 = [ "stm32-metapac/stm32c051c6" ] | ||
| 241 | stm32c051c8 = [ "stm32-metapac/stm32c051c8" ] | ||
| 242 | stm32c051d8 = [ "stm32-metapac/stm32c051d8" ] | ||
| 243 | stm32c051f6 = [ "stm32-metapac/stm32c051f6" ] | ||
| 244 | stm32c051f8 = [ "stm32-metapac/stm32c051f8" ] | ||
| 245 | stm32c051g6 = [ "stm32-metapac/stm32c051g6" ] | ||
| 246 | stm32c051g8 = [ "stm32-metapac/stm32c051g8" ] | ||
| 247 | stm32c051k6 = [ "stm32-metapac/stm32c051k6" ] | ||
| 248 | stm32c051k8 = [ "stm32-metapac/stm32c051k8" ] | ||
| 249 | stm32c071c8 = [ "stm32-metapac/stm32c071c8" ] | ||
| 250 | stm32c071cb = [ "stm32-metapac/stm32c071cb" ] | ||
| 251 | stm32c071f8 = [ "stm32-metapac/stm32c071f8" ] | ||
| 252 | stm32c071fb = [ "stm32-metapac/stm32c071fb" ] | ||
| 253 | stm32c071g8 = [ "stm32-metapac/stm32c071g8" ] | ||
| 254 | stm32c071gb = [ "stm32-metapac/stm32c071gb" ] | ||
| 255 | stm32c071k8 = [ "stm32-metapac/stm32c071k8" ] | ||
| 256 | stm32c071kb = [ "stm32-metapac/stm32c071kb" ] | ||
| 257 | stm32c071r8 = [ "stm32-metapac/stm32c071r8" ] | ||
| 258 | stm32c071rb = [ "stm32-metapac/stm32c071rb" ] | ||
| 259 | stm32c091cb = [ "stm32-metapac/stm32c091cb" ] | ||
| 260 | stm32c091cc = [ "stm32-metapac/stm32c091cc" ] | ||
| 261 | stm32c091ec = [ "stm32-metapac/stm32c091ec" ] | ||
| 262 | stm32c091fb = [ "stm32-metapac/stm32c091fb" ] | ||
| 263 | stm32c091fc = [ "stm32-metapac/stm32c091fc" ] | ||
| 264 | stm32c091gb = [ "stm32-metapac/stm32c091gb" ] | ||
| 265 | stm32c091gc = [ "stm32-metapac/stm32c091gc" ] | ||
| 266 | stm32c091kb = [ "stm32-metapac/stm32c091kb" ] | ||
| 267 | stm32c091kc = [ "stm32-metapac/stm32c091kc" ] | ||
| 268 | stm32c091rb = [ "stm32-metapac/stm32c091rb" ] | ||
| 269 | stm32c091rc = [ "stm32-metapac/stm32c091rc" ] | ||
| 270 | stm32c092cb = [ "stm32-metapac/stm32c092cb" ] | ||
| 271 | stm32c092cc = [ "stm32-metapac/stm32c092cc" ] | ||
| 272 | stm32c092ec = [ "stm32-metapac/stm32c092ec" ] | ||
| 273 | stm32c092fb = [ "stm32-metapac/stm32c092fb" ] | ||
| 274 | stm32c092fc = [ "stm32-metapac/stm32c092fc" ] | ||
| 275 | stm32c092gb = [ "stm32-metapac/stm32c092gb" ] | ||
| 276 | stm32c092gc = [ "stm32-metapac/stm32c092gc" ] | ||
| 277 | stm32c092kb = [ "stm32-metapac/stm32c092kb" ] | ||
| 278 | stm32c092kc = [ "stm32-metapac/stm32c092kc" ] | ||
| 279 | stm32c092rb = [ "stm32-metapac/stm32c092rb" ] | ||
| 280 | stm32c092rc = [ "stm32-metapac/stm32c092rc" ] | ||
| 240 | stm32f030c6 = [ "stm32-metapac/stm32f030c6" ] | 281 | stm32f030c6 = [ "stm32-metapac/stm32f030c6" ] |
| 241 | stm32f030c8 = [ "stm32-metapac/stm32f030c8" ] | 282 | stm32f030c8 = [ "stm32-metapac/stm32f030c8" ] |
| 242 | stm32f030cc = [ "stm32-metapac/stm32f030cc" ] | 283 | stm32f030cc = [ "stm32-metapac/stm32f030cc" ] |
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index f4781380c..73860c64a 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs | |||
| @@ -1918,9 +1918,9 @@ fn main() { | |||
| 1918 | } | 1918 | } |
| 1919 | 1919 | ||
| 1920 | g.extend(quote!( | 1920 | g.extend(quote!( |
| 1921 | pub fn gpio_block(n: usize) -> crate::pac::gpio::Gpio {{ | 1921 | pub fn gpio_block(n: usize) -> crate::pac::gpio::Gpio { |
| 1922 | unsafe {{ crate::pac::gpio::Gpio::from_ptr((#gpio_base + #gpio_stride*n) as _) }} | 1922 | unsafe { crate::pac::gpio::Gpio::from_ptr((#gpio_base + #gpio_stride*n) as _) } |
| 1923 | }} | 1923 | } |
| 1924 | )); | 1924 | )); |
| 1925 | 1925 | ||
| 1926 | // ======== | 1926 | // ======== |
diff --git a/embassy-stm32/src/flash/u5.rs b/embassy-stm32/src/flash/u5.rs index 131caa195..6c3d4b422 100644 --- a/embassy-stm32/src/flash/u5.rs +++ b/embassy-stm32/src/flash/u5.rs | |||
| @@ -30,19 +30,19 @@ pub(crate) unsafe fn enable_blocking_write() { | |||
| 30 | 30 | ||
| 31 | #[cfg(feature = "trustzone-secure")] | 31 | #[cfg(feature = "trustzone-secure")] |
| 32 | pac::FLASH.seccr().write(|w| { | 32 | pac::FLASH.seccr().write(|w| { |
| 33 | w.set_pg(pac::flash::vals::SeccrPg::B_0X1); | 33 | w.set_pg(true); |
| 34 | }); | 34 | }); |
| 35 | #[cfg(not(feature = "trustzone-secure"))] | 35 | #[cfg(not(feature = "trustzone-secure"))] |
| 36 | pac::FLASH.nscr().write(|w| { | 36 | pac::FLASH.nscr().write(|w| { |
| 37 | w.set_pg(pac::flash::vals::NscrPg::B_0X1); | 37 | w.set_pg(true); |
| 38 | }); | 38 | }); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | pub(crate) unsafe fn disable_blocking_write() { | 41 | pub(crate) unsafe fn disable_blocking_write() { |
| 42 | #[cfg(feature = "trustzone-secure")] | 42 | #[cfg(feature = "trustzone-secure")] |
| 43 | pac::FLASH.seccr().write(|w| w.set_pg(pac::flash::vals::SeccrPg::B_0X0)); | 43 | pac::FLASH.seccr().write(|w| w.set_pg(false)); |
| 44 | #[cfg(not(feature = "trustzone-secure"))] | 44 | #[cfg(not(feature = "trustzone-secure"))] |
| 45 | pac::FLASH.nscr().write(|w| w.set_pg(pac::flash::vals::NscrPg::B_0X0)); | 45 | pac::FLASH.nscr().write(|w| w.set_pg(false)); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> { | 48 | pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> { |
| @@ -65,19 +65,19 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E | |||
| 65 | w.set_pnb(sector.index_in_bank); | 65 | w.set_pnb(sector.index_in_bank); |
| 66 | // TODO: add check for bank swap | 66 | // TODO: add check for bank swap |
| 67 | w.set_bker(match sector.bank { | 67 | w.set_bker(match sector.bank { |
| 68 | FlashBank::Bank1 => pac::flash::vals::SeccrBker::B_0X0, | 68 | FlashBank::Bank1 => false, |
| 69 | FlashBank::Bank2 => pac::flash::vals::SeccrBker::B_0X1, | 69 | FlashBank::Bank2 => true, |
| 70 | _ => unreachable!(), | 70 | _ => unreachable!(), |
| 71 | }); | 71 | }); |
| 72 | }); | 72 | }); |
| 73 | #[cfg(not(feature = "trustzone-secure"))] | 73 | #[cfg(not(feature = "trustzone-secure"))] |
| 74 | pac::FLASH.nscr().modify(|w| { | 74 | pac::FLASH.nscr().modify(|w| { |
| 75 | w.set_per(pac::flash::vals::NscrPer::B_0X1); | 75 | w.set_per(true); |
| 76 | w.set_pnb(sector.index_in_bank); | 76 | w.set_pnb(sector.index_in_bank); |
| 77 | // TODO: add check for bank swap | 77 | // TODO: add check for bank swap |
| 78 | w.set_bker(match sector.bank { | 78 | w.set_bker(match sector.bank { |
| 79 | FlashBank::Bank1 => pac::flash::vals::NscrBker::B_0X0, | 79 | FlashBank::Bank1 => false, |
| 80 | FlashBank::Bank2 => pac::flash::vals::NscrBker::B_0X1, | 80 | FlashBank::Bank2 => true, |
| 81 | _ => unreachable!(), | 81 | _ => unreachable!(), |
| 82 | }); | 82 | }); |
| 83 | }); | 83 | }); |
| @@ -93,13 +93,9 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E | |||
| 93 | 93 | ||
| 94 | let ret: Result<(), Error> = blocking_wait_ready(); | 94 | let ret: Result<(), Error> = blocking_wait_ready(); |
| 95 | #[cfg(feature = "trustzone-secure")] | 95 | #[cfg(feature = "trustzone-secure")] |
| 96 | pac::FLASH | 96 | pac::FLASH.seccr().modify(|w| w.set_per(false)); |
| 97 | .seccr() | ||
| 98 | .modify(|w| w.set_per(pac::flash::vals::SeccrPer::B_0X0)); | ||
| 99 | #[cfg(not(feature = "trustzone-secure"))] | 97 | #[cfg(not(feature = "trustzone-secure"))] |
| 100 | pac::FLASH | 98 | pac::FLASH.nscr().modify(|w| w.set_per(false)); |
| 101 | .nscr() | ||
| 102 | .modify(|w| w.set_per(pac::flash::vals::NscrPer::B_0X0)); | ||
| 103 | clear_all_err(); | 99 | clear_all_err(); |
| 104 | ret | 100 | ret |
| 105 | } | 101 | } |
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 700905850..c7a33ed72 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs | |||
| @@ -196,11 +196,13 @@ macro_rules! bind_interrupts { | |||
| 196 | $(#[cfg($cond_irq)])? | 196 | $(#[cfg($cond_irq)])? |
| 197 | $(#[doc = $doc])* | 197 | $(#[doc = $doc])* |
| 198 | unsafe extern "C" fn $irq() { | 198 | unsafe extern "C" fn $irq() { |
| 199 | $( | 199 | unsafe { |
| 200 | $(#[cfg($cond_handler)])? | 200 | $( |
| 201 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | 201 | $(#[cfg($cond_handler)])? |
| 202 | <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt(); | ||
| 202 | 203 | ||
| 203 | )* | 204 | )* |
| 205 | } | ||
| 204 | } | 206 | } |
| 205 | 207 | ||
| 206 | $(#[cfg($cond_irq)])? | 208 | $(#[cfg($cond_irq)])? |
diff --git a/embassy-stm32/src/rcc/c0.rs b/embassy-stm32/src/rcc/c0.rs index cac2a9149..c2295bab6 100644 --- a/embassy-stm32/src/rcc/c0.rs +++ b/embassy-stm32/src/rcc/c0.rs | |||
| @@ -190,6 +190,8 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 190 | // TODO | 190 | // TODO |
| 191 | lsi: None, | 191 | lsi: None, |
| 192 | lse: None, | 192 | lse: None, |
| 193 | #[cfg(crs)] | ||
| 194 | hsi48: None, | ||
| 193 | ); | 195 | ); |
| 194 | 196 | ||
| 195 | RCC.ccipr() | 197 | RCC.ccipr() |
diff --git a/embassy-stm32/src/rcc/hsi48.rs b/embassy-stm32/src/rcc/hsi48.rs index 3ea5c96c9..49be4af5e 100644 --- a/embassy-stm32/src/rcc/hsi48.rs +++ b/embassy-stm32/src/rcc/hsi48.rs | |||
| @@ -39,9 +39,9 @@ pub(crate) fn init_hsi48(config: Hsi48Config) -> Hertz { | |||
| 39 | }); | 39 | }); |
| 40 | 40 | ||
| 41 | // Enable HSI48 | 41 | // Enable HSI48 |
| 42 | #[cfg(not(any(stm32u5, stm32g0, stm32h5, stm32h7, stm32h7rs, stm32u5, stm32wba, stm32f0)))] | 42 | #[cfg(not(any(stm32u5, stm32g0, stm32h5, stm32h7, stm32h7rs, stm32u5, stm32wba, stm32f0, stm32c071)))] |
| 43 | let r = RCC.crrcr(); | 43 | let r = RCC.crrcr(); |
| 44 | #[cfg(any(stm32u5, stm32g0, stm32h5, stm32h7, stm32h7rs, stm32u5, stm32wba))] | 44 | #[cfg(any(stm32u5, stm32g0, stm32h5, stm32h7, stm32h7rs, stm32u5, stm32wba, stm32c071))] |
| 45 | let r = RCC.cr(); | 45 | let r = RCC.cr(); |
| 46 | #[cfg(any(stm32f0))] | 46 | #[cfg(any(stm32f0))] |
| 47 | let r = RCC.cr2(); | 47 | let r = RCC.cr2(); |
diff --git a/embassy-stm32/src/rcc/mco.rs b/embassy-stm32/src/rcc/mco.rs index 0371b9141..96e628b1a 100644 --- a/embassy-stm32/src/rcc/mco.rs +++ b/embassy-stm32/src/rcc/mco.rs | |||
| @@ -74,7 +74,7 @@ macro_rules! impl_peri { | |||
| 74 | }; | 74 | }; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | #[cfg(any(rcc_c0, rcc_g0x0, rcc_g0x1, rcc_u0))] | 77 | #[cfg(any(rcc_c0, rcc_c0v2, rcc_g0x0, rcc_g0x1, rcc_u0))] |
| 78 | #[allow(unused_imports)] | 78 | #[allow(unused_imports)] |
| 79 | use self::{McoSource as Mco1Source, McoSource as Mco2Source}; | 79 | use self::{McoSource as Mco1Source, McoSource as Mco2Source}; |
| 80 | 80 | ||
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 8d10f6593..7c32c0ce1 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -7,6 +7,7 @@ autobins = false | |||
| 7 | 7 | ||
| 8 | [features] | 8 | [features] |
| 9 | stm32c031c6 = ["embassy-stm32/stm32c031c6", "cm0", "not-gpdma"] | 9 | stm32c031c6 = ["embassy-stm32/stm32c031c6", "cm0", "not-gpdma"] |
| 10 | stm32c071rb = ["embassy-stm32/stm32c071rb", "cm0", "not-gpdma"] | ||
| 10 | stm32f103c8 = ["embassy-stm32/stm32f103c8", "spi-v1", "not-gpdma"] | 11 | stm32f103c8 = ["embassy-stm32/stm32f103c8", "spi-v1", "not-gpdma"] |
| 11 | stm32f207zg = ["embassy-stm32/stm32f207zg", "spi-v1", "chrono", "not-gpdma", "eth", "rng"] | 12 | stm32f207zg = ["embassy-stm32/stm32f207zg", "spi-v1", "chrono", "not-gpdma", "eth", "rng"] |
| 12 | stm32f303ze = ["embassy-stm32/stm32f303ze", "chrono", "not-gpdma"] | 13 | stm32f303ze = ["embassy-stm32/stm32f303ze", "chrono", "not-gpdma"] |
diff --git a/tests/stm32/build.rs b/tests/stm32/build.rs index 722671bf1..556d77a20 100644 --- a/tests/stm32/build.rs +++ b/tests/stm32/build.rs | |||
| @@ -12,6 +12,7 @@ fn main() -> Result<(), Box<dyn Error>> { | |||
| 12 | // too little RAM to run from RAM. | 12 | // too little RAM to run from RAM. |
| 13 | feature = "stm32f103c8", // 20 kb | 13 | feature = "stm32f103c8", // 20 kb |
| 14 | feature = "stm32c031c6", // 6 kb | 14 | feature = "stm32c031c6", // 6 kb |
| 15 | feature = "stm32c071rb", // 24 kb | ||
| 15 | feature = "stm32l073rz", // 20 kb | 16 | feature = "stm32l073rz", // 20 kb |
| 16 | feature = "stm32h503rb", // 32 kb | 17 | feature = "stm32h503rb", // 32 kb |
| 17 | // no VTOR, so interrupts can't work when running from RAM | 18 | // no VTOR, so interrupts can't work when running from RAM |
diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs index 829f2cff0..a4d8048ce 100644 --- a/tests/stm32/src/common.rs +++ b/tests/stm32/src/common.rs | |||
| @@ -34,6 +34,8 @@ teleprobe_meta::target!(b"nucleo-stm32u5a5zj"); | |||
| 34 | teleprobe_meta::target!(b"nucleo-stm32h563zi"); | 34 | teleprobe_meta::target!(b"nucleo-stm32h563zi"); |
| 35 | #[cfg(feature = "stm32c031c6")] | 35 | #[cfg(feature = "stm32c031c6")] |
| 36 | teleprobe_meta::target!(b"nucleo-stm32c031c6"); | 36 | teleprobe_meta::target!(b"nucleo-stm32c031c6"); |
| 37 | #[cfg(feature = "stm32c071rb")] | ||
| 38 | teleprobe_meta::target!(b"nucleo-stm32c071rb"); | ||
| 37 | #[cfg(feature = "stm32l073rz")] | 39 | #[cfg(feature = "stm32l073rz")] |
| 38 | teleprobe_meta::target!(b"nucleo-stm32l073rz"); | 40 | teleprobe_meta::target!(b"nucleo-stm32l073rz"); |
| 39 | #[cfg(feature = "stm32l152re")] | 41 | #[cfg(feature = "stm32l152re")] |
| @@ -186,6 +188,12 @@ define_peris!( | |||
| 186 | SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH1, SPI_RX_DMA = DMA1_CH2, | 188 | SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH1, SPI_RX_DMA = DMA1_CH2, |
| 187 | @irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;}, | 189 | @irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;}, |
| 188 | ); | 190 | ); |
| 191 | #[cfg(feature = "stm32c071rb")] | ||
| 192 | define_peris!( | ||
| 193 | UART = USART1, UART_TX = PB6, UART_RX = PB7, UART_TX_DMA = DMA1_CH1, UART_RX_DMA = DMA1_CH2, | ||
| 194 | SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH1, SPI_RX_DMA = DMA1_CH2, | ||
| 195 | @irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;}, | ||
| 196 | ); | ||
| 189 | #[cfg(feature = "stm32l496zg")] | 197 | #[cfg(feature = "stm32l496zg")] |
| 190 | define_peris!( | 198 | define_peris!( |
| 191 | UART = USART3, UART_TX = PD8, UART_RX = PD9, UART_TX_DMA = DMA1_CH2, UART_RX_DMA = DMA1_CH3, | 199 | UART = USART3, UART_TX = PD8, UART_RX = PD9, UART_TX_DMA = DMA1_CH2, UART_RX_DMA = DMA1_CH3, |
| @@ -271,7 +279,7 @@ pub fn config() -> Config { | |||
| 271 | #[allow(unused_mut)] | 279 | #[allow(unused_mut)] |
| 272 | let mut config = Config::default(); | 280 | let mut config = Config::default(); |
| 273 | 281 | ||
| 274 | #[cfg(feature = "stm32c031c6")] | 282 | #[cfg(any(feature = "stm32c031c6", feature = "stm32c071rb"))] |
| 275 | { | 283 | { |
| 276 | config.rcc.hsi = Some(Hsi { | 284 | config.rcc.hsi = Some(Hsi { |
| 277 | sys_div: HsiSysDiv::DIV1, // 48Mhz | 285 | sys_div: HsiSysDiv::DIV1, // 48Mhz |
