|
50 | 50 |
|
51 | 51 | #if defined(CONFIG_SOC_NRF5340_CPUAPP) && defined(PM_CPUNET_B0N_ADDRESS)
|
52 | 52 | #include <dfu/pcd.h>
|
| 53 | +#ifdef CONFIG_PCD_READ_NETCORE_APP_VERSION |
| 54 | +#include <fw_info_bare.h> |
| 55 | +int pcd_version_cmp_net(const struct flash_area *fap, struct image_header *hdr); |
| 56 | +#endif |
53 | 57 | #endif
|
54 | 58 |
|
55 | 59 | #ifdef MCUBOOT_ENC_IMAGES
|
@@ -781,9 +785,21 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
|
781 | 785 | #if defined(MCUBOOT_OVERWRITE_ONLY) && defined(MCUBOOT_DOWNGRADE_PREVENTION)
|
782 | 786 | if (slot != BOOT_PRIMARY_SLOT) {
|
783 | 787 | /* Check if version of secondary slot is sufficient */
|
784 |
| - rc = boot_version_cmp( |
785 |
| - &boot_img_hdr(state, BOOT_SECONDARY_SLOT)->ih_ver, |
786 |
| - &boot_img_hdr(state, BOOT_PRIMARY_SLOT)->ih_ver); |
| 788 | + |
| 789 | +#if defined(CONFIG_SOC_NRF5340_CPUAPP) && defined(CONFIG_NRF53_MULTI_IMAGE_UPDATE) \ |
| 790 | + && defined(CONFIG_PCD_APP) && defined(CONFIG_PCD_READ_NETCORE_APP_VERSION) |
| 791 | + if (BOOT_CURR_IMG(state) == 1) { |
| 792 | + rc = pcd_version_cmp_net(fap, boot_img_hdr(state, BOOT_SECONDARY_SLOT)); |
| 793 | + } else { |
| 794 | + rc = boot_version_cmp( |
| 795 | + &boot_img_hdr(state, BOOT_SECONDARY_SLOT)->ih_ver, |
| 796 | + &boot_img_hdr(state, BOOT_PRIMARY_SLOT)->ih_ver); |
| 797 | + } |
| 798 | +#else |
| 799 | + rc = boot_version_cmp( |
| 800 | + &boot_img_hdr(state, BOOT_SECONDARY_SLOT)->ih_ver, |
| 801 | + &boot_img_hdr(state, BOOT_PRIMARY_SLOT)->ih_ver); |
| 802 | +#endif |
787 | 803 | if (rc < 0 && boot_check_header_erased(state, BOOT_PRIMARY_SLOT)) {
|
788 | 804 | BOOT_LOG_ERR("insufficient version in secondary slot");
|
789 | 805 | flash_area_erase(fap, 0, flash_area_get_size(fap));
|
|
0 commit comments