mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			TESTS: flashiap: Add condition to check error on unaligned access
In case the target supports a page size of 1 byte, i.e. is able to program flash 1 byte at a time, which is the case of STM32 F4 targets, there is no reason for flash_device.program to return an error when trying to write on an "unaligned" address.pull/4980/head
							parent
							
								
									a9468c09e3
								
							
						
					
					
						commit
						be7fa925ad
					
				| 
						 | 
				
			
			@ -106,12 +106,16 @@ void flashiap_program_error_test()
 | 
			
		|||
    // unaligned address
 | 
			
		||||
    ret = flash_device.erase(address + 1, sector_size);
 | 
			
		||||
    TEST_ASSERT_EQUAL_INT32(-1, ret);
 | 
			
		||||
    ret = flash_device.program(data, address + 1, page_size);
 | 
			
		||||
    TEST_ASSERT_EQUAL_INT32(-1, ret);
 | 
			
		||||
    if (flash_device.get_page_size() > 1) {
 | 
			
		||||
        ret = flash_device.program(data, address + 1, page_size);
 | 
			
		||||
        TEST_ASSERT_EQUAL_INT32(-1, ret);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // unaligned page size
 | 
			
		||||
    ret = flash_device.program(data, address, page_size + 1);
 | 
			
		||||
    TEST_ASSERT_EQUAL_INT32(-1, ret);
 | 
			
		||||
    if (flash_device.get_page_size() > 1) {
 | 
			
		||||
        // unaligned page size
 | 
			
		||||
        ret = flash_device.program(data, address, page_size + 1);
 | 
			
		||||
        TEST_ASSERT_EQUAL_INT32(-1, ret);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    delete[] data;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue