From 2f31d7da537c754f3b1ba7b9533d1c42269721c5 Mon Sep 17 00:00:00 2001 From: Angelina-2007 <24uam107angelina@kgkite.ac.in> Date: Thu, 9 Oct 2025 18:51:15 -0700 Subject: Fix #2696: Prevent 8-bit UID reads on STM32H5 by returning [u8; 12] value --- embassy-stm32/src/uid.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 @@ //! Unique ID (UID) /// Get this device's unique 96-bit ID. -pub fn uid() -> &'static [u8; 12] { - unsafe { &*crate::pac::UID.uid(0).as_ptr().cast::<[u8; 12]>() } +pub fn uid() -> [u8; 12] { + unsafe { *crate::pac::UID.uid(0).as_ptr().cast::<[u8; 12]>() } } /// Get this device's unique 96-bit ID, encoded into a string of 24 hexadecimal ASCII digits. -- cgit From 94c2cc9eba3b1840063ea11a62e2eb27442bbe16 Mon Sep 17 00:00:00 2001 From: Angelina-2007 <24uam107angelina@kgkite.ac.in> Date: Thu, 9 Oct 2025 20:21:41 -0700 Subject: ci: Add changelog entry for STM32H5 UID fix --- embassy-stm32/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) 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/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [Unreleased] + +* **Fix(stm32h5):** Prevent a HardFault crash on STM32H5 devices by changing `uid()` to return `[u8; 12]` by value instead of a reference. (Fixes #2696) ## Unreleased - ReleaseDate - fix: Fixed STM32H5 builds requiring time feature -- cgit