Skip to content

Commit feb1023

Browse files
committed
test_program_read_small_data_sizes: get erase size specific to the sector we use
The test case only uses one specific sector, but the erase size is obtained for the whole block device instead. This doesn't work if different regions of the flash don't have a common erase size. Fix the issue by getting the erase size at the address we use.
1 parent 54f0f56 commit feb1023

File tree

1 file changed

+1
-1
lines changed
  • storage/blockdevice/tests/TESTS/blockdevice/general_block_device

1 file changed

+1
-1
lines changed

storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,6 @@ void test_program_read_small_data_sizes()
584584

585585
TEST_SKIP_UNLESS_MESSAGE(block_device != NULL, "no block device found.");
586586

587-
bd_size_t erase_size = block_device->get_erase_size();
588587
bd_size_t program_size = block_device->get_program_size();
589588
bd_size_t read_size = block_device->get_read_size();
590589
TEST_ASSERT(program_size > 0);
@@ -606,6 +605,7 @@ void test_program_read_small_data_sizes()
606605

607606
// Determine starting address
608607
bd_addr_t start_address = 0;
608+
bd_size_t erase_size = block_device->get_erase_size(start_address);
609609

610610
for (int i = 1; i <= 7; i++) {
611611
err = buff_block_device->erase(start_address, erase_size);

0 commit comments

Comments
 (0)