Skip to content

Commit e203ccb

Browse files
michalek-norlubos
authored andcommitted
[nrf noup] boot: zephyr: sysflash: fprotect size roundup
adds FPROTECT_ALIGN_UP to FPROTECT_REGION_SIZE calculation Signed-off-by: Mateusz Michalek <mateusz.michalek@nordicsemi.no> (cherry picked from commit 65ada4b)
1 parent 8ecf029 commit e203ccb

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

boot/zephyr/include/sysflash/pm_sysflash.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ static inline uint32_t __flash_area_ids_for_slot(int img, int slot)
151151
*/
152152
#ifdef CONFIG_FPROTECT
153153
#define FPROTECT_REGION_OFFSET (PM_S0_ADDRESS)
154-
#define FPROTECT_REGION_SIZE (PM_MCUBOOT_PRIMARY_ADDRESS - FPROTECT_REGION_OFFSET)
154+
#define FPROTECT_REGION_SIZE \
155+
FPROTECT_ALIGN_UP(PM_MCUBOOT_PRIMARY_ADDRESS - FPROTECT_REGION_OFFSET)
155156
#endif
156157

157158
/* RWX protection regions: the currently executing MCUboot is protecting itself */

boot/zephyr/include/sysflash/sysflash.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@
110110
#ifdef CONFIG_FPROTECT
111111
#define FPROTECT_REGION_OFFSET PARTITION_OFFSET(s0_partition)
112112
#define FPROTECT_REGION_SIZE \
113-
(PARTITION_SIZE(s0_partition) + PARTITION_SIZE(s1_partition))
113+
FPROTECT_ALIGN_UP(PARTITION_SIZE(s0_partition) + \
114+
PARTITION_SIZE(s1_partition))
114115
#endif
115116

116117
/* RWX protection regions: the currently executing MCUboot is protecting itself */
@@ -184,7 +185,7 @@ static inline uint32_t __flash_area_ids_for_slot(int img, int slot)
184185
/* Protecting MCUboot partition */
185186
#ifdef CONFIG_FPROTECT
186187
#define FPROTECT_REGION_OFFSET PARTITION_OFFSET(boot_partition)
187-
#define FPROTECT_REGION_SIZE PARTITION_SIZE(boot_partition)
188+
#define FPROTECT_REGION_SIZE FPROTECT_ALIGN_UP(PARTITION_SIZE(boot_partition))
188189
#endif
189190

190191
/* RWX protection regions, MCUboot is protecting itself */

0 commit comments

Comments
 (0)