Hi,
I am using NCS 2.2.0, nRF5240.
Recently, i add NSIB to my project, but MCUboot, application(app core and netcore)can not upgrade.
I read some MCUboot code, and find some puzzling questions.
In sysflash.h file, it has the follow code snippet, PATH:${NCS_DIR}/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h
#if (MCUBOOT_IMAGE_NUMBER == 1) #define FLASH_AREA_IMAGE_PRIMARY(x) PM_MCUBOOT_PRIMARY_ID #define FLASH_AREA_IMAGE_SECONDARY(x) PM_MCUBOOT_SECONDARY_ID #elif (MCUBOOT_IMAGE_NUMBER == 2) /* If B0 is present then two bootloaders are present, and we must use * a single secondary slot for both primary slots. */ #ifdef PM_B0_ADDRESS extern uint32_t _image_1_primary_slot_id[]; #define FLASH_AREA_IMAGE_PRIMARY(x) \ ((x == 0) ? \ PM_MCUBOOT_PRIMARY_ID : \ (x == 1) ? \ (uint32_t)_image_1_primary_slot_id : \ 255 ) #define FLASH_AREA_IMAGE_SECONDARY(x) \ ((x == 0) ? \ PM_MCUBOOT_SECONDARY_ID: \ (x == 1) ? \ PM_MCUBOOT_SECONDARY_ID: \ 255 ) #else #define FLASH_AREA_IMAGE_PRIMARY(x) \ ((x == 0) ? \ PM_MCUBOOT_PRIMARY_ID : \ (x == 1) ? \ PM_MCUBOOT_PRIMARY_1_ID : \ 255 ) #define FLASH_AREA_IMAGE_SECONDARY(x) \ ((x == 0) ? \ PM_MCUBOOT_SECONDARY_ID: \ (x == 1) ? \ PM_MCUBOOT_SECONDARY_1_ID: \ 255 ) #endif /* PM_B0_ADDRESS */ #endif
It works ok on single core MCU.
xxx_IMAGE_PRIMARY is the application flash area and xxx_IMAGE_SECONDARY is upgrading flash area.
Also, on double core MCU, if not define the PM_B0_ADDRESS, in other words, not add NSIB in my project, it works ok.