Skip to content

Commit 3553663

Browse files
committed
boot: bootutil: bootutil_misc: Fix max image size for single images
Fixes wrongly including swap and trailer sizes for single image builds which reduced the maximum size of applications, these areas are not used or applicable with single image modes Signed-off-by: Jamie McCrae <[email protected]>
1 parent 15b8991 commit 3553663

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

boot/bootutil/src/bootutil_misc.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ fih_ret boot_fih_memequal(const void *s1, const void *s2, size_t n)
9999
static inline uint32_t
100100
boot_trailer_info_sz(void)
101101
{
102+
#if defined(MCUBOOT_SINGLE_APPLICATION_SLOT) || \
103+
defined(MCUBOOT_FIRMWARE_LOADER) || \
104+
defined(MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD)
105+
/* Single image MCUboot modes do not have a trailer */
106+
return 0;
107+
#else
102108
return (
103109
#ifdef MCUBOOT_ENC_IMAGES
104110
/* encryption keys */
@@ -112,6 +118,7 @@ boot_trailer_info_sz(void)
112118
BOOT_MAX_ALIGN * 4 +
113119
BOOT_MAGIC_ALIGN_SIZE
114120
);
121+
#endif
115122
}
116123

117124
/*
@@ -121,7 +128,14 @@ boot_trailer_info_sz(void)
121128
static inline uint32_t
122129
boot_status_entry_sz(uint32_t min_write_sz)
123130
{
131+
#if defined(MCUBOOT_SINGLE_APPLICATION_SLOT) || \
132+
defined(MCUBOOT_FIRMWARE_LOADER) || \
133+
defined(MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD)
134+
/* Single image MCUboot modes do not have a swap status fields */
135+
return 0;
136+
#else
124137
return BOOT_STATUS_STATE_COUNT * min_write_sz;
138+
#endif
125139
}
126140

127141
uint32_t

0 commit comments

Comments
 (0)