From da8612e95b93eff0720150317848694a76418151 Mon Sep 17 00:00:00 2001 From: Adam Greig Date: Wed, 22 Jan 2025 01:17:20 +0000 Subject: [PATCH] stm32: Change unreachable panic to explicit error message when accessing clock-muxed peripherals set to invalid clocks --- embassy-stm32/build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index 4abbf8d69..03d4383ac 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs @@ -532,7 +532,11 @@ fn main() { match crate::pac::RCC.#fieldset_name().read().#field_name() { #match_arms #[allow(unreachable_patterns)] - _ => unreachable!(), + _ => panic!( + "attempted to use peripheral '{}' but its clock mux is not set to a valid \ + clock. Change 'config.rcc.mux' to another clock.", + #peripheral + ) } } }