Am 2021-09-30 18:19, schrieb Frieder Schrempf:
In order to support unaligned updates, we simply read the first full
block and check only the requested part of the block for changes. If
necessary, the block is erased, the first (unchanged) part of the block
is written back together with the second part of the block (updated data).

I'm not sure what I should think of this. You might loose that unchanged
part if there is an power loss in the middle, even worse, you likely don't have this part anymore because it isn't part of the data you want to write
to the flash.

Maybe add an parameter for allow (unsafe) unaligned updates?

Now you might argue, that with "sf erase, sf write" you can do the same
harm, to which i reply: but then it is intentional ;) Because "sf erase"
just works on sector boundaries (which isn't really checked in the command,
i just realized, but at least my driver returns EINVAL) and then the
user has to include the "unchanged part" for the arguments on the
commandline.

-michael

Reply via email to