Skip to content

Commit 939c689

Browse files
BootloaderTest: Read the current flash in 130_invalid_writes
This should ensure that even when for whatever reason a full page is written, no erases happen. This serves to prevent unintended flash wear.
1 parent 34218ab commit 939c689

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

BootloaderTest/BootloaderTest.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,13 @@ test(120_write_flash) {
505505
}
506506

507507
test(130_invalid_writes) {
508-
uint8_t data[32];
508+
uint8_t data[16];
509509
uint8_t status, reason;
510+
511+
// Read the current flash contents to prevent actually writing to flash
512+
uint8_t dataout[3] = {0, 0, sizeof(data)};
513+
assertTrue(run_transaction_ok(Commands::READ_FLASH, dataout, sizeof(dataout), data, sizeof(data)));
514+
510515
// Start at 0 and skip a few bytes
511516
assertTrue(write_flash_cmd(0, data, 13, &status, &reason));
512517
assertOk(status);

0 commit comments

Comments
 (0)