Skip to content

Commit 30ef7f9

Browse files
nordicjmrlubos
authored andcommitted
[nrf noup] boot: bootutil: Add support for NSIB maximum image size
nrf-squash! [nrf noup] treewide: Add support for sysbuild assigned images Adds support for getting the maximum allowable image size for NSIB Signed-off-by: Jamie McCrae <[email protected]>
1 parent fa17bc9 commit 30ef7f9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

boot/bootutil/src/bootutil_misc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,18 @@ get_first_trailer_sector_end_off(struct boot_loader_state *state, size_t slot, s
457457

458458
uint32_t bootutil_max_image_size(struct boot_loader_state *state, const struct flash_area *fap)
459459
{
460+
#if CONFIG_MCUBOOT_MCUBOOT_IMAGE_NUMBER != -1
461+
if (BOOT_CURR_IMG(state) == CONFIG_MCUBOOT_MCUBOOT_IMAGE_NUMBER) {
462+
/* NSIB is a direct upgrade without any status or trailer, get the full size of the
463+
* primary slot.
464+
*/
465+
const struct flash_area *fap_nsib = BOOT_IMG_AREA(state, 0);
466+
assert(fap_nsib != NULL);
467+
468+
return flash_area_get_size(fap_nsib);
469+
}
470+
#endif /* CONFIG_MCUBOOT_MCUBOOT_IMAGE_NUMBER != -1 */
471+
460472
#if defined(MCUBOOT_SINGLE_APPLICATION_SLOT) || \
461473
defined(MCUBOOT_FIRMWARE_LOADER) || \
462474
defined(MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD)

0 commit comments

Comments
 (0)