Failed to build FOTA firmware (nRF 1.9.1)

We have an nRF5340 application that builds fine for our custom board. However, it is not very straightforward what steps need to be performed to enable FOTA updates. I have looked into the "bluetooth/peripheral_uart" example and some tutorials, so I have added the following options in `prj.conf` :

# All below settings included from: https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu
# Enable mcumgr.
CONFIG_MCUMGR=y

# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n
CONFIG_MCUMGR_SMP_BT_CONN_PARAM_CONTROL=y
# CONFIG_MCUMGR_SMP_SHELL=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

# Enable custom SMP request to erase settings partition.
CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y
CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y

# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=502

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMAGE_VERSION="1.0.0+0"
CONFIG_UPDATEABLE_IMAGE_NUMBER=2

CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

CONFIG_MAIN_STACK_SIZE=4096

But when I build the application, I am getting the following error:

C:\Nordic_ncs\incus\zephyr\include\toolchain\gcc.h:61:36: error: static assertion failed: "Missing partitions?"
   61 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
      |                                    ^~~~~~~~~~~~~~
C:\Nordic_ncs\incus\zephyr\subsys\mgmt\mcumgr\lib\cmd\img_mgmt\src\zephyr_img_mgmt.c:26:1: note: in expansion of macro 'BUILD_ASSERT'
   26 | BUILD_ASSERT(IMG_MGMT_UPDATABLE_IMAGE_NUMBER == 1 ||
      | ^~~~~~~~~~~~
[304/591] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/smp.c.obj

I have several questions:

1. How to make the project build for multi-image FOTA, BLE updates? Do I need to include the following in the MCUboot configuration?

CONFIG_BOOT_UPGRADE_ONLY - The simultaneous update of multiple images does not support network core image reversion, so you need to disable application image reversion.

CONFIG_PCD_APP - Enable commands exchange with the network core.

CONFIG_UPDATEABLE_IMAGE_NUMBER - Enable support for multiple update partitions by setting this option to 2.

2. I haven't found any nRF samples that demonstrate how to do an FOTA update via BLE, using the nRF5340-DK. Can you please point me to any?

3. The peripheral_uart example uses external flash for the FOTA update. We don't have an external flash chip on our custom board, will there be enough space in the internal flash storage? I read here there may not be enough: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_thingy53.html#external-flash But we do have an SD card which we could use.

Thank you.

Related