mcu-tools / mcuboot

Secure boot for 32-bit Microcontrollers!
Apache License 2.0
1.32k stars 668 forks source link

Sector sizes of primary/secodary are not checked #1716

Closed maxd-nordic closed 10 months ago

maxd-nordic commented 1 year ago

Context: I develop for NCS/Zephyr.

AFAICT the swap_move implementation doesn't check if the sector sizes are the same and just uses the sector size of the primary partition. I had to set CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 because the external flash pages would be 64KB by default. This should at least cause a build warning.

nordicjm commented 1 year ago

The problem is that this can't be checked at build time and would need to checked at run time, which means additional code for everyone's builds of mcuboot to check for an issue that they probably won't have. If the flash page sizes were available for all flash drivers in dts then this could be used, but with things like SFDP it would be calculated at runtime.

d3zd3z commented 1 year ago

The problem is that this can't be checked at build time and would need to checked at run time, which means additional code for everyone's builds of mcuboot to check for an issue that they probably won't have.

I'm not sure that a simple check is too much additional code to justify not checking for it, especially if people do run into this very issue. Even better would be improvements to the code to make it automatically handle using the larger sector size.

de-nordic commented 1 year ago

That is rather Zephyr flash issue than MCUboot. The Kconfig is not used in MCUboot directly.

github-actions[bot] commented 10 months ago

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.