aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Storah <[email protected]>2025-07-23 15:52:36 +1000
committerChris Storah <[email protected]>2025-07-23 15:52:36 +1000
commit487b42f62cd11292d421831a8943de01b2b25a39 (patch)
tree400b77a39d332a811809c6a7610816e33c351092
parent88e1d61654b44dc90fe26135cdbb37b3f2a296f4 (diff)
Added missing guard for hsi48. Updated use of removed enums from stm32-data u5 chip
-rw-r--r--embassy-stm32/src/flash/u5.rs22
-rw-r--r--embassy-stm32/src/rcc/c0.rs1
2 files changed, 12 insertions, 11 deletions
diff --git a/embassy-stm32/src/flash/u5.rs b/embassy-stm32/src/flash/u5.rs
index 131caa195..2d06fdc67 100644
--- a/embassy-stm32/src/flash/u5.rs
+++ b/embassy-stm32/src/flash/u5.rs
@@ -30,19 +30,19 @@ pub(crate) unsafe fn enable_blocking_write() {
30 30
31 #[cfg(feature = "trustzone-secure")] 31 #[cfg(feature = "trustzone-secure")]
32 pac::FLASH.seccr().write(|w| { 32 pac::FLASH.seccr().write(|w| {
33 w.set_pg(pac::flash::vals::SeccrPg::B_0X1); 33 w.set_pg(true);
34 }); 34 });
35 #[cfg(not(feature = "trustzone-secure"))] 35 #[cfg(not(feature = "trustzone-secure"))]
36 pac::FLASH.nscr().write(|w| { 36 pac::FLASH.nscr().write(|w| {
37 w.set_pg(pac::flash::vals::NscrPg::B_0X1); 37 w.set_pg(true);
38 }); 38 });
39} 39}
40 40
41pub(crate) unsafe fn disable_blocking_write() { 41pub(crate) unsafe fn disable_blocking_write() {
42 #[cfg(feature = "trustzone-secure")] 42 #[cfg(feature = "trustzone-secure")]
43 pac::FLASH.seccr().write(|w| w.set_pg(pac::flash::vals::SeccrPg::B_0X0)); 43 pac::FLASH.seccr().write(|w| w.set_pg(false));
44 #[cfg(not(feature = "trustzone-secure"))] 44 #[cfg(not(feature = "trustzone-secure"))]
45 pac::FLASH.nscr().write(|w| w.set_pg(pac::flash::vals::NscrPg::B_0X0)); 45 pac::FLASH.nscr().write(|w| w.set_pg(false));
46} 46}
47 47
48pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> { 48pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> {
@@ -65,19 +65,19 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E
65 w.set_pnb(sector.index_in_bank); 65 w.set_pnb(sector.index_in_bank);
66 // TODO: add check for bank swap 66 // TODO: add check for bank swap
67 w.set_bker(match sector.bank { 67 w.set_bker(match sector.bank {
68 FlashBank::Bank1 => pac::flash::vals::SeccrBker::B_0X0, 68 FlashBank::Bank1 => false,
69 FlashBank::Bank2 => pac::flash::vals::SeccrBker::B_0X1, 69 FlashBank::Bank2 => true,
70 _ => unreachable!(), 70 _ => unreachable!(),
71 }); 71 });
72 }); 72 });
73 #[cfg(not(feature = "trustzone-secure"))] 73 #[cfg(not(feature = "trustzone-secure"))]
74 pac::FLASH.nscr().modify(|w| { 74 pac::FLASH.nscr().modify(|w| {
75 w.set_per(pac::flash::vals::NscrPer::B_0X1); 75 w.set_per(true);
76 w.set_pnb(sector.index_in_bank); 76 w.set_pnb(sector.index_in_bank);
77 // TODO: add check for bank swap 77 // TODO: add check for bank swap
78 w.set_bker(match sector.bank { 78 w.set_bker(match sector.bank {
79 FlashBank::Bank1 => pac::flash::vals::NscrBker::B_0X0, 79 FlashBank::Bank1 => false,
80 FlashBank::Bank2 => pac::flash::vals::NscrBker::B_0X1, 80 FlashBank::Bank2 => true,
81 _ => unreachable!(), 81 _ => unreachable!(),
82 }); 82 });
83 }); 83 });
@@ -95,11 +95,11 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E
95 #[cfg(feature = "trustzone-secure")] 95 #[cfg(feature = "trustzone-secure")]
96 pac::FLASH 96 pac::FLASH
97 .seccr() 97 .seccr()
98 .modify(|w| w.set_per(pac::flash::vals::SeccrPer::B_0X0)); 98 .modify(|w| w.set_per(false));
99 #[cfg(not(feature = "trustzone-secure"))] 99 #[cfg(not(feature = "trustzone-secure"))]
100 pac::FLASH 100 pac::FLASH
101 .nscr() 101 .nscr()
102 .modify(|w| w.set_per(pac::flash::vals::NscrPer::B_0X0)); 102 .modify(|w| w.set_per(false));
103 clear_all_err(); 103 clear_all_err();
104 ret 104 ret
105} 105}
diff --git a/embassy-stm32/src/rcc/c0.rs b/embassy-stm32/src/rcc/c0.rs
index 763f1b19c..c2295bab6 100644
--- a/embassy-stm32/src/rcc/c0.rs
+++ b/embassy-stm32/src/rcc/c0.rs
@@ -190,6 +190,7 @@ pub(crate) unsafe fn init(config: Config) {
190 // TODO 190 // TODO
191 lsi: None, 191 lsi: None,
192 lse: None, 192 lse: None,
193 #[cfg(crs)]
193 hsi48: None, 194 hsi48: None,
194 ); 195 );
195 196