aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/flash
diff options
context:
space:
mode:
authorDion Dokter <[email protected]>2025-04-29 16:34:12 +0200
committerDion Dokter <[email protected]>2025-04-29 16:34:12 +0200
commitb967aaf7cc90e1e8810f24968ba137141b0c35ec (patch)
treebc89aff328f195778bb3af82b61e685c6ac97b83 /embassy-stm32/src/flash
parenta41c83d1824a42bd68bb4d2f01500d06d25b0118 (diff)
Add support for g0
Diffstat (limited to 'embassy-stm32/src/flash')
-rw-r--r--embassy-stm32/src/flash/g.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/embassy-stm32/src/flash/g.rs b/embassy-stm32/src/flash/g.rs
index f55c5e6a7..70e472dcf 100644
--- a/embassy-stm32/src/flash/g.rs
+++ b/embassy-stm32/src/flash/g.rs
@@ -110,7 +110,7 @@ fn wait_busy() {
110 while pac::FLASH.sr().read().bsy() {} 110 while pac::FLASH.sr().read().bsy() {}
111} 111}
112 112
113#[cfg(bank_setup_configurable)] 113#[cfg(all(bank_setup_configurable, any(flash_g4c2, flash_g4c3, flash_g4c4)))]
114pub(crate) fn check_bank_setup() { 114pub(crate) fn check_bank_setup() {
115 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() { 115 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() {
116 panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use dual-bank config"); 116 panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use dual-bank config");
@@ -119,3 +119,13 @@ pub(crate) fn check_bank_setup() {
119 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"); 119 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");
120 } 120 }
121} 121}
122
123#[cfg(all(bank_setup_configurable, flash_g0x1))]
124pub(crate) fn check_bank_setup() {
125 if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dual_bank() {
126 panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dual_bank value in the user option bytes or configure embassy to use dual-bank config");
127 }
128 if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dual_bank() {
129 panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dual_bank value in the user option bytes or configure embassy to use single-bank config");
130 }
131}