HI,
I'm trying to configure the MCUboot / Netboot with an external QSPI flash. I can do it for the APP core with MCUboot, however I get lost how it work with the NET core / Netboot. I can do this with storing update in internal flash but not external flash.
Looking into the "bootloader\mcuboot\boot\bootuil\src\loader.c", I found something strange, in this function:
static int
boot_validated_swap_type(struct boot_loader_state *state,
struct boot_status *bs)
{
int swap_type;
fih_int fih_rc = FIH_FAILURE;
bool upgrade_valid = false;
#if defined(PM_S1_ADDRESS) || defined(CONFIG_SOC_NRF5340_CPUAPP)
const struct flash_area *secondary_fa =
BOOT_IMG_AREA(state, BOOT_SECONDARY_SLOT);
struct image_header *hdr = (struct image_header *)secondary_fa->fa_off;
uint32_t vtable_addr = 0;
uint32_t *vtable = 0;
uint32_t reset_addr = 0;
/* Patch needed for NCS. Since image 0 (the app) and image 1 (the other
* B1 slot S0 or S1) share the same secondary slot, we need to check
* whether the update candidate in the secondary slot is intended for
* image 0 or image 1 primary by looking at the address of the reset
* vector. Note that there are good reasons for not using img_num from
* the swap info.
*/
if (hdr->ih_magic == IMAGE_MAGIC) {
vtable_addr = (uint32_t)hdr + hdr->ih_hdr_size;
vtable = (uint32_t *)(vtable_addr);
reset_addr = vtable[1];
#ifdef PM_S1_ADDRESS
const struct flash_area *primary_fa;
int rc = flash_area_open(flash_area_id_from_multi_image_slot(
BOOT_CURR_IMG(state),
BOOT_PRIMARY_SLOT),
&primary_fa);
if (rc != 0) {
return BOOT_SWAP_TYPE_FAIL;
}
/* Get start and end of primary slot for current image */
if (reset_addr < primary_fa->fa_off ||
reset_addr > (primary_fa->fa_off + primary_fa->fa_size)) {
/* The image in the secondary slot is not intended for this image
*/
return BOOT_SWAP_TYPE_NONE;
}
#endif /* PM_S1_ADDRESS */
}
It try to get the image's "ih_magic" and "reset_addr" from "hdr" which eventually go to "state.imsg[0][1].area" (to determine if the update image is for APP or NET). When storing the update in internal flash, this is correctly pointed. But after I change it to external storage, this area points to the external storage's physical address, just like this: (I store the update in MX25R64, address 0x00)

So this function just get the ih_magic from the INTERNAL FLASH by using my external flash address (0x00), of course it will never get the "reset_addr" correctly, and always think my update image is APP core.
Is there anything I missed? Or any fix for this function?