|
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
|
@@ -1065,9 +1069,21 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
|
1065 | 1069 | #if defined(MCUBOOT_OVERWRITE_ONLY) && defined(MCUBOOT_DOWNGRADE_PREVENTION)
|
1066 | 1070 | if (slot != BOOT_PRIMARY_SLOT) {
|
1067 | 1071 | /* Check if version of secondary slot is sufficient */
|
1068 |
| - rc = boot_version_cmp( |
1069 |
| - &boot_img_hdr(state, BOOT_SECONDARY_SLOT)->ih_ver, |
1070 |
| - &boot_img_hdr(state, BOOT_PRIMARY_SLOT)->ih_ver); |
| 1072 | + |
| 1073 | +#if defined(CONFIG_SOC_NRF5340_CPUAPP) && defined(CONFIG_NRF53_MULTI_IMAGE_UPDATE) \ |
| 1074 | + && defined(CONFIG_PCD_APP) && defined(CONFIG_PCD_READ_NETCORE_APP_VERSION) |
| 1075 | + if (BOOT_CURR_IMG(state) == 1) { |
| 1076 | + rc = pcd_version_cmp_net(fap, boot_img_hdr(state, BOOT_SECONDARY_SLOT)); |
| 1077 | + } else { |
| 1078 | + rc = boot_version_cmp( |
| 1079 | + &boot_img_hdr(state, BOOT_SECONDARY_SLOT)->ih_ver, |
| 1080 | + &boot_img_hdr(state, BOOT_PRIMARY_SLOT)->ih_ver); |
| 1081 | + } |
| 1082 | +#else |
| 1083 | + rc = boot_version_cmp( |
| 1084 | + &boot_img_hdr(state, BOOT_SECONDARY_SLOT)->ih_ver, |
| 1085 | + &boot_img_hdr(state, BOOT_PRIMARY_SLOT)->ih_ver); |
| 1086 | +#endif |
1071 | 1087 | if (rc < 0 && boot_check_header_erased(state, BOOT_PRIMARY_SLOT)) {
|
1072 | 1088 | BOOT_LOG_ERR("insufficient version in secondary slot");
|
1073 | 1089 | flash_area_erase(fap, 0, flash_area_get_size(fap));
|
|
0 commit comments