Skip to content

Commit 2d24ce8

Browse files
nvlsianpucarlescufi
authored andcommitted
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 <[email protected]>
1 parent 279115e commit 2d24ce8

File tree

1 file changed

+1
-2
lines changed
  • samples/drivers/soc_flash_nrf/src

1 file changed

+1
-2
lines changed

samples/drivers/soc_flash_nrf/src/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void main(void)
4646
}
4747

4848
printf("\nTest 1: Flash erase page at 0x%x\n", FLASH_TEST_OFFSET);
49+
flash_write_protection_set(flash_dev, false);
4950
if (flash_erase(flash_dev, FLASH_TEST_OFFSET, FLASH_PAGE_SIZE) != 0) {
5051
printf(" Flash erase failed!\n");
5152
} else {
@@ -76,7 +77,6 @@ void main(void)
7677
printf(" Data read does not match data written!\n");
7778
}
7879
}
79-
flash_write_protection_set(flash_dev, true);
8080

8181
offset = FLASH_TEST_OFFSET - FLASH_PAGE_SIZE * 2;
8282
printf("\nTest 3: Flash erase (4 pages at 0x%x)\n", offset);
@@ -110,7 +110,6 @@ void main(void)
110110
printf(" Data read does not match data written!\n");
111111
}
112112
}
113-
flash_write_protection_set(flash_dev, true);
114113

115114
printf("\nTest 5: Flash erase page at 0x%x\n", FLASH_TEST_OFFSET);
116115
if (flash_erase(flash_dev, FLASH_TEST_OFFSET, FLASH_PAGE_SIZE) != 0) {

0 commit comments

Comments
 (0)