From c14bb7c0f1b2ebb3f1013c90a3e6f3b37d26a1b3 Mon Sep 17 00:00:00 2001 From: Janek Date: Fri, 24 Nov 2023 12:07:09 +0100 Subject: [PATCH 1/5] Fix unused doc comment compiler warning in rcc.rs --- src/rcc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rcc.rs b/src/rcc.rs index e013e7b..6e79f68 100644 --- a/src/rcc.rs +++ b/src/rcc.rs @@ -14,7 +14,7 @@ impl RccExt for RCC { pclk: None, sysclk: None, clock_src: SysClkSource::HSI, - /// CRS is only available on devices with HSI48 + // CRS is only available on devices with HSI48 #[cfg(any( feature = "stm32f042", feature = "stm32f048", From a103135843c04be9723738ba59bc4177de5fc876 Mon Sep 17 00:00:00 2001 From: Janek Date: Fri, 24 Nov 2023 12:17:42 +0100 Subject: [PATCH 2/5] Fix invalid reference casting compile error in spi.rs NOTE: I have not tested this on hardware, just added the allow attribute. Also see [this](https://github.com/rust-lang/rust/issues/116410) issue --- src/spi.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/spi.rs b/src/spi.rs index eb18dfe..a7c3cce 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -413,7 +413,10 @@ where fn send_u8(&mut self, byte: u8) { // NOTE(write_volatile) see note above - unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, byte) } + #[allow(invalid_reference_casting)] + unsafe { + ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, byte) + } } fn read_u16(&mut self) -> u16 { @@ -423,7 +426,10 @@ where fn send_u16(&mut self, byte: u16) { // NOTE(write_volatile) see note above - unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u16, byte) } + #[allow(invalid_reference_casting)] + unsafe { + ptr::write_volatile(&self.spi.dr as *const _ as *mut u16, byte) + } } pub fn release(self) -> (SPI, (SCKPIN, MISOPIN, MOSIPIN)) { From 36773a3ac923107dee9321453d56805ac4b4dd0a Mon Sep 17 00:00:00 2001 From: Janek Date: Fri, 24 Nov 2023 12:30:30 +0100 Subject: [PATCH 3/5] Update CHANGELOG.md --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d688384..4e83607 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Wrong mode when using PWM channel 2 of a two-channel timer - `adc_values` example conversion error +- `invalid_reference_casting` Compilation error in spi.rs for Rust version 1.73+ ( + See [PR#112431](https://github.com/rust-lang/rust/pull/112431) for more info) +- `unused_doc_comments` Warning in rcc.rs ## [v0.18.0] - 2021-11-14 @@ -254,19 +257,35 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Interrupt handler to new #[interrupt] attribute [Unreleased]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.18.0...HEAD + [v0.18.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.17.1...v0.18.0 + [v0.17.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.17.0...v0.17.1 + [v0.17.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.16.0...v0.17.0 + [v0.16.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.15.2...v0.16.0 + [v0.15.2]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.15.1...v0.15.2 + [v0.15.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.15.0...v0.15.1 + [v0.15.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.14.1...v0.15.0 + [v0.14.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.14.0...v0.14.1 + [v0.14.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.13.0...v0.14.0 + [v0.13.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.12.0...v0.13.0 + [v0.12.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.11.1...v0.12.0 + [v0.11.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.11.0...v0.11.1 + [v0.11.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.10.1...v0.11.0 + [v0.10.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.10.0...v0.10.1 + [v0.10.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.9.0...v0.10.0 + [v0.9.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.8.0...v0.9.0 From 563da21c7514c63e2edb2f8ee331bc8ac459325f Mon Sep 17 00:00:00 2001 From: Janek Date: Sat, 9 Dec 2023 09:58:16 +0100 Subject: [PATCH 4/5] Use core::ptr::addr_of! in spi.rs instead of suppressing the compile error --- src/spi.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/spi.rs b/src/spi.rs index a7c3cce..17eeef7 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -413,10 +413,7 @@ where fn send_u8(&mut self, byte: u8) { // NOTE(write_volatile) see note above - #[allow(invalid_reference_casting)] - unsafe { - ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, byte) - } + unsafe { ptr::write_volatile(ptr::addr_of!(self.spi.dr) as *mut u8, byte) } } fn read_u16(&mut self) -> u16 { @@ -426,10 +423,7 @@ where fn send_u16(&mut self, byte: u16) { // NOTE(write_volatile) see note above - #[allow(invalid_reference_casting)] - unsafe { - ptr::write_volatile(&self.spi.dr as *const _ as *mut u16, byte) - } + unsafe { ptr::write_volatile(ptr::addr_of!(self.spi.dr) as *mut u16, byte) } } pub fn release(self) -> (SPI, (SCKPIN, MISOPIN, MOSIPIN)) { From ec3e60394466641668ed7dc03f7068b414a853f3 Mon Sep 17 00:00:00 2001 From: Janek Date: Sat, 9 Dec 2023 09:59:15 +0100 Subject: [PATCH 5/5] fixup! Update CHANGELOG.md --- CHANGELOG.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e83607..e95ebc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -257,35 +257,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Interrupt handler to new #[interrupt] attribute [Unreleased]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.18.0...HEAD - [v0.18.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.17.1...v0.18.0 - [v0.17.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.17.0...v0.17.1 - [v0.17.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.16.0...v0.17.0 - [v0.16.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.15.2...v0.16.0 - [v0.15.2]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.15.1...v0.15.2 - [v0.15.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.15.0...v0.15.1 - [v0.15.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.14.1...v0.15.0 - [v0.14.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.14.0...v0.14.1 - [v0.14.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.13.0...v0.14.0 - [v0.13.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.12.0...v0.13.0 - [v0.12.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.11.1...v0.12.0 - [v0.11.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.11.0...v0.11.1 - [v0.11.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.10.1...v0.11.0 - [v0.10.1]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.10.0...v0.10.1 - [v0.10.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.9.0...v0.10.0 - [v0.9.0]: https://github.com/stm32-rs/stm32f0xx-hal/compare/v0.8.0...v0.9.0