Fix end address for assertion
This commit is contained in:
		
							parent
							
								
									41a632a56c
								
							
						
					
					
						commit
						88543445d8
					
				@ -91,7 +91,7 @@ pub(super) fn blocking_read(base: u32, size: u32, offset: u32, bytes: &mut [u8])
 | 
				
			|||||||
    let start_address = base + offset;
 | 
					    let start_address = base + offset;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #[cfg(flash_f4)]
 | 
					    #[cfg(flash_f4)]
 | 
				
			||||||
    family::assert_not_corrupted_read(start_address + bytes.len());
 | 
					    family::assert_not_corrupted_read(start_address + bytes.len() as u32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let flash_data = unsafe { core::slice::from_raw_parts(start_address as *const u8, bytes.len()) };
 | 
					    let flash_data = unsafe { core::slice::from_raw_parts(start_address as *const u8, bytes.len()) };
 | 
				
			||||||
    bytes.copy_from_slice(flash_data);
 | 
					    bytes.copy_from_slice(flash_data);
 | 
				
			||||||
 | 
				
			|||||||
@ -443,7 +443,7 @@ pub(crate) fn assert_not_corrupted_read(end_address: u32) {
 | 
				
			|||||||
    const REVISION_3: u16 = 0x2001;
 | 
					    const REVISION_3: u16 = 0x2001;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #[allow(unused)]
 | 
					    #[allow(unused)]
 | 
				
			||||||
    let second_bank_read = get_flash_regions().last().unwrap().bank == FlashBank::Bank2 && end_address > FLASH_SIZE / 2;
 | 
					    let second_bank_read = get_flash_regions().last().unwrap().bank == FlashBank::Bank2 && end_address > (FLASH_SIZE / 2) as u32;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #[cfg(any(
 | 
					    #[cfg(any(
 | 
				
			||||||
        feature = "stm32f427ai",
 | 
					        feature = "stm32f427ai",
 | 
				
			||||||
@ -491,7 +491,7 @@ pub(crate) fn assert_not_corrupted_read(end_address: u32) {
 | 
				
			|||||||
        feature = "stm32f439vg",
 | 
					        feature = "stm32f439vg",
 | 
				
			||||||
        feature = "stm32f439zg",
 | 
					        feature = "stm32f439zg",
 | 
				
			||||||
    ))]
 | 
					    ))]
 | 
				
			||||||
    if second_bank_read && unsafe { &&pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() }
 | 
					    if second_bank_read && unsafe { pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() }
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        panic!("Read corruption for stm32f42xxG and stm32f43xxG in dual bank mode when PA12 is in use for chips below revision 3, see errata 2.2.11");
 | 
					        panic!("Read corruption for stm32f42xxG and stm32f43xxG in dual bank mode when PA12 is in use for chips below revision 3, see errata 2.2.11");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user