Attention is currently required from: Nico Huber, Edward O'Callaghan, Anastasia Klimchuk.
9 comments:
File tests/chip.c:
/*
* Populate buf with the value used for erase operation, this allows to pass
* verification checks and also emulates successful erase.
*/
buf = memset(buf, 0xff, len);
should this memset happen instead in the block erase fn and use a singleton state here to see if tha […]
+1. Doing the erases in `block_erase_chip()` accounting for the `blockaddr` and `blocklen` parameters is much more robust. This would also allow testing partial block updates, e.g. smallest erase block size is 2 KiB, but the boundary between two contiguous regions isn't aligned to at least 2 KiB, and only one of the regions is included.
Hmmm, but doesn't dummyflasher already emulate flash chips? Why not use them, then?
Patch Set #1, Line 42: printf("Unlock chip called\n");
The singleton state could also be queried with a counter to ensure a double unlock isn't done?
Even better would be to prevent erases/writes if the chip hasn't been unlocked.
Patch Set #1, Line 57: char *param_dup = strdup("");
The second parameter of `programmer_init()` is of `const char *` type. You don't need `strdup()`, just use a string literal:
const char *param = "";
Patch Set #1, Line 60: "aklm"
😜
/*
* Total size less than 16 * 1024 to skip some steps
* in flashrom.c#prepare_flash_access.
*/
Is skipping these steps an issue, though? `spi_master_no_4ba_modes()` can only return true for SPI programmers with the `SPI_MASTER_NO_4BA_MODES` flag. Currently, only Dediprog sets this flag.
Patch Set #1, Line 73: {2 * 1024, 3}
Huh? This is just three blocks of 2 KiB each. The flash chip size is 8 MiB (`total_size` is in KiB).
If you emulate the flash chip contents for the test (zero-initialise the buffer and erase the blocks in `block_erase_chip`), you should see that verification fails.
Patch Set #1, Line 86: 0x00002000
chip->total_size * KiB
Patch Set #1, Line 86: 0x00000000
0
Patch Set #1, Line 114: free(param_dup);
If using a string literal on line 57, this must be removed.
To view, visit change 56501. To unsubscribe, or for help writing mail filters, visit settings.