tests/drivers/soc_flash_nrf: fix lack of disabled protection

Write protection was not disabled prior erase call.
It used to work before only because nrf driver had not check
the protection before erase execution. This behavior was changed in
order to align to zephyr - which implied requirement for this test fix.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2019-04-02 12:01:32 +02:00 committed by Carles Cufí
commit 2d24ce8565

View file

@ -46,6 +46,7 @@ void main(void)
}
printf("\nTest 1: Flash erase page at 0x%x\n", FLASH_TEST_OFFSET);
flash_write_protection_set(flash_dev, false);
if (flash_erase(flash_dev, FLASH_TEST_OFFSET, FLASH_PAGE_SIZE) != 0) {
printf(" Flash erase failed!\n");
} else {
@ -76,7 +77,6 @@ void main(void)
printf(" Data read does not match data written!\n");
}
}
flash_write_protection_set(flash_dev, true);
offset = FLASH_TEST_OFFSET - FLASH_PAGE_SIZE * 2;
printf("\nTest 3: Flash erase (4 pages at 0x%x)\n", offset);
@ -110,7 +110,6 @@ void main(void)
printf(" Data read does not match data written!\n");
}
}
flash_write_protection_set(flash_dev, true);
printf("\nTest 5: Flash erase page at 0x%x\n", FLASH_TEST_OFFSET);
if (flash_erase(flash_dev, FLASH_TEST_OFFSET, FLASH_PAGE_SIZE) != 0) {