Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions boot/bootutil/zephyr/src/boot_request_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

#include "bootutil/bootutil_log.h"

#define MAIN_FLASH_DEV FIXED_PARTITION_NODE_DEVICE(DT_CHOSEN(nrf_bootloader_request))
#define MAIN_OFFSET FIXED_PARTITION_NODE_OFFSET(DT_CHOSEN(nrf_bootloader_request))
#define MAIN_SIZE FIXED_PARTITION_NODE_SIZE(DT_CHOSEN(nrf_bootloader_request))
#define MAIN_FLASH_DEV PARTITION_NODE_DEVICE(DT_CHOSEN(nrf_bootloader_request))
#define MAIN_OFFSET PARTITION_NODE_OFFSET(DT_CHOSEN(nrf_bootloader_request))
#define MAIN_SIZE PARTITION_NODE_SIZE(DT_CHOSEN(nrf_bootloader_request))

#ifdef CONFIG_NRF_MCUBOOT_BOOT_REQUEST_PREFERENCE_KEEP
#define BACKUP_FLASH_DEV FIXED_PARTITION_NODE_DEVICE(DT_CHOSEN(nrf_bootloader_request_backup))
#define BACKUP_OFFSET FIXED_PARTITION_NODE_OFFSET(DT_CHOSEN(nrf_bootloader_request_backup))
#define BACKUP_SIZE FIXED_PARTITION_NODE_SIZE(DT_CHOSEN(nrf_bootloader_request_backup))
#define BACKUP_FLASH_DEV PARTITION_NODE_DEVICE(DT_CHOSEN(nrf_bootloader_request_backup))
#define BACKUP_OFFSET PARTITION_NODE_OFFSET(DT_CHOSEN(nrf_bootloader_request_backup))
#define BACKUP_SIZE PARTITION_NODE_SIZE(DT_CHOSEN(nrf_bootloader_request_backup))
#endif /* CONFIG_NRF_MCUBOOT_BOOT_REQUEST_PREFERENCE_KEEP */

#define BOOT_REQUEST_CHECKSUM_SIZE sizeof(uint32_t)
Expand Down
6 changes: 3 additions & 3 deletions boot/zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ if(CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 OR CONFIG_BOOT_ENCRYPT_EC256)
zephyr_include_directories(${BL_CRYPTO_DIR}/../include)
endif()

if(CONFIG_MBEDTLS_CFG_FILE)
if(CONFIG_MBEDTLS_CONFIG_FILE)
# Since here we are not using Zephyr's mbedTLS but rather our own, we need
# to set MBEDTLS_CONFIG_FILE ourselves. When using Zephyr's copy, this
# variable is set by its Kconfig in the Zephyr codebase.
zephyr_library_compile_definitions(
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CONFIG_FILE}"
)
endif()
elseif(CONFIG_BOOT_SIGNATURE_TYPE_NONE)
Expand Down Expand Up @@ -323,7 +323,7 @@ elseif(CONFIG_BOOT_SIGNATURE_TYPE_ED25519 OR CONFIG_BOOT_ENCRYPT_X25519)
${TINYCRYPT_SHA512_DIR}/source/sha512.c
)
zephyr_library_compile_definitions(
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CONFIG_FILE}"
)
else()
zephyr_include_directories(include)
Expand Down
5 changes: 3 additions & 2 deletions boot/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ config BOOT_SIGNATURE_TYPE_RSA
select BOOT_USE_MBEDTLS
select MBEDTLS
select MBEDTLS_ASN1_PARSE_C if MBEDTLS_BUILTIN
select MBEDTLS_MD if MBEDTLS_BUILTIN
select MBEDTLS_MD_C if MBEDTLS_BUILTIN
select MBEDTLS_SHA256 if MBEDTLS_BUILTIN
select MBEDTLS_RSA_C if MBEDTLS_BUILTIN
select MBEDTLS_PKCS1_V15 if MBEDTLS_BUILTIN
select MBEDTLS_PKCS1_V21 if MBEDTLS_BUILTIN
Expand Down Expand Up @@ -566,7 +567,7 @@ config MBEDTLS
config NRF_SECURITY
select MBEDTLS_PROMPTLESS

config MBEDTLS_CFG_FILE
config MBEDTLS_CONFIG_FILE
# It might be awkward to define an Mbed TLS header file when TinyCrypt
# is used, but the fact is that Mbed TLS' ASN1 parse module is used
# also when TinyCrypt is used as crypto backend.
Expand Down
2 changes: 1 addition & 1 deletion boot/zephyr/boards/thingy53_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CONFIG_SYSTEM_CLOCK_NO_WAIT=y
CONFIG_PM=n

CONFIG_MAIN_STACK_SIZE=10240
CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"
CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h"

CONFIG_BOOT_MAX_IMG_SECTORS=2048
CONFIG_BOOT_SIGNATURE_TYPE_RSA=y
Expand Down
2 changes: 1 addition & 1 deletion boot/zephyr/boot_serial_extension_zephyr_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static int bs_custom_storage_erase(const struct nmgr_hdr *hdr,
return MGMT_ERR_ENOTSUP;
}

rc = flash_area_open(FIXED_PARTITION_ID(storage_partition), &fa);
rc = flash_area_open(PARTITION_ID(storage_partition), &fa);

if (rc < 0) {
BOOT_LOG_ERR("failed to open flash area");
Expand Down
4 changes: 2 additions & 2 deletions boot/zephyr/firmware_loader_bm.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ BOOT_LOG_MODULE_DECLARE(mcuboot);

static struct flash_area fa_app_installer = {
.fa_id = 1,
.fa_off = FIXED_PARTITION_OFFSET(slot0_partition),
.fa_size = FIXED_PARTITION_SIZE(slot0_partition),
.fa_off = PARTITION_OFFSET(slot0_partition),
.fa_size = PARTITION_SIZE(slot0_partition),
.fa_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller)),
};

Expand Down
22 changes: 11 additions & 11 deletions boot/zephyr/flash_map_extended.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,26 @@ int flash_area_id_from_direct_image(int image_id)
switch (image_id) {
case 0:
case 1:
return FIXED_PARTITION_ID(slot0_partition);
#if FIXED_PARTITION_EXISTS(slot1_partition)
return PARTITION_ID(slot0_partition);
#if PARTITION_EXISTS(slot1_partition)
case 2:
return FIXED_PARTITION_ID(slot1_partition);
return PARTITION_ID(slot1_partition);
#endif
#if FIXED_PARTITION_EXISTS(slot2_partition)
#if PARTITION_EXISTS(slot2_partition)
case 3:
return FIXED_PARTITION_ID(slot2_partition);
return PARTITION_ID(slot2_partition);
#endif
#if FIXED_PARTITION_EXISTS(slot3_partition)
#if PARTITION_EXISTS(slot3_partition)
case 4:
return FIXED_PARTITION_ID(slot3_partition);
return PARTITION_ID(slot3_partition);
#endif
#if FIXED_PARTITION_EXISTS(slot4_partition)
#if PARTITION_EXISTS(slot4_partition)
case 5:
return FIXED_PARTITION_ID(slot4_partition);
return PARTITION_ID(slot4_partition);
#endif
#if FIXED_PARTITION_EXISTS(slot5_partition)
#if PARTITION_EXISTS(slot5_partition)
case 6:
return FIXED_PARTITION_ID(slot5_partition);
return PARTITION_ID(slot5_partition);
#endif
}
return -EINVAL;
Expand Down
38 changes: 19 additions & 19 deletions boot/zephyr/include/sysflash/sysflash.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,31 @@
#define PROTECTED_REGION_START_SKIP CONFIG_NCS_MCUBOOT_DISABLE_SELF_RWX_SKIP_SIZE

#define SECOND_STAGE_ACTIVE_MCUBOOT_OFFSET \
FIXED_PARTITION_OFFSET(SECOND_STAGE_ACTIVE_PARTITION)
PARTITION_OFFSET(SECOND_STAGE_ACTIVE_PARTITION)

#define SECOND_STAGE_ACTIVE_MCUBOOT_SIZE \
FIXED_PARTITION_SIZE(SECOND_STAGE_ACTIVE_PARTITION)
PARTITION_SIZE(SECOND_STAGE_ACTIVE_PARTITION)

#define SECOND_STAGE_ACTIVE_MCUBOOT_ID \
FIXED_PARTITION_ID(SECOND_STAGE_ACTIVE_PARTITION)
PARTITION_ID(SECOND_STAGE_ACTIVE_PARTITION)

#define SECOND_STAGE_INACTIVE_MCUBOOT_OFFSET \
FIXED_PARTITION_OFFSET(SECOND_STAGE_INACTIVE_PARTITION)
PARTITION_OFFSET(SECOND_STAGE_INACTIVE_PARTITION)

#define SECOND_STAGE_INACTIVE_MCUBOOT_SIZE \
FIXED_PARTITION_SIZE(SECOND_STAGE_INACTIVE_PARTITION)
PARTITION_SIZE(SECOND_STAGE_INACTIVE_PARTITION)

#define SECOND_STAGE_INACTIVE_MCUBOOT_ID \
FIXED_PARTITION_ID(SECOND_STAGE_INACTIVE_PARTITION)
PARTITION_ID(SECOND_STAGE_INACTIVE_PARTITION)

/* FPROTECT region covers both S0 and S1 slots. Assumption here is
* that they precede PRIMARY application image partition, in flash
* layout.
*/
#ifdef CONFIG_FPROTECT
#define FPROTECT_REGION_OFFSET FIXED_PARTITION_OFFSET(s0_partition)
#define FPROTECT_REGION_OFFSET PARTITION_OFFSET(s0_partition)
#define FPROTECT_REGION_SIZE \
(FIXED_PARTITION_SIZE(s0_partition) + FIXED_PARTITION_SIZE(s1_partition))
(PARTITION_SIZE(s0_partition) + PARTITION_SIZE(s1_partition))
#endif

/* RWX protection regions: the currently executing MCUboot is protecting itself */
Expand Down Expand Up @@ -139,20 +139,20 @@
static inline uint32_t __flash_area_ids_for_slot(int img, int slot)
{
static const int all_slots[] = {
FIXED_PARTITION_ID(slot0_partition), FIXED_PARTITION_ID(slot1_partition),
PARTITION_ID(slot0_partition), PARTITION_ID(slot1_partition),
#if MCUBOOT_NEEDED_SLOT_PAIRS > 1
FIXED_PARTITION_ID(slot2_partition), FIXED_PARTITION_ID(slot3_partition),
PARTITION_ID(slot2_partition), PARTITION_ID(slot3_partition),
#endif
#if MCUBOOT_NEEDED_SLOT_PAIRS > 2
FIXED_PARTITION_ID(slot4_partition), FIXED_PARTITION_ID(slot5_partition),
PARTITION_ID(slot4_partition), PARTITION_ID(slot5_partition),
#endif
#ifdef MCUBOOT_IS_SECOND_STAGE
/* MCUboot as a second stage bootloader brings in two additional slots;
* one slot is slot that it can update itself to and the other is source
* of update. At this point source slot is, by default, secondary slot
* of primary image.
*/
SECOND_STAGE_INACTIVE_MCUBOOT_ID, FIXED_PARTITION_ID(slot1_partition)
SECOND_STAGE_INACTIVE_MCUBOOT_ID, PARTITION_ID(slot1_partition)
#endif
};
return all_slots[img * 2 + slot];
Expand All @@ -162,28 +162,28 @@ static inline uint32_t __flash_area_ids_for_slot(int img, int slot)
#define FLASH_AREA_IMAGE_SECONDARY(x) __flash_area_ids_for_slot(x, 1)

#if !defined(CONFIG_BOOT_SWAP_USING_MOVE) && !defined(CONFIG_BOOT_SWAP_USING_OFFSET)
#define FLASH_AREA_IMAGE_SCRATCH FIXED_PARTITION_ID(scratch_partition)
#define FLASH_AREA_IMAGE_SCRATCH PARTITION_ID(scratch_partition)
#endif

#else /* !CONFIG_SINGLE_APPLICATION_SLOT && !CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP */

#define FLASH_AREA_IMAGE_PRIMARY(x) FIXED_PARTITION_ID(slot0_partition)
#define FLASH_AREA_IMAGE_SECONDARY(x) FIXED_PARTITION_ID(slot0_partition)
#define FLASH_AREA_IMAGE_PRIMARY(x) PARTITION_ID(slot0_partition)
#define FLASH_AREA_IMAGE_SECONDARY(x) PARTITION_ID(slot0_partition)

#endif /* CONFIG_SINGLE_APPLICATION_SLOT */

/* Here are protection ranges for primary stage MCUboot */
#ifndef MCUBOOT_IS_SECOND_STAGE
/* Protecting MCUboot partition */
#ifdef CONFIG_FPROTECT
#define FPROTECT_REGION_OFFSET FIXED_PARTITION_OFFSET(boot_partition)
#define FPROTECT_REGION_SIZE FIXED_PARTITION_SIZE(boot_partition)
#define FPROTECT_REGION_OFFSET PARTITION_OFFSET(boot_partition)
#define FPROTECT_REGION_SIZE PARTITION_SIZE(boot_partition)
#endif

/* RWX protection regions, MCUboot is protecting itself */
#if CONFIG_NCS_MCUBOOT_DISABLE_SELF_RWX
#define PROTECTED_REGION_START FIXED_PARTITION_OFFSET(boot_partition)
#define PROTECTED_REGION_SIZE FIXED_PARTITION_SIZE(boot_partition)
#define PROTECTED_REGION_START PARTITION_OFFSET(boot_partition)
#define PROTECTED_REGION_SIZE PARTITION_SIZE(boot_partition)
#endif /* CONFIG_NCS_MCUBOOT_DISABLE_SELF_RWX */
#endif

Expand Down
10 changes: 5 additions & 5 deletions boot/zephyr/include/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
((defined(CONFIG_SOC_SERIES_NRF54H) || defined(CONFIG_SOC_SERIES_NRF71)) && \
!DT_HAS_CHOSEN(zephyr_flash)) || \
!defined(FLASH_ALIGN) || \
!(FIXED_PARTITION_EXISTS(slot0_partition)) || \
!(FIXED_PARTITION_EXISTS(slot1_partition) || CONFIG_SINGLE_APPLICATION_SLOT) || \
(defined(CONFIG_BOOT_SWAP_USING_SCRATCH) && !FIXED_PARTITION_EXISTS(scratch_partition))
!(PARTITION_EXISTS(slot0_partition)) || \
!(PARTITION_EXISTS(slot1_partition) || CONFIG_SINGLE_APPLICATION_SLOT) || \
(defined(CONFIG_BOOT_SWAP_USING_SCRATCH) && !PARTITION_EXISTS(scratch_partition))
#error "Target support is incomplete; cannot build mcuboot."
#endif

#if (MCUBOOT_IMAGE_NUMBER == 2) && (!(FIXED_PARTITION_EXISTS(slot2_partition)) || \
!(FIXED_PARTITION_EXISTS(slot3_partition)))
#if (MCUBOOT_IMAGE_NUMBER == 2) && (!(PARTITION_EXISTS(slot2_partition)) || \
!(PARTITION_EXISTS(slot3_partition)))
#error "Target support is incomplete; cannot build mcuboot."
#endif

Expand Down
26 changes: 13 additions & 13 deletions boot/zephyr/load_ironside_se_conf_mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,49 +25,49 @@ BUILD_ASSERT(MCUBOOT_IMAGE_NUMBER <= 2,

/* clang-format off */
#define MIN_START_ADDR(_label0, _label1) \
MIN(FIXED_PARTITION_ADDRESS(_label0), \
MIN(PARTITION_ADDRESS(_label0), \
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_label1)), \
(FIXED_PARTITION_ADDRESS(_label1)), \
(PARTITION_ADDRESS(_label1)), \
(UINTPTR_MAX)))

#define MIN_END_ADDR(_label0, _label1) \
MIN((FIXED_PARTITION_ADDRESS(_label0) + FIXED_PARTITION_SIZE(_label0)), \
MIN((PARTITION_ADDRESS(_label0) + PARTITION_SIZE(_label0)), \
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_label1)), \
((FIXED_PARTITION_ADDRESS(_label1) + FIXED_PARTITION_SIZE(_label1))), \
((PARTITION_ADDRESS(_label1) + PARTITION_SIZE(_label1))), \
(UINTPTR_MAX)))

#define MAX_START_ADDR(_label0, _label1) \
MAX(FIXED_PARTITION_ADDRESS(_label0), \
MAX(PARTITION_ADDRESS(_label0), \
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_label1)), \
(FIXED_PARTITION_ADDRESS(_label1)), \
(PARTITION_ADDRESS(_label1)), \
(0)))

#define MAX_END_ADDR(_label0, _label1) \
MAX((FIXED_PARTITION_ADDRESS(_label0) + FIXED_PARTITION_SIZE(_label0)), \
MAX((PARTITION_ADDRESS(_label0) + PARTITION_SIZE(_label0)), \
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_label1)), \
((FIXED_PARTITION_ADDRESS(_label1) + FIXED_PARTITION_SIZE(_label1))), \
((PARTITION_ADDRESS(_label1) + PARTITION_SIZE(_label1))), \
(0)))
/* clang-format on */

#define ACCESSIBLE_MRAM_START FIXED_PARTITION_NODE_ADDRESS(DT_CHOSEN(zephyr_code_partition))
#define ACCESSIBLE_MRAM_START PARTITION_NODE_ADDRESS(DT_CHOSEN(zephyr_code_partition))
BUILD_ASSERT((ACCESSIBLE_MRAM_START % OVERRIDE_ALIGNMENT) == 0);

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(secure_storage_partition))
BUILD_ASSERT((FIXED_PARTITION_ADDRESS(secure_storage_partition) +
FIXED_PARTITION_SIZE(secure_storage_partition)) ==
BUILD_ASSERT((PARTITION_ADDRESS(secure_storage_partition) +
PARTITION_SIZE(secure_storage_partition)) ==
(DT_REG_ADDR(DT_NODELABEL(mram1x)) + DT_REG_SIZE(DT_NODELABEL(mram1x))),
"The MPC override configuration used to provide write protection for the image "
"partitions currently requires that the secure storage partitions are placed at the "
"end of MRAM.");

#define ACCESSIBLE_MRAM_END FIXED_PARTITION_ADDRESS(secure_storage_partition)
#define ACCESSIBLE_MRAM_END PARTITION_ADDRESS(secure_storage_partition)
#else
#define ACCESSIBLE_MRAM_END (DT_REG_ADDR(DT_NODELABEL(mram1x)) + DT_REG_SIZE(DT_NODELABEL(mram1x)))
#endif
BUILD_ASSERT((ACCESSIBLE_MRAM_END % OVERRIDE_ALIGNMENT) == 0);

#define BOOT_PARTITION_END \
(FIXED_PARTITION_NODE_ADDRESS(DT_CHOSEN(zephyr_code_partition)) + \
(PARTITION_NODE_ADDRESS(DT_CHOSEN(zephyr_code_partition)) + \
CONFIG_NCS_MCUBOOT_MPCCONF_STATIC_WRITE_PROTECTION_INITIAL_REGION_SIZE)
BUILD_ASSERT((BOOT_PARTITION_END % OVERRIDE_ALIGNMENT) == 0);

Expand Down
8 changes: 4 additions & 4 deletions boot/zephyr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@
#define SECONDARY_SLOT 1

#define IMAGE0_PRIMARY_START_ADDRESS \
DT_PROP_BY_IDX(DT_NODE_BY_FIXED_PARTITION_LABEL(image_0), reg, 0)
DT_PROP_BY_IDX(DT_NODE_BY_PARTITION_LABEL(image_0), reg, 0)
#define IMAGE0_PRIMARY_SIZE \
DT_PROP_BY_IDX(DT_NODE_BY_FIXED_PARTITION_LABEL(image_0), reg, 1)
DT_PROP_BY_IDX(DT_NODE_BY_PARTITION_LABEL(image_0), reg, 1)

#define IMAGE1_PRIMARY_START_ADDRESS \
DT_PROP_BY_IDX(DT_NODE_BY_FIXED_PARTITION_LABEL(image_1), reg, 0)
DT_PROP_BY_IDX(DT_NODE_BY_PARTITION_LABEL(image_1), reg, 0)
#define IMAGE1_PRIMARY_SIZE \
DT_PROP_BY_IDX(DT_NODE_BY_FIXED_PARTITION_LABEL(image_1), reg, 1)
DT_PROP_BY_IDX(DT_NODE_BY_PARTITION_LABEL(image_1), reg, 1)

#endif /* CONFIG_SOC_FAMILY_ESPRESSIF_ESP32 */

Expand Down
1 change: 1 addition & 0 deletions boot/zephyr/nrf54h20_custom_s2ram.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <zephyr/toolchain.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/linker/sections.h>

GTEXT(pm_s2ram_mark_check_and_mediate)

Expand Down
8 changes: 3 additions & 5 deletions boot/zephyr/nrf54h20_custom_s2ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ volatile struct mcuboot_resume_s mcuboot_resume;
#error "mcuboot resume support section not defined in dts"
#endif

#define FIXED_PARTITION_ADDR(node_label) DT_REG_ADDR(DT_NODELABEL(node_label))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomchy You suggested that for some purpose. Is this removal/replacement OK?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look here: nrfconnect/sdk-zephyr#3880
The devicetree.h file now includes the <zephyr/devicetree/mapped-partition.h> which is the newly introduced mechanism to get partition address/offset/size, without the need to enable FLASH_MAP in the build.
Additionally, the PR sets all partitions on all Nordic platform to use the new compatible (zephyr,mapped-partition).

We still may need to give it a thought if those changes are backward compatible (imagine an out of tree sample that still uses fixed-partitions and fixed-subpartitions). The code there should handle it fine, but since all platforms are migrated, there are no tests that verify the old syntax.


#define S2RAM_SLOT_INFO_A 0x37
#define S2RAM_SLOT_INFO_B 0xA4

Expand Down Expand Up @@ -76,17 +74,17 @@ void pm_s2ram_mark_check_and_mediate(void)
#ifdef CONFIG_BOOT_DIRECT_XIP
if (mcuboot_resume.slot_info == S2RAM_SLOT_INFO_A) {
vt = (struct arm_vector_table *)
(FIXED_PARTITION_ADDR(slot0_partition) + APP_EXE_START_OFFSET);
(PARTITION_ADDRESS(slot0_partition) + APP_EXE_START_OFFSET);
} else if (mcuboot_resume.slot_info == S2RAM_SLOT_INFO_B) {
vt = (struct arm_vector_table *)
(FIXED_PARTITION_ADDR(slot1_partition) + APP_EXE_START_OFFSET);
(PARTITION_ADDRESS(slot1_partition) + APP_EXE_START_OFFSET);
} else {
/* invalid slot info */
goto resume_failed;
}
#else
vt = (struct arm_vector_table *)
(FIXED_PARTITION_ADDR(slot0_partition) + APP_EXE_START_OFFSET);
(PARTITION_ADDRESS(slot0_partition) + APP_EXE_START_OFFSET);
#endif

/* Jump to application */
Expand Down
4 changes: 2 additions & 2 deletions samples/runtime-source/zephyr/hooks/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ static struct image_header _hdr;
static uint8_t tmpbuf[BOOT_TMPBUF_SZ];

static uint8_t known_ids[] = {
FIXED_PARTITION_ID(slot0_partition),
FIXED_PARTITION_ID(slot1_partition),
PARTITION_ID(slot0_partition),
PARTITION_ID(slot1_partition),
};

static int current_id;
Expand Down
Loading