Skip to content

Commit 5b202e4

Browse files
hakonfamcarlescufi
authored andcommitted
[nrf noup] linker: fix incorrect check
squash! [nrf noup] tree-wide: support NCS Partition Manager (PM) When both b0 (CONFIG_SECURE_BOOT) and MCUboot (CONFIG_BOOTLOADER_MCUBOOT) is enabled we need some symbols to be set correctly in the MCUboot image depending on if it is being built as a variant image or not. Specifically, if MCUboot is built as a variant image, this indicates that it will be located in the S1 slot (b0 terminology). When MCUboot is located in the S1 slot in needs to point to the slot ID of slot S0 as the primary slot for image 1. This so that any update of image 1 (which is an update of MCUboot itself) is stored in slot S0. The problem with the check was that it would not be true for the MCUboot variant image. This because CONFIG_SECURE_BOOT is only set for the top level image, and not MCUboot which is typically built as a child image. Hence, the variant build of MCUboot would not have the correct value for '_image_1_primary_slot_id' as it would point to 'PM_S1_ID' instead. This resulted in MCUboot located in S1 slot not being able to load a new MCUboot image into slot S0. Ref: NCSDK-15503 Signed-off-by: Håkon Øye Amundsen <[email protected]>
1 parent 6c08d64 commit 5b202e4

File tree

1 file changed

+1
-1
lines changed
  • include/zephyr/arch/arm/aarch32/cortex_m/scripts

1 file changed

+1
-1
lines changed

include/zephyr/arch/arm/aarch32/cortex_m/scripts/linker.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#include <pm_config.h>
3333

34-
#if CONFIG_NCS_IS_VARIANT_IMAGE && CONFIG_SECURE_BOOT
34+
#if CONFIG_NCS_IS_VARIANT_IMAGE && defined(PM_S0_ID)
3535
/* We are linking against S1, create symbol containing the flash ID of S0.
3636
* This is used when writing code operating on the "other" slot.
3737
*/

0 commit comments

Comments
 (0)