New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unconditional erase of trailer sector in serial recovery #1862
Comments
This is expected, the MCUboot swap status goes there. An MCUboot image should be your whole image i.e. the hex/bin file, which then goes through imgtool to add the MCUboot header and footer, at this point that is the final image that cannot be changed, you cannot append data to the end of it. If you want to do that, you need to edit the hex/bin file before it is passed to imgtool |
By image data I did not mean any modifications to the binary after imgtool, just the normal binary. Let's say the image slot is 896 KiB with flash sectors of 128KiB. I observe that if the signed binary is larger than 768KiB, after upload this last sector is erased. Since it would have data/tlvs, the image is invalid. The same binary is working fine if flashed via debugger or uploaded without |
This is incorrect, there is the TLVs which are part of the image, they do not go in a new sector. There is a new sector(s) which is/are used for the swap status, this should be visible on https://docs.mcuboot.com/design.html but the website is down at present for some reason |
Not a new sector, but in the last sector of the slot due to the size of the binary requiring it.
But is it exclusively for swap status? The design page only mentions
I was under the impression that it needs space for swap information, but this is controlled by |
That Kconfig is the maximum number of sectors that will be searched and are supported (i.e. controls how large the swap field size will be), the size is limited by the partition size, so you can set that Kconfig to 5000 but with a 4KiB sector size and only 20 sectors in the partition, the 5000 value will just waste flash space, it will never go beyond 80KiB. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
With MCUBoot in serial recovery, and with
MCUBOOT_ERASE_PROGRESSIVELY
, it seems that the last flash sector is unconditionally erased after the full image is received, causing the slot to be invalid if there was image data in that sector.In this section from
boot_serial.c
The comment appears to indicate that it should check if the sector was already erased, but no such check is done.
Is this unintended, or does this mean that the last sector cannot have image data? I'm using a swap with scratch configuration.
The text was updated successfully, but these errors were encountered: