Doloscmd: Optimize EEPROM writes

Optimize the EEPROM writes by identifying the delta between the
current and desired flash state. We identify the segments where
deltas are present and consolidate these into chunks 16B long.

This reduces the total number of write transactions needed from 64
to around a dozen and allows it to be 2 if a single register is
updated.

BUG=b:392957164
TEST=pytest
TEST=dolos_program_cable utility

Change-Id: Ia17837a8bce72749d6b40184d9f7c1010e21f68e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dolos/+/6349697
Auto-Submit: Brian Nemec <bnemec@google.com>
Tested-by: Brian Nemec <bnemec@google.com>
Reviewed-by: Keith Haddow <haddowk@chromium.org>
Commit-Queue: Keith Haddow <haddowk@chromium.org>
3 files changed