From 34a4dddfe79e55057c2ce87ee60b1c6b93c5ac76 Mon Sep 17 00:00:00 2001 From: Dion Dokter Date: Tue, 29 Apr 2025 17:05:07 +0200 Subject: [PATCH] Add L4+ support --- embassy-stm32/src/flash/l.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/embassy-stm32/src/flash/l.rs b/embassy-stm32/src/flash/l.rs index bc6f8c873..3b62fa2ee 100644 --- a/embassy-stm32/src/flash/l.rs +++ b/embassy-stm32/src/flash/l.rs @@ -248,3 +248,13 @@ pub(crate) fn check_bank_setup() { panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use single-bank config"); } } + +#[cfg(all(bank_setup_configurable, flash_l4))] +pub(crate) fn check_bank_setup() { + if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dualbank() { + panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dualbank value in the user option bytes or configure embassy to use dual-bank config"); + } + if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dualbank() { + panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dualbank value in the user option bytes or configure embassy to use single-bank config"); + } +}