trunks_send: make sure update addresses increase monotonously

A recent Cr50 firmware change rejects attempts to write into the flash
at addresses which are below any address which was written in the last

This presents a problem on devices which run RO_A and RW_B: the
updater sends the RO first (which is RW_B), and then tries to send
RW_A, but the base address of RW_A is below the address range of RO_B,
so the RW portion of the update is rejected.

The solution is to send the section with the lower addresses first,
which is accomplished by this patch.

TEST=verified successful updates with various combinations of
     currently active RO and RW sections.

Change-Id: Iadc6c35e6fbbb1ca1d707a1fc17ab5d041773032
Signed-off-by: Vadim Bendebury <>
Reviewed-by: Nicolas Boichat <>
1 file changed