Skip to content

Commit 1d93c0c

Browse files
committed
[nrf noup] Make fprotect area span only MCUBoot
nrf-squash! [nrf noup] treewide: add NCS partition manager support This commit changes the fprotect area size definition. This is necessary, as if TFM is used, tfm_storage is placed between mcuboot and the application. The old implementation led to the protected fprotect area including both MCUBoot and tfm_storage. This was unnecessary and in case of nRF54L15 (where the maximum FPROTECT area is small) not being able to use FPROTECT in case TF-M was used. Signed-off-by: Artur Hadasz <[email protected]>
1 parent 3839107 commit 1d93c0c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

boot/zephyr/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,11 +905,15 @@ int main(void)
905905

906906
#ifdef PM_S1_ADDRESS
907907
/* MCUBoot is stored in either S0 or S1, protect both */
908-
#define PROTECT_SIZE (PM_MCUBOOT_PRIMARY_ADDRESS - PM_S0_ADDRESS)
908+
#define PROTECT_SIZE (PM_S1_ADDRESS + PM_S1_SIZE - PM_S0_ADDRESS)
909+
#define PROTECT_ADDR PM_S0_ADDRESS
910+
#elif defined(PM_S0_ADDRESS)
911+
/* There is only one instance of MCUBoot */
912+
#define PROTECT_SIZE PM_S0_SIZE
909913
#define PROTECT_ADDR PM_S0_ADDRESS
910914
#else
911915
/* There is only one instance of MCUBoot */
912-
#define PROTECT_SIZE (PM_MCUBOOT_PRIMARY_ADDRESS - PM_MCUBOOT_ADDRESS)
916+
#define PROTECT_SIZE PM_MCUBOOT_SIZE
913917
#define PROTECT_ADDR PM_MCUBOOT_ADDRESS
914918
#endif
915919

boot/zephyr/pm.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ mcuboot:
44
size: CONFIG_PM_PARTITION_SIZE_MCUBOOT
55
placement:
66
before: [mcuboot_primary]
7+
#if defined(CONFIG_FPROTECT)
8+
align: {end: CONFIG_FPROTECT_BLOCK_SIZE}
9+
#else
710
align: {end: 0x1000}
11+
#endif
812

913
mcuboot_primary_app:
1014
# All images to be placed in MCUboot's slot 0 should be placed in this

0 commit comments

Comments
 (0)