diff options
| author | Ulf Lilleengen <[email protected]> | 2025-10-13 07:00:11 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-10-13 07:00:11 +0000 |
| commit | 4d6763364d0eab3858eebfea9d98c4fdd208faf9 (patch) | |
| tree | b0341ab5067ad7c7fbc84a90e524a44dfd5e67b3 | |
| parent | aaf544318a9f678ac7727d8fe59a1bc831c86a5f (diff) | |
| parent | 94c2cc9eba3b1840063ea11a62e2eb27442bbe16 (diff) | |
Merge pull request #4755 from Angelina-2007/main
Fix #2696: Prevent 8-bit UID reads on STM32H5 by returning [u8; 12] v…
| -rw-r--r-- | embassy-stm32/CHANGELOG.md | 3 | ||||
| -rw-r--r-- | embassy-stm32/src/uid.rs | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md index a6ee5c4b8..7675567ff 100644 --- a/embassy-stm32/CHANGELOG.md +++ b/embassy-stm32/CHANGELOG.md | |||
| @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
| 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 7 | 7 | ||
| 8 | <!-- next-header --> | 8 | <!-- next-header --> |
| 9 | ### [Unreleased] | ||
| 10 | |||
| 11 | * **Fix(stm32h5):** Prevent a HardFault crash on STM32H5 devices by changing `uid()` to return `[u8; 12]` by value instead of a reference. (Fixes #2696) | ||
| 9 | ## Unreleased - ReleaseDate | 12 | ## Unreleased - ReleaseDate |
| 10 | 13 | ||
| 11 | - fix: Fixed STM32H5 builds requiring time feature | 14 | - fix: Fixed STM32H5 builds requiring time feature |
diff --git a/embassy-stm32/src/uid.rs b/embassy-stm32/src/uid.rs index 5e38532bd..2d3e2b972 100644 --- a/embassy-stm32/src/uid.rs +++ b/embassy-stm32/src/uid.rs | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | //! Unique ID (UID) | 1 | //! Unique ID (UID) |
| 2 | 2 | ||
| 3 | /// Get this device's unique 96-bit ID. | 3 | /// Get this device's unique 96-bit ID. |
| 4 | pub fn uid() -> &'static [u8; 12] { | 4 | pub fn uid() -> [u8; 12] { |
| 5 | unsafe { &*crate::pac::UID.uid(0).as_ptr().cast::<[u8; 12]>() } | 5 | unsafe { *crate::pac::UID.uid(0).as_ptr().cast::<[u8; 12]>() } |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | /// Get this device's unique 96-bit ID, encoded into a string of 24 hexadecimal ASCII digits. | 8 | /// Get this device's unique 96-bit ID, encoded into a string of 24 hexadecimal ASCII digits. |
