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