sim: Avoid assuming trailer is sector-aligned for swap-scratch + max-align-32
When testing the swap-scratch upgrade strategy with 32-byte flash write
size, the largest image size was computed assuming the trailer starts at
the beginning of a sector. This assumption is not mentionned in the
MCUboot's user documentation and a user would therefore expect that
swap-scratch is working even if a sector contains both firmware and
trailer data.
Also, this assumption is not made for flash write sizes lower than 32
bytes. This is probably due to the fact that when 'max-align-32' is not
selected, the trailer fits into a single sector for all tested
configuration. However, when 'max-align-32' is enabled, the trailer is
larger than a single sector in some tested configurations, which makes
harder to compute the maximal image size since the size of the trailer
in the scratch area has to be taken into account.
This commit modifies in the simulator the routine computing the size
that must be reserved for the trailer to properly handle the case of
trailers too large to fit into a single sector. Unfortunately, this
reveals that the swap-scratch implementation doesn't properly handle
this case, which will be fixed in the following commits.
Signed-off-by:
Thomas Altenbach <thomas.altenbach@legrand.com>
Loading
Please sign in to comment