Hi Nordic Team
We develop a sensor node for a customer based on nRF5340. For now I use a nRF5340DK to do my tests with NCS 2.8.0 (using VS Code).
Based on examples, I am trying to get mcuboot + img manager to work with the secondary slot in the external flash, as I know that the final FW image will be to large if we don't put the secondary slots in the external QSPI. Updating the hci_rpc firmware on the netcore is not required at the moment, but would be nice to have.
Here are the most improtant files.
sysbuild.conf:
SB_CONFIG_BOOTLOADER_MCUBOOT=y SB_CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/priv.pem" SB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=1 SB_CONFIG_NETCORE_HCI_IPC=y SB_CONFIG_PARTITION_MANAGER=y SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
prj.conf:
CONFIG_GPIO=y CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="mcu-test" #CONFIG_BT_FIXED_PASSKEY=y CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_MPU_ALLOW_FLASH_WRITE=y CONFIG_NORDIC_QSPI_NOR=y CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_IMG_MANAGER=y CONFIG_MCUBOOT_IMG_MANAGER=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
mcuboot.conf:
CONFIG_BOOT_UPGRADE_ONLY=y CONFIG_MCUBOOT_DOWNGRADE_PREVENTION=y CONFIG_NORDIC_QSPI_NOR=y # Enable flash operations CONFIG_FLASH=y # enable to get log output on uart CONFIG_LOG=y CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_SERIAL=y CONFIG_LOG_BACKEND_UART=y CONFIG_FLASH_LOG_LEVEL_DBG=y CONFIG_MCUBOOT_LOG_LEVEL_DBG=y
dt.overlay:
/ { chosen { nordic,pm-ext-flash = &mx25r64; }; };
Connecting to /dev/ttyACM1 with 115200 I can see mcuboot starting, but it fails to access the flash:
[00:00:00.397,155] <dbg> qspi_nor: configure_chip: RDSR 40 QE 1 need 1: no-change *** Booting MCUboot v2.1.0-dev-4594a8693738 *** *** Using nRF Connect SDK v2.8.0-a2386bfc8401 *** *** Using Zephyr OS v3.7.99-0bc3393fb112 *** [00:00:00.417,572] <inf> mcuboot: Starting bootloader [00:00:00.423,065] <err> mcuboot: Failed to open flash area ID 1 (image 0 slot 1): -19, cannot continue
My first suspect was the communication with the external QSPI, but that seems to be OK, reading the QE bit appears to work. (see above).
After some debugging, I suspect an issue with v2.8.0/nrf/subsys/partition_manager/flash_map_partition_manager.c which defines const struct flash_area *flash_map.
My debugging suggests that some entries in flash_map have .fa_dev = NULL.
Am I missing some configuration settings or is this some other problem?
Thank's for your support!