Our system is composed of a nrf5340, a QSPI flash, and a nrf7002 on single wire SPI. We are not using the network processor.
We are using Zephyr NCS 2.9 with sysbuild. We desire to use the http download client integrated with the dfu multi image tool.
The core of the issue is that we cannot convince the build tool to create a 4 image update package.
SB_CONFIG_BOOTLOADER_MCUBOOT=y #SB_CONFIG_SECURE_BOOT_NETCORE=y SB_CONFIG_NETCORE_EMPTY=y #SB_CONFIG_NETCORE_NONE=y # nRF7002 setup configurations SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y #SB_CONFIG_WIFI_PATCHES_EXT_FLASH_XIP=y SB_CONFIG_WIFI_NRF70_SYSTEM_MODE=y # Multi-image needed for 5340 app and net core # 3 images for app core, net core, WiFi patch, and XIP SB_CONFIG_NETCORE_APP_UPDATE=y SB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=4 SB_CONFIG_PARTITION_MANAGER=y SB_CONFIG_PM_MCUBOOT_PAD=0x200 # XIP settings to enable split image where app code runs # out of internal flash and QSPI SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y SB_CONFIG_QSPI_XIP_SPLIT_IMAGE=y SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY=y
sysbuild.conf is above. You can see some of the settings I've tried.
pm_static.yml for reference:
app: address: 0x10200 end_address: 0x100000 region: flash_primary size: 0xefe00 external_flash: address: 0x130000 device: MX25R64 end_address: 0x800000 region: external_flash size: 0x6D0000 mcuboot: address: 0x0 end_address: 0x10000 region: flash_primary size: 0x10000 mcuboot_pad: address: 0x10000 end_address: 0x10200 region: flash_primary size: 0x200 mcuboot_primary: address: 0x10000 end_address: 0x100000 orig_span: &id001 - mcuboot_pad - app region: flash_primary size: 0xf0000 span: *id001 mcuboot_primary_1: #missing address: 0x0 device: flash_ctrl end_address: 0x40000 region: ram_flash size: 0x40000 mcuboot_primary_app: address: 0x10200 end_address: 0x100000 orig_span: &id002 - app region: flash_primary size: 0xefe00 span: *id002 mcuboot_secondary: address: 0x0 device: MX25R64 end_address: 0xF0000 region: external_flash size: 0xF0000 mcuboot_secondary_1: address: 0xF0000 device: MX25R64 end_address: 0x130000 region: external_flash size: 0x40000 mcuboot_primary_2: address: 0x130000 device: MX25R64 end_address: 0x230000 orig_span: &id003 - mcuboot_primary_2_pad - mcuboot_primary_2_app region: external_flash size: 0x100000 span: *id003 mcuboot_primary_2_pad: address: 0x230000 end_address: 0x230200 region: external_flash device: MX25R64 size: 0x200 mcuboot_primary_2_app: address: 0x230200 end_address: 0x330000 device: MX25R64 region: external_flash size: 0x0FFE00 mcuboot_secondary_2: address: 0x230000 device: MX25R64 end_address: 0x330000 region: external_flash size: 0x100000 nrf70_wifi_fw: address: 0x330000 size: 0x20000 device: MX25R64 region: external_flash littlefs_storage: address: 0x350000 device: MX25R64 end_address: 0x800000 region: external_flash size: 0x4DB000 otp: address: 0xff8100 end_address: 0xff83fc region: otp size: 0x2fc pcd_sram: address: 0x20000000 end_address: 0x20002000 region: sram_primary size: 0x2000 ram_flash: address: 0x40000 end_address: 0x40000 region: ram_flash size: 0x0 rpmsg_nrf53_sram: address: 0x20070000 end_address: 0x20080000 placement: before: - end region: sram_primary size: 0x10000 sram_primary: address: 0x20002000 end_address: 0x20070000 region: sram_primary size: 0x6e000
In file included from C:/_DSGit/customer/external/zephyr/include/zephyr/toolchain.h:50,
from C:/_DSGit/customer/external/zephyr/include/zephyr/kernel_includes.h:23,
from C:/_DSGit/customer/external/zephyr/include/zephyr/kernel.h:17,
from C:/_DSGit/customer/external/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c:7:
C:/_DSGit/customer/external/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "Missing partitions?"
87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
| ^~~~~~~~~~~~~~
C:/_DSGit/customer/external/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c:43:1: note: in expansion of macro 'BUILD_ASSERT'
43 | BUILD_ASSERT(FIXED_PARTITION_EXISTS(SLOT2_PARTITION) &&
| ^~~~~~~~~~~~
This ultimately tracks back to #define slot2_partition mcuboot_primary_1 in flash_map_pm.h which id not defined and noted as #missing in the pm_static.yml.
If I rearrange some things and try to not build the net core at all:
It would appear some of the DFU tools don't support more than 3 images based on the kconfig errors. (subsys/dfu/Kconfig and subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig) subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c also has thrown some build_asserts.
For reference, this is mcuboot.conf
# Disable image verification for MCUboot and set to 3 images CONFIG_MCUBOOT_VERIFY_IMG_ADDRESS=n CONFIG_UPDATEABLE_IMAGE_NUMBER=4 # Flash CONFIG_FLASH=y CONFIG_BOOT_ERASE_PROGRESSIVELY=y CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y #debug only CONFIG_FPROTECT=n CONFIG_BOOT_MAX_IMG_SECTORS=512 # Required by QSPI CONFIG_NORDIC_QSPI_NOR=y CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 CONFIG_MULTITHREADING=y # Decrease memory footprint CONFIG_CBPRINTF_NANO=y CONFIG_RESET_ON_FATAL_ERROR=n # The following configurations are required to support simultaneous multi image update CONFIG_PCD_APP=y CONFIG_BOOT_UPGRADE_ONLY=y # The network core cannot access external flash directly. The flash simulator must be used to # provide a memory region that is used to forward the new firmware to the network core. CONFIG_FLASH_SIMULATOR=y CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y CONFIG_FLASH_SIMULATOR_STATS=n # Enable custom command to erase settings partition. CONFIG_ENABLE_MGMT_PERUSER=y #SB 2.9 doens't like this #CONFIG_MCUBOOT_SERIAL=y CONFIG_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y CONFIG_MCUBOOT_SERIAL=y CONFIG_UART_CONSOLE=n CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=y #CONFIG_LOG_DEFAULT_LEVEL=3 #CONFIG_MCUBOOT_LOG_LEVEL_DBG=y #mcu boot led CONFIG_MCUBOOT_INDICATION_LED=y ################# # DEBUG TEST ONLY #################
I get these build warnings, but it does complete:
warning: I2C (defined at boards/shields\sparkfun_carrier_asset_tracker\Kconfig.defconfig:15,
drivers/i2c/Kconfig:9) was assigned the value 'n' but got the value 'y'. See
docs.zephyrproject.org/.../kconfig.html and/or look up I2C in the
menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
warning: ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS (defined at C:/_DSGit/customer
/external/nrf/modules/mcuboot/Kconfig:127) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: BOOTLOADER_MCUBOOT (=n). See
docs.zephyrproject.org/.../kconfig.html and/or
look up ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS in the menuconfig/guiconfig interface. The Application
Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of
the manual might be helpful too.
warning: FLASH_SIMULATOR (defined at drivers/flash/Kconfig.simulator:6) was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies: DT_HAS_ZEPHYR_SIM_FLASH_ENABLED (=n).
See docs.zephyrproject.org/.../kconfig.html and/or look up
FLASH_SIMULATOR in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.
warning: FLASH_SIMULATOR_DOUBLE_WRITES (defined at drivers/flash/Kconfig.simulator:42) was assigned
the value 'y' but got the value 'n'. Check these unsatisfied dependencies: FLASH_SIMULATOR (=n). See
docs.zephyrproject.org/.../kconfig.html and/or look
up FLASH_SIMULATOR_DOUBLE_WRITES in the menuconfig/guiconfig interface. The Application Development
Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
might be helpful too.
I tried CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=y in prj.conf too, didn't help.
--
In short, we need to support 3 or 4 images, internal flash app, maybe internal flash net core, qspi flash app, nrf7002 patches.
Another option I tried was making the nrf7002 patches XIP loadable, but that didn't get me anywhere.
Thanks,
Gabriel